CV *cv;
HV *hv;
- sv_setpvf(sv, "%_:%ld-%ld",
- GvSV(curcop->cop_filegv),
- (long)subline, (long)curcop->cop_line);
+ sv_setpvf(sv, "%_:%ld-%ld", GvSV(curcop->cop_filegv),
+ (long)(subline < 0 ? -subline : subline),
+ (long)curcop->cop_line);
gv_efullname3(tmpstr, gv, Nullch);
hv_store(GvHV(DBsub), SvPVX(tmpstr), SvCUR(tmpstr), sv, 0);
if (!db_postponed) {
op_free(o);
#ifdef USE_THREADS
- if (subline) {
+ if (subline > 0) {
argop = newOP(OP_PADAV, OPf_REF);
argop->op_targ = 0; /* curpad[0] is @_ */
}
}
#else
argop = newUNOP(OP_RV2AV, 0,
- scalar(newGVOP(OP_GV, 0, subline ?
+ scalar(newGVOP(OP_GV, 0, subline > 0 ?
defgv : gv_fetchpv("ARGV", TRUE, SVt_PVAV))));
#endif /* USE_THREADS */
return newUNOP(type, 0, scalar(argop));
{ char *name = SvPV(((SVOP*)yyvsp[0].opval)->op_sv, na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ { CvUNIQUE_on(compcv); subline = -subline; }
yyval.opval = yyvsp[0].opval; }
break;
case 57:
- short yyss[YYSTACKSIZE];
- YYSTYPE yyvs[YYSTACKSIZE];
- #define yystacksize YYSTACKSIZE
- #line 631 "perly.y"
+ #line 632 "perly.y"
/* PROGRAM */
--- 1283,1288 ----
***************
*** 1361,1372 ****
---- 1291,1347 ----
+ #define YYACCEPT goto yyaccept
+ #define YYERROR goto yyerrlab
+ int
+! yyparse()
+ {
+ register int yym, yyn, yystate;
+ #if YYDEBUG
+ register char *yys;
+ extern char *getenv();
+
+ if (yys = getenv("YYDEBUG"))
+ {
+--- 1291,1348 ----
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
+
+ };
+
+ void
-+ yydestruct(ptr)
-+ void* ptr;
++ yydestruct(void *ptr)
+ {
+ struct ysv* ysave = (struct ysv*)ptr;
+ if (ysave->yyss) Safefree(ysave->yyss);
+ }
+
int
- yyparse()
+! yyparse(void)
{
register int yym, yyn, yystate;
+ register short *yyssp;
+ int retval = 0;
#if YYDEBUG
register char *yys;
++ #ifndef __cplusplus
extern char *getenv();
+ #endif
++ #endif
+
+ struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
+ SAVEDESTRUCTOR(yydestruct, ysave);
{
***************
*** 1381,1384 ****
---- 1356,1367 ----
+--- 1357,1368 ----
yychar = (-1);
+ /*
! printf("yydebug: state %d, reading %d (%s)\n", yystate,
yychar, yys);
}
---- 1379,1383 ----
+--- 1380,1384 ----
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
! goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
---- 1389,1412 ----
+--- 1390,1413 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
! goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
---- 1444,1468 ----
+--- 1445,1469 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
! *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
---- 1474,1480 ----
+--- 1475,1481 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
! yystate, yychar, yys);
}
#endif
---- 1493,1499 ----
+--- 1494,1500 ----
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! fprintf(stderr,
! printf("yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
#endif
---- 1504,1508 ----
+--- 1505,1509 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
#endif
***************
-*** 2278,2283 ****
+*** 2279,2284 ****
#if YYDEBUG
if (yydebug)
! printf("yydebug: after reduction, shifting from state 0 to\
! state %d\n", YYFINAL);
#endif
yystate = YYFINAL;
---- 2292,2298 ----
+--- 2294,2300 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
#endif
yystate = YYFINAL;
***************
-*** 2293,2297 ****
+*** 2294,2298 ****
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! printf("yydebug: state %d, reading %d (%s)\n",
YYFINAL, yychar, yys);
}
---- 2308,2312 ----
+--- 2310,2314 ----
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
YYFINAL, yychar, yys);
}
***************
-*** 2308,2317 ****
+*** 2309,2318 ****
#if YYDEBUG
if (yydebug)
! printf("yydebug: after reduction, shifting from state %d \
! goto yyoverflow;
}
*++yyssp = yystate;
---- 2323,2347 ----
+--- 2325,2349 ----
#if YYDEBUG
if (yydebug)
! fprintf(stderr,
}
*++yyssp = yystate;
***************
-*** 2319,2326 ****
+*** 2320,2327 ****
goto yyloop;
yyoverflow:
! yyerror("yacc stack overflow");
yyaccept:
! return (0);
}
---- 2349,2356 ----
+--- 2351,2358 ----
goto yyloop;
yyoverflow:
! yyerror("Out of memory for yacc stack");
subname : WORD { char *name = SvPV(((SVOP*)$1)->op_sv, na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ { CvUNIQUE_on(compcv); subline = -subline; }
$$ = $1; }
;
Unmatched right bracket at (re_eval 1) line 1, at end of line
syntax error at (re_eval 1) line 1, near ""{"}"
Compilation failed in regexp at - line 1.
+########
+BEGIN { @ARGV = qw(a b c) }
+BEGIN { print "argv <@ARGV>\nbegin <",shift,">\n" }
+END { print "end <",shift,">\nargv <@ARGV>\n" }
+INIT { print "init <",shift,">\n" }
+EXPECT
+argv <a b c>
+begin <a>
+init <b>
+end <c>
+argv <>
#include "perl.h"
static void
-dep()
+dep(void)
{
deprecate("\"do\" to call subroutines");
}
};
void
-yydestruct(ptr)
-void* ptr;
+yydestruct(void *ptr)
{
struct ysv* ysave = (struct ysv*)ptr;
if (ysave->yyss) Safefree(ysave->yyss);
}
int
-yyparse()
+yyparse(void)
{
register int yym, yyn, yystate;
register short *yyssp;
int retval = 0;
#if YYDEBUG
register char *yys;
+#ifndef __cplusplus
# ifndef getenv
extern char *getenv();
# endif
#endif
+#endif
struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
SAVEDESTRUCTOR(yydestruct, ysave);
{ char *name = SvPV(((SVOP*)yyvsp[0].opval)->op_sv, na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ { CvUNIQUE_on(compcv); subline = -subline; }
yyval.opval = yyvsp[0].opval; }
break;
case 57: