This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
bb9b7dc5d990ca904fe4c87714072940e9e14e1e
[perl5.git] / cc_runtime.h
1 #define DOOP(ppname) PUTBACK; PL_op = ppname(ARGS); 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 = &PL_sv_undef;   \
10             SP = MARK;                  \
11         }                               \
12    } while (0)
13
14 #define MAYBE_TAINT_SASSIGN_SRC(sv) \
15     if (PL_tainting && PL_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         PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;    \
32         FREETMPS;               \
33         oldsave = PL_scopestack[PL_scopestack_ix - 1]; \
34         LEAVE_SCOPE(oldsave);   \
35         SPAGAIN;                \
36     } while(0)
37
38 /* Anyone using eval "" deserves this mess */
39 #define PP_EVAL(ppaddr, nxt) do {               \
40         dJMPENV;                                \
41         int ret;                                \
42         PUTBACK;                                \
43         JMPENV_PUSH(ret);                       \
44         switch (ret) {                          \
45         case 0:                                 \
46             PL_op = ppaddr(ARGS);                       \
47             PL_retstack[PL_retstack_ix - 1] = Nullop;   \
48             if (PL_op != nxt) CALLRUNOPS();             \
49             JMPENV_POP;                         \
50             break;                              \
51         case 1: JMPENV_POP; JMPENV_JUMP(1);     \
52         case 2: JMPENV_POP; JMPENV_JUMP(2);     \
53         case 3:                                 \
54             JMPENV_POP;                         \
55             if (PL_restartop != nxt)            \
56                 JMPENV_JUMP(3);                 \
57         }                                       \
58         PL_op = nxt;                            \
59         SPAGAIN;                                \
60     } while (0)
61
62
63 #define PP_ENTERTRY(jmpbuf,label)  \
64         STMT_START {                    \
65                 int ret;                \
66                 JMPENV_PUSH_ENV(jmpbuf,ret);                    \
67                 switch (ret) {                          \
68                         case 1: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(1);\
69                         case 2: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(2);\
70                         case 3: JMPENV_POP_ENV(jmpbuf); SPAGAIN; goto label;\
71                 }                                       \
72         } STMT_END
73 #define PP_LEAVETRY \
74         STMT_START{ PL_top_env=PL_top_env->je_prev; }STMT_END