main.cc
changeset 980 9ed5aff159db
parent 959 8bfcc8e62bd6
child 1011 76175defb87b
equal deleted inserted replaced
979:f8f1d89ff7d5 980:9ed5aff159db
   117   printf(" -l : use a relaxed datatype equivalence model       (a non-standard extension?)\n");  
   117   printf(" -l : use a relaxed datatype equivalence model       (a non-standard extension?)\n");  
   118   printf(" -s : allow use of safe datatypes (SAFEBOOL, etc.)   (defined in PLCOpen Safety)\n"); // PLCopen TC5 "Safety Software Technical Specification - Part 1" v1.0
   118   printf(" -s : allow use of safe datatypes (SAFEBOOL, etc.)   (defined in PLCOpen Safety)\n"); // PLCopen TC5 "Safety Software Technical Specification - Part 1" v1.0
   119   printf(" -r : allow use of references (REF_TO, REF, ^, NULL) (an IEC 61131-3 v3 feature)\n");
   119   printf(" -r : allow use of references (REF_TO, REF, ^, NULL) (an IEC 61131-3 v3 feature)\n");
   120   printf(" -R : allow use of REF_TO ANY datatypes              (a non-standard extension!)\n");
   120   printf(" -R : allow use of REF_TO ANY datatypes              (a non-standard extension!)\n");
   121   printf("        as well as REF_TO in ARRAYs and STRUCTs      (a non-standard extension!)\n");
   121   printf("        as well as REF_TO in ARRAYs and STRUCTs      (a non-standard extension!)\n");
       
   122   printf(" -a : allow use of non-literals in array size limits (a non-standard extension!)\n");
   122   printf(" -c : create conversion functions for enumerated data types\n");
   123   printf(" -c : create conversion functions for enumerated data types\n");
   123   printf(" -O : options for output (code generation) stage. Available options for %s are...\n", cmd);
   124   printf(" -O : options for output (code generation) stage. Available options for %s are...\n", cmd);
   124   stage4_print_options();
   125   stage4_print_options();
   125   printf("\n");
   126   printf("\n");
   126   printf("%s - Copyright (C) 2003-2014 \n"
   127   printf("%s - Copyright (C) 2003-2014 \n"
   145   runtime_options.full_token_loc          = false; /* error messages specify full token location */
   146   runtime_options.full_token_loc          = false; /* error messages specify full token location */
   146   runtime_options.conversion_functions    = false; /* Create a conversion function for derived datatype */
   147   runtime_options.conversion_functions    = false; /* Create a conversion function for derived datatype */
   147   runtime_options.nested_comments         = false; /* Allow the use of nested comments. */
   148   runtime_options.nested_comments         = false; /* Allow the use of nested comments. */
   148   runtime_options.ref_standard_extensions = false; /* Allow the use of REFerences (keywords REF_TO, REF, DREF, ^, NULL). */
   149   runtime_options.ref_standard_extensions = false; /* Allow the use of REFerences (keywords REF_TO, REF, DREF, ^, NULL). */
   149   runtime_options.ref_nonstand_extensions = false; /* Allow the use of non-standard extensions to REF_TO datatypes: REF_TO ANY, and REF_TO in struct elements! */
   150   runtime_options.ref_nonstand_extensions = false; /* Allow the use of non-standard extensions to REF_TO datatypes: REF_TO ANY, and REF_TO in struct elements! */
       
   151   runtime_options.nonliteral_in_array_size= false; /* Allow the use of constant non-literals when specifying size of arrays (ARRAY [1..max] OF INT) */
   150   runtime_options.includedir              = NULL;  /* Include directory, where included files will be searched for... */
   152   runtime_options.includedir              = NULL;  /* Include directory, where included files will be searched for... */
   151 
   153 
   152   /* Default values for the command line options... */
   154   /* Default values for the command line options... */
   153   runtime_options.relaxed_datatype_model    = false; /* by default use the strict datatype equivalence model */
   155   runtime_options.relaxed_datatype_model    = false; /* by default use the strict datatype equivalence model */
   154   
   156   
   155   /******************************************/
   157   /******************************************/
   156   /*   Parse command line options...        */
   158   /*   Parse command line options...        */
   157   /******************************************/
   159   /******************************************/
   158   while ((optres = getopt(argc, argv, ":nhvfplsrRcI:T:O:")) != -1) {
   160   while ((optres = getopt(argc, argv, ":nhvfplsrRacI:T:O:")) != -1) {
   159     switch(optres) {
   161     switch(optres) {
   160     case 'h':
   162     case 'h':
   161       printusage(argv[0]);
   163       printusage(argv[0]);
   162       return 0;
   164       return 0;
   163     case 'v':
   165     case 'v':
   164       fprintf(stdout, "%s version %s\n" "changeset id: %s\n", PACKAGE_NAME, PACKAGE_VERSION, HGVERSION);      
   166       fprintf(stdout, "%s version %s\n" "changeset id: %s\n", PACKAGE_NAME, PACKAGE_VERSION, HGVERSION);      
   165       return 0;
   167       return 0;
   166     case 'l':
   168     case 'l': runtime_options.relaxed_datatype_model   = true;  break;
   167       runtime_options.relaxed_datatype_model = true;
   169     case 'p': runtime_options.pre_parsing              = true;  break;
   168       break;
   170     case 'f': runtime_options.full_token_loc           = true;  break;
   169     case 'p':
   171     case 's': runtime_options.safe_extensions          = true;  break;
   170       runtime_options.pre_parsing = true;
   172     case 'R': runtime_options.ref_standard_extensions  = true; /* use of REF_TO ANY implies activating support for REF extensions! */
   171       break;
   173               runtime_options.ref_nonstand_extensions  = true;  break;
   172     case 'f':
   174     case 'r': runtime_options.ref_standard_extensions  = true;  break;
   173       runtime_options.full_token_loc = true;
   175     case 'a': runtime_options.nonliteral_in_array_size = true;  break;
   174       break;
   176     case 'c': runtime_options.conversion_functions     = true;  break;
   175     case 's':
   177     case 'n': runtime_options.nested_comments          = true;  break;
   176       runtime_options.safe_extensions = true;
       
   177       break;
       
   178     case 'R':
       
   179       runtime_options.ref_standard_extensions = true; /* use of REF_TO ANY implies activating support for REF extensions! */
       
   180       runtime_options.ref_nonstand_extensions = true;
       
   181       break;
       
   182     case 'r':
       
   183       runtime_options.ref_standard_extensions = true;
       
   184       break;
       
   185     case 'c':
       
   186       runtime_options.conversion_functions = true;
       
   187       break;
       
   188     case 'n':
       
   189       runtime_options.nested_comments = true;
       
   190       break;
       
   191     case 'I':
   178     case 'I':
   192       /* NOTE: To improve the usability under windows:
   179       /* NOTE: To improve the usability under windows:
   193        *       We delete last char's path if it ends with "\".
   180        *       We delete last char's path if it ends with "\".
   194        *       In this way compiler front-end accepts paths with or without
   181        *       In this way compiler front-end accepts paths with or without
   195        *       slash terminator.
   182        *       slash terminator.