main.cc
changeset 1014 a61f8f58f612
parent 1012 1f2af384fb1f
equal deleted inserted replaced
1013:d41dc551a326 1014:a61f8f58f612
   120   printf(" -r : allow use of references (REF_TO, REF, ^, NULL) (an IEC 61131-3 v3 feature)\n");
   120   printf(" -r : allow use of references (REF_TO, REF, ^, NULL) (an IEC 61131-3 v3 feature)\n");
   121   printf(" -R : allow use of REF_TO ANY datatypes              (a non-standard extension!)\n");
   121   printf(" -R : allow use of REF_TO ANY datatypes              (a non-standard extension!)\n");
   122   printf("        as well as REF_TO in ARRAYs and STRUCTs      (a non-standard extension!)\n");
   122   printf("        as well as REF_TO in ARRAYs and STRUCTs      (a non-standard extension!)\n");
   123   printf(" -a : allow use of non-literals in array size limits (a non-standard extension!)\n");
   123   printf(" -a : allow use of non-literals in array size limits (a non-standard extension!)\n");
   124   printf(" -i : allow POUs with no in out and inout parameters (a non-standard extension!)\n");
   124   printf(" -i : allow POUs with no in out and inout parameters (a non-standard extension!)\n");
       
   125   printf(" -b : allow functions returning VOID                 (a non-standard extension!)\n");
   125   printf(" -e : disable generation of implicit EN and ENO parameters.\n");
   126   printf(" -e : disable generation of implicit EN and ENO parameters.\n");
   126   printf(" -c : create conversion functions for enumerated data types\n");
   127   printf(" -c : create conversion functions for enumerated data types\n");
   127   printf(" -O : options for output (code generation) stage. Available options for %s are...\n", cmd);
   128   printf(" -O : options for output (code generation) stage. Available options for %s are...\n", cmd);
   128   runtime_options.allow_missing_var_in    = false; /* disable: allow definition and invocation of POUs with no input, output and in_out parameters! */
   129   runtime_options.allow_missing_var_in    = false; /* disable: allow definition and invocation of POUs with no input, output and in_out parameters! */
   129   stage4_print_options();
   130   stage4_print_options();
   143   char * builddir = NULL;
   144   char * builddir = NULL;
   144   int optres, errflg = 0;
   145   int optres, errflg = 0;
   145   int path_len;
   146   int path_len;
   146 
   147 
   147   /* Default values for the command line options... */
   148   /* Default values for the command line options... */
       
   149   runtime_options.allow_void_datatype     = false; /* disable: allow declaration of functions returning VOID  */
   148   runtime_options.allow_missing_var_in    = false; /* disable: allow definition and invocation of POUs with no input, output and in_out parameters! */
   150   runtime_options.allow_missing_var_in    = false; /* disable: allow definition and invocation of POUs with no input, output and in_out parameters! */
   149   runtime_options.disable_implicit_en_eno = false; /* disable: do not generate EN and ENO parameters */
   151   runtime_options.disable_implicit_en_eno = false; /* disable: do not generate EN and ENO parameters */
   150   runtime_options.pre_parsing             = false; /* disable: allow use of forward references (run pre-parsing phase before the definitive parsing phase that builds the AST) */
   152   runtime_options.pre_parsing             = false; /* disable: allow use of forward references (run pre-parsing phase before the definitive parsing phase that builds the AST) */
   151   runtime_options.safe_extensions         = false; /* disable: allow use of SAFExxx datatypes */
   153   runtime_options.safe_extensions         = false; /* disable: allow use of SAFExxx datatypes */
   152   runtime_options.full_token_loc          = false; /* disable: error messages specify full token location */
   154   runtime_options.full_token_loc          = false; /* disable: error messages specify full token location */
   161   runtime_options.relaxed_datatype_model    = false; /* by default use the strict datatype equivalence model */
   163   runtime_options.relaxed_datatype_model    = false; /* by default use the strict datatype equivalence model */
   162   
   164   
   163   /******************************************/
   165   /******************************************/
   164   /*   Parse command line options...        */
   166   /*   Parse command line options...        */
   165   /******************************************/
   167   /******************************************/
   166   while ((optres = getopt(argc, argv, ":nehvfplsrRaicI:T:O:")) != -1) {
   168   while ((optres = getopt(argc, argv, ":nehvfplsrRabicI:T:O:")) != -1) {
   167     switch(optres) {
   169     switch(optres) {
   168     case 'h':
   170     case 'h':
   169       printusage(argv[0]);
   171       printusage(argv[0]);
   170       return 0;
   172       return 0;
   171     case 'v':
   173     case 'v':
   177     case 's': runtime_options.safe_extensions          = true;  break;
   179     case 's': runtime_options.safe_extensions          = true;  break;
   178     case 'R': runtime_options.ref_standard_extensions  = true; /* use of REF_TO ANY implies activating support for REF extensions! */
   180     case 'R': runtime_options.ref_standard_extensions  = true; /* use of REF_TO ANY implies activating support for REF extensions! */
   179               runtime_options.ref_nonstand_extensions  = true;  break;
   181               runtime_options.ref_nonstand_extensions  = true;  break;
   180     case 'r': runtime_options.ref_standard_extensions  = true;  break;
   182     case 'r': runtime_options.ref_standard_extensions  = true;  break;
   181     case 'a': runtime_options.nonliteral_in_array_size = true;  break;
   183     case 'a': runtime_options.nonliteral_in_array_size = true;  break;
       
   184     case 'b': runtime_options.allow_void_datatype      = true;  break;
   182     case 'i': runtime_options.allow_missing_var_in     = true;  break;
   185     case 'i': runtime_options.allow_missing_var_in     = true;  break;
   183     case 'c': runtime_options.conversion_functions     = true;  break;
   186     case 'c': runtime_options.conversion_functions     = true;  break;
   184     case 'n': runtime_options.nested_comments          = true;  break;
   187     case 'n': runtime_options.nested_comments          = true;  break;
   185     case 'e': runtime_options.disable_implicit_en_eno  = true;  break;
   188     case 'e': runtime_options.disable_implicit_en_eno  = true;  break;
   186     case 'I':
   189     case 'I':