This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
support POSIX::uname() via win32_uname()
[perl5.git] / cc_runtime.h
CommitLineData
6b88bc9c 1#define DOOP(ppname) PUTBACK; PL_op = ppname(ARGS); SPAGAIN
a8a597b2
MB
2
3#define PP_LIST(g) do { \
4 dMARK; \
5 if (g != G_ARRAY) { \
6 if (++MARK <= SP) \
7 *MARK = *SP; \
8 else \
6b88bc9c 9 *MARK = &PL_sv_undef; \
a8a597b2
MB
10 SP = MARK; \
11 } \
12 } while (0)
13
14#define MAYBE_TAINT_SASSIGN_SRC(sv) \
6b88bc9c 15 if (PL_tainting && PL_tainted && (!SvGMAGICAL(left) || !SvSMAGICAL(left) || \
a8a597b2
MB
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; \
6b88bc9c 31 PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp; \
a8a597b2 32 FREETMPS; \
6b88bc9c 33 oldsave = PL_scopestack[PL_scopestack_ix - 1]; \
a8a597b2
MB
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; \
6224f72b 41 int ret; \
a8a597b2 42 PUTBACK; \
6224f72b
GS
43 JMPENV_PUSH(ret); \
44 switch (ret) { \
45 case 0: \
6b88bc9c
GS
46 PL_op = ppaddr(ARGS); \
47 PL_retstack[PL_retstack_ix - 1] = Nullop; \
8af582d5 48 if (PL_op != nxt) CALLRUNOPS(); \
a8a597b2
MB
49 JMPENV_POP; \
50 break; \
6224f72b
GS
51 case 1: JMPENV_POP; JMPENV_JUMP(1); \
52 case 2: JMPENV_POP; JMPENV_JUMP(2); \
53 case 3: \
a8a597b2 54 JMPENV_POP; \
6b88bc9c 55 if (PL_restartop != nxt) \
6224f72b 56 JMPENV_JUMP(3); \
a8a597b2 57 } \
6b88bc9c 58 PL_op = nxt; \
a8a597b2
MB
59 SPAGAIN; \
60 } while (0)
61
a6f4eb0a
VB
62#define B_JMPENV_PUSH(cur_env,v) \
63 STMT_START { \
64 cur_env.je_prev = PL_top_env; \
65 OP_REG_TO_MEM; \
66 cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, 1); \
67 OP_MEM_TO_REG; \
68 PL_top_env = &cur_env; \
69 cur_env.je_mustcatch = FALSE; \
70 (v) = cur_env.je_ret; \
71 } STMT_END
72#define B_JMPENV_POP(cur_env) \
73 STMT_START { PL_top_env = cur_env.je_prev; } STMT_END
74
75#define B_JMPENV_JUMP(cur_env,v) \
76 STMT_START { \
77 OP_REG_TO_MEM; \
78 if (PL_top_env->je_prev) \
79 PerlProc_longjmp(PL_top_env->je_buf, (v)); \
80 if ((v) == 2) \
81 PerlProc_exit(STATUS_NATIVE_EXPORT); \
82 PerlIO_printf(PerlIO_stderr(), "panic: top_env\n"); \
83 PerlProc_exit(1); \
84 } STMT_END
85
86
87#define PP_ENTERTRY(jmpbuf,label) { \
a8a597b2 88 int ret; \
a6f4eb0a 89 B_JMPENV_PUSH(jmpbuf,ret); \
a8a597b2 90 switch (ret) { \
a6f4eb0a
VB
91 case 1: B_JMPENV_POP(jmpbuf); B_JMPENV_JUMP(jmpbuf,1); \
92 case 2: B_JMPENV_POP(jmpbuf); B_JMPENV_JUMP(jmpbuf,2); \
93 case 3: B_JMPENV_POP(jmpbuf); SPAGAIN; goto label;\
94 } \
a8a597b2 95 } while (0)
a6f4eb0a
VB
96
97#define PP_LEAVETRY PL_top_env=PL_top_env->je_prev