Changes between Initial Version and Version 1 of GeneralTransformation


Ignore:
Timestamp:
05/20/14 13:06:16 (12 years ago)
Author:
zmanchun
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GeneralTransformation

    v1 v1  
     1The General Transformation deals with common features of C programs.
     2Currently, we only translate away the arguments of the main function.
     3
     4For example,
     5
     6{{{
     7... // declarations
     8int main(int argc, char *argv[]){
     9  ...//main body
     10}
     11...// other code
     12}}}
     13
     14After General Transformation, the code becomes:
     15
     16{{{
     17... // declarations
     18
     19$input int __argc;
     20$input char __argv[][];
     21
     22void main(){
     23  int argc = __argc;
     24  char** argv = (char**) $malloc(argc*sizeof(char*));
     25
     26  for(int i = 0; i < argc; i++){
     27    argv[i] = &__argv[i][0];
     28  }
     29
     30  ... // main body
     31
     32  free(argv);
     33}
     34...// other code
     35}}}