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