/[bison]/bison/src/output.c
ViewVC logotype

Diff of /bison/src/output.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.127 by akim, Mon Feb 25 14:00:57 2002 UTC revision 1.128 by akim, Mon Feb 25 14:06:53 2002 UTC
# Line 1071  prepare (void) Line 1071  prepare (void)
1071    muscle_insert ("skeleton", skeleton);    muscle_insert ("skeleton", skeleton);
1072  }  }
1073    
 /*-------------------------.  
 | Output the header file.  |  
 `-------------------------*/  
   
 static void  
 header_output (void)  
 {  
   FILE *out = xfopen (spec_defines_file, "w");  
   char *macro_name = compute_header_macro ();  
   
   fprintf (out, "#ifndef %s\n", macro_name);  
   fprintf (out, "# define %s\n\n", macro_name);  
   
   token_definitions_output (out);  
   fprintf (out, "\  
 #ifndef YYSTYPE\n\  
 typedef %s  
 yystype;\n\  
 # define YYSTYPE yystype\n\  
 #endif\n",  
                     muscle_find ("stype"));  
   
   if (!pure_parser)  
     fprintf (out, "\nextern YYSTYPE %slval;\n",  
              spec_name_prefix ? spec_name_prefix : "yy");  
   
   if (locations_flag)  
     {  
       fputs ("\n\n", out);  
       fprintf (out, "\  
 #ifndef YYLTYPE\n\  
 typedef struct yyltype\n\  
 {\n\  
   int first_line;\n\  
   int first_column;\n\  
   int last_line;\n\  
   int last_column;\n\  
 } yyltype;\n\  
 # define YYLTYPE yyltype\n\  
 #endif\n");  
       if (!pure_parser)  
         fprintf (out, "\nextern YYLTYPE %slloc;\n",  
                  spec_name_prefix ? spec_name_prefix : "yy");  
     }  
   
   if (semantic_parser)  
     {  
       int i;  
   
       for (i = ntokens; i < nsyms; i++)  
         /* don't make these for dummy nonterminals made by gensym.  */  
         if (*symbols[i]->tag != '@')  
           fprintf (out, "# define NT%s\t%d\n", symbols[i]->tag, i);  
     }  
   
   fprintf (out, "\n#endif /* not %s */\n", macro_name);  
   free (macro_name);  
   xfclose (out);  
 }  
   
1074    
1075  /*----------------------------------------------------------.  /*----------------------------------------------------------.
1076  | Output the parsing tables and the parser code to ftable.  |  | Output the parsing tables and the parser code to ftable.  |
# Line 1155  output (void) Line 1095  output (void)
1095    /* Process the selected skeleton file.  */    /* Process the selected skeleton file.  */
1096    output_skeleton ();    output_skeleton ();
1097    
   /* Output the header if needed. */  
   
   if (0)  
     header_output ();  
   
1098    free (rules + 1);    free (rules + 1);
1099    obstack_free (&muscle_obstack, NULL);    obstack_free (&muscle_obstack, NULL);
1100    obstack_free (&format_obstack, NULL);    obstack_free (&format_obstack, NULL);

Legend:
Removed from v.1.127  
changed lines
  Added in v.1.128

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26