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