/[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.119 by akim, Sat Dec 29 14:27:45 2001 UTC revision 1.120 by ra, Sun Dec 30 14:50:15 2001 UTC
# Line 125  static struct obstack format_obstack; Line 125  static struct obstack format_obstack;
125  int error_verbose = 0;  int error_verbose = 0;
126    
127  /* Returns the number of lines of S.  */  /* Returns the number of lines of S.  */
128  static size_t  size_t
129  get_lines_number (const char *s)  get_lines_number (const char *s)
130  {  {
131    size_t lines = 0;    size_t lines = 0;
# Line 503  token_actions (void) Line 503  token_actions (void)
503  | Output the actions to OOUT.  |  | Output the actions to OOUT.  |
504  `-----------------------------*/  `-----------------------------*/
505    
506  static void  void
507  actions_output (FILE *out, size_t *line)  actions_output (FILE *out, size_t *line)
508  {  {
509    int rule;    int rule;
# Line 539  actions_output (FILE *out, size_t *line) Line 539  actions_output (FILE *out, size_t *line)
539  | Output the guards to OOUT.  |  | Output the guards to OOUT.  |
540  `----------------------------*/  `----------------------------*/
541    
542  static void  void
543  guards_output (FILE *out, size_t *line)  guards_output (FILE *out, size_t *line)
544  {  {
545    int rule;    int rule;
# Line 571  guards_output (FILE *out, size_t *line) Line 571  guards_output (FILE *out, size_t *line)
571  | Output the tokens definition to OOUT.  |  | Output the tokens definition to OOUT.  |
572  `---------------------------------------*/  `---------------------------------------*/
573    
574  static void  void
575  token_definitions_output (FILE *out, size_t *line)  token_definitions_output (FILE *out, size_t *line)
576  {  {
577    int i;    int i;
# Line 1042  static void Line 1042  static void
1042  output_master_parser (void)  output_master_parser (void)
1043  {  {
1044    FILE *parser = xfopen (parser_file_name, "w");    FILE *parser = xfopen (parser_file_name, "w");
1045    
1046      /* FIXME: Remove the two following lines.  */
1047      printf ("Test: %s\n", infile);
1048      printf ("Test: %s\n", parser_file_name);
1049    
1050    if (!skeleton)    if (!skeleton)
1051      {      {
1052        if (semantic_parser)        if (semantic_parser)
# Line 1056  output_master_parser (void) Line 1061  output_master_parser (void)
1061    xfclose (parser);    xfclose (parser);
1062  }  }
1063    
1064    /* Call the skeleton parser.  */
1065    
1066  /* FIXME. */  static
1067    void
1068    output_skeleton ()
1069    {
1070      /* Find the right skeleton file.  */
1071      if (!skeleton)
1072        {
1073          if (semantic_parser)
1074            skeleton = skeleton_find ("BISON_HAIRY", BISON_HAIRY);
1075          else
1076            skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE);
1077        }
1078    
1079  #define MUSCLE_INSERT_INT(Key, Value)                           \    /* Parse the skeleton file and output the needed parsers.  */
1080  {                                                               \    muscle_insert ("skeleton", skeleton);
1081    obstack_fgrow1 (&muscle_obstack, "%d", Value);                \    process_skeleton (infile, skeleton);
   obstack_1grow (&muscle_obstack, 0);                           \  
   muscle_insert (Key, obstack_finish (&muscle_obstack));        \  
 }  
   
 #define MUSCLE_INSERT_STRING(Key, Value)                        \  
 {                                                               \  
   obstack_sgrow (&muscle_obstack, Value);                       \  
   obstack_1grow (&muscle_obstack, 0);                           \  
   muscle_insert (Key, obstack_finish (&muscle_obstack));        \  
 }  
   
 #define MUSCLE_INSERT_PREFIX(Key, Value)                                \  
 {                                                                       \  
   obstack_fgrow2 (&muscle_obstack, "%s%s",                              \  
                   spec_name_prefix ? spec_name_prefix : "yy", Value);   \  
   obstack_1grow (&muscle_obstack, 0);                                   \  
   muscle_insert (Key, obstack_finish (&muscle_obstack));                \  
1082  }  }
1083    
1084  static void  static void
# Line 1102  prepare (void) Line 1102  prepare (void)
1102    MUSCLE_INSERT_INT ("locations-flag", locations_flag);    MUSCLE_INSERT_INT ("locations-flag", locations_flag);
1103  }  }
1104    
   
1105  /*-------------------------.  /*-------------------------.
1106  | Output the header file.  |  | Output the header file.  |
1107  `-------------------------*/  `-------------------------*/
# Line 1188  output (void) Line 1187  output (void)
1187    obstack_1grow (&attrs_obstack, 0);    obstack_1grow (&attrs_obstack, 0);
1188    muscle_insert ("prologue", obstack_finish (&attrs_obstack));    muscle_insert ("prologue", obstack_finish (&attrs_obstack));
1189    
1190      /* Process the selected skeleton file.  */
1191      output_skeleton ();
1192    
1193    /* Output the parser. */    /* Output the parser. */
1194    #if 0
1195    output_master_parser ();    output_master_parser ();
1196    #endif
1197    /* Output the header if needed. */    /* Output the header if needed. */
1198    if (defines_flag)    if (defines_flag)
1199      header_output ();      header_output ();

Legend:
Removed from v.1.119  
changed lines
  Added in v.1.120

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