4 #include "caps.h" /* XSH_HAS_PERL() */
7 # error XSH_PACKAGE must be defined
10 #define XSH_PACKAGE_LEN (sizeof(XSH_PACKAGE)-1)
13 # if XSH_HAS_PERL(5, 8, 9) || XSH_HAS_PERL(5, 9, 3)
14 # define XSH_ASSERT(C) assert(C)
17 # define XSH_DEB(X) PERL_DEB(X)
19 # define XSH_DEB(X) (X)
21 # define XSH_ASSERT(C) XSH_DEB( \
23 : (Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \
24 "\", line %d", STRINGIFY(C), __LINE__), \
28 # define XSH_ASSERT(C)
33 # define VOID2(T, P) static_cast<T>(P)
35 # define VOID2(T, P) (P)
39 # define STMT_START do
43 # define STMT_END while (0)
54 #if XSH_HAS_PERL(5, 13, 2)
55 # define XSH_DUP_PARAMS_TYPE CLONE_PARAMS *
56 # define xsh_dup_params_init(P, O) ((P) = Perl_clone_params_new((O), aTHX))
57 # define xsh_dup_params_deinit(P) Perl_clone_params_del(P)
58 # define xsh_dup_params_ptr(P) (P)
60 # define XSH_DUP_PARAMS_TYPE CLONE_PARAMS
61 # define xsh_dup_params_init(P, O) \
62 ((P).stashes = newAV()); (P).flags = 0; ((P).proto_perl = (O))
63 # define xsh_dup_params_deinit(P) SvREFCNT_dec((P).stashes)
64 # define xsh_dup_params_ptr(P) &(P)
66 #define xsh_dup(S, P) sv_dup((S), (P))
67 #define xsh_dup_inc(S, P) SvREFCNT_inc(xsh_dup((S), (P)))
69 /* Context for PerlMemShared_*() functions */
70 #ifdef PERL_IMPLICIT_SYS
83 # define XSH_LOCK(M) MUTEX_LOCK(M)
84 # define XSH_UNLOCK(M) MUTEX_UNLOCK(M)
86 # define XSH_LOCK(M) NOOP
87 # define XSH_UNLOCK(M) NOOP
91 # define PTR2nat(p) (PTRV)(p)
95 # define DPTR2FPTR(t,p) ((t)PTR2nat(p))
99 # define FPTR2DPTR(t,p) ((t)PTR2nat(p))
102 #endif /* XSH_UTIL_H */