Re: Exceptions in IPC::Open2
[p5sagit/p5-mst-13.2.git] / byterun.c
1 /*
2  *      Copyright (c) 1996-1998 Malcolm Beattie
3  *
4  *      You may distribute under the terms of either the GNU General Public
5  *      License or the Artistic License, as specified in the README file.
6  *
7  */
8 /*
9  * This file is autogenerated from bytecode.pl. Changes made here will be lost.
10  */
11
12 #include "EXTERN.h"
13 #include "perl.h"
14
15 void *
16 bset_obj_store(void *obj, I32 ix)
17 {
18     if (ix > obj_list_fill) {
19         if (obj_list_fill == -1)
20             New(666, obj_list, ix + 1, void*);
21         else
22             Renew(obj_list, ix + 1, void*);
23         obj_list_fill = ix;
24     }
25     obj_list[ix] = obj;
26     return obj;
27 }
28
29 #ifdef INDIRECT_BGET_MACROS
30 void byterun(struct bytestream bs)
31 #else
32 void byterun(PerlIO *fp)
33 #endif /* INDIRECT_BGET_MACROS */
34 {
35     dTHR;
36     int insn;
37     while ((insn = BGET_FGETC()) != EOF) {
38         switch (insn) {
39           case INSN_COMMENT:            /* 35 */
40             {
41                 comment_t arg;
42                 BGET_comment_t(arg);
43                 arg = arg;
44                 break;
45             }
46           case INSN_NOP:                /* 10 */
47             {
48                 break;
49             }
50           case INSN_RET:                /* 0 */
51             {
52                 BSET_ret(none);
53                 break;
54             }
55           case INSN_LDSV:               /* 1 */
56             {
57                 svindex arg;
58                 BGET_svindex(arg);
59                 sv = arg;
60                 break;
61             }
62           case INSN_LDOP:               /* 2 */
63             {
64                 opindex arg;
65                 BGET_opindex(arg);
66                 op = arg;
67                 break;
68             }
69           case INSN_STSV:               /* 3 */
70             {
71                 U32 arg;
72                 BGET_U32(arg);
73                 BSET_OBJ_STORE(sv, arg);
74                 break;
75             }
76           case INSN_STOP:               /* 4 */
77             {
78                 U32 arg;
79                 BGET_U32(arg);
80                 BSET_OBJ_STORE(op, arg);
81                 break;
82             }
83           case INSN_LDSPECSV:           /* 5 */
84             {
85                 U8 arg;
86                 BGET_U8(arg);
87                 BSET_ldspecsv(sv, arg);
88                 break;
89             }
90           case INSN_NEWSV:              /* 6 */
91             {
92                 U8 arg;
93                 BGET_U8(arg);
94                 BSET_newsv(sv, arg);
95                 break;
96             }
97           case INSN_NEWOP:              /* 7 */
98             {
99                 U8 arg;
100                 BGET_U8(arg);
101                 BSET_newop(op, arg);
102                 break;
103             }
104           case INSN_NEWOPN:             /* 8 */
105             {
106                 U8 arg;
107                 BGET_U8(arg);
108                 BSET_newopn(op, arg);
109                 break;
110             }
111           case INSN_NEWPV:              /* 9 */
112             {
113                 PV arg;
114                 BGET_PV(arg);
115                 break;
116             }
117           case INSN_PV_CUR:             /* 11 */
118             {
119                 STRLEN arg;
120                 BGET_U32(arg);
121                 pv.xpv_cur = arg;
122                 break;
123             }
124           case INSN_PV_FREE:            /* 12 */
125             {
126                 BSET_pv_free(pv);
127                 break;
128             }
129           case INSN_SV_UPGRADE:         /* 13 */
130             {
131                 char arg;
132                 BGET_U8(arg);
133                 BSET_sv_upgrade(sv, arg);
134                 break;
135             }
136           case INSN_SV_REFCNT:          /* 14 */
137             {
138                 U32 arg;
139                 BGET_U32(arg);
140                 SvREFCNT(sv) = arg;
141                 break;
142             }
143           case INSN_SV_REFCNT_ADD:              /* 15 */
144             {
145                 I32 arg;
146                 BGET_I32(arg);
147                 BSET_sv_refcnt_add(SvREFCNT(sv), arg);
148                 break;
149             }
150           case INSN_SV_FLAGS:           /* 16 */
151             {
152                 U32 arg;
153                 BGET_U32(arg);
154                 SvFLAGS(sv) = arg;
155                 break;
156             }
157           case INSN_XRV:                /* 17 */
158             {
159                 svindex arg;
160                 BGET_svindex(arg);
161                 SvRV(sv) = arg;
162                 break;
163             }
164           case INSN_XPV:                /* 18 */
165             {
166                 BSET_xpv(sv);
167                 break;
168             }
169           case INSN_XIV32:              /* 19 */
170             {
171                 I32 arg;
172                 BGET_I32(arg);
173                 SvIVX(sv) = arg;
174                 break;
175             }
176           case INSN_XIV64:              /* 20 */
177             {
178                 IV64 arg;
179                 BGET_IV64(arg);
180                 SvIVX(sv) = arg;
181                 break;
182             }
183           case INSN_XNV:                /* 21 */
184             {
185                 double arg;
186                 BGET_double(arg);
187                 SvNVX(sv) = arg;
188                 break;
189             }
190           case INSN_XLV_TARGOFF:                /* 22 */
191             {
192                 STRLEN arg;
193                 BGET_U32(arg);
194                 LvTARGOFF(sv) = arg;
195                 break;
196             }
197           case INSN_XLV_TARGLEN:                /* 23 */
198             {
199                 STRLEN arg;
200                 BGET_U32(arg);
201                 LvTARGLEN(sv) = arg;
202                 break;
203             }
204           case INSN_XLV_TARG:           /* 24 */
205             {
206                 svindex arg;
207                 BGET_svindex(arg);
208                 LvTARG(sv) = arg;
209                 break;
210             }
211           case INSN_XLV_TYPE:           /* 25 */
212             {
213                 char arg;
214                 BGET_U8(arg);
215                 LvTYPE(sv) = arg;
216                 break;
217             }
218           case INSN_XBM_USEFUL:         /* 26 */
219             {
220                 I32 arg;
221                 BGET_I32(arg);
222                 BmUSEFUL(sv) = arg;
223                 break;
224             }
225           case INSN_XBM_PREVIOUS:               /* 27 */
226             {
227                 U16 arg;
228                 BGET_U16(arg);
229                 BmPREVIOUS(sv) = arg;
230                 break;
231             }
232           case INSN_XBM_RARE:           /* 28 */
233             {
234                 U8 arg;
235                 BGET_U8(arg);
236                 BmRARE(sv) = arg;
237                 break;
238             }
239           case INSN_XFM_LINES:          /* 29 */
240             {
241                 I32 arg;
242                 BGET_I32(arg);
243                 FmLINES(sv) = arg;
244                 break;
245             }
246           case INSN_XIO_LINES:          /* 30 */
247             {
248                 long arg;
249                 BGET_I32(arg);
250                 IoLINES(sv) = arg;
251                 break;
252             }
253           case INSN_XIO_PAGE:           /* 31 */
254             {
255                 long arg;
256                 BGET_I32(arg);
257                 IoPAGE(sv) = arg;
258                 break;
259             }
260           case INSN_XIO_PAGE_LEN:               /* 32 */
261             {
262                 long arg;
263                 BGET_I32(arg);
264                 IoPAGE_LEN(sv) = arg;
265                 break;
266             }
267           case INSN_XIO_LINES_LEFT:             /* 33 */
268             {
269                 long arg;
270                 BGET_I32(arg);
271                 IoLINES_LEFT(sv) = arg;
272                 break;
273             }
274           case INSN_XIO_TOP_NAME:               /* 34 */
275             {
276                 pvcontents arg;
277                 BGET_pvcontents(arg);
278                 IoTOP_NAME(sv) = arg;
279                 break;
280             }
281           case INSN_XIO_TOP_GV:         /* 36 */
282             {
283                 svindex arg;
284                 BGET_svindex(arg);
285                 *(SV**)&IoTOP_GV(sv) = arg;
286                 break;
287             }
288           case INSN_XIO_FMT_NAME:               /* 37 */
289             {
290                 pvcontents arg;
291                 BGET_pvcontents(arg);
292                 IoFMT_NAME(sv) = arg;
293                 break;
294             }
295           case INSN_XIO_FMT_GV:         /* 38 */
296             {
297                 svindex arg;
298                 BGET_svindex(arg);
299                 *(SV**)&IoFMT_GV(sv) = arg;
300                 break;
301             }
302           case INSN_XIO_BOTTOM_NAME:            /* 39 */
303             {
304                 pvcontents arg;
305                 BGET_pvcontents(arg);
306                 IoBOTTOM_NAME(sv) = arg;
307                 break;
308             }
309           case INSN_XIO_BOTTOM_GV:              /* 40 */
310             {
311                 svindex arg;
312                 BGET_svindex(arg);
313                 *(SV**)&IoBOTTOM_GV(sv) = arg;
314                 break;
315             }
316           case INSN_XIO_SUBPROCESS:             /* 41 */
317             {
318                 short arg;
319                 BGET_U16(arg);
320                 IoSUBPROCESS(sv) = arg;
321                 break;
322             }
323           case INSN_XIO_TYPE:           /* 42 */
324             {
325                 char arg;
326                 BGET_U8(arg);
327                 IoTYPE(sv) = arg;
328                 break;
329             }
330           case INSN_XIO_FLAGS:          /* 43 */
331             {
332                 char arg;
333                 BGET_U8(arg);
334                 IoFLAGS(sv) = arg;
335                 break;
336             }
337           case INSN_XCV_STASH:          /* 44 */
338             {
339                 svindex arg;
340                 BGET_svindex(arg);
341                 *(SV**)&CvSTASH(sv) = arg;
342                 break;
343             }
344           case INSN_XCV_START:          /* 45 */
345             {
346                 opindex arg;
347                 BGET_opindex(arg);
348                 CvSTART(sv) = arg;
349                 break;
350             }
351           case INSN_XCV_ROOT:           /* 46 */
352             {
353                 opindex arg;
354                 BGET_opindex(arg);
355                 CvROOT(sv) = arg;
356                 break;
357             }
358           case INSN_XCV_GV:             /* 47 */
359             {
360                 svindex arg;
361                 BGET_svindex(arg);
362                 *(SV**)&CvGV(sv) = arg;
363                 break;
364             }
365           case INSN_XCV_FILEGV:         /* 48 */
366             {
367                 svindex arg;
368                 BGET_svindex(arg);
369                 *(SV**)&CvFILEGV(sv) = arg;
370                 break;
371             }
372           case INSN_XCV_DEPTH:          /* 49 */
373             {
374                 long arg;
375                 BGET_I32(arg);
376                 CvDEPTH(sv) = arg;
377                 break;
378             }
379           case INSN_XCV_PADLIST:                /* 50 */
380             {
381                 svindex arg;
382                 BGET_svindex(arg);
383                 *(SV**)&CvPADLIST(sv) = arg;
384                 break;
385             }
386           case INSN_XCV_OUTSIDE:                /* 51 */
387             {
388                 svindex arg;
389                 BGET_svindex(arg);
390                 *(SV**)&CvOUTSIDE(sv) = arg;
391                 break;
392             }
393           case INSN_XCV_FLAGS:          /* 52 */
394             {
395                 U8 arg;
396                 BGET_U8(arg);
397                 CvFLAGS(sv) = arg;
398                 break;
399             }
400           case INSN_AV_EXTEND:          /* 53 */
401             {
402                 SSize_t arg;
403                 BGET_I32(arg);
404                 BSET_av_extend(sv, arg);
405                 break;
406             }
407           case INSN_AV_PUSH:            /* 54 */
408             {
409                 svindex arg;
410                 BGET_svindex(arg);
411                 BSET_av_push(sv, arg);
412                 break;
413             }
414           case INSN_XAV_FILL:           /* 55 */
415             {
416                 SSize_t arg;
417                 BGET_I32(arg);
418                 AvFILLp(sv) = arg;
419                 break;
420             }
421           case INSN_XAV_MAX:            /* 56 */
422             {
423                 SSize_t arg;
424                 BGET_I32(arg);
425                 AvMAX(sv) = arg;
426                 break;
427             }
428           case INSN_XAV_FLAGS:          /* 57 */
429             {
430                 U8 arg;
431                 BGET_U8(arg);
432                 AvFLAGS(sv) = arg;
433                 break;
434             }
435           case INSN_XHV_RITER:          /* 58 */
436             {
437                 I32 arg;
438                 BGET_I32(arg);
439                 HvRITER(sv) = arg;
440                 break;
441             }
442           case INSN_XHV_NAME:           /* 59 */
443             {
444                 pvcontents arg;
445                 BGET_pvcontents(arg);
446                 HvNAME(sv) = arg;
447                 break;
448             }
449           case INSN_HV_STORE:           /* 60 */
450             {
451                 svindex arg;
452                 BGET_svindex(arg);
453                 BSET_hv_store(sv, arg);
454                 break;
455             }
456           case INSN_SV_MAGIC:           /* 61 */
457             {
458                 char arg;
459                 BGET_U8(arg);
460                 BSET_sv_magic(sv, arg);
461                 break;
462             }
463           case INSN_MG_OBJ:             /* 62 */
464             {
465                 svindex arg;
466                 BGET_svindex(arg);
467                 SvMAGIC(sv)->mg_obj = arg;
468                 break;
469             }
470           case INSN_MG_PRIVATE:         /* 63 */
471             {
472                 U16 arg;
473                 BGET_U16(arg);
474                 SvMAGIC(sv)->mg_private = arg;
475                 break;
476             }
477           case INSN_MG_FLAGS:           /* 64 */
478             {
479                 U8 arg;
480                 BGET_U8(arg);
481                 SvMAGIC(sv)->mg_flags = arg;
482                 break;
483             }
484           case INSN_MG_PV:              /* 65 */
485             {
486                 pvcontents arg;
487                 BGET_pvcontents(arg);
488                 BSET_mg_pv(SvMAGIC(sv), arg);
489                 break;
490             }
491           case INSN_XMG_STASH:          /* 66 */
492             {
493                 svindex arg;
494                 BGET_svindex(arg);
495                 *(SV**)&SvSTASH(sv) = arg;
496                 break;
497             }
498           case INSN_GV_FETCHPV:         /* 67 */
499             {
500                 strconst arg;
501                 BGET_strconst(arg);
502                 BSET_gv_fetchpv(sv, arg);
503                 break;
504             }
505           case INSN_GV_STASHPV:         /* 68 */
506             {
507                 strconst arg;
508                 BGET_strconst(arg);
509                 BSET_gv_stashpv(sv, arg);
510                 break;
511             }
512           case INSN_GP_SV:              /* 69 */
513             {
514                 svindex arg;
515                 BGET_svindex(arg);
516                 GvSV(sv) = arg;
517                 break;
518             }
519           case INSN_GP_REFCNT:          /* 70 */
520             {
521                 U32 arg;
522                 BGET_U32(arg);
523                 GvREFCNT(sv) = arg;
524                 break;
525             }
526           case INSN_GP_REFCNT_ADD:              /* 71 */
527             {
528                 I32 arg;
529                 BGET_I32(arg);
530                 BSET_gp_refcnt_add(GvREFCNT(sv), arg);
531                 break;
532             }
533           case INSN_GP_AV:              /* 72 */
534             {
535                 svindex arg;
536                 BGET_svindex(arg);
537                 *(SV**)&GvAV(sv) = arg;
538                 break;
539             }
540           case INSN_GP_HV:              /* 73 */
541             {
542                 svindex arg;
543                 BGET_svindex(arg);
544                 *(SV**)&GvHV(sv) = arg;
545                 break;
546             }
547           case INSN_GP_CV:              /* 74 */
548             {
549                 svindex arg;
550                 BGET_svindex(arg);
551                 *(SV**)&GvCV(sv) = arg;
552                 break;
553             }
554           case INSN_GP_FILEGV:          /* 75 */
555             {
556                 svindex arg;
557                 BGET_svindex(arg);
558                 *(SV**)&GvFILEGV(sv) = arg;
559                 break;
560             }
561           case INSN_GP_IO:              /* 76 */
562             {
563                 svindex arg;
564                 BGET_svindex(arg);
565                 *(SV**)&GvIOp(sv) = arg;
566                 break;
567             }
568           case INSN_GP_FORM:            /* 77 */
569             {
570                 svindex arg;
571                 BGET_svindex(arg);
572                 *(SV**)&GvFORM(sv) = arg;
573                 break;
574             }
575           case INSN_GP_CVGEN:           /* 78 */
576             {
577                 U32 arg;
578                 BGET_U32(arg);
579                 GvCVGEN(sv) = arg;
580                 break;
581             }
582           case INSN_GP_LINE:            /* 79 */
583             {
584                 line_t arg;
585                 BGET_U16(arg);
586                 GvLINE(sv) = arg;
587                 break;
588             }
589           case INSN_GP_SHARE:           /* 80 */
590             {
591                 svindex arg;
592                 BGET_svindex(arg);
593                 BSET_gp_share(sv, arg);
594                 break;
595             }
596           case INSN_XGV_FLAGS:          /* 81 */
597             {
598                 U8 arg;
599                 BGET_U8(arg);
600                 GvFLAGS(sv) = arg;
601                 break;
602             }
603           case INSN_OP_NEXT:            /* 82 */
604             {
605                 opindex arg;
606                 BGET_opindex(arg);
607                 op->op_next = arg;
608                 break;
609             }
610           case INSN_OP_SIBLING:         /* 83 */
611             {
612                 opindex arg;
613                 BGET_opindex(arg);
614                 op->op_sibling = arg;
615                 break;
616             }
617           case INSN_OP_PPADDR:          /* 84 */
618             {
619                 strconst arg;
620                 BGET_strconst(arg);
621                 BSET_op_ppaddr(op->op_ppaddr, arg);
622                 break;
623             }
624           case INSN_OP_TARG:            /* 85 */
625             {
626                 PADOFFSET arg;
627                 BGET_U32(arg);
628                 op->op_targ = arg;
629                 break;
630             }
631           case INSN_OP_TYPE:            /* 86 */
632             {
633                 OPCODE arg;
634                 BGET_U16(arg);
635                 BSET_op_type(op, arg);
636                 break;
637             }
638           case INSN_OP_SEQ:             /* 87 */
639             {
640                 U16 arg;
641                 BGET_U16(arg);
642                 op->op_seq = arg;
643                 break;
644             }
645           case INSN_OP_FLAGS:           /* 88 */
646             {
647                 U8 arg;
648                 BGET_U8(arg);
649                 op->op_flags = arg;
650                 break;
651             }
652           case INSN_OP_PRIVATE:         /* 89 */
653             {
654                 U8 arg;
655                 BGET_U8(arg);
656                 op->op_private = arg;
657                 break;
658             }
659           case INSN_OP_FIRST:           /* 90 */
660             {
661                 opindex arg;
662                 BGET_opindex(arg);
663                 cUNOP->op_first = arg;
664                 break;
665             }
666           case INSN_OP_LAST:            /* 91 */
667             {
668                 opindex arg;
669                 BGET_opindex(arg);
670                 cBINOP->op_last = arg;
671                 break;
672             }
673           case INSN_OP_OTHER:           /* 92 */
674             {
675                 opindex arg;
676                 BGET_opindex(arg);
677                 cLOGOP->op_other = arg;
678                 break;
679             }
680           case INSN_OP_TRUE:            /* 93 */
681             {
682                 opindex arg;
683                 BGET_opindex(arg);
684                 cCONDOP->op_true = arg;
685                 break;
686             }
687           case INSN_OP_FALSE:           /* 94 */
688             {
689                 opindex arg;
690                 BGET_opindex(arg);
691                 cCONDOP->op_false = arg;
692                 break;
693             }
694           case INSN_OP_CHILDREN:                /* 95 */
695             {
696                 U32 arg;
697                 BGET_U32(arg);
698                 cLISTOP->op_children = arg;
699                 break;
700             }
701           case INSN_OP_PMREPLROOT:              /* 96 */
702             {
703                 opindex arg;
704                 BGET_opindex(arg);
705                 cPMOP->op_pmreplroot = arg;
706                 break;
707             }
708           case INSN_OP_PMREPLROOTGV:            /* 97 */
709             {
710                 svindex arg;
711                 BGET_svindex(arg);
712                 *(SV**)&cPMOP->op_pmreplroot = arg;
713                 break;
714             }
715           case INSN_OP_PMREPLSTART:             /* 98 */
716             {
717                 opindex arg;
718                 BGET_opindex(arg);
719                 cPMOP->op_pmreplstart = arg;
720                 break;
721             }
722           case INSN_OP_PMNEXT:          /* 99 */
723             {
724                 opindex arg;
725                 BGET_opindex(arg);
726                 *(OP**)&cPMOP->op_pmnext = arg;
727                 break;
728             }
729           case INSN_PREGCOMP:           /* 100 */
730             {
731                 pvcontents arg;
732                 BGET_pvcontents(arg);
733                 BSET_pregcomp(op, arg);
734                 break;
735             }
736           case INSN_OP_PMFLAGS:         /* 101 */
737             {
738                 U16 arg;
739                 BGET_U16(arg);
740                 cPMOP->op_pmflags = arg;
741                 break;
742             }
743           case INSN_OP_PMPERMFLAGS:             /* 102 */
744             {
745                 U16 arg;
746                 BGET_U16(arg);
747                 cPMOP->op_pmpermflags = arg;
748                 break;
749             }
750           case INSN_OP_SV:              /* 103 */
751             {
752                 svindex arg;
753                 BGET_svindex(arg);
754                 cSVOP->op_sv = arg;
755                 break;
756             }
757           case INSN_OP_GV:              /* 104 */
758             {
759                 svindex arg;
760                 BGET_svindex(arg);
761                 *(SV**)&cGVOP->op_gv = arg;
762                 break;
763             }
764           case INSN_OP_PV:              /* 105 */
765             {
766                 pvcontents arg;
767                 BGET_pvcontents(arg);
768                 cPVOP->op_pv = arg;
769                 break;
770             }
771           case INSN_OP_PV_TR:           /* 106 */
772             {
773                 op_tr_array arg;
774                 BGET_op_tr_array(arg);
775                 cPVOP->op_pv = arg;
776                 break;
777             }
778           case INSN_OP_REDOOP:          /* 107 */
779             {
780                 opindex arg;
781                 BGET_opindex(arg);
782                 cLOOP->op_redoop = arg;
783                 break;
784             }
785           case INSN_OP_NEXTOP:          /* 108 */
786             {
787                 opindex arg;
788                 BGET_opindex(arg);
789                 cLOOP->op_nextop = arg;
790                 break;
791             }
792           case INSN_OP_LASTOP:          /* 109 */
793             {
794                 opindex arg;
795                 BGET_opindex(arg);
796                 cLOOP->op_lastop = arg;
797                 break;
798             }
799           case INSN_COP_LABEL:          /* 110 */
800             {
801                 pvcontents arg;
802                 BGET_pvcontents(arg);
803                 cCOP->cop_label = arg;
804                 break;
805             }
806           case INSN_COP_STASH:          /* 111 */
807             {
808                 svindex arg;
809                 BGET_svindex(arg);
810                 *(SV**)&cCOP->cop_stash = arg;
811                 break;
812             }
813           case INSN_COP_FILEGV:         /* 112 */
814             {
815                 svindex arg;
816                 BGET_svindex(arg);
817                 *(SV**)&cCOP->cop_filegv = arg;
818                 break;
819             }
820           case INSN_COP_SEQ:            /* 113 */
821             {
822                 U32 arg;
823                 BGET_U32(arg);
824                 cCOP->cop_seq = arg;
825                 break;
826             }
827           case INSN_COP_ARYBASE:                /* 114 */
828             {
829                 I32 arg;
830                 BGET_I32(arg);
831                 cCOP->cop_arybase = arg;
832                 break;
833             }
834           case INSN_COP_LINE:           /* 115 */
835             {
836                 line_t arg;
837                 BGET_U16(arg);
838                 cCOP->cop_line = arg;
839                 break;
840             }
841           case INSN_MAIN_START:         /* 116 */
842             {
843                 opindex arg;
844                 BGET_opindex(arg);
845                 main_start = arg;
846                 break;
847             }
848           case INSN_MAIN_ROOT:          /* 117 */
849             {
850                 opindex arg;
851                 BGET_opindex(arg);
852                 main_root = arg;
853                 break;
854             }
855           case INSN_CURPAD:             /* 118 */
856             {
857                 svindex arg;
858                 BGET_svindex(arg);
859                 BSET_curpad(curpad, arg);
860                 break;
861             }
862           default:
863             croak("Illegal bytecode instruction %d\n", insn);
864             /* NOTREACHED */
865         }
866     }
867 }