This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add tests for precedence of CORE:: subs
[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 _INC_PERL_XSUB_H
12 #define _INC_PERL_XSUB_H 1
13
14 /* first, some documentation for xsubpp-generated items */
15
16 /*
17 =head1 Variables created by C<xsubpp> and C<xsubpp> internal functions
18
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
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
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
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
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
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
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
74 =for apidoc Ams||dXSARGS
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>.
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
83 =for apidoc Ams||dUNDERBAR
84 Sets up any variable needed by the C<UNDERBAR> macro. It used to define
85 C<padoff_du>, but it is currently a noop. However, it is strongly advised
86 to still use it for ensuring past and future compatibility.
87
88 =for apidoc AmU||UNDERBAR
89 The SV* corresponding to the $_ variable. Works even if there
90 is a lexical $_ in scope.
91
92 =cut
93 */
94
95 #ifndef PERL_UNUSED_ARG
96 #  if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
97 #    include <note.h>
98 #    define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
99 #  else
100 #    define PERL_UNUSED_ARG(x) ((void)x)
101 #  endif
102 #endif
103 #ifndef PERL_UNUSED_VAR
104 #  define PERL_UNUSED_VAR(x) ((void)x)
105 #endif
106
107 #define ST(off) PL_stack_base[ax + (off)]
108
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  */
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)
133
134 #undef XS
135 #undef XS_EXTERNAL
136 #undef XS_INTERNAL
137 #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
138 #  define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO_EXTERNAL(name)
139 #  define XS_INTERNAL(name) __declspec(dllexport) XSPROTO_INTERNAL(name)
140 #endif
141 #if defined(__SYMBIAN32__)
142 #  define XS_EXTERNAL(name) EXPORT_C XSPROTO_EXTERNAL(name)
143 #  define XS_INTERNAL(name) EXPORT_C XSPROTO_INTERNAL(name)
144 #endif
145 #ifndef XS_EXTERNAL
146 #  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
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__)
149 #  else
150 #    ifdef __cplusplus
151 #      define XS_EXTERNAL(name) extern "C" XSPROTO_EXTERNAL(name)
152 #      define XS_INTERNAL(name) extern "C" XSPROTO_INTERNAL(name)
153 #    else
154 #      define XS_EXTERNAL(name) XSPROTO_EXTERNAL(name)
155 #      define XS_INTERNAL(name) XSPROTO_INTERNAL(name)
156 #    endif
157 #  endif
158 #endif
159
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
165 #define dAX const I32 ax = (I32)(MARK - PL_stack_base + 1)
166
167 #define dAXMARK                         \
168         I32 ax = POPMARK;       \
169         register SV **mark = PL_stack_base + ax++
170
171 #define dITEMS I32 items = (I32)(SP - MARK)
172
173 #if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
174 #  define dXSARGS \
175         NOTE(ARGUNUSED(cv)) \
176         dSP; dAXMARK; dITEMS
177 #else
178 #  define dXSARGS \
179         dSP; dAXMARK; dITEMS
180 #endif
181
182 #define dXSTARG SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \
183                              ? PAD_SV(PL_op->op_targ) : sv_newmortal())
184
185 /* Should be used before final PUSHi etc. if not in PPCODE section. */
186 #define XSprePUSH (sp = PL_stack_base + ax - 1)
187
188 #define XSANY CvXSUBANY(cv)
189
190 #define dXSI32 I32 ix = XSANY.any_i32
191
192 #ifdef __cplusplus
193 #  define XSINTERFACE_CVT(ret,name) ret (*name)(...)
194 #  define XSINTERFACE_CVT_ANON(ret) ret (*)(...)
195 #else
196 #  define XSINTERFACE_CVT(ret,name) ret (*name)()
197 #  define XSINTERFACE_CVT_ANON(ret) ret (*)()
198 #endif
199 #define dXSFUNCTION(ret)                XSINTERFACE_CVT(ret,XSFUNCTION)
200 #define XSINTERFACE_FUNC(ret,cv,f)     ((XSINTERFACE_CVT_ANON(ret))(f))
201 #define XSINTERFACE_FUNC_SET(cv,f)      \
202                 CvXSUBANY(cv).any_dxptr = (void (*) (pTHX_ void*))(f)
203
204 #define dUNDERBAR dNOOP
205 #define UNDERBAR  find_rundefsv()
206
207 /* Simple macros to put new mortal values onto the stack.   */
208 /* Typically used to return values from XS functions.       */
209
210 /*
211 =head1 Stack Manipulation Macros
212
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
244 =for apidoc Am|void|XSRETURN_UV|IV uv
245 Return an integer from an XSUB immediately.  Uses C<XST_mUV>.
246
247 =for apidoc Am|void|XSRETURN_NV|NV nv
248 Return a double from an XSUB immediately.  Uses C<XST_mNV>.
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
265 =head1 Variables created by C<xsubpp> and C<xsubpp> internal functions
266
267 =for apidoc AmU||newXSproto|char* name|XSUBADDR_t f|char* filename|const char *proto
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
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
284 =head1 Simple Exception Handling Macros
285
286 =for apidoc Ams||dXCPT
287 Set up necessary local variables for exception handling.
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
302 =cut
303 */
304
305 #define XST_mIV(i,v)  (ST(i) = sv_2mortal(newSViv(v))  )
306 #define XST_mUV(i,v)  (ST(i) = sv_2mortal(newSVuv(v))  )
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)))
309 #define XST_mPVN(i,v,n)  (ST(i) = newSVpvn_flags(v,n, SVs_TEMP))
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)
313
314 #define XSRETURN(off)                                   \
315     STMT_START {                                        \
316         const IV tmpXSoff = (off);                      \
317         PL_stack_sp = PL_stack_base + ax + (tmpXSoff - 1);      \
318         return;                                         \
319     } STMT_END
320
321 #define XSRETURN_IV(v) STMT_START { XST_mIV(0,v);  XSRETURN(1); } STMT_END
322 #define XSRETURN_UV(v) STMT_START { XST_mUV(0,v);  XSRETURN(1); } STMT_END
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
325 #define XSRETURN_PVN(v,n) STMT_START { XST_mPVN(0,v,n);  XSRETURN(1); } STMT_END
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
330
331 #define newXSproto(a,b,c,d)     newXS_flags(a,b,c,d,0)
332
333 #ifdef XS_VERSION
334 #  define XS_VERSION_BOOTCHECK                                          \
335     Perl_xs_version_bootcheck(aTHX_ items, ax, STR_WITH_LEN(XS_VERSION))
336 #else
337 #  define XS_VERSION_BOOTCHECK
338 #endif
339
340 #define XS_APIVERSION_BOOTCHECK                                         \
341     Perl_xs_apiversion_bootcheck(aTHX_ ST(0), STR_WITH_LEN("v" PERL_API_VERSION_STRING))
342
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
350
351 /*
352    The DBM_setFilter & DBM_ckFilter macros are only used by
353    the *DB*_File modules
354 */
355
356 #define DBM_setFilter(db_type,code)                             \
357         STMT_START {                                            \
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             }                                                   \
371         } STMT_END
372
373 #define DBM_ckFilter(arg,type,name)                             \
374         STMT_START {                                            \
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 ;                              \
383             SAVE_DEFSV ;                                        \
384             if (name[7] == 's')                                 \
385                 arg = newSVsv(arg);                             \
386             DEFSV_set(arg) ;                                    \
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 ;                                             \
395             if (name[7] == 's'){                                \
396                 arg = sv_2mortal(arg);                          \
397             }                                                   \
398         } } STMT_END                                                     
399
400 #if 1           /* for compatibility */
401 #  define VTBL_sv               &PL_vtbl_sv
402 #  define VTBL_env              &PL_vtbl_env
403 #  define VTBL_envelem          &PL_vtbl_envelem
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
411 #  define VTBL_glob             &PL_vtbl_glob
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
428 #  define VTBL_amagic           &PL_vtbl_amagic
429 #  define VTBL_amagicelem       &PL_vtbl_amagicelem
430 #endif
431
432 #include "perlapi.h"
433
434 #if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_GET_CONTEXT) && !defined(PERL_CORE)
435 #  undef aTHX
436 #  undef aTHX_
437 #  define aTHX          PERL_GET_THX
438 #  define aTHX_         aTHX,
439 #endif
440
441 #if defined(PERL_IMPLICIT_SYS) && !defined(PERL_CORE)
442 #  ifndef NO_XSLOCKS
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
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
467 /* Following symbols were giving redefinition errors while building extensions - sgp 17th Oct 2000 */
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
496 /* to avoid warnings: "xyz" redefined */
497 #ifdef WIN32
498 #    undef  popen
499 #    undef  pclose
500 #endif /* WIN32 */
501
502 #    undef  socketpair
503
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
515 #    define uname               PerlEnv_uname
516 #    define stdin               PerlSIO_stdin
517 #    define stdout              PerlSIO_stdout
518 #    define stderr              PerlSIO_stderr
519 #    define fopen               PerlSIO_fopen
520 #    define fclose              PerlSIO_fclose
521 #    define feof                PerlSIO_feof
522 #    define ferror              PerlSIO_ferror
523 #    define clearerr            PerlSIO_clearerr
524 #    define getc                PerlSIO_getc
525 #    define fgets               PerlSIO_fgets
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
535 #    define setbuf              PerlSIO_setbuf
536 #    define setvbuf             PerlSIO_setvbuf
537 #    define setlinebuf          PerlSIO_setlinebuf
538 #    define stdoutf             PerlSIO_stdoutf
539 #    define vfprintf            PerlSIO_vprintf
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
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
556 #    define link                PerlLIO_link
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
564 #    define stat(buf,sb)        PerlLIO_stat(buf,sb)
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
598 #    define getpid              PerlProc_getpid
599 #    define gettimeofday        PerlProc_gettimeofday
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
643 #       endif   /* NETWARE && USE_STDIO */
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
658 #  endif  /* NO_XSLOCKS */
659 #endif  /* PERL_IMPLICIT_SYS && !PERL_CORE */
660
661 #endif /* _INC_PERL_XSUB_H */           /* include guard */
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  */