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