main.cc
changeset 867 a435684a5223
parent 746 c7219a37cc39
child 873 dea39ef02847
equal deleted inserted replaced
866:c8c48ab075e0 867:a435684a5223
   118       /* as defined in PLCopen - Technical Committee 5      */
   118       /* as defined in PLCopen - Technical Committee 5      */
   119       /* Safety Software Technical Specification,           */
   119       /* Safety Software Technical Specification,           */
   120       /* Part 1: Concepts and Function Blocks,              */
   120       /* Part 1: Concepts and Function Blocks,              */
   121       /* Version 1.0 is Official Release                    */
   121       /* Version 1.0 is Official Release                    */
   122       /******************************************************/
   122       /******************************************************/
   123   printf("  s : allow use of safe extensions\n");
   123   printf("  s : allow use of safe extensions (e.g. SAFExxx data types))\n");
   124   printf("  c : create conversion functions\n");
   124   printf("  n : allow use of nested comments\n");
       
   125   printf("  c : create conversion functions for enumerated data types\n");
   125   printf("\n");
   126   printf("\n");
   126   printf("%s - Copyright (C) 2003-2011 \n"
   127   printf("%s - Copyright (C) 2003-2011 \n"
   127          "This program comes with ABSOLUTELY NO WARRANTY!\n"
   128          "This program comes with ABSOLUTELY NO WARRANTY!\n"
   128          "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);
   129          "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);
   129 }
   130 }
   131 
   132 
   132 
   133 
   133 int main(int argc, char **argv) {
   134 int main(int argc, char **argv) {
   134   symbol_c *tree_root;
   135   symbol_c *tree_root;
   135   char * builddir = NULL;
   136   char * builddir = NULL;
   136   stage1_2_options_t stage1_2_options = {false, false, NULL};
   137   stage1_2_options_t stage1_2_options;
   137   int optres, errflg = 0;
   138   int optres, errflg = 0;
   138   int path_len;
   139   int path_len;
   139 
   140 
       
   141   /* Default values for the command line options... */
       
   142   stage1_2_options.safe_extensions      = false; /* allow use of SAFExxx datatypes */
       
   143   stage1_2_options.full_token_loc       = false; /* error messages specify full token location */
       
   144   stage1_2_options.conversion_functions = false; /* Create a conversion function for derived datatype */
       
   145   stage1_2_options.nested_comments      = false; /* Allow the use of nested comments. */
       
   146   stage1_2_options.includedir           = NULL;  /* Include directory, where included files will be searched for... */
   140 
   147 
   141   /******************************************/
   148   /******************************************/
   142   /*   Parse command line options...        */
   149   /*   Parse command line options...        */
   143   /******************************************/
   150   /******************************************/
   144   while ((optres = getopt(argc, argv, ":hvfscI:T:")) != -1) {
   151   while ((optres = getopt(argc, argv, ":nhvfscI:T:")) != -1) {
   145     switch(optres) {
   152     switch(optres) {
   146     case 'h':
   153     case 'h':
   147       printusage(argv[0]);
   154       printusage(argv[0]);
   148       return 0;
   155       return 0;
   149 
   156 
   160       stage1_2_options.safe_extensions = true;
   167       stage1_2_options.safe_extensions = true;
   161       break;
   168       break;
   162 
   169 
   163     case 'c':
   170     case 'c':
   164       stage1_2_options.conversion_functions = true;
   171       stage1_2_options.conversion_functions = true;
       
   172       break;
       
   173 
       
   174     case 'n':
       
   175       stage1_2_options.nested_comments = true;
   165       break;
   176       break;
   166 
   177 
   167     case 'I':
   178     case 'I':
   168       /* NOTE: To improve the usability under windows:
   179       /* NOTE: To improve the usability under windows:
   169        *       We delete last char's path if it ends with "\".
   180        *       We delete last char's path if it ends with "\".