add the 'y' and 'Y' options to ps, and add the 'iac' keyword. The 'y'
[dragonfly.git] / contrib / perl5 / perly_c.diff
1 *** perly.c.old Wed Jan 06 20:03:41 1999
2 --- perly.c     Wed Jan 06 18:51:20 1999
3 ***************
4 *** 7,86 ****
5   #include "perl.h"
6   
7   static void
8   dep(void)
9   {
10       deprecate("\"do\" to call subroutines");
11   }
12   
13   #line 30 "perly.y"
14 - #ifndef OEMVS
15 - #line 33 "perly.y"
16 - typedef union {
17 -     I32       ival;
18 -     char *pval;
19 -     OP *opval;
20 -     GV *gvval;
21 - } YYSTYPE;
22 - #line 41 "perly.y"
23 - #endif /* OEMVS */
24 - #line 27 "y.tab.c"
25 - #define WORD 257
26 - #define METHOD 258
27 - #define FUNCMETH 259
28 - #define THING 260
29 - #define PMFUNC 261
30 - #define PRIVATEREF 262
31 - #define FUNC0SUB 263
32 - #define UNIOPSUB 264
33 - #define LSTOPSUB 265
34 - #define LABEL 266
35 - #define FORMAT 267
36 - #define SUB 268
37 - #define ANONSUB 269
38 - #define PACKAGE 270
39 - #define USE 271
40 - #define WHILE 272
41 - #define UNTIL 273
42 - #define IF 274
43 - #define UNLESS 275
44 - #define ELSE 276
45 - #define ELSIF 277
46 - #define CONTINUE 278
47 - #define FOR 279
48 - #define LOOPEX 280
49 - #define DOTDOT 281
50 - #define FUNC0 282
51 - #define FUNC1 283
52 - #define FUNC 284
53 - #define UNIOP 285
54 - #define LSTOP 286
55 - #define RELOP 287
56 - #define EQOP 288
57 - #define MULOP 289
58 - #define ADDOP 290
59 - #define DOLSHARP 291
60 - #define DO 292
61 - #define HASHBRACK 293
62 - #define NOAMP 294
63 - #define LOCAL 295
64 - #define MY 296
65 - #define OROP 297
66 - #define ANDOP 298
67 - #define NOTOP 299
68 - #define ASSIGNOP 300
69 - #define OROR 301
70 - #define ANDAND 302
71 - #define BITOROP 303
72 - #define BITANDOP 304
73 - #define SHIFTOP 305
74 - #define MATCHOP 306
75 - #define UMINUS 307
76 - #define REFGEN 308
77 - #define POWOP 309
78 - #define PREINC 310
79 - #define PREDEC 311
80 - #define POSTINC 312
81 - #define POSTDEC 313
82 - #define ARROW 314
83   #define YYERRCODE 256
84   short yylhs[] = {                                        -1,
85 --- 7,26 ----
86   #include "perl.h"
87   
88 + #ifdef PERL_OBJECT
89   static void
90 + Dep(CPerlObj *pPerl)
91 + {
92 +     pPerl->deprecate("\"do\" to call subroutines");
93 + }
94 + #define dep() Dep(this)
95 + #else
96 + static void
97   dep(void)
98   {
99       deprecate("\"do\" to call subroutines");
100   }
101 + #endif
102   
103   #line 30 "perly.y"
104   #define YYERRCODE 256
105   short yylhs[] = {                                        -1,
106 ***************
107 *** 1337,1340 ****
108 --- 1277,1281 ----
109   #endif
110   #endif
111 + #ifndef PERL_OBJECT
112   int yydebug;
113   int yynerrs;
114 ***************
115 *** 1345,1365 ****
116   YYSTYPE yyval;
117   YYSTYPE yylval;
118 ! short yyss[YYSTACKSIZE];
119 ! YYSTYPE yyvs[YYSTACKSIZE];
120 ! #define yystacksize YYSTACKSIZE
121   #line 643 "perly.y"
122    /* PROGRAM */
123 ! #line 1353 "y.tab.c"
124   #define YYABORT goto yyabort
125   #define YYACCEPT goto yyaccept
126   #define YYERROR goto yyerrlab
127   int
128 ! yyparse()
129   {
130       register int yym, yyn, yystate;
131   #if YYDEBUG
132       register char *yys;
133       extern char *getenv();
134   
135       if (yys = getenv("YYDEBUG"))
136       {
137 --- 1286,1351 ----
138   YYSTYPE yyval;
139   YYSTYPE yylval;
140 ! #endif
141   #line 643 "perly.y"
142    /* PROGRAM */
143 ! #line 1353 "perly.c"
144   #define YYABORT goto yyabort
145   #define YYACCEPT goto yyaccept
146   #define YYERROR goto yyerrlab
147
148 + struct ysv {
149 +     short* yyss;
150 +     YYSTYPE* yyvs;
151 +     int oldyydebug;
152 +     int oldyynerrs;
153 +     int oldyyerrflag;
154 +     int oldyychar;
155 +     YYSTYPE oldyyval;
156 +     YYSTYPE oldyylval;
157 + };
158
159 + void
160 + yydestruct(void *ptr)
161 + {
162 +     struct ysv* ysave = (struct ysv*)ptr;
163 +     if (ysave->yyss) Safefree(ysave->yyss);
164 +     if (ysave->yyvs) Safefree(ysave->yyvs);
165 +     yydebug   = ysave->oldyydebug;
166 +     yynerrs   = ysave->oldyynerrs;
167 +     yyerrflag = ysave->oldyyerrflag;
168 +     yychar    = ysave->oldyychar;
169 +     yyval     = ysave->oldyyval;
170 +     yylval    = ysave->oldyylval;
171 +     Safefree(ysave);
172 + }
173
174   int
175 ! yyparse(void)
176   {
177       register int yym, yyn, yystate;
178 +     register short *yyssp;
179 +     register YYSTYPE *yyvsp;
180 +     short* yyss;
181 +     YYSTYPE* yyvs;
182 +     unsigned yystacksize = YYSTACKSIZE;
183 +     int retval = 0;
184   #if YYDEBUG
185       register char *yys;
186 + #ifndef __cplusplus
187       extern char *getenv();
188 + #endif
189 + #endif
190
191 +     struct ysv *ysave;
192 +     New(73, ysave, 1, struct ysv);
193 +     SAVEDESTRUCTOR(yydestruct, ysave);
194 +     ysave->oldyydebug = yydebug;
195 +     ysave->oldyynerrs = yynerrs;
196 +     ysave->oldyyerrflag       = yyerrflag;
197 +     ysave->oldyychar  = yychar;
198 +     ysave->oldyyval   = yyval;
199 +     ysave->oldyylval  = yylval;
200   
201 + #if YYDEBUG
202       if (yys = getenv("YYDEBUG"))
203       {
204 ***************
205 *** 1374,1377 ****
206 --- 1360,1373 ----
207       yychar = (-1);
208   
209 +     /*
210 +     ** Initialize private stacks (yyparse may be called from an action)
211 +     */
212 +     New(73, yyss, yystacksize, short);
213 +     New(73, yyvs, yystacksize, YYSTYPE);
214 +     ysave->yyss = yyss;
215 +     ysave->yyvs = yyvs;
216 +     if (!yyvs || !yyss)
217 +       goto yyoverflow;
218
219       yyssp = yyss;
220       yyvsp = yyvs;
221 ***************
222 *** 1389,1393 ****
223               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
224               if (!yys) yys = "illegal-symbol";
225 !             printf("yydebug: state %d, reading %d (%s)\n", yystate,
226                       yychar, yys);
227           }
228 --- 1385,1389 ----
229               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
230               if (!yys) yys = "illegal-symbol";
231 !             PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate,
232                       yychar, yys);
233           }
234 ***************
235 *** 1399,1408 ****
236   #if YYDEBUG
237           if (yydebug)
238 !             printf("yydebug: state %d, shifting to state %d\n",
239                       yystate, yytable[yyn]);
240   #endif
241           if (yyssp >= yyss + yystacksize - 1)
242           {
243 !             goto yyoverflow;
244           }
245           *++yyssp = yystate = yytable[yyn];
246 --- 1395,1418 ----
247   #if YYDEBUG
248           if (yydebug)
249 !             PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n",
250                       yystate, yytable[yyn]);
251   #endif
252           if (yyssp >= yyss + yystacksize - 1)
253           {
254 !           /*
255 !           ** reallocate and recover.  Note that pointers
256 !           ** have to be reset, or bad things will happen
257 !           */
258 !           int yyps_index = (yyssp - yyss);
259 !           int yypv_index = (yyvsp - yyvs);
260 !           yystacksize += YYSTACKSIZE;
261 !           ysave->yyvs = yyvs =
262 !               (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
263 !           ysave->yyss = yyss =
264 !               (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
265 !           if (!yyvs || !yyss)
266 !               goto yyoverflow;
267 !           yyssp = yyss + yyps_index;
268 !           yyvsp = yyvs + yypv_index;
269           }
270           *++yyssp = yystate = yytable[yyn];
271 ***************
272 *** 1440,1449 ****
273   #if YYDEBUG
274                   if (yydebug)
275 !                     printf("yydebug: state %d, error recovery shifting\
276 !  to state %d\n", *yyssp, yytable[yyn]);
277   #endif
278                   if (yyssp >= yyss + yystacksize - 1)
279                   {
280 !                     goto yyoverflow;
281                   }
282                   *++yyssp = yystate = yytable[yyn];
283 --- 1450,1474 ----
284   #if YYDEBUG
285                   if (yydebug)
286 !                     PerlIO_printf(Perl_debug_log,
287 !                    "yydebug: state %d, error recovery shifting to state %d\n",
288 !                    *yyssp, yytable[yyn]);
289   #endif
290                   if (yyssp >= yyss + yystacksize - 1)
291                   {
292 !                   /*
293 !                   ** reallocate and recover.  Note that pointers
294 !                   ** have to be reset, or bad things will happen
295 !                   */
296 !                   int yyps_index = (yyssp - yyss);
297 !                   int yypv_index = (yyvsp - yyvs);
298 !                   yystacksize += YYSTACKSIZE;
299 !                   ysave->yyvs = yyvs = (YYSTYPE*)PerlMem_realloc((char*)yyvs,
300 !                       yystacksize * sizeof(YYSTYPE));
301 !                   ysave->yyss = yyss = (short*)PerlMem_realloc((char*)yyss,
302 !                       yystacksize * sizeof(short));
303 !                   if (!yyvs || !yyss)
304 !                       goto yyoverflow;
305 !                   yyssp = yyss + yyps_index;
306 !                   yyvsp = yyvs + yypv_index;
307                   }
308                   *++yyssp = yystate = yytable[yyn];
309 ***************
310 *** 1455,1460 ****
311   #if YYDEBUG
312                   if (yydebug)
313 !                     printf("yydebug: error recovery discarding state %d\n",
314 !                             *yyssp);
315   #endif
316                   if (yyssp <= yyss) goto yyabort;
317 --- 1480,1486 ----
318   #if YYDEBUG
319                   if (yydebug)
320 !                     PerlIO_printf(Perl_debug_log,
321 !                       "yydebug: error recovery discarding state %d\n",
322 !                       *yyssp);
323   #endif
324                   if (yyssp <= yyss) goto yyabort;
325 ***************
326 *** 1473,1478 ****
327               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
328               if (!yys) yys = "illegal-symbol";
329 !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
330 !                     yystate, yychar, yys);
331           }
332   #endif
333 --- 1499,1505 ----
334               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
335               if (!yys) yys = "illegal-symbol";
336 !             PerlIO_printf(Perl_debug_log,
337 !               "yydebug: state %d, error recovery discards token %d (%s)\n",
338 !               yystate, yychar, yys);
339           }
340   #endif
341 ***************
342 *** 1483,1487 ****
343   #if YYDEBUG
344       if (yydebug)
345 !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
346                   yystate, yyn, yyrule[yyn]);
347   #endif
348 --- 1510,1514 ----
349   #if YYDEBUG
350       if (yydebug)
351 !         PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n",
352                   yystate, yyn, yyrule[yyn]);
353   #endif
354 ***************
355 *** 2267,2271 ****
356   { yyval.opval = yyvsp[0].opval; }
357   break;
358 ! #line 2270 "y.tab.c"
359       }
360       yyssp -= yym;
361 --- 2294,2298 ----
362   { yyval.opval = yyvsp[0].opval; }
363   break;
364 ! #line 2270 "perly.c"
365       }
366       yyssp -= yym;
367 ***************
368 *** 2277,2282 ****
369   #if YYDEBUG
370           if (yydebug)
371 !             printf("yydebug: after reduction, shifting from state 0 to\
372 !  state %d\n", YYFINAL);
373   #endif
374           yystate = YYFINAL;
375 --- 2304,2310 ----
376   #if YYDEBUG
377           if (yydebug)
378 !             PerlIO_printf(Perl_debug_log,
379 !               "yydebug: after reduction, shifting from state 0 to state %d\n",
380 !               YYFINAL);
381   #endif
382           yystate = YYFINAL;
383 ***************
384 *** 2292,2296 ****
385                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
386                   if (!yys) yys = "illegal-symbol";
387 !                 printf("yydebug: state %d, reading %d (%s)\n",
388                           YYFINAL, yychar, yys);
389               }
390 --- 2320,2324 ----
391                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
392                   if (!yys) yys = "illegal-symbol";
393 !                 PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n",
394                           YYFINAL, yychar, yys);
395               }
396 ***************
397 *** 2307,2316 ****
398   #if YYDEBUG
399       if (yydebug)
400 !         printf("yydebug: after reduction, shifting from state %d \
401 ! to state %d\n", *yyssp, yystate);
402   #endif
403       if (yyssp >= yyss + yystacksize - 1)
404       {
405 !         goto yyoverflow;
406       }
407       *++yyssp = yystate;
408 --- 2335,2359 ----
409   #if YYDEBUG
410       if (yydebug)
411 !         PerlIO_printf(Perl_debug_log,
412 !           "yydebug: after reduction, shifting from state %d to state %d\n",
413 !           *yyssp, yystate);
414   #endif
415       if (yyssp >= yyss + yystacksize - 1)
416       {
417 !       /*
418 !       ** reallocate and recover.  Note that pointers
419 !       ** have to be reset, or bad things will happen
420 !       */
421 !       int yyps_index = (yyssp - yyss);
422 !       int yypv_index = (yyvsp - yyvs);
423 !       yystacksize += YYSTACKSIZE;
424 !       ysave->yyvs = yyvs =
425 !           (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
426 !       ysave->yyss = yyss =
427 !           (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short));
428 !       if (!yyvs || !yyss)
429 !           goto yyoverflow;
430 !       yyssp = yyss + yyps_index;
431 !       yyvsp = yyvs + yypv_index;
432       }
433       *++yyssp = yystate;
434 ***************
435 *** 2318,2325 ****
436       goto yyloop;
437   yyoverflow:
438 !     yyerror("yacc stack overflow");
439   yyabort:
440 !     return (1);
441   yyaccept:
442 !     return (0);
443   }
444 --- 2361,2368 ----
445       goto yyloop;
446   yyoverflow:
447 !     yyerror("Out of memory for yacc stack");
448   yyabort:
449 !     retval = 1;
450   yyaccept:
451 !     return retval;
452   }