/[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.183 by akim, Wed Jul 3 06:51:43 2002 UTC revision 1.184 by akim, Wed Jul 3 06:52:02 2002 UTC
# Line 104  Line 104 
104  #include "conflicts.h"  #include "conflicts.h"
105  #include "muscle_tab.h"  #include "muscle_tab.h"
106    
 /* From lib/readpipe.h.  */  
 FILE *readpipe PARAMS ((const char *, ...));  
   
107  /* From src/scan-skel.l. */  /* From src/scan-skel.l. */
108  int skel_lex PARAMS ((void));  void m4_invoke PARAMS ((const char *definitions));
 extern FILE *skel_in;  
109    
110  static int nvectors;  static int nvectors;
111  static int nentries;  static int nentries;
# Line 894  sort_actions (void) Line 890  sort_actions (void)
890  {  {
891    int i;    int i;
892    
   order = XCALLOC (short, nvectors);  
893    nentries = 0;    nentries = 0;
894    
895    for (i = 0; i < nvectors; i++)    for (i = 0; i < nvectors; i++)
# Line 1056  pack_table (void) Line 1051  pack_table (void)
1051        XFREE (conflict_tos[i]);        XFREE (conflict_tos[i]);
1052      }      }
1053    
1054    XFREE (froms);    free (froms);
1055    XFREE (tos);    free (tos);
1056    XFREE (conflict_tos);    free (conflict_tos);
1057    XFREE (pos);    free (pos);
1058  }  }
1059    
1060  /* the following functions output yytable, yycheck, yyconflp, yyconfl,  /* the following functions output yytable, yycheck, yyconflp, yyconfl,
# Line 1124  output_check (void) Line 1119  output_check (void)
1119  `-----------------------------------------------------------------*/  `-----------------------------------------------------------------*/
1120    
1121  static void  static void
1122  output_actions (void)  prepare_actions (void)
1123  {  {
1124    /* That's a poor way to make sure the sizes are properly corelated,    /* That's a poor way to make sure the sizes are properly corelated,
1125       in particular the signedness is not taking into account, but it's       in particular the signedness is not taking into account, but it's
# Line 1149  output_actions (void) Line 1144  output_actions (void)
1144    XFREE (from_state);    XFREE (from_state);
1145    XFREE (to_state);    XFREE (to_state);
1146    
1147      order = XCALLOC (short, nvectors);
1148    sort_actions ();    sort_actions ();
1149    pack_table ();    pack_table ();
1150      free (order);
1151    
1152      free (tally);
1153      free (width);
1154    
1155    output_base ();    output_base ();
1156    output_table ();    output_table ();
# Line 1160  output_actions (void) Line 1160  output_actions (void)
1160  }  }
1161    
1162    
 /*----------------------.  
 | Run our backend, M4.  |  
 `----------------------*/  
   
 static void  
 m4_invoke (const char *definitions)  
 {  
   /* Invoke m4 on the definition of the muscles, and the skeleton. */  
   const char *bison_pkgdatadir = getenv ("BISON_PKGDATADIR");  
   const char *m4 = getenv ("M4");  
   int pkg_data_len;  
   char *full_skeleton;  
   
   if (!m4)  
     m4 = M4;  
   if (!bison_pkgdatadir)  
     bison_pkgdatadir = PKGDATADIR;  
   pkg_data_len = strlen (bison_pkgdatadir);  
   full_skeleton = XMALLOC (char, pkg_data_len + strlen (skeleton) + 2);  
   if (bison_pkgdatadir[pkg_data_len-1] == '/')  
     sprintf (full_skeleton, "%s%s", bison_pkgdatadir, skeleton);  
   else  
     sprintf (full_skeleton, "%s/%s", bison_pkgdatadir, skeleton);  
   if (trace_flag)  
     fprintf (stderr,  
              "running: %s -I %s m4sugar/m4sugar.m4 %s %s\n",  
              m4, bison_pkgdatadir, definitions, full_skeleton);  
   skel_in = readpipe (m4,  
                       "-I", bison_pkgdatadir,  
                       "m4sugar/m4sugar.m4",  
                       definitions,  
                       full_skeleton,  
                       NULL);  
   XFREE (full_skeleton);  
   if (!skel_in)  
     error (EXIT_FAILURE, errno, "cannot run m4");  
   skel_lex ();  
 }  
   
   
1163  /*---------------------------.  /*---------------------------.
1164  | Call the skeleton parser.  |  | Call the skeleton parser.  |
1165  `---------------------------*/  `---------------------------*/
# Line 1312  output (void) Line 1272  output (void)
1272    prepare_tokens ();    prepare_tokens ();
1273    prepare_rules ();    prepare_rules ();
1274    prepare_states ();    prepare_states ();
1275    output_actions ();    prepare_actions ();
1276    
1277    prepare ();    prepare ();
1278    

Legend:
Removed from v.1.183  
changed lines
  Added in v.1.184

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