main.cc
changeset 1012 1f2af384fb1f
parent 1011 76175defb87b
child 1014 a61f8f58f612
equal deleted inserted replaced
1011:76175defb87b 1012:1f2af384fb1f
   119   printf(" -n : allow use of nested comments                   (an IEC 61131-3 v3 feature)\n");
   119   printf(" -n : allow use of nested comments                   (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");
   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(" -e : disable generation of implicit EN and ENO parameters.\n");
   125   printf(" -e : disable generation of implicit EN and ENO parameters.\n");
   125   printf(" -c : create conversion functions for enumerated data types\n");
   126   printf(" -c : create conversion functions for enumerated data types\n");
   126   printf(" -O : options for output (code generation) stage. Available options for %s are...\n", cmd);
   127   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! */
   127   stage4_print_options();
   129   stage4_print_options();
   128   printf("\n");
   130   printf("\n");
   129   printf("%s - Copyright (C) 2003-2014 \n"
   131   printf("%s - Copyright (C) 2003-2014 \n"
   130          "This program comes with ABSOLUTELY NO WARRANTY!\n"
   132          "This program comes with ABSOLUTELY NO WARRANTY!\n"
   131          "This is free software licensed under GPL v3, and you are welcome to redistribute it under the conditions specified by this license.\n", PACKAGE_NAME);
   133          "This is free software licensed under GPL v3, and you are welcome to redistribute it under the conditions specified by this license.\n", PACKAGE_NAME);
   141   char * builddir = NULL;
   143   char * builddir = NULL;
   142   int optres, errflg = 0;
   144   int optres, errflg = 0;
   143   int path_len;
   145   int path_len;
   144 
   146 
   145   /* Default values for the command line options... */
   147   /* Default values for the command line options... */
       
   148   runtime_options.allow_missing_var_in    = false; /* disable: allow definition and invocation of POUs with no input, output and in_out parameters! */
   146   runtime_options.disable_implicit_en_eno = false; /* disable: do not generate EN and ENO parameters */
   149   runtime_options.disable_implicit_en_eno = false; /* disable: do not generate EN and ENO parameters */
   147   runtime_options.pre_parsing             = false; /* disable: allow use of forward references (run pre-parsing phase before the definitive parsing phase that builds the AST) */
   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) */
   148   runtime_options.safe_extensions         = false; /* disable: allow use of SAFExxx datatypes */
   151   runtime_options.safe_extensions         = false; /* disable: allow use of SAFExxx datatypes */
   149   runtime_options.full_token_loc          = false; /* disable: error messages specify full token location */
   152   runtime_options.full_token_loc          = false; /* disable: error messages specify full token location */
   150   runtime_options.conversion_functions    = false; /* disable: create a conversion function for derived datatype */
   153   runtime_options.conversion_functions    = false; /* disable: create a conversion function for derived datatype */
   158   runtime_options.relaxed_datatype_model    = false; /* by default use the strict datatype equivalence model */
   161   runtime_options.relaxed_datatype_model    = false; /* by default use the strict datatype equivalence model */
   159   
   162   
   160   /******************************************/
   163   /******************************************/
   161   /*   Parse command line options...        */
   164   /*   Parse command line options...        */
   162   /******************************************/
   165   /******************************************/
   163   while ((optres = getopt(argc, argv, ":nehvfplsrRacI:T:O:")) != -1) {
   166   while ((optres = getopt(argc, argv, ":nehvfplsrRaicI:T:O:")) != -1) {
   164     switch(optres) {
   167     switch(optres) {
   165     case 'h':
   168     case 'h':
   166       printusage(argv[0]);
   169       printusage(argv[0]);
   167       return 0;
   170       return 0;
   168     case 'v':
   171     case 'v':
   174     case 's': runtime_options.safe_extensions          = true;  break;
   177     case 's': runtime_options.safe_extensions          = true;  break;
   175     case 'R': runtime_options.ref_standard_extensions  = true; /* use of REF_TO ANY implies activating support for REF extensions! */
   178     case 'R': runtime_options.ref_standard_extensions  = true; /* use of REF_TO ANY implies activating support for REF extensions! */
   176               runtime_options.ref_nonstand_extensions  = true;  break;
   179               runtime_options.ref_nonstand_extensions  = true;  break;
   177     case 'r': runtime_options.ref_standard_extensions  = true;  break;
   180     case 'r': runtime_options.ref_standard_extensions  = true;  break;
   178     case 'a': runtime_options.nonliteral_in_array_size = true;  break;
   181     case 'a': runtime_options.nonliteral_in_array_size = true;  break;
       
   182     case 'i': runtime_options.allow_missing_var_in     = true;  break;
   179     case 'c': runtime_options.conversion_functions     = true;  break;
   183     case 'c': runtime_options.conversion_functions     = true;  break;
   180     case 'n': runtime_options.nested_comments          = true;  break;
   184     case 'n': runtime_options.nested_comments          = true;  break;
   181     case 'e': runtime_options.disable_implicit_en_eno  = true;  break;
   185     case 'e': runtime_options.disable_implicit_en_eno  = true;  break;
   182     case 'I':
   186     case 'I':
   183       /* NOTE: To improve the usability under windows:
   187       /* NOTE: To improve the usability under windows: