/[bison]/bison/src/scan-skel.l
ViewVC logotype

Diff of /bison/src/scan-skel.l

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

revision 1.11 by akim, Mon Jun 3 07:30:03 2002 UTC revision 1.12 by akim, Wed Jul 3 06:52:02 2002 UTC
# Line 23  Line 23 
23    
24  %{  %{
25  #include "system.h"  #include "system.h"
26    #include "error.h"
27    #include "getargs.h"
28  #include "files.h"  #include "files.h"
29  int skel_lex PARAMS ((void));  int skel_lex PARAMS ((void));
30  static int yylineno = 1;  static int yylineno = 1;
# Line 38  static char *yyoutname = NULL; Line 40  static char *yyoutname = NULL;
40       yylineno = 1;       yylineno = 1;
41     }     }
42    
43  "@<:@" fputc ('[', yyout);  "@<:@"           fputc ('[', yyout);
44  "@:>@" fputc (']', yyout);  "@:>@"           fputc (']', yyout);
45    
46  "__oline__"      fprintf (yyout, "%d", yylineno+1);  "__oline__"      fprintf (yyout, "%d", yylineno+1);
47  "__ofile__"      fprintf (yyout, "%s", yyoutname);  "__ofile__"      fprintf (yyout, "%s", yyoutname);
# Line 47  static char *yyoutname = NULL; Line 49  static char *yyoutname = NULL;
49  \n+              yylineno += yyleng; ECHO;  \n+              yylineno += yyleng; ECHO;
50  .                ECHO;  .                ECHO;
51    
52    <<EOF>>          xfclose (yyout); free (yyoutname); return EOF;
53  %%  %%
54    
55    /* From lib/readpipe.c.  */
56    FILE *readpipe PARAMS ((const char *, ...));
57    
58    /*----------------------.
59    | Run our backend, M4.  |
60    `----------------------*/
61    
62    void m4_invoke PARAMS ((const char *definitions));
63    
64    void
65    m4_invoke (const char *definitions)
66    {
67      /* Invoke m4 on the definition of the muscles, and the skeleton. */
68      const char *bison_pkgdatadir = getenv ("BISON_PKGDATADIR");
69      const char *m4 = getenv ("M4");
70      int pkg_data_len;
71      char *full_skeleton;
72    
73      if (!m4)
74        m4 = M4;
75      if (!bison_pkgdatadir)
76        bison_pkgdatadir = PKGDATADIR;
77      pkg_data_len = strlen (bison_pkgdatadir);
78      full_skeleton = XMALLOC (char, pkg_data_len + strlen (skeleton) + 2);
79      if (bison_pkgdatadir[pkg_data_len-1] == '/')
80        sprintf (full_skeleton, "%s%s", bison_pkgdatadir, skeleton);
81      else
82        sprintf (full_skeleton, "%s/%s", bison_pkgdatadir, skeleton);
83      if (trace_flag)
84        fprintf (stderr,
85                 "running: %s -I %s m4sugar/m4sugar.m4 %s %s\n",
86                 m4, bison_pkgdatadir, definitions, full_skeleton);
87      skel_in = readpipe (m4,
88                          "-I", bison_pkgdatadir,
89                          "m4sugar/m4sugar.m4",
90                          definitions,
91                          full_skeleton,
92                          NULL);
93      XFREE (full_skeleton);
94      if (!skel_in)
95        error (EXIT_FAILURE, errno, "cannot run m4");
96      skel_lex ();
97    
98      /* Reclaim Flex's buffers.  */
99      yy_delete_buffer (YY_CURRENT_BUFFER);
100    }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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