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