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