stage4/generate_c/generate_c.cc
changeset 902 38dca2e264b6
parent 896 c1cf7259160d
parent 894 39086e324665
child 906 b225af94405f
equal deleted inserted replaced
901:6a3964be6a29 902:38dca2e264b6
   168 /***********************************************************************/
   168 /***********************************************************************/
   169 /***********************************************************************/
   169 /***********************************************************************/
   170 /***********************************************************************/
   170 /***********************************************************************/
   171 /***********************************************************************/
   171 /***********************************************************************/
   172 
   172 
       
   173 
       
   174 static int generate_line_directives__ = 0;
       
   175 
       
   176 #ifdef __unix__
   173 /* Parse command line options passed from main.c !! */
   177 /* Parse command line options passed from main.c !! */
   174 #include <stdlib.h> // for getsybopt()
   178 #include <stdlib.h> // for getsybopt()
   175 
       
   176 static int generate_line_directives__ = 0;
       
   177 
       
   178 int  stage4_parse_options(char *options) {
   179 int  stage4_parse_options(char *options) {
   179   enum {                    LINE_OPT = 0             /*, SOME_OTHER_OPT, YET_ANOTHER_OPT */};
   180   enum {                    LINE_OPT = 0             /*, SOME_OTHER_OPT, YET_ANOTHER_OPT */};
   180   char *const token[] = { /*[LINE_OPT]=*/(char *)"l" /*, SOME_OTHER_OPT, ...             */, NULL };
   181   char *const token[] = { /*[LINE_OPT]=*/(char *)"l" /*, SOME_OTHER_OPT, ...             */, NULL };
   181   /* unfortunately, the above commented out syntax for array initialization is valid in C, but not in C++ */
   182   /* unfortunately, the above commented out syntax for array initialization is valid in C, but not in C++ */
   182   
   183   
   196 
   197 
   197 void stage4_print_options(void) {
   198 void stage4_print_options(void) {
   198   printf("          (options must be separated by commas. Example: 'l,w,x')\n"); 
   199   printf("          (options must be separated by commas. Example: 'l,w,x')\n"); 
   199   printf("      l : insert '#line' directives in generated C code.\n"); 
   200   printf("      l : insert '#line' directives in generated C code.\n"); 
   200 }
   201 }
   201 
   202 #else /* not __unix__ */
       
   203 /* getsubopt isn't supported with mingw, 
       
   204  *  then stage4 options aren't available on windows*/
       
   205 void stage4_print_options(void) {}
       
   206 int  stage4_parse_options(char *options) {}
       
   207 #endif 
   202 
   208 
   203 /***********************************************************************/
   209 /***********************************************************************/
   204 /***********************************************************************/
   210 /***********************************************************************/
   205 /***********************************************************************/
   211 /***********************************************************************/
   206 /***********************************************************************/
   212 /***********************************************************************/