Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/flex/dist Regen initparse.c/initscan.c without ...



details:   https://anonhg.NetBSD.org/src/rev/dd58a232a34f
branches:  trunk
changeset: 752206:dd58a232a34f
user:      njoly <njoly%NetBSD.org@localhost>
date:      Fri Feb 19 14:22:43 2010 +0000

description:
Regen initparse.c/initscan.c without #line directives, to avoid host
tool depency problems when NETBSDSRCDIR != /usr/src.

diffstat:

 external/bsd/flex/dist/initparse.c |  188 ++++++----------------
 external/bsd/flex/dist/initscan.c  |  302 +------------------------------------
 2 files changed, 58 insertions(+), 432 deletions(-)

diffs (truncated from 2337 to 300 lines):

diff -r ccc98f572586 -r dd58a232a34f external/bsd/flex/dist/initparse.c
--- a/external/bsd/flex/dist/initparse.c        Fri Feb 19 13:56:39 2010 +0000
+++ b/external/bsd/flex/dist/initparse.c        Fri Feb 19 14:22:43 2010 +0000
@@ -12,7 +12,6 @@
 #define YYMAJOR 1
 #define YYMINOR 9
 
-#define YYLEX yylex()
 #define YYEMPTY        (-1)
 #define yyclearin      (yychar = YYEMPTY)
 #define yyerrok        (yyerrflag = 0)
@@ -21,18 +20,24 @@
 /* compatibility with bison */
 #ifdef YYPARSE_PARAM
 /* compatibility with FreeBSD */
-#ifdef YYPARSE_PARAM_TYPE
-#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-#else
-#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-#endif
+# ifdef YYPARSE_PARAM_TYPE
+#  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+#  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
 #else
-#define YYPARSE_DECL() yyparse(void)
-#endif /* YYPARSE_PARAM */
+# define YYPARSE_DECL() yyparse(void)
+#endif
 
-static int yygrowstack(void);
+/* Pure parsers. */
+#define YYPURE 0
+#ifdef YYLEX_PARAM
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX yylex()
+#endif
+
 #define YYPREFIX "yy"
-#line 37 "/usr/src/external/bsd/flex/dist/parse.y"
 /*  Copyright (c) 1990 The Regents of the University of California. */
 /*  All rights reserved. */
 
@@ -113,7 +118,6 @@
  */
 #define YYSTYPE int
 
-#line 116 "/usr/src/external/bsd/flex/dist/parse.c"
 #define CHAR 257
 #define NUMBER 258
 #define SECTEND 259
@@ -465,6 +469,8 @@
 #endif
 
 extern int YYPARSE_DECL();
+static int yygrowstack(short **, short **, short **,
+    YYSTYPE **, YYSTYPE **, unsigned *);
 
 /* define the initial stack-sizes */
 #ifdef YYSTACKSIZE
@@ -482,20 +488,11 @@
 #define YYINITSTACKSIZE 500
 
 int      yydebug;
-int      yynerrs;
 int      yyerrflag;
-int      yychar;
-short   *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE  yyval;
-YYSTYPE  yylval;
+    int      yynerrs;
+    int      yychar;
+    YYSTYPE  yylval;
 
-/* variables for the parser stack */
-static short   *yyss;
-static short   *yysslim;
-static YYSTYPE *yyvs;
-static unsigned yystacksize;
-#line 952 "/usr/src/external/bsd/flex/dist/parse.y"
 
 
 /* build_eof_action - build the "<<EOF>>" action for the active start
@@ -634,41 +631,37 @@
 const char *msg;
        {
        }
-#line 637 "/usr/src/external/bsd/flex/dist/parse.c"
 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(void)
+static int yygrowstack(short **yyss, short **yyssp, short **yysslim,
+    YYSTYPE **yyvs, YYSTYPE **yyvsp, unsigned *yystacksize)
 {
     int i;
     unsigned newsize;
     short *newss;
     YYSTYPE *newvs;
 
-    if ((newsize = yystacksize) == 0)
+    if ((newsize = *yystacksize) == 0)
         newsize = YYINITSTACKSIZE;
     else if (newsize >= YYMAXDEPTH)
         return -1;
     else if ((newsize *= 2) > YYMAXDEPTH)
         newsize = YYMAXDEPTH;
 
-    i = yyssp - yyss;
-    newss = (yyss != 0)
-          ? (short *)realloc(yyss, newsize * sizeof(*newss))
-          : (short *)malloc(newsize * sizeof(*newss));
+    i = *yyssp - *yyss;
+    newss = (short *)realloc(*yyss, newsize * sizeof(*newss));
     if (newss == 0)
         return -1;
 
-    yyss  = newss;
-    yyssp = newss + i;
-    newvs = (yyvs != 0)
-          ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
-          : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
+    *yyss  = newss;
+    *yyssp = newss + i;
+    newvs = (YYSTYPE *)realloc(*yyvs, newsize * sizeof(*newvs));
     if (newvs == 0)
         return -1;
 
-    yyvs = newvs;
-    yyvsp = newvs + i;
-    yystacksize = newsize;
-    yysslim = yyss + newsize - 1;
+    *yyvs = newvs;
+    *yyvsp = newvs + i;
+    *yystacksize = newsize;
+    *yysslim = *yyss + newsize - 1;
     return 0;
 }
 
@@ -681,6 +674,15 @@
 YYPARSE_DECL()
 {
     int yym, yyn, yystate;
+
+    YYSTYPE  yyval;
+    /* variables for the parser stack */
+    short   *yyssp;
+    short   *yyss;
+    short   *yysslim;
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
+    unsigned yystacksize;
 #if YYDEBUG
     const char *yys;
 
