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