This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Initial check-in of perl compiler.
[perl5.git] / cc_runtime.h
1 #define DOOP(ppname) PUTBACK; op = ppname(); SPAGAIN
2
3 #define PP_LIST(g) do {                 \
4         dMARK;                          \
5         if (g != G_ARRAY) {             \
6             if (++MARK <= SP)           \
7                 *MARK = *SP;            \
8             else                        \
9                 *MARK = &sv_undef;      \
10             SP = MARK;                  \
11         }                               \
12    } while (0)
13
14 #define MAYBE_TAINT_SASSIGN_SRC(sv) \
15     if (tainting && tainted && (!SvGMAGICAL(left) || !SvSMAGICAL(left) || \
16                                 !((mg=mg_find(left, 't')) && mg->mg_len & 1)))\
17         TAINT_NOT
18
19 #define PP_PREINC(sv) do {      \
20         if (SvIOK(sv)) {        \
21             ++SvIVX(sv);        \
22             SvFLAGS(sv) &= ~(SVf_NOK|SVf_POK|SVp_NOK|SVp_POK); \
23         }                       \
24         else                    \
25             sv_inc(sv);         \
26         SvSETMAGIC(sv);         \
27     } while (0)
28
29 #define PP_UNSTACK do {         \
30         TAINT_NOT;              \
31         stack_sp = stack_base + cxstack[cxstack_ix].blk_oldsp;  \
32         FREETMPS;               \
33         oldsave = scopestack[scopestack_ix - 1]; \
34         LEAVE_SCOPE(oldsave);   \
35         SPAGAIN;                \
36     } while(0)
37
38 #include "patchlevel.h"
39 #if PATCHLEVEL < 3
40 #define RUN() run()
41 #else
42 #define RUN() runops()
43 #endif
44
45 /* Anyone using eval "" deserves this mess */
46 #define PP_EVAL(ppaddr, nxt) do {               \
47         Sigjmp_buf oldtop;                      \
48         Copy(top_env,oldtop,1,Sigjmp_buf);      \
49         PUTBACK;                                \
50         switch (Sigsetjmp(top_env,1)) {         \
51         case 0:                                 \
52             op = ppaddr();                      \
53             retstack[retstack_ix - 1] = Nullop; \
54             Copy(oldtop,top_env,1,Sigjmp_buf);  \
55             if (op != nxt) RUN();               \
56             break;                              \
57         case 1: Copy(oldtop,top_env,1,Sigjmp_buf); Siglongjmp(top_env,1); \
58         case 2: Copy(oldtop,top_env,1,Sigjmp_buf); Siglongjmp(top_env,2); \
59         case 3:                                 \
60             Copy(oldtop,top_env,1,Sigjmp_buf);  \
61             if (restartop != nxt)               \
62                 Siglongjmp(top_env, 3);         \
63         }                                       \
64         op = nxt;                               \
65         SPAGAIN;                                \
66     } while (0)
67
68 #define PP_ENTERTRY(jmpbuf,label) do {          \
69         Copy(top_env,jmpbuf,1,Sigjmp_buf);      \
70         switch (Sigsetjmp(top_env,1)) {         \
71         case 1: Copy(jmpbuf,top_env,1,Sigjmp_buf); Siglongjmp(top_env,1); \
72         case 2: Copy(jmpbuf,top_env,1,Sigjmp_buf); Siglongjmp(top_env,2); \
73         case 3: Copy(jmpbuf,top_env,1,Sigjmp_buf); SPAGAIN; goto label; \
74         }                                       \
75     } while (0)