1 #define ST(off) PL_stack_base[ax + (off)]
5 # define XS(name) void name(CV* cv, CPerlObj* pPerl)
7 # define XS(name) void name(CV* cv)
10 # define XS(name) void name(cv) CV* cv;
15 I32 ax = mark - PL_stack_base + 1; \
18 #define XSANY CvXSUBANY(cv)
20 #define dXSI32 I32 ix = XSANY.any_i32
23 # define XSINTERFACE_CVT(ret,name) ret (*name)(...)
25 # define XSINTERFACE_CVT(ret,name) ret (*name)()
27 #define dXSFUNCTION(ret) XSINTERFACE_CVT(ret,XSFUNCTION)
28 #define XSINTERFACE_FUNC(ret,cv,f) ((XSINTERFACE_CVT(ret,))(f))
29 #define XSINTERFACE_FUNC_SET(cv,f) \
30 CvXSUBANY(cv).any_dptr = (void (*) _((void*)))(f)
32 #define XSRETURN(off) \
34 PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
38 /* Simple macros to put new mortal values onto the stack. */
39 /* Typically used to return values from XS functions. */
40 #define XST_mIV(i,v) (ST(i) = sv_2mortal(newSViv(v)) )
41 #define XST_mNV(i,v) (ST(i) = sv_2mortal(newSVnv(v)) )
42 #define XST_mPV(i,v) (ST(i) = sv_2mortal(newSVpv(v,0)))
43 #define XST_mNO(i) (ST(i) = &PL_sv_no )
44 #define XST_mYES(i) (ST(i) = &PL_sv_yes )
45 #define XST_mUNDEF(i) (ST(i) = &PL_sv_undef)
47 #define XSRETURN_IV(v) STMT_START { XST_mIV(0,v); XSRETURN(1); } STMT_END
48 #define XSRETURN_NV(v) STMT_START { XST_mNV(0,v); XSRETURN(1); } STMT_END
49 #define XSRETURN_PV(v) STMT_START { XST_mPV(0,v); XSRETURN(1); } STMT_END
50 #define XSRETURN_NO STMT_START { XST_mNO(0); XSRETURN(1); } STMT_END
51 #define XSRETURN_YES STMT_START { XST_mYES(0); XSRETURN(1); } STMT_END
52 #define XSRETURN_UNDEF STMT_START { XST_mUNDEF(0); XSRETURN(1); } STMT_END
53 #define XSRETURN_EMPTY STMT_START { XSRETURN(0); } STMT_END
55 #define newXSproto(a,b,c,d) sv_setpv((SV*)newXS(a,b,c), d)
58 # define XS_VERSION_BOOTCHECK \
60 SV *tmpsv; STRLEN n_a; \
61 char *vn = Nullch, *module = SvPV(ST(0),n_a); \
62 if (items >= 2) /* version supplied as bootstrap arg */ \
65 /* XXX GV_ADDWARN */ \
66 tmpsv = perl_get_sv(form("%s::%s", module, \
67 vn = "XS_VERSION"), FALSE); \
68 if (!tmpsv || !SvOK(tmpsv)) \
69 tmpsv = perl_get_sv(form("%s::%s", module, \
70 vn = "VERSION"), FALSE); \
72 if (tmpsv && (!SvOK(tmpsv) || strNE(XS_VERSION, SvPV(tmpsv, n_a)))) \
73 croak("%s object version %s does not match %s%s%s%s %_", \
75 vn ? "$" : "", vn ? module : "", vn ? "::" : "", \
76 vn ? vn : "bootstrap parameter", tmpsv); \
79 # define XS_VERSION_BOOTCHECK
83 # define VTBL_sv get_vtbl(want_vtbl_sv)
84 # define VTBL_env get_vtbl(want_vtbl_env)
85 # define VTBL_envelem get_vtbl(want_vtbl_envelem)
86 # define VTBL_sig get_vtbl(want_vtbl_sig)
87 # define VTBL_sigelem get_vtbl(want_vtbl_sigelem)
88 # define VTBL_pack get_vtbl(want_vtbl_pack)
89 # define VTBL_packelem get_vtbl(want_vtbl_packelem)
90 # define VTBL_dbline get_vtbl(want_vtbl_dbline)
91 # define VTBL_isa get_vtbl(want_vtbl_isa)
92 # define VTBL_isaelem get_vtbl(want_vtbl_isaelem)
93 # define VTBL_arylen get_vtbl(want_vtbl_arylen)
94 # define VTBL_glob get_vtbl(want_vtbl_glob)
95 # define VTBL_mglob get_vtbl(want_vtbl_mglob)
96 # define VTBL_nkeys get_vtbl(want_vtbl_nkeys)
97 # define VTBL_taint get_vtbl(want_vtbl_taint)
98 # define VTBL_substr get_vtbl(want_vtbl_substr)
99 # define VTBL_vec get_vtbl(want_vtbl_vec)
100 # define VTBL_pos get_vtbl(want_vtbl_pos)
101 # define VTBL_bm get_vtbl(want_vtbl_bm)
102 # define VTBL_fm get_vtbl(want_vtbl_fm)
103 # define VTBL_uvar get_vtbl(want_vtbl_uvar)
104 # define VTBL_defelem get_vtbl(want_vtbl_defelem)
105 # define VTBL_regexp get_vtbl(want_vtbl_regexp)
106 # define VTBL_regdata get_vtbl(want_vtbl_regdata)
107 # define VTBL_regdatum get_vtbl(want_vtbl_regdatum)
108 # ifdef USE_LOCALE_COLLATE
109 # define VTBL_collxfrm get_vtbl(want_vtbl_collxfrm)
111 # define VTBL_amagic get_vtbl(want_vtbl_amagic)
112 # define VTBL_amagicelem get_vtbl(want_vtbl_amagicelem)
114 # define VTBL_sv &PL_vtbl_sv
115 # define VTBL_env &PL_vtbl_env
116 # define VTBL_envelem &PL_vtbl_envelem
117 # define VTBL_sig &PL_vtbl_sig
118 # define VTBL_sigelem &PL_vtbl_sigelem
119 # define VTBL_pack &PL_vtbl_pack
120 # define VTBL_packelem &PL_vtbl_packelem
121 # define VTBL_dbline &PL_vtbl_dbline
122 # define VTBL_isa &PL_vtbl_isa
123 # define VTBL_isaelem &PL_vtbl_isaelem
124 # define VTBL_arylen &PL_vtbl_arylen
125 # define VTBL_glob &PL_vtbl_glob
126 # define VTBL_mglob &PL_vtbl_mglob
127 # define VTBL_nkeys &PL_vtbl_nkeys
128 # define VTBL_taint &PL_vtbl_taint
129 # define VTBL_substr &PL_vtbl_substr
130 # define VTBL_vec &PL_vtbl_vec
131 # define VTBL_pos &PL_vtbl_pos
132 # define VTBL_bm &PL_vtbl_bm
133 # define VTBL_fm &PL_vtbl_fm
134 # define VTBL_uvar &PL_vtbl_uvar
135 # define VTBL_defelem &PL_vtbl_defelem
136 # define VTBL_regexp &PL_vtbl_regexp
137 # define VTBL_regdata &PL_vtbl_regdata
138 # define VTBL_regdatum &PL_vtbl_regdatum
139 # ifdef USE_LOCALE_COLLATE
140 # define VTBL_collxfrm &PL_vtbl_collxfrm
142 # define VTBL_amagic &PL_vtbl_amagic
143 # define VTBL_amagicelem &PL_vtbl_amagicelem
147 # include "objXSUB.h"
149 # undef PERL_OBJECT_THIS
150 # define PERL_OBJECT_THIS pPerl
151 # undef PERL_OBJECT_THIS_
152 # define PERL_OBJECT_THIS_ pPerl,
154 # undef SAVEDESTRUCTOR
155 # define SAVEDESTRUCTOR(f,p) \
156 pPerl->Perl_save_destructor((FUNC_NAME_TO_PTR(f)),(p))
159 # ifndef WIN32IO_IS_STDIO
161 # define errno ErrorNo()
164 # define ErrorNo pPerl->ErrorNo
166 # define NtCrypt pPerl->NtCrypt
168 # define NtGetLib pPerl->NtGetLib
170 # define NtGetArchLib pPerl->NtGetArchLib
172 # define NtGetSiteLib pPerl->NtGetSiteLib
174 # define NtGetBin pPerl->NtGetBin
175 # undef NtGetDebugScriptStr
176 # define NtGetDebugScriptStr pPerl->NtGetDebugScriptStr
195 # define mkdir PerlDir_mkdir
196 # define chdir PerlDir_chdir
197 # define rmdir PerlDir_rmdir
198 # define closedir PerlDir_close
199 # define opendir PerlDir_open
200 # define readdir PerlDir_read
201 # define rewinddir PerlDir_rewind
202 # define seekdir PerlDir_seek
203 # define telldir PerlDir_tell
204 # define putenv PerlEnv_putenv
205 # define getenv PerlEnv_getenv
206 # define stdin PerlIO_stdin()
207 # define stdout PerlIO_stdout()
208 # define stderr PerlIO_stderr()
209 # define fopen PerlIO_open
210 # define fclose PerlIO_close
211 # define feof PerlIO_eof
212 # define ferror PerlIO_error
213 # define fclearerr PerlIO_clearerr
214 # define getc PerlIO_getc
215 # define fputc(c, f) PerlIO_putc(f,c)
216 # define fputs(s, f) PerlIO_puts(f,s)
217 # define fflush PerlIO_flush
218 # define ungetc(c, f) PerlIO_ungetc((f),(c))
219 # define fileno PerlIO_fileno
220 # define fdopen PerlIO_fdopen
221 # define freopen PerlIO_reopen
222 # define fread(b,s,c,f) PerlIO_read((f),(b),(s*c))
223 # define fwrite(b,s,c,f) PerlIO_write((f),(b),(s*c))
224 # define setbuf PerlIO_setbuf
225 # define setvbuf PerlIO_setvbuf
226 # define setlinebuf PerlIO_setlinebuf
227 # define stdoutf PerlIO_stdoutf
228 # define vfprintf PerlIO_vprintf
229 # define ftell PerlIO_tell
230 # define fseek PerlIO_seek
231 # define fgetpos PerlIO_getpos
232 # define fsetpos PerlIO_setpos
233 # define frewind PerlIO_rewind
234 # define tmpfile PerlIO_tmpfile
235 # define access PerlLIO_access
236 # define chmod PerlLIO_chmod
237 # define chsize PerlLIO_chsize
238 # define close PerlLIO_close
239 # define dup PerlLIO_dup
240 # define dup2 PerlLIO_dup2
241 # define flock PerlLIO_flock
242 # define fstat PerlLIO_fstat
243 # define ioctl PerlLIO_ioctl
244 # define isatty PerlLIO_isatty
245 # define lseek PerlLIO_lseek
246 # define lstat PerlLIO_lstat
247 # define mktemp PerlLIO_mktemp
248 # define open PerlLIO_open
249 # define read PerlLIO_read
250 # define rename PerlLIO_rename
251 # define setmode PerlLIO_setmode
252 # define stat PerlLIO_stat
253 # define tmpnam PerlLIO_tmpnam
254 # define umask PerlLIO_umask
255 # define unlink PerlLIO_unlink
256 # define utime PerlLIO_utime
257 # define write PerlLIO_write
258 # define malloc PerlMem_malloc
259 # define realloc PerlMem_realloc
260 # define free PerlMem_free
261 # define abort PerlProc_abort
262 # define exit PerlProc_exit
263 # define _exit PerlProc__exit
264 # define execl PerlProc_execl
265 # define execv PerlProc_execv
266 # define execvp PerlProc_execvp
267 # define getuid PerlProc_getuid
268 # define geteuid PerlProc_geteuid
269 # define getgid PerlProc_getgid
270 # define getegid PerlProc_getegid
271 # define getlogin PerlProc_getlogin
272 # define kill PerlProc_kill
273 # define killpg PerlProc_killpg
274 # define pause PerlProc_pause
275 # define popen PerlProc_popen
276 # define pclose PerlProc_pclose
277 # define pipe PerlProc_pipe
278 # define setuid PerlProc_setuid
279 # define setgid PerlProc_setgid
280 # define sleep PerlProc_sleep
281 # define times PerlProc_times
282 # define wait PerlProc_wait
283 # define setjmp PerlProc_setjmp
284 # define longjmp PerlProc_longjmp
285 # define signal PerlProc_signal
286 # define htonl PerlSock_htonl
287 # define htons PerlSock_htons
288 # define ntohl PerlSock_ntohl
289 # define ntohs PerlSock_ntohs
290 # define accept PerlSock_accept
291 # define bind PerlSock_bind
292 # define connect PerlSock_connect
293 # define endhostent PerlSock_endhostent
294 # define endnetent PerlSock_endnetent
295 # define endprotoent PerlSock_endprotoent
296 # define endservent PerlSock_endservent
297 # define gethostbyaddr PerlSock_gethostbyaddr
298 # define gethostbyname PerlSock_gethostbyname
299 # define gethostent PerlSock_gethostent
300 # define gethostname PerlSock_gethostname
301 # define getnetbyaddr PerlSock_getnetbyaddr
302 # define getnetbyname PerlSock_getnetbyname
303 # define getnetent PerlSock_getnetent
304 # define getpeername PerlSock_getpeername
305 # define getprotobyname PerlSock_getprotobyname
306 # define getprotobynumber PerlSock_getprotobynumber
307 # define getprotoent PerlSock_getprotoent
308 # define getservbyname PerlSock_getservbyname
309 # define getservbyport PerlSock_getservbyport
310 # define getservent PerlSock_getservent
311 # define getsockname PerlSock_getsockname
312 # define getsockopt PerlSock_getsockopt
313 # define inet_addr PerlSock_inet_addr
314 # define inet_ntoa PerlSock_inet_ntoa
315 # define listen PerlSock_listen
316 # define recv PerlSock_recv
317 # define recvfrom PerlSock_recvfrom
318 # define select PerlSock_select
319 # define send PerlSock_send
320 # define sendto PerlSock_sendto
321 # define sethostent PerlSock_sethostent
322 # define setnetent PerlSock_setnetent
323 # define setprotoent PerlSock_setprotoent
324 # define setservent PerlSock_setservent
325 # define setsockopt PerlSock_setsockopt
326 # define shutdown PerlSock_shutdown
327 # define socket PerlSock_socket
328 # define socketpair PerlSock_socketpair
333 # endif /* NO_XSLOCKS */
336 # include "perlCAPI.h"
338 #endif /* PERL_OBJECT */