Commit | Line | Data |
---|---|---|
eb1102fc NIS |
1 | /* XSUB.h |
2 | * | |
699a97de | 3 | * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
1129b882 | 4 | * 2003, 2004, 2005, 2006, 2007, 2008 by Larry Wall and others |
eb1102fc NIS |
5 | * |
6 | * You may distribute under the terms of either the GNU General Public | |
7 | * License or the Artistic License, as specified in the README file. | |
8 | * | |
9 | */ | |
10 | ||
b4ba0ab9 GS |
11 | #ifndef _INC_PERL_XSUB_H |
12 | #define _INC_PERL_XSUB_H 1 | |
13 | ||
954c1994 GS |
14 | /* first, some documentation for xsubpp-generated items */ |
15 | ||
16 | /* | |
ccfc67b7 JH |
17 | =head1 Variables created by C<xsubpp> and C<xsubpp> internal functions |
18 | ||
954c1994 GS |
19 | =for apidoc Amn|char*|CLASS |
20 | Variable which is setup by C<xsubpp> to indicate the | |
21 | class name for a C++ XS constructor. This is always a C<char*>. See C<THIS>. | |
22 | ||
23 | =for apidoc Amn|(whatever)|RETVAL | |
24 | Variable which is setup by C<xsubpp> to hold the return value for an | |
25 | XSUB. This is always the proper type for the XSUB. See | |
26 | L<perlxs/"The RETVAL Variable">. | |
27 | ||
28 | =for apidoc Amn|(whatever)|THIS | |
29 | Variable which is setup by C<xsubpp> to designate the object in a C++ | |
30 | XSUB. This is always the proper type for the C++ object. See C<CLASS> and | |
31 | L<perlxs/"Using XS With C++">. | |
32 | ||
9f2ea798 DM |
33 | =for apidoc Amn|I32|ax |
34 | Variable which is setup by C<xsubpp> to indicate the stack base offset, | |
35 | used by the C<ST>, C<XSprePUSH> and C<XSRETURN> macros. The C<dMARK> macro | |
36 | must be called prior to setup the C<MARK> variable. | |
37 | ||
954c1994 GS |
38 | =for apidoc Amn|I32|items |
39 | Variable which is setup by C<xsubpp> to indicate the number of | |
40 | items on the stack. See L<perlxs/"Variable-length Parameter Lists">. | |
41 | ||
42 | =for apidoc Amn|I32|ix | |
43 | Variable which is setup by C<xsubpp> to indicate which of an | |
44 | XSUB's aliases was used to invoke it. See L<perlxs/"The ALIAS: Keyword">. | |
45 | ||
46 | =for apidoc Am|SV*|ST|int ix | |
47 | Used to access elements on the XSUB's stack. | |
48 | ||
49 | =for apidoc AmU||XS | |
50 | Macro to declare an XSUB and its C parameter list. This is handled by | |
51 | C<xsubpp>. | |
52 | ||
e64345f8 S |
53 | =for apidoc AmU||XS_INTERNAL |
54 | Macro to declare an XSUB and its C parameter list without exporting the symbols. | |
55 | This is handled by C<xsubpp> and generally preferable over exporting the XSUB | |
56 | symbols unnecessarily. This is handled by C<xsubpp>. | |
57 | ||
58 | =for apidoc AmU||XS_EXTERNAL | |
59 | Macro to declare an XSUB and its C parameter list explicitly exporting the symbols. | |
60 | This is handled by C<xsubpp>. | |
61 | ||
9f2ea798 DM |
62 | =for apidoc Ams||dAX |
63 | Sets up the C<ax> variable. | |
64 | This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>. | |
65 | ||
557b887a SS |
66 | =for apidoc Ams||dAXMARK |
67 | Sets up the C<ax> variable and stack marker variable C<mark>. | |
68 | This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>. | |
69 | ||
9f2ea798 DM |
70 | =for apidoc Ams||dITEMS |
71 | Sets up the C<items> variable. | |
72 | This is usually handled automatically by C<xsubpp> by calling C<dXSARGS>. | |
73 | ||
954c1994 | 74 | =for apidoc Ams||dXSARGS |
9f2ea798 DM |
75 | Sets up stack and mark pointers for an XSUB, calling dSP and dMARK. |
76 | Sets up the C<ax> and C<items> variables by calling C<dAX> and C<dITEMS>. | |
77 | This is usually handled automatically by C<xsubpp>. | |
954c1994 GS |
78 | |
79 | =for apidoc Ams||dXSI32 | |
80 | Sets up the C<ix> variable for an XSUB which has aliases. This is usually | |
81 | handled automatically by C<xsubpp>. | |
82 | ||
88037a85 | 83 | =for apidoc Ams||dUNDERBAR |
483ce06a | 84 | Sets up any variable needed by the C<UNDERBAR> macro. It used to define |
486ec47a | 85 | C<padoff_du>, but it is currently a noop. However, it is strongly advised |
483ce06a | 86 | to still use it for ensuring past and future compatibility. |
88037a85 RGS |
87 | |
88 | =for apidoc AmU||UNDERBAR | |
89 | The SV* corresponding to the $_ variable. Works even if there | |
90 | is a lexical $_ in scope. | |
91 | ||
954c1994 GS |
92 | =cut |
93 | */ | |
94 | ||
53c1dcc0 | 95 | #ifndef PERL_UNUSED_ARG |
c99ffe5e | 96 | # if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ |
ad73156c | 97 | # include <note.h> |
53c1dcc0 | 98 | # define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x)) |
ad73156c | 99 | # else |
53c1dcc0 | 100 | # define PERL_UNUSED_ARG(x) ((void)x) |
ad73156c AL |
101 | # endif |
102 | #endif | |
53c1dcc0 AL |
103 | #ifndef PERL_UNUSED_VAR |
104 | # define PERL_UNUSED_VAR(x) ((void)x) | |
105 | #endif | |
ad73156c | 106 | |
3280af22 | 107 | #define ST(off) PL_stack_base[ax + (off)] |
a0d0e21e | 108 | |
081304ca AMS |
109 | /* XSPROTO() is also used by SWIG like this: |
110 | * | |
111 | * typedef XSPROTO(SwigPerlWrapper); | |
112 | * typedef SwigPerlWrapper *SwigPerlWrapperPtr; | |
113 | * | |
114 | * This code needs to be compilable under both C and C++. | |
115 | * | |
116 | * Don't forget to change the __attribute__unused__ version of XS() | |
117 | * below too if you change XSPROTO() here. | |
118 | */ | |
e64345f8 S |
119 | |
120 | /* XSPROTO_INTERNAL and XS_INTERNAL are the static-linkage variants | |
121 | * of the default XSPROTO/XS macros. They are enabled by | |
122 | * a special XS verb that is still tbd. | |
123 | * | |
124 | * XSPROTO_EXTERNAL/XS_EXTERNAL are (for now) exactly the same as | |
125 | * XSPROTO/XS, but if the default wrt. linkage changes in future, they | |
126 | * will allow users to explicitly mark XSUBs for exporting their | |
127 | * symbols. | |
128 | */ | |
129 | ||
130 | #define XSPROTO_EXTERNAL(name) void name(pTHX_ CV* cv) | |
131 | #define XSPROTO_INTERNAL(name) STATIC void name(pTHX_ CV* cv) | |
132 | #define XSPROTO(name) XSPROTO_EXTERNAL(name) | |
081304ca | 133 | |
27da23d5 | 134 | #undef XS |
e64345f8 S |
135 | #undef XS_EXTERNAL |
136 | #undef XS_INTERNAL | |
d308986b | 137 | #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
e64345f8 S |
138 | # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO_EXTERNAL(name) |
139 | # define XS_INTERNAL(name) __declspec(dllexport) XSPROTO_INTERNAL(name) | |
27da23d5 | 140 | #endif |
a0fd4948 | 141 | #if defined(__SYMBIAN32__) |
e64345f8 S |
142 | # define XS_EXTERNAL(name) EXPORT_C XSPROTO_EXTERNAL(name) |
143 | # define XS_INTERNAL(name) EXPORT_C XSPROTO_INTERNAL(name) | |
27da23d5 | 144 | #endif |
e64345f8 | 145 | #ifndef XS_EXTERNAL |
34659ad4 | 146 | # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
e64345f8 S |
147 | # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
148 | # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) | |
88d01955 | 149 | # else |
a0c21aa1 | 150 | # ifdef __cplusplus |
e64345f8 S |
151 | # define XS_EXTERNAL(name) extern "C" XSPROTO_EXTERNAL(name) |
152 | # define XS_INTERNAL(name) extern "C" XSPROTO_INTERNAL(name) | |
a0c21aa1 | 153 | # else |
e64345f8 S |
154 | # define XS_EXTERNAL(name) XSPROTO_EXTERNAL(name) |
155 | # define XS_INTERNAL(name) XSPROTO_INTERNAL(name) | |
a0c21aa1 | 156 | # endif |
88d01955 | 157 | # endif |
a0d0e21e LW |
158 | #endif |
159 | ||
e64345f8 S |
160 | /* We currently default to exporting XSUB symbols */ |
161 | #define XS(name) XS_EXTERNAL(name) | |
162 | /* Apparently needed for SWIG: */ | |
163 | #define XSPROTO(name) XSPROTO_EXTERNAL(name) | |
164 | ||
514696af | 165 | #define dAX const I32 ax = (I32)(MARK - PL_stack_base + 1) |
9f2ea798 | 166 | |
557b887a | 167 | #define dAXMARK \ |
a3b680e6 | 168 | I32 ax = POPMARK; \ |
92800dc8 | 169 | register SV **mark = PL_stack_base + ax++ |
557b887a | 170 | |
514696af | 171 | #define dITEMS I32 items = (I32)(SP - MARK) |
9f2ea798 | 172 | |
c99ffe5e | 173 | #if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ |
53c1dcc0 AL |
174 | # define dXSARGS \ |
175 | NOTE(ARGUNUSED(cv)) \ | |
176 | dSP; dAXMARK; dITEMS | |
177 | #else | |
178 | # define dXSARGS \ | |
557b887a | 179 | dSP; dAXMARK; dITEMS |
53c1dcc0 | 180 | #endif |
a0d0e21e | 181 | |
a3b680e6 | 182 | #define dXSTARG SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \ |
8a7fc0dc GS |
183 | ? PAD_SV(PL_op->op_targ) : sv_newmortal()) |
184 | ||
b26a54d0 GS |
185 | /* Should be used before final PUSHi etc. if not in PPCODE section. */ |
186 | #define XSprePUSH (sp = PL_stack_base + ax - 1) | |
187 | ||
a0d0e21e LW |
188 | #define XSANY CvXSUBANY(cv) |
189 | ||
190 | #define dXSI32 I32 ix = XSANY.any_i32 | |
191 | ||
cfc02341 IZ |
192 | #ifdef __cplusplus |
193 | # define XSINTERFACE_CVT(ret,name) ret (*name)(...) | |
4ef0c66e | 194 | # define XSINTERFACE_CVT_ANON(ret) ret (*)(...) |
cfc02341 IZ |
195 | #else |
196 | # define XSINTERFACE_CVT(ret,name) ret (*name)() | |
4ef0c66e | 197 | # define XSINTERFACE_CVT_ANON(ret) ret (*)() |
cfc02341 IZ |
198 | #endif |
199 | #define dXSFUNCTION(ret) XSINTERFACE_CVT(ret,XSFUNCTION) | |
4ef0c66e | 200 | #define XSINTERFACE_FUNC(ret,cv,f) ((XSINTERFACE_CVT_ANON(ret))(f)) |
cfc02341 | 201 | #define XSINTERFACE_FUNC_SET(cv,f) \ |
a12c3db7 | 202 | CvXSUBANY(cv).any_dxptr = (void (*) (pTHX_ void*))(f) |
cfc02341 | 203 | |
483ce06a VP |
204 | #define dUNDERBAR dNOOP |
205 | #define UNDERBAR find_rundefsv() | |
88037a85 | 206 | |
748a9306 LW |
207 | /* Simple macros to put new mortal values onto the stack. */ |
208 | /* Typically used to return values from XS functions. */ | |
954c1994 GS |
209 | |
210 | /* | |
ccfc67b7 JH |
211 | =head1 Stack Manipulation Macros |
212 | ||
954c1994 GS |
213 | =for apidoc Am|void|XST_mIV|int pos|IV iv |
214 | Place an integer into the specified position C<pos> on the stack. The | |
215 | value is stored in a new mortal SV. | |
216 | ||
217 | =for apidoc Am|void|XST_mNV|int pos|NV nv | |
218 | Place a double into the specified position C<pos> on the stack. The value | |
219 | is stored in a new mortal SV. | |
220 | ||
221 | =for apidoc Am|void|XST_mPV|int pos|char* str | |
222 | Place a copy of a string into the specified position C<pos> on the stack. | |
223 | The value is stored in a new mortal SV. | |
224 | ||
225 | =for apidoc Am|void|XST_mNO|int pos | |
226 | Place C<&PL_sv_no> into the specified position C<pos> on the | |
227 | stack. | |
228 | ||
229 | =for apidoc Am|void|XST_mYES|int pos | |
230 | Place C<&PL_sv_yes> into the specified position C<pos> on the | |
231 | stack. | |
232 | ||
233 | =for apidoc Am|void|XST_mUNDEF|int pos | |
234 | Place C<&PL_sv_undef> into the specified position C<pos> on the | |
235 | stack. | |
236 | ||
237 | =for apidoc Am|void|XSRETURN|int nitems | |
238 | Return from XSUB, indicating number of items on the stack. This is usually | |
239 | handled by C<xsubpp>. | |
240 | ||
241 | =for apidoc Am|void|XSRETURN_IV|IV iv | |
242 | Return an integer from an XSUB immediately. Uses C<XST_mIV>. | |
243 | ||
108ccc45 JH |
244 | =for apidoc Am|void|XSRETURN_UV|IV uv |
245 | Return an integer from an XSUB immediately. Uses C<XST_mUV>. | |
246 | ||
954c1994 | 247 | =for apidoc Am|void|XSRETURN_NV|NV nv |
d1be9408 | 248 | Return a double from an XSUB immediately. Uses C<XST_mNV>. |
954c1994 GS |
249 | |
250 | =for apidoc Am|void|XSRETURN_PV|char* str | |
251 | Return a copy of a string from an XSUB immediately. Uses C<XST_mPV>. | |
252 | ||
253 | =for apidoc Ams||XSRETURN_NO | |
254 | Return C<&PL_sv_no> from an XSUB immediately. Uses C<XST_mNO>. | |
255 | ||
256 | =for apidoc Ams||XSRETURN_YES | |
257 | Return C<&PL_sv_yes> from an XSUB immediately. Uses C<XST_mYES>. | |
258 | ||
259 | =for apidoc Ams||XSRETURN_UNDEF | |
260 | Return C<&PL_sv_undef> from an XSUB immediately. Uses C<XST_mUNDEF>. | |
261 | ||
262 | =for apidoc Ams||XSRETURN_EMPTY | |
263 | Return an empty list from an XSUB immediately. | |
264 | ||
ccfc67b7 JH |
265 | =head1 Variables created by C<xsubpp> and C<xsubpp> internal functions |
266 | ||
c578083c | 267 | =for apidoc AmU||newXSproto|char* name|XSUBADDR_t f|char* filename|const char *proto |
954c1994 GS |
268 | Used by C<xsubpp> to hook up XSUBs as Perl subs. Adds Perl prototypes to |
269 | the subs. | |
270 | ||
271 | =for apidoc AmU||XS_VERSION | |
272 | The version identifier for an XS module. This is usually | |
273 | handled automatically by C<ExtUtils::MakeMaker>. See C<XS_VERSION_BOOTCHECK>. | |
274 | ||
275 | =for apidoc Ams||XS_VERSION_BOOTCHECK | |
276 | Macro to verify that a PM module's $VERSION variable matches the XS | |
277 | module's C<XS_VERSION> variable. This is usually handled automatically by | |
278 | C<xsubpp>. See L<perlxs/"The VERSIONCHECK: Keyword">. | |
279 | ||
1e8125c6 FR |
280 | =for apidoc Ams||XS_APIVERSION_BOOTCHECK |
281 | Macro to verify that the perl api version an XS module has been compiled against | |
282 | matches the api version of the perl interpreter it's being loaded into. | |
283 | ||
0ca3a874 MHM |
284 | =head1 Simple Exception Handling Macros |
285 | ||
286 | =for apidoc Ams||dXCPT | |
2dfe1b17 | 287 | Set up necessary local variables for exception handling. |
0ca3a874 MHM |
288 | See L<perlguts/"Exception Handling">. |
289 | ||
290 | =for apidoc AmU||XCPT_TRY_START | |
291 | Starts a try block. See L<perlguts/"Exception Handling">. | |
292 | ||
293 | =for apidoc AmU||XCPT_TRY_END | |
294 | Ends a try block. See L<perlguts/"Exception Handling">. | |
295 | ||
296 | =for apidoc AmU||XCPT_CATCH | |
297 | Introduces a catch block. See L<perlguts/"Exception Handling">. | |
298 | ||
299 | =for apidoc Ams||XCPT_RETHROW | |
300 | Rethrows a previously caught exception. See L<perlguts/"Exception Handling">. | |
301 | ||
954c1994 GS |
302 | =cut |
303 | */ | |
304 | ||
4633a7c4 | 305 | #define XST_mIV(i,v) (ST(i) = sv_2mortal(newSViv(v)) ) |
108ccc45 | 306 | #define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) |
4633a7c4 LW |
307 | #define XST_mNV(i,v) (ST(i) = sv_2mortal(newSVnv(v)) ) |
308 | #define XST_mPV(i,v) (ST(i) = sv_2mortal(newSVpv(v,0))) | |
ad25789c | 309 | #define XST_mPVN(i,v,n) (ST(i) = newSVpvn_flags(v,n, SVs_TEMP)) |
3280af22 NIS |
310 | #define XST_mNO(i) (ST(i) = &PL_sv_no ) |
311 | #define XST_mYES(i) (ST(i) = &PL_sv_yes ) | |
312 | #define XST_mUNDEF(i) (ST(i) = &PL_sv_undef) | |
954c1994 GS |
313 | |
314 | #define XSRETURN(off) \ | |
315 | STMT_START { \ | |
61f9802b | 316 | const IV tmpXSoff = (off); \ |
a02b2239 | 317 | PL_stack_sp = PL_stack_base + ax + (tmpXSoff - 1); \ |
954c1994 GS |
318 | return; \ |
319 | } STMT_END | |
320 | ||
80b92232 | 321 | #define XSRETURN_IV(v) STMT_START { XST_mIV(0,v); XSRETURN(1); } STMT_END |
108ccc45 | 322 | #define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END |
80b92232 | 323 | #define XSRETURN_NV(v) STMT_START { XST_mNV(0,v); XSRETURN(1); } STMT_END |
324 | #define XSRETURN_PV(v) STMT_START { XST_mPV(0,v); XSRETURN(1); } STMT_END | |
954c1994 | 325 | #define XSRETURN_PVN(v,n) STMT_START { XST_mPVN(0,v,n); XSRETURN(1); } STMT_END |
80b92232 | 326 | #define XSRETURN_NO STMT_START { XST_mNO(0); XSRETURN(1); } STMT_END |
327 | #define XSRETURN_YES STMT_START { XST_mYES(0); XSRETURN(1); } STMT_END | |
328 | #define XSRETURN_UNDEF STMT_START { XST_mUNDEF(0); XSRETURN(1); } STMT_END | |
329 | #define XSRETURN_EMPTY STMT_START { XSRETURN(0); } STMT_END | |
382b8d97 | 330 | |
77004dee | 331 | #define newXSproto(a,b,c,d) newXS_flags(a,b,c,d,0) |
720fb644 | 332 | |
333 | #ifdef XS_VERSION | |
ddb5125f | 334 | # define XS_VERSION_BOOTCHECK \ |
e9b067d9 | 335 | Perl_xs_version_bootcheck(aTHX_ items, ax, STR_WITH_LEN(XS_VERSION)) |
720fb644 | 336 | #else |
c6af7a1a | 337 | # define XS_VERSION_BOOTCHECK |
720fb644 | 338 | #endif |
76e3520e | 339 | |
1e8125c6 | 340 | #define XS_APIVERSION_BOOTCHECK \ |
379a8907 | 341 | Perl_xs_apiversion_bootcheck(aTHX_ ST(0), STR_WITH_LEN("v" PERL_API_VERSION_STRING)) |
1e8125c6 | 342 | |
9b5c3821 MHM |
343 | #ifdef NO_XSLOCKS |
344 | # define dXCPT dJMPENV; int rEtV = 0 | |
345 | # define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) | |
346 | # define XCPT_TRY_END JMPENV_POP; | |
347 | # define XCPT_CATCH if (rEtV != 0) | |
348 | # define XCPT_RETHROW JMPENV_JUMP(rEtV) | |
349 | #endif | |
0ca3a874 | 350 | |
1e8125c6 FR |
351 | /* |
352 | The DBM_setFilter & DBM_ckFilter macros are only used by | |
353 | the *DB*_File modules | |
6a31061a PM |
354 | */ |
355 | ||
356 | #define DBM_setFilter(db_type,code) \ | |
891c2e08 | 357 | STMT_START { \ |
6a31061a PM |
358 | if (db_type) \ |
359 | RETVAL = sv_mortalcopy(db_type) ; \ | |
360 | ST(0) = RETVAL ; \ | |
361 | if (db_type && (code == &PL_sv_undef)) { \ | |
362 | SvREFCNT_dec(db_type) ; \ | |
363 | db_type = NULL ; \ | |
364 | } \ | |
365 | else if (code) { \ | |
366 | if (db_type) \ | |
367 | sv_setsv(db_type, code) ; \ | |
368 | else \ | |
369 | db_type = newSVsv(code) ; \ | |
370 | } \ | |
891c2e08 | 371 | } STMT_END |
6a31061a PM |
372 | |
373 | #define DBM_ckFilter(arg,type,name) \ | |
891c2e08 | 374 | STMT_START { \ |
6a31061a PM |
375 | if (db->type) { \ |
376 | if (db->filtering) { \ | |
377 | croak("recursion detected in %s", name) ; \ | |
378 | } \ | |
379 | ENTER ; \ | |
380 | SAVETMPS ; \ | |
381 | SAVEINT(db->filtering) ; \ | |
382 | db->filtering = TRUE ; \ | |
414bf5ae | 383 | SAVE_DEFSV ; \ |
5bbd4290 PM |
384 | if (name[7] == 's') \ |
385 | arg = newSVsv(arg); \ | |
414bf5ae | 386 | DEFSV_set(arg) ; \ |
6a31061a PM |
387 | SvTEMP_off(arg) ; \ |
388 | PUSHMARK(SP) ; \ | |
389 | PUTBACK ; \ | |
390 | (void) perl_call_sv(db->type, G_DISCARD); \ | |
391 | SPAGAIN ; \ | |
392 | PUTBACK ; \ | |
393 | FREETMPS ; \ | |
394 | LEAVE ; \ | |
5bbd4290 PM |
395 | if (name[7] == 's'){ \ |
396 | arg = sv_2mortal(arg); \ | |
397 | } \ | |
891c2e08 | 398 | } } STMT_END |
6a31061a | 399 | |
51371543 | 400 | #if 1 /* for compatibility */ |
dc9e4912 GS |
401 | # define VTBL_sv &PL_vtbl_sv |
402 | # define VTBL_env &PL_vtbl_env | |
403 | # define VTBL_envelem &PL_vtbl_envelem | |
dc9e4912 GS |
404 | # define VTBL_sigelem &PL_vtbl_sigelem |
405 | # define VTBL_pack &PL_vtbl_pack | |
406 | # define VTBL_packelem &PL_vtbl_packelem | |
407 | # define VTBL_dbline &PL_vtbl_dbline | |
408 | # define VTBL_isa &PL_vtbl_isa | |
409 | # define VTBL_isaelem &PL_vtbl_isaelem | |
410 | # define VTBL_arylen &PL_vtbl_arylen | |
c696a6a4 | 411 | # define VTBL_glob &PL_vtbl_glob |
dc9e4912 GS |
412 | # define VTBL_mglob &PL_vtbl_mglob |
413 | # define VTBL_nkeys &PL_vtbl_nkeys | |
414 | # define VTBL_taint &PL_vtbl_taint | |
415 | # define VTBL_substr &PL_vtbl_substr | |
416 | # define VTBL_vec &PL_vtbl_vec | |
417 | # define VTBL_pos &PL_vtbl_pos | |
418 | # define VTBL_bm &PL_vtbl_bm | |
419 | # define VTBL_fm &PL_vtbl_fm | |
420 | # define VTBL_uvar &PL_vtbl_uvar | |
421 | # define VTBL_defelem &PL_vtbl_defelem | |
422 | # define VTBL_regexp &PL_vtbl_regexp | |
423 | # define VTBL_regdata &PL_vtbl_regdata | |
424 | # define VTBL_regdatum &PL_vtbl_regdatum | |
425 | # ifdef USE_LOCALE_COLLATE | |
426 | # define VTBL_collxfrm &PL_vtbl_collxfrm | |
427 | # endif | |
9e7bc3e8 JD |
428 | # define VTBL_amagic &PL_vtbl_amagic |
429 | # define VTBL_amagicelem &PL_vtbl_amagicelem | |
dc9e4912 GS |
430 | #endif |
431 | ||
6f4183fe | 432 | #include "perlapi.h" |
c6af7a1a | 433 | |
e8ee3774 | 434 | #if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_GET_CONTEXT) && !defined(PERL_CORE) |
c5be433b GS |
435 | # undef aTHX |
436 | # undef aTHX_ | |
54aff467 GS |
437 | # define aTHX PERL_GET_THX |
438 | # define aTHX_ aTHX, | |
54aff467 GS |
439 | #endif |
440 | ||
acfe0abc | 441 | #if defined(PERL_IMPLICIT_SYS) && !defined(PERL_CORE) |
c6af7a1a | 442 | # ifndef NO_XSLOCKS |
2986a63f JH |
443 | # if defined (NETWARE) && defined (USE_STDIO) |
444 | # define times PerlProc_times | |
445 | # define setuid PerlProc_setuid | |
446 | # define setgid PerlProc_setgid | |
447 | # define getpid PerlProc_getpid | |
448 | # define pause PerlProc_pause | |
449 | # define exit PerlProc_exit | |
450 | # define _exit PerlProc__exit | |
451 | # else | |
c6af7a1a GS |
452 | # undef closedir |
453 | # undef opendir | |
454 | # undef stdin | |
455 | # undef stdout | |
456 | # undef stderr | |
457 | # undef feof | |
458 | # undef ferror | |
459 | # undef fgetpos | |
460 | # undef ioctl | |
461 | # undef getlogin | |
462 | # undef setjmp | |
463 | # undef getc | |
464 | # undef ungetc | |
465 | # undef fileno | |
466 | ||
cb69f87a | 467 | /* Following symbols were giving redefinition errors while building extensions - sgp 17th Oct 2000 */ |
2986a63f JH |
468 | #ifdef NETWARE |
469 | # undef readdir | |
470 | # undef fstat | |
471 | # undef stat | |
472 | # undef longjmp | |
473 | # undef endhostent | |
474 | # undef endnetent | |
475 | # undef endprotoent | |
476 | # undef endservent | |
477 | # undef gethostbyaddr | |
478 | # undef gethostbyname | |
479 | # undef gethostent | |
480 | # undef getnetbyaddr | |
481 | # undef getnetbyname | |
482 | # undef getnetent | |
483 | # undef getprotobyname | |
484 | # undef getprotobynumber | |
485 | # undef getprotoent | |
486 | # undef getservbyname | |
487 | # undef getservbyport | |
488 | # undef getservent | |
489 | # undef inet_ntoa | |
490 | # undef sethostent | |
491 | # undef setnetent | |
492 | # undef setprotoent | |
493 | # undef setservent | |
494 | #endif /* NETWARE */ | |
495 | ||
fa58a56f S |
496 | /* to avoid warnings: "xyz" redefined */ |
497 | #ifdef WIN32 | |
498 | # undef popen | |
499 | # undef pclose | |
500 | #endif /* WIN32 */ | |
501 | ||
1018e26f NIS |
502 | # undef socketpair |
503 | ||
c6af7a1a GS |
504 | # define mkdir PerlDir_mkdir |
505 | # define chdir PerlDir_chdir | |
506 | # define rmdir PerlDir_rmdir | |
507 | # define closedir PerlDir_close | |
508 | # define opendir PerlDir_open | |
509 | # define readdir PerlDir_read | |
510 | # define rewinddir PerlDir_rewind | |
511 | # define seekdir PerlDir_seek | |
512 | # define telldir PerlDir_tell | |
513 | # define putenv PerlEnv_putenv | |
514 | # define getenv PerlEnv_getenv | |
b2af26b1 | 515 | # define uname PerlEnv_uname |
197357d0 GS |
516 | # define stdin PerlSIO_stdin |
517 | # define stdout PerlSIO_stdout | |
518 | # define stderr PerlSIO_stderr | |
f9415d23 NIS |
519 | # define fopen PerlSIO_fopen |
520 | # define fclose PerlSIO_fclose | |
521 | # define feof PerlSIO_feof | |
522 | # define ferror PerlSIO_ferror | |
b6d726d6 | 523 | # define clearerr PerlSIO_clearerr |
f9415d23 | 524 | # define getc PerlSIO_getc |
20c8f8f9 | 525 | # define fgets PerlSIO_fgets |
f9415d23 NIS |
526 | # define fputc PerlSIO_fputc |
527 | # define fputs PerlSIO_fputs | |
528 | # define fflush PerlSIO_fflush | |
529 | # define ungetc PerlSIO_ungetc | |
530 | # define fileno PerlSIO_fileno | |
531 | # define fdopen PerlSIO_fdopen | |
532 | # define freopen PerlSIO_freopen | |
533 | # define fread PerlSIO_fread | |
534 | # define fwrite PerlSIO_fwrite | |
22a46b6e NIS |
535 | # define setbuf PerlSIO_setbuf |
536 | # define setvbuf PerlSIO_setvbuf | |
537 | # define setlinebuf PerlSIO_setlinebuf | |
1f59ddd9 GS |
538 | # define stdoutf PerlSIO_stdoutf |
539 | # define vfprintf PerlSIO_vprintf | |
f9415d23 NIS |
540 | # define ftell PerlSIO_ftell |
541 | # define fseek PerlSIO_fseek | |
542 | # define fgetpos PerlSIO_fgetpos | |
543 | # define fsetpos PerlSIO_fsetpos | |
544 | # define frewind PerlSIO_rewind | |
545 | # define tmpfile PerlSIO_tmpfile | |
c6af7a1a GS |
546 | # define access PerlLIO_access |
547 | # define chmod PerlLIO_chmod | |
548 | # define chsize PerlLIO_chsize | |
549 | # define close PerlLIO_close | |
550 | # define dup PerlLIO_dup | |
551 | # define dup2 PerlLIO_dup2 | |
552 | # define flock PerlLIO_flock | |
553 | # define fstat PerlLIO_fstat | |
554 | # define ioctl PerlLIO_ioctl | |
555 | # define isatty PerlLIO_isatty | |
6b980173 | 556 | # define link PerlLIO_link |
c6af7a1a GS |
557 | # define lseek PerlLIO_lseek |
558 | # define lstat PerlLIO_lstat | |
559 | # define mktemp PerlLIO_mktemp | |
560 | # define open PerlLIO_open | |
561 | # define read PerlLIO_read | |
562 | # define rename PerlLIO_rename | |
563 | # define setmode PerlLIO_setmode | |
4f49e16e | 564 | # define stat(buf,sb) PerlLIO_stat(buf,sb) |
c6af7a1a GS |
565 | # define tmpnam PerlLIO_tmpnam |
566 | # define umask PerlLIO_umask | |
567 | # define unlink PerlLIO_unlink | |
568 | # define utime PerlLIO_utime | |
569 | # define write PerlLIO_write | |
570 | # define malloc PerlMem_malloc | |
571 | # define realloc PerlMem_realloc | |
572 | # define free PerlMem_free | |
573 | # define abort PerlProc_abort | |
574 | # define exit PerlProc_exit | |
575 | # define _exit PerlProc__exit | |
576 | # define execl PerlProc_execl | |
577 | # define execv PerlProc_execv | |
578 | # define execvp PerlProc_execvp | |
579 | # define getuid PerlProc_getuid | |
580 | # define geteuid PerlProc_geteuid | |
581 | # define getgid PerlProc_getgid | |
582 | # define getegid PerlProc_getegid | |
583 | # define getlogin PerlProc_getlogin | |
584 | # define kill PerlProc_kill | |
585 | # define killpg PerlProc_killpg | |
586 | # define pause PerlProc_pause | |
587 | # define popen PerlProc_popen | |
588 | # define pclose PerlProc_pclose | |
589 | # define pipe PerlProc_pipe | |
590 | # define setuid PerlProc_setuid | |
591 | # define setgid PerlProc_setgid | |
592 | # define sleep PerlProc_sleep | |
593 | # define times PerlProc_times | |
594 | # define wait PerlProc_wait | |
595 | # define setjmp PerlProc_setjmp | |
596 | # define longjmp PerlProc_longjmp | |
597 | # define signal PerlProc_signal | |
7766f137 | 598 | # define getpid PerlProc_getpid |
57ab3dfe | 599 | # define gettimeofday PerlProc_gettimeofday |
c6af7a1a GS |
600 | # define htonl PerlSock_htonl |
601 | # define htons PerlSock_htons | |
602 | # define ntohl PerlSock_ntohl | |
603 | # define ntohs PerlSock_ntohs | |
604 | # define accept PerlSock_accept | |
605 | # define bind PerlSock_bind | |
606 | # define connect PerlSock_connect | |
607 | # define endhostent PerlSock_endhostent | |
608 | # define endnetent PerlSock_endnetent | |
609 | # define endprotoent PerlSock_endprotoent | |
610 | # define endservent PerlSock_endservent | |
611 | # define gethostbyaddr PerlSock_gethostbyaddr | |
612 | # define gethostbyname PerlSock_gethostbyname | |
613 | # define gethostent PerlSock_gethostent | |
614 | # define gethostname PerlSock_gethostname | |
615 | # define getnetbyaddr PerlSock_getnetbyaddr | |
616 | # define getnetbyname PerlSock_getnetbyname | |
617 | # define getnetent PerlSock_getnetent | |
618 | # define getpeername PerlSock_getpeername | |
619 | # define getprotobyname PerlSock_getprotobyname | |
620 | # define getprotobynumber PerlSock_getprotobynumber | |
621 | # define getprotoent PerlSock_getprotoent | |
622 | # define getservbyname PerlSock_getservbyname | |
623 | # define getservbyport PerlSock_getservbyport | |
624 | # define getservent PerlSock_getservent | |
625 | # define getsockname PerlSock_getsockname | |
626 | # define getsockopt PerlSock_getsockopt | |
627 | # define inet_addr PerlSock_inet_addr | |
628 | # define inet_ntoa PerlSock_inet_ntoa | |
629 | # define listen PerlSock_listen | |
630 | # define recv PerlSock_recv | |
631 | # define recvfrom PerlSock_recvfrom | |
632 | # define select PerlSock_select | |
633 | # define send PerlSock_send | |
634 | # define sendto PerlSock_sendto | |
635 | # define sethostent PerlSock_sethostent | |
636 | # define setnetent PerlSock_setnetent | |
637 | # define setprotoent PerlSock_setprotoent | |
638 | # define setservent PerlSock_setservent | |
639 | # define setsockopt PerlSock_setsockopt | |
640 | # define shutdown PerlSock_shutdown | |
641 | # define socket PerlSock_socket | |
642 | # define socketpair PerlSock_socketpair | |
2986a63f | 643 | # endif /* NETWARE && USE_STDIO */ |
21c5e947 JH |
644 | |
645 | # ifdef USE_SOCKETS_AS_HANDLES | |
646 | # undef fd_set | |
647 | # undef FD_SET | |
648 | # undef FD_CLR | |
649 | # undef FD_ISSET | |
650 | # undef FD_ZERO | |
651 | # define fd_set Perl_fd_set | |
652 | # define FD_SET(n,p) PERL_FD_SET(n,p) | |
653 | # define FD_CLR(n,p) PERL_FD_CLR(n,p) | |
654 | # define FD_ISSET(n,p) PERL_FD_ISSET(n,p) | |
655 | # define FD_ZERO(p) PERL_FD_ZERO(p) | |
656 | # endif /* USE_SOCKETS_AS_HANDLES */ | |
657 | ||
c6af7a1a | 658 | # endif /* NO_XSLOCKS */ |
acfe0abc | 659 | #endif /* PERL_IMPLICIT_SYS && !PERL_CORE */ |
b4ba0ab9 | 660 | |
cfeeb022 | 661 | #endif /* _INC_PERL_XSUB_H */ /* include guard */ |
ad73156c AL |
662 | |
663 | /* | |
664 | * Local variables: | |
665 | * c-indentation-style: bsd | |
666 | * c-basic-offset: 4 | |
667 | * indent-tabs-mode: t | |
668 | * End: | |
669 | * | |
670 | * ex: set ts=8 sts=4 sw=4 noet: | |
671 | */ |