@@ -697,9 +699,11 @@
     yychar = YYEMPTY;
     yystate = 0;
 
-    if (yyss == NULL && yygrowstack()) goto yyoverflow;
-    yyssp = yyss;
-    yyvsp = yyvs;
+    yystacksize = 0;
+    yyvs = yyvsp = NULL;
+    yyss = yyssp = NULL;
+    if (yygrowstack(&yyss, &yyssp, &yysslim, &yyvs, &yyvsp, &yystacksize))
+        goto yyoverflow;
     yystate = 0;
     *yyssp = 0;
 
@@ -727,7 +731,8 @@
             printf("%sdebug: state %d, shifting to state %d\n",
                     YYPREFIX, yystate, yytable[yyn]);
 #endif
-        if (yyssp >= yysslim && yygrowstack())
+        if (yyssp >= yysslim && yygrowstack(&yyss, &yyssp, &yysslim,
+            &yyvs, &yyvsp, &yystacksize))
         {
             goto yyoverflow;
         }
@@ -767,7 +772,8 @@
                     printf("%sdebug: state %d, error recovery shifting\
  to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
 #endif
-                if (yyssp >= yysslim && yygrowstack())
+                if (yyssp >= yysslim && yygrowstack(&yyss, &yyssp,
+                    &yysslim, &yyvs, &yyvsp, &yystacksize))
                 {
                     goto yyoverflow;
                 }
@@ -820,7 +826,6 @@
     switch (yyn)
     {
 case 1:
-#line 121 "/usr/src/external/bsd/flex/dist/parse.y"
        { /* add default rule */
                        int def_rule;
 
@@ -849,7 +854,6 @@
                        }
 break;
 case 2:
-#line 150 "/usr/src/external/bsd/flex/dist/parse.y"
        { /* initialize for processing rules */
 
                        /* Create default DFA start condition. */
@@ -857,11 +861,9 @@
                        }
 break;
 case 6:
-#line 161 "/usr/src/external/bsd/flex/dist/parse.y"
        { synerr( _("unknown error processing section 1") ); }
 break;
 case 7:
-#line 165 "/usr/src/external/bsd/flex/dist/parse.y"
        {
                        check_options();
                        scon_stk = allocate_integer_array( lastsc + 1 );
@@ -869,62 +871,48 @@
                        }
 break;
 case 8:
-#line 173 "/usr/src/external/bsd/flex/dist/parse.y"
        { xcluflg = false; }
 break;
 case 9:
-#line 176 "/usr/src/external/bsd/flex/dist/parse.y"
        { xcluflg = true; }
 break;
 case 10:
-#line 180 "/usr/src/external/bsd/flex/dist/parse.y"
        { scinstal( nmstr, xcluflg ); }
 break;
 case 11:
-#line 183 "/usr/src/external/bsd/flex/dist/parse.y"
        { scinstal( nmstr, xcluflg ); }
 break;
 case 12:
-#line 186 "/usr/src/external/bsd/flex/dist/parse.y"
        { synerr( _("bad start condition list") ); }
 break;
 case 16:
-#line 197 "/usr/src/external/bsd/flex/dist/parse.y"
        {
                        outfilename = copy_string( nmstr );
                        did_outfilename = 1;
                        }
 break;
 case 17:
-#line 202 "/usr/src/external/bsd/flex/dist/parse.y"
        { extra_type = copy_string( nmstr ); }
 break;
 case 18:
-#line 204 "/usr/src/external/bsd/flex/dist/parse.y"
        { prefix = copy_string( nmstr ); }
 break;
 case 19:
-#line 206 "/usr/src/external/bsd/flex/dist/parse.y"
        { yyclass = copy_string( nmstr ); }
 break;
 case 20:
-#line 208 "/usr/src/external/bsd/flex/dist/parse.y"
        { headerfilename = copy_string( nmstr ); }
 break;
 case 21:
-#line 210 "/usr/src/external/bsd/flex/dist/parse.y"
        { tablesext = true; tablesfilename = copy_string( nmstr ); }
 break;
 case 22:
-#line 214 "/usr/src/external/bsd/flex/dist/parse.y"
        { scon_stk_ptr = yyvsp[-3]; }
 break;
 case 23:
-#line 216 "/usr/src/external/bsd/flex/dist/parse.y"
        { scon_stk_ptr = yyvsp[-3]; }
 break;
 case 25:
-#line 221 "/usr/src/external/bsd/flex/dist/parse.y"
        {
                        /* Initialize for a parse of one rule. */
                        trlcontxt = variable_trail_rule = varlength = false;
@@ -937,7 +925,6 @@
                        }
 break;
 case 26:
-#line 234 "/usr/src/external/bsd/flex/dist/parse.y"
        {
                        pat = yyvsp[0];
                        finish_rule( pat, variable_trail_rule,
@@ -974,7 +961,6 @@
                        }
 break;
 case 27:
-#line 270 "/usr/src/external/bsd/flex/dist/parse.y"
        {
                        pat = yyvsp[0];
                        finish_rule( pat, variable_trail_rule,
@@ -999,7 +985,6 @@
                        }



Home | Main Index | Thread Index | Old Index