From: Gurusamy Sarathy Date: Thu, 24 Sep 1998 04:29:14 +0000 (+0000) Subject: move yyglobal decls from perly.c to perlvars.h, regen headers, tweak X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d3b6f988cac8d2811966703f0abfa69a19d8e06a;p=p5sagit%2Fp5-mst-13.2.git move yyglobal decls from perly.c to perlvars.h, regen headers, tweak perly_c.diff p4raw-id: //depot/perl@1864 --- diff --git a/embed.h b/embed.h index 50a5580..376fb34 100644 --- a/embed.h +++ b/embed.h @@ -1112,27 +1112,21 @@ #define watchaddr Perl_watchaddr #define watchok Perl_watchok #define whichsig Perl_whichsig -#define yychar Perl_yychar #define yycheck Perl_yycheck -#define yydebug Perl_yydebug #define yydefred Perl_yydefred #define yydestruct Perl_yydestruct #define yydgoto Perl_yydgoto -#define yyerrflag Perl_yyerrflag #define yyerror Perl_yyerror #define yygindex Perl_yygindex #define yylen Perl_yylen #define yylex Perl_yylex #define yylhs Perl_yylhs -#define yylval Perl_yylval #define yyname Perl_yyname -#define yynerrs Perl_yynerrs #define yyparse Perl_yyparse #define yyrindex Perl_yyrindex #define yyrule Perl_yyrule #define yysindex Perl_yysindex #define yytable Perl_yytable -#define yyval Perl_yyval #define yywarn Perl_yywarn #endif /* EMBED */ diff --git a/embedvar.h b/embedvar.h index be36de0..a6ab6bc 100644 --- a/embedvar.h +++ b/embedvar.h @@ -766,6 +766,14 @@ #define PL_xnv_root (PL_Vars.Gxnv_root) #define PL_xpv_root (PL_Vars.Gxpv_root) #define PL_xrv_root (PL_Vars.Gxrv_root) +#define PL_yychar (PL_Vars.Gyychar) +#define PL_yydebug (PL_Vars.Gyydebug) +#define PL_yyerrflag (PL_Vars.Gyyerrflag) +#define PL_yylval (PL_Vars.Gyylval) +#define PL_yynerrs (PL_Vars.Gyynerrs) +#define PL_yyssp (PL_Vars.Gyyssp) +#define PL_yyval (PL_Vars.Gyyval) +#define PL_yyvsp (PL_Vars.Gyyvsp) #else /* !PERL_GLOBAL_STRUCT */ @@ -892,6 +900,14 @@ #define PL_Gxnv_root PL_xnv_root #define PL_Gxpv_root PL_xpv_root #define PL_Gxrv_root PL_xrv_root +#define PL_Gyychar PL_yychar +#define PL_Gyydebug PL_yydebug +#define PL_Gyyerrflag PL_yyerrflag +#define PL_Gyylval PL_yylval +#define PL_Gyynerrs PL_yynerrs +#define PL_Gyyssp PL_yyssp +#define PL_Gyyval PL_yyval +#define PL_Gyyvsp PL_yyvsp #ifdef EMBED diff --git a/global.sym b/global.sym index 676cb2a..2536965 100644 --- a/global.sym +++ b/global.sym @@ -139,23 +139,17 @@ warn_reserved warn_uninit watchaddr watchok -yychar yycheck -yydebug yydefred yydgoto -yyerrflag yygindex yylen yylhs -yylval yyname -yynerrs yyrindex yyrule yysindex yytable -yyval # Functions diff --git a/perlvars.h b/perlvars.h index 4ccfc58..98e78c9 100644 --- a/perlvars.h +++ b/perlvars.h @@ -171,22 +171,22 @@ PERLVARI(Gnumeric_local, bool, TRUE) #endif /* !USE_LOCALE_NUMERIC */ /* utf8 character classes */ -PERLVAR(Gutf8_alnum, SV *) -PERLVAR(Gutf8_alpha, SV *) -PERLVAR(Gutf8_space, SV *) -PERLVAR(Gutf8_digit, SV *) -PERLVAR(Gutf8_upper, SV *) -PERLVAR(Gutf8_lower, SV *) -PERLVAR(Gutf8_print, SV *) -PERLVAR(Gutf8_mark, SV *) -PERLVAR(Gutf8_toupper, SV *) -PERLVAR(Gutf8_totitle, SV *) -PERLVAR(Gutf8_tolower, SV *) -PERLVAR(Glast_swash_hv, HV *) -PERLVAR(Glast_swash_klen, U32) -PERLVAR(Glast_swash_key[10], U8) -PERLVAR(Glast_swash_tmps, U8 *) -PERLVAR(Glast_swash_slen, STRLEN) +PERLVAR(Gutf8_alnum, SV *) +PERLVAR(Gutf8_alpha, SV *) +PERLVAR(Gutf8_space, SV *) +PERLVAR(Gutf8_digit, SV *) +PERLVAR(Gutf8_upper, SV *) +PERLVAR(Gutf8_lower, SV *) +PERLVAR(Gutf8_print, SV *) +PERLVAR(Gutf8_mark, SV *) +PERLVAR(Gutf8_toupper, SV *) +PERLVAR(Gutf8_totitle, SV *) +PERLVAR(Gutf8_tolower, SV *) +PERLVAR(Glast_swash_hv, HV *) +PERLVAR(Glast_swash_klen, U32) +PERLVAR(Glast_swash_key[10], U8) +PERLVAR(Glast_swash_tmps, U8 *) +PERLVAR(Glast_swash_slen, STRLEN) /* constants (these are not literals to facilitate pointer comparisons) */ PERLVARIC(GYes, char *, "1") @@ -196,3 +196,12 @@ PERLVARIC(Gpatleave, char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}") PERLVAR(Gspecialsv_list[4],SV *) /* from byterun.h */ +/* perly.c globals */ +PERLVAR(Gyydebug, int) +PERLVAR(Gyynerrs, int) +PERLVAR(Gyyerrflag, int) +PERLVAR(Gyychar, int) +PERLVAR(Gyyssp, short*) +PERLVAR(Gyyvsp, YYSTYPE*) +PERLVAR(Gyyval, YYSTYPE) +PERLVAR(Gyylval, YYSTYPE) diff --git a/perly.c b/perly.c index 7a53d4b..f9799a8 100644 --- a/perly.c +++ b/perly.c @@ -6,6 +6,15 @@ static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/91"; #include "EXTERN.h" #include "perl.h" +#define yydebug PL_yydebug +#define yynerrs PL_yynerrs +#define yyerrflag PL_yyerrflag +#define yychar PL_yychar +#define yyssp PL_yyssp +#define yyvsp PL_yyvsp +#define yyval PL_yyval +#define yylval PL_yylval + #ifdef PERL_OBJECT static void Dep(CPerlObj *pPerl) @@ -1276,14 +1285,6 @@ char *yyrule[] = { #define YYMAXDEPTH 500 #endif #endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; -YYSTYPE yylval; #line 643 "perly.y" /* PROGRAM */ #line 1353 "perly.c" @@ -1405,9 +1406,9 @@ yyloop: int yypv_index = (yyvsp - yyvs); yystacksize += YYSTACKSIZE; ysave->yyvs = yyvs = - (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); + (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); ysave->yyss = yyss = - (short*)realloc((char*)yyss,yystacksize * sizeof(short)); + (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short)); if (!yyvs || !yyss) goto yyoverflow; yyssp = yyss + yyps_index; @@ -1460,9 +1461,9 @@ yyinrecovery: int yyps_index = (yyssp - yyss); int yypv_index = (yyvsp - yyvs); yystacksize += YYSTACKSIZE; - ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs, + ysave->yyvs = yyvs = (YYSTYPE*)PerlMem_realloc((char*)yyvs, yystacksize * sizeof(YYSTYPE)); - ysave->yyss = yyss = (short*)realloc((char*)yyss, + ysave->yyss = yyss = (short*)PerlMem_realloc((char*)yyss, yystacksize * sizeof(short)); if (!yyvs || !yyss) goto yyoverflow; @@ -2346,9 +2347,9 @@ break; int yypv_index = (yyvsp - yyvs); yystacksize += YYSTACKSIZE; ysave->yyvs = yyvs = - (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); + (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); ysave->yyss = yyss = - (short*)realloc((char*)yyss,yystacksize * sizeof(short)); + (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short)); if (!yyvs || !yyss) goto yyoverflow; yyssp = yyss + yyps_index; diff --git a/perly.h b/perly.h index c1f7806..8b0bdbb 100644 --- a/perly.h +++ b/perly.h @@ -62,4 +62,3 @@ typedef union { OP *opval; GV *gvval; } YYSTYPE; -extern YYSTYPE yylval; diff --git a/perly_c.diff b/perly_c.diff index aa0555b..f770e24 100644 --- a/perly_c.diff +++ b/perly_c.diff @@ -1,21 +1,29 @@ -*** perly.c.orig Tue Jul 28 15:02:41 1998 ---- perly.c Tue Jul 28 15:14:54 1998 +*** perly.c.orig Thu Sep 24 00:32:28 1998 +--- perly.c Thu Sep 24 00:18:13 1998 *************** -*** 7,11 **** ---- 7,19 ---- +*** 7,10 **** +--- 7,27 ---- #include "perl.h" ++ #define yydebug PL_yydebug ++ #define yynerrs PL_yynerrs ++ #define yyerrflag PL_yyerrflag ++ #define yychar PL_yychar ++ #define yyssp PL_yyssp ++ #define yyvsp PL_yyvsp ++ #define yyval PL_yyval ++ #define yylval PL_yylval ++ + #ifdef PERL_OBJECT - static void ++ static void + Dep(CPerlObj *pPerl) + { + pPerl->deprecate("\"do\" to call subroutines"); + } + #define dep() Dep(this) + #else -+ static void + static void dep(void) - { *************** *** 12,86 **** deprecate("\"do\" to call subroutines"); @@ -93,7 +101,7 @@ - #define ARROW 314 #define YYERRCODE 256 short yylhs[] = { -1, ---- 20,26 ---- +--- 29,35 ---- deprecate("\"do\" to call subroutines"); } + #endif @@ -102,9 +110,17 @@ #define YYERRCODE 256 short yylhs[] = { -1, *************** -*** 1345,1365 **** - YYSTYPE yyval; - YYSTYPE yylval; +*** 1337,1365 **** + #endif + #endif +- int yydebug; +- int yynerrs; +- int yyerrflag; +- int yychar; +- short *yyssp; +- YYSTYPE *yyvsp; +- YYSTYPE yyval; +- YYSTYPE yylval; - short yyss[YYSTACKSIZE]; - YYSTYPE yyvs[YYSTACKSIZE]; - #define yystacksize YYSTACKSIZE @@ -124,9 +140,9 @@ if (yys = getenv("YYDEBUG")) { ---- 1285,1349 ---- - YYSTYPE yyval; - YYSTYPE yylval; +--- 1286,1350 ---- + #endif + #endif #line 643 "perly.y" /* PROGRAM */ ! #line 1353 "perly.c" @@ -176,7 +192,7 @@ extern char *getenv(); + #endif + #endif - ++ + struct ysv *ysave; + New(73, ysave, 1, struct ysv); + SAVEDESTRUCTOR(yydestruct, ysave); @@ -186,13 +202,13 @@ + ysave->oldyychar = yychar; + ysave->oldyyval = yyval; + ysave->oldyylval = yylval; -+ + + #if YYDEBUG if (yys = getenv("YYDEBUG")) { *************** *** 1374,1377 **** ---- 1358,1371 ---- +--- 1359,1372 ---- yychar = (-1); + /* @@ -214,33 +230,30 @@ ! printf("yydebug: state %d, reading %d (%s)\n", yystate, yychar, yys); } ---- 1383,1387 ---- +--- 1384,1388 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate, yychar, yys); } *************** -*** 1399,1403 **** +*** 1399,1408 **** #if YYDEBUG if (yydebug) ! printf("yydebug: state %d, shifting to state %d\n", yystate, yytable[yyn]); #endif ---- 1393,1397 ---- - #if YYDEBUG - if (yydebug) -! PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n", - yystate, yytable[yyn]); - #endif -*************** -*** 1404,1408 **** if (yyssp >= yyss + yystacksize - 1) { ! goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; ---- 1398,1416 ---- +--- 1394,1417 ---- + #if YYDEBUG + if (yydebug) +! PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n", + yystate, yytable[yyn]); + #endif if (yyssp >= yyss + yystacksize - 1) { ! /* @@ -251,9 +264,9 @@ ! int yypv_index = (yyvsp - yyvs); ! yystacksize += YYSTACKSIZE; ! ysave->yyvs = yyvs = -! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); +! (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); ! ysave->yyss = yyss = -! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); +! (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short)); ! if (!yyvs || !yyss) ! goto yyoverflow; ! yyssp = yyss + yyps_index; @@ -272,7 +285,7 @@ ! goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; ---- 1448,1472 ---- +--- 1449,1473 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -288,9 +301,9 @@ ! int yyps_index = (yyssp - yyss); ! int yypv_index = (yyvsp - yyvs); ! yystacksize += YYSTACKSIZE; -! ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs, +! ysave->yyvs = yyvs = (YYSTYPE*)PerlMem_realloc((char*)yyvs, ! yystacksize * sizeof(YYSTYPE)); -! ysave->yyss = yyss = (short*)realloc((char*)yyss, +! ysave->yyss = yyss = (short*)PerlMem_realloc((char*)yyss, ! yystacksize * sizeof(short)); ! if (!yyvs || !yyss) ! goto yyoverflow; @@ -306,7 +319,7 @@ ! *yyssp); #endif if (yyssp <= yyss) goto yyabort; ---- 1478,1484 ---- +--- 1479,1485 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -322,7 +335,7 @@ ! yystate, yychar, yys); } #endif ---- 1497,1503 ---- +--- 1498,1504 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; ! PerlIO_printf(Perl_debug_log, @@ -337,7 +350,7 @@ ! printf("yydebug: state %d, reducing by rule %d (%s)\n", yystate, yyn, yyrule[yyn]); #endif ---- 1508,1512 ---- +--- 1509,1513 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n", @@ -350,7 +363,7 @@ ! #line 2270 "y.tab.c" } yyssp -= yym; ---- 2292,2296 ---- +--- 2293,2297 ---- { yyval.opval = yyvsp[0].opval; } break; ! #line 2270 "perly.c" @@ -364,7 +377,7 @@ ! state %d\n", YYFINAL); #endif yystate = YYFINAL; ---- 2302,2308 ---- +--- 2303,2309 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -379,7 +392,7 @@ ! printf("yydebug: state %d, reading %d (%s)\n", YYFINAL, yychar, yys); } ---- 2318,2322 ---- +--- 2319,2323 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", @@ -397,7 +410,7 @@ ! goto yyoverflow; } *++yyssp = yystate; ---- 2333,2357 ---- +--- 2334,2358 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -414,9 +427,9 @@ ! int yypv_index = (yyvsp - yyvs); ! yystacksize += YYSTACKSIZE; ! ysave->yyvs = yyvs = -! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); +! (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); ! ysave->yyss = yyss = -! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); +! (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short)); ! if (!yyvs || !yyss) ! goto yyoverflow; ! yyssp = yyss + yyps_index; @@ -433,7 +446,7 @@ yyaccept: ! return (0); } ---- 2359,2366 ---- +--- 2360,2367 ---- goto yyloop; yyoverflow: ! yyerror("Out of memory for yacc stack"); diff --git a/toke.c b/toke.c index 1556325..3d59a4f 100644 --- a/toke.c +++ b/toke.c @@ -14,6 +14,9 @@ #include "EXTERN.h" #include "perl.h" +#define yychar PL_yychar +#define yylval PL_yylval + #ifndef PERL_OBJECT static void check_uni _((void)); static void force_next _((I32 type));