Commit | Line | Data |
0f4eea8f |
1 | /* |
2 | * iperlsys.h - Perl's interface to the system |
3 | * |
4 | * This file defines the system level functionality that perl needs. |
5 | * |
6 | * When using C, this definition is in the form of a set of macros |
7 | * that can be #defined to the system-level function (or a wrapper |
8 | * provided elsewhere). |
9 | * |
10 | * When using C++ with -DPERL_OBJECT, this definition is in the |
11 | * form of a set of virtual base classes which must be subclassed to |
12 | * provide a real implementation. The Perl Object will use instances |
13 | * of this implementation to use the system-level functionality. |
14 | * |
15 | * GSAR 21-JUN-98 |
16 | */ |
17 | |
18 | #ifndef __Inc__IPerl___ |
19 | #define __Inc__IPerl___ |
20 | |
21 | /* |
22 | * PerlXXX_YYY explained - DickH and DougL @ ActiveState.com |
23 | * |
24 | * XXX := functional group |
25 | * YYY := stdlib/OS function name |
26 | * |
27 | * Continuing with the theme of PerlIO, all OS functionality was |
28 | * encapsulated into one of several interfaces. |
29 | * |
30 | * PerlIO - stdio |
31 | * PerlLIO - low level I/O |
32 | * PerlMem - malloc, realloc, free |
33 | * PerlDir - directory related |
34 | * PerlEnv - process environment handling |
35 | * PerlProc - process control |
36 | * PerlSock - socket functions |
37 | * |
38 | * |
39 | * The features of this are: |
40 | * 1. All OS dependant code is in the Perl Host and not the Perl Core. |
41 | * (At least this is the holy grail goal of this work) |
42 | * 2. The Perl Host (see perl.h for description) can provide a new and |
43 | * improved interface to OS functionality if required. |
44 | * 3. Developers can easily hook into the OS calls for instrumentation |
45 | * or diagnostic purposes. |
46 | * |
47 | * What was changed to do this: |
48 | * 1. All calls to OS functions were replaced with PerlXXX_YYY |
49 | * |
50 | */ |
51 | |
52 | |
53 | /* |
54 | Interface for perl stdio functions |
55 | */ |
56 | |
57 | |
58 | /* Clean up (or at least document) the various possible #defines. |
59 | This section attempts to match the 5.003_03 Configure variables |
60 | onto the 5.003_02 header file values. |
61 | I can't figure out where USE_STDIO was supposed to be set. |
62 | --AD |
63 | */ |
64 | #ifndef USE_PERLIO |
65 | # define PERLIO_IS_STDIO |
66 | #endif |
67 | |
68 | /* Below is the 5.003_02 stuff. */ |
69 | #ifdef USE_STDIO |
70 | # ifndef PERLIO_IS_STDIO |
71 | # define PERLIO_IS_STDIO |
72 | # endif |
73 | #else |
20ce7b12 |
74 | extern void PerlIO_init (void); |
0f4eea8f |
75 | #endif |
76 | |
d543acb6 |
77 | #ifndef Sighandler_t |
78 | typedef Signal_t (*Sighandler_t) (int); |
79 | #endif |
80 | |
c5be433b |
81 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f |
82 | |
83 | #ifndef PerlIO |
84 | typedef struct _PerlIO PerlIO; |
85 | #endif |
86 | |
0cb96387 |
87 | /* IPerlStdIO */ |
88 | struct IPerlStdIO; |
7766f137 |
89 | struct IPerlStdIOInfo; |
0cb96387 |
90 | typedef PerlIO* (*LPStdin)(struct IPerlStdIO*); |
91 | typedef PerlIO* (*LPStdout)(struct IPerlStdIO*); |
92 | typedef PerlIO* (*LPStderr)(struct IPerlStdIO*); |
93 | typedef PerlIO* (*LPOpen)(struct IPerlStdIO*, const char*, |
94 | const char*); |
95 | typedef int (*LPClose)(struct IPerlStdIO*, PerlIO*); |
96 | typedef int (*LPEof)(struct IPerlStdIO*, PerlIO*); |
97 | typedef int (*LPError)(struct IPerlStdIO*, PerlIO*); |
98 | typedef void (*LPClearerr)(struct IPerlStdIO*, PerlIO*); |
99 | typedef int (*LPGetc)(struct IPerlStdIO*, PerlIO*); |
100 | typedef char* (*LPGetBase)(struct IPerlStdIO*, PerlIO*); |
101 | typedef int (*LPGetBufsiz)(struct IPerlStdIO*, PerlIO*); |
102 | typedef int (*LPGetCnt)(struct IPerlStdIO*, PerlIO*); |
103 | typedef char* (*LPGetPtr)(struct IPerlStdIO*, PerlIO*); |
104 | typedef char* (*LPGets)(struct IPerlStdIO*, PerlIO*, char*, int); |
105 | typedef int (*LPPutc)(struct IPerlStdIO*, PerlIO*, int); |
106 | typedef int (*LPPuts)(struct IPerlStdIO*, PerlIO*, const char*); |
107 | typedef int (*LPFlush)(struct IPerlStdIO*, PerlIO*); |
108 | typedef int (*LPUngetc)(struct IPerlStdIO*, PerlIO*,int); |
109 | typedef int (*LPFileno)(struct IPerlStdIO*, PerlIO*); |
110 | typedef PerlIO* (*LPFdopen)(struct IPerlStdIO*, int, const char*); |
111 | typedef PerlIO* (*LPReopen)(struct IPerlStdIO*, const char*, |
112 | const char*, PerlIO*); |
113 | typedef SSize_t (*LPRead)(struct IPerlStdIO*, PerlIO*, void*, Size_t); |
114 | typedef SSize_t (*LPWrite)(struct IPerlStdIO*, PerlIO*, const void*, |
115 | Size_t); |
116 | typedef void (*LPSetBuf)(struct IPerlStdIO*, PerlIO*, char*); |
117 | typedef int (*LPSetVBuf)(struct IPerlStdIO*, PerlIO*, char*, int, |
118 | Size_t); |
119 | typedef void (*LPSetCnt)(struct IPerlStdIO*, PerlIO*, int); |
120 | typedef void (*LPSetPtrCnt)(struct IPerlStdIO*, PerlIO*, char*, |
121 | int); |
122 | typedef void (*LPSetlinebuf)(struct IPerlStdIO*, PerlIO*); |
123 | typedef int (*LPPrintf)(struct IPerlStdIO*, PerlIO*, const char*, |
124 | ...); |
125 | typedef int (*LPVprintf)(struct IPerlStdIO*, PerlIO*, const char*, |
126 | va_list); |
127 | typedef long (*LPTell)(struct IPerlStdIO*, PerlIO*); |
128 | typedef int (*LPSeek)(struct IPerlStdIO*, PerlIO*, Off_t, int); |
129 | typedef void (*LPRewind)(struct IPerlStdIO*, PerlIO*); |
130 | typedef PerlIO* (*LPTmpfile)(struct IPerlStdIO*); |
131 | typedef int (*LPGetpos)(struct IPerlStdIO*, PerlIO*, Fpos_t*); |
132 | typedef int (*LPSetpos)(struct IPerlStdIO*, PerlIO*, |
133 | const Fpos_t*); |
134 | typedef void (*LPInit)(struct IPerlStdIO*); |
135 | typedef void (*LPInitOSExtras)(struct IPerlStdIO*); |
7766f137 |
136 | typedef PerlIO* (*LPFdupopen)(struct IPerlStdIO*, PerlIO*); |
0cb96387 |
137 | |
138 | struct IPerlStdIO |
0f4eea8f |
139 | { |
0cb96387 |
140 | LPStdin pStdin; |
141 | LPStdout pStdout; |
142 | LPStderr pStderr; |
143 | LPOpen pOpen; |
144 | LPClose pClose; |
145 | LPEof pEof; |
146 | LPError pError; |
147 | LPClearerr pClearerr; |
148 | LPGetc pGetc; |
149 | LPGetBase pGetBase; |
150 | LPGetBufsiz pGetBufsiz; |
151 | LPGetCnt pGetCnt; |
152 | LPGetPtr pGetPtr; |
153 | LPGets pGets; |
154 | LPPutc pPutc; |
155 | LPPuts pPuts; |
156 | LPFlush pFlush; |
157 | LPUngetc pUngetc; |
158 | LPFileno pFileno; |
159 | LPFdopen pFdopen; |
160 | LPReopen pReopen; |
161 | LPRead pRead; |
162 | LPWrite pWrite; |
163 | LPSetBuf pSetBuf; |
164 | LPSetVBuf pSetVBuf; |
165 | LPSetCnt pSetCnt; |
166 | LPSetPtrCnt pSetPtrCnt; |
167 | LPSetlinebuf pSetlinebuf; |
168 | LPPrintf pPrintf; |
169 | LPVprintf pVprintf; |
170 | LPTell pTell; |
171 | LPSeek pSeek; |
172 | LPRewind pRewind; |
173 | LPTmpfile pTmpfile; |
174 | LPGetpos pGetpos; |
175 | LPSetpos pSetpos; |
176 | LPInit pInit; |
177 | LPInitOSExtras pInitOSExtras; |
7766f137 |
178 | LPFdupopen pFdupopen; |
0f4eea8f |
179 | }; |
180 | |
0cb96387 |
181 | struct IPerlStdIOInfo |
182 | { |
183 | unsigned long nCount; /* number of entries expected */ |
184 | struct IPerlStdIO perlStdIOList; |
185 | }; |
2bd2b9e0 |
186 | |
187 | #ifdef USE_STDIO_PTR |
188 | # define PerlIO_has_cntptr(f) 1 |
189 | # ifdef STDIO_CNT_LVALUE |
190 | # define PerlIO_canset_cnt(f) 1 |
191 | # ifdef STDIO_PTR_LVALUE |
192 | # define PerlIO_fast_gets(f) 1 |
193 | # endif |
194 | # else |
195 | # define PerlIO_canset_cnt(f) 0 |
196 | # endif |
197 | #else /* USE_STDIO_PTR */ |
198 | # define PerlIO_has_cntptr(f) 0 |
199 | # define PerlIO_canset_cnt(f) 0 |
200 | #endif /* USE_STDIO_PTR */ |
201 | |
202 | #ifndef PerlIO_fast_gets |
203 | #define PerlIO_fast_gets(f) 0 |
204 | #endif |
205 | |
206 | #ifdef FILE_base |
207 | #define PerlIO_has_base(f) 1 |
208 | #else |
209 | #define PerlIO_has_base(f) 0 |
210 | #endif |
0f4eea8f |
211 | |
0cb96387 |
212 | #define PerlIO_stdin() \ |
51371543 |
213 | (*PL_StdIO->pStdin)(PL_StdIO) |
0cb96387 |
214 | #define PerlIO_stdout() \ |
51371543 |
215 | (*PL_StdIO->pStdout)(PL_StdIO) |
0cb96387 |
216 | #define PerlIO_stderr() \ |
51371543 |
217 | (*PL_StdIO->pStderr)(PL_StdIO) |
0cb96387 |
218 | #define PerlIO_open(x,y) \ |
51371543 |
219 | (*PL_StdIO->pOpen)(PL_StdIO, (x),(y)) |
0cb96387 |
220 | #define PerlIO_close(f) \ |
51371543 |
221 | (*PL_StdIO->pClose)(PL_StdIO, (f)) |
0cb96387 |
222 | #define PerlIO_eof(f) \ |
51371543 |
223 | (*PL_StdIO->pEof)(PL_StdIO, (f)) |
0cb96387 |
224 | #define PerlIO_error(f) \ |
51371543 |
225 | (*PL_StdIO->pError)(PL_StdIO, (f)) |
0cb96387 |
226 | #define PerlIO_clearerr(f) \ |
51371543 |
227 | (*PL_StdIO->pClearerr)(PL_StdIO, (f)) |
0cb96387 |
228 | #define PerlIO_getc(f) \ |
51371543 |
229 | (*PL_StdIO->pGetc)(PL_StdIO, (f)) |
a20bf0c3 |
230 | #define PerlIO_get_base(f) \ |
51371543 |
231 | (*PL_StdIO->pGetBase)(PL_StdIO, (f)) |
a20bf0c3 |
232 | #define PerlIO_get_bufsiz(f) \ |
51371543 |
233 | (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f)) |
a20bf0c3 |
234 | #define PerlIO_get_cnt(f) \ |
51371543 |
235 | (*PL_StdIO->pGetCnt)(PL_StdIO, (f)) |
a20bf0c3 |
236 | #define PerlIO_get_ptr(f) \ |
51371543 |
237 | (*PL_StdIO->pGetPtr)(PL_StdIO, (f)) |
0cb96387 |
238 | #define PerlIO_putc(f,c) \ |
51371543 |
239 | (*PL_StdIO->pPutc)(PL_StdIO, (f),(c)) |
0cb96387 |
240 | #define PerlIO_puts(f,s) \ |
51371543 |
241 | (*PL_StdIO->pPuts)(PL_StdIO, (f),(s)) |
0cb96387 |
242 | #define PerlIO_flush(f) \ |
51371543 |
243 | (*PL_StdIO->pFlush)(PL_StdIO, (f)) |
0cb96387 |
244 | #define PerlIO_gets(s, n, fp) \ |
51371543 |
245 | (*PL_StdIO->pGets)(PL_StdIO, (fp), s, n) |
0cb96387 |
246 | #define PerlIO_ungetc(f,c) \ |
51371543 |
247 | (*PL_StdIO->pUngetc)(PL_StdIO, (f),(c)) |
0cb96387 |
248 | #define PerlIO_fileno(f) \ |
51371543 |
249 | (*PL_StdIO->pFileno)(PL_StdIO, (f)) |
0cb96387 |
250 | #define PerlIO_fdopen(f, s) \ |
51371543 |
251 | (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s)) |
0cb96387 |
252 | #define PerlIO_reopen(p, m, f) \ |
51371543 |
253 | (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f)) |
0f4eea8f |
254 | #define PerlIO_read(f,buf,count) \ |
51371543 |
255 | (SSize_t)(*PL_StdIO->pRead)(PL_StdIO, (f), (buf), (count)) |
0f4eea8f |
256 | #define PerlIO_write(f,buf,count) \ |
51371543 |
257 | (*PL_StdIO->pWrite)(PL_StdIO, (f), (buf), (count)) |
0cb96387 |
258 | #define PerlIO_setbuf(f,b) \ |
51371543 |
259 | (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b)) |
0cb96387 |
260 | #define PerlIO_setvbuf(f,b,t,s) \ |
51371543 |
261 | (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s)) |
a20bf0c3 |
262 | #define PerlIO_set_cnt(f,c) \ |
51371543 |
263 | (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c)) |
a20bf0c3 |
264 | #define PerlIO_set_ptrcnt(f,p,c) \ |
51371543 |
265 | (*PL_StdIO->pSetPtrCnt)(PL_StdIO, (f), (p), (c)) |
0cb96387 |
266 | #define PerlIO_setlinebuf(f) \ |
51371543 |
267 | (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f)) |
c5be433b |
268 | #define PerlIO_printf Perl_fprintf_nocontext |
51371543 |
269 | #define PerlIO_stdoutf *PL_StdIO->pPrintf |
0cb96387 |
270 | #define PerlIO_vprintf(f,fmt,a) \ |
51371543 |
271 | (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a) |
0cb96387 |
272 | #define PerlIO_tell(f) \ |
51371543 |
273 | (*PL_StdIO->pTell)(PL_StdIO, (f)) |
0cb96387 |
274 | #define PerlIO_seek(f,o,w) \ |
51371543 |
275 | (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w)) |
0cb96387 |
276 | #define PerlIO_getpos(f,p) \ |
51371543 |
277 | (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p)) |
0cb96387 |
278 | #define PerlIO_setpos(f,p) \ |
51371543 |
279 | (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p)) |
0cb96387 |
280 | #define PerlIO_rewind(f) \ |
51371543 |
281 | (*PL_StdIO->pRewind)(PL_StdIO, (f)) |
0cb96387 |
282 | #define PerlIO_tmpfile() \ |
51371543 |
283 | (*PL_StdIO->pTmpfile)(PL_StdIO) |
0cb96387 |
284 | #define PerlIO_init() \ |
51371543 |
285 | (*PL_StdIO->pInit)(PL_StdIO) |
0f4eea8f |
286 | #undef init_os_extras |
c5be433b |
287 | #define init_os_extras() \ |
51371543 |
288 | (*PL_StdIO->pInitOSExtras)(PL_StdIO) |
7766f137 |
289 | #define PerlIO_fdupopen(f) \ |
290 | (*PL_StdIO->pFdupopen)(PL_StdIO, (f)) |
0f4eea8f |
291 | |
c5be433b |
292 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
293 | |
294 | #include "perlsdio.h" |
d9b3e12d |
295 | #include "perl.h" |
014822e4 |
296 | #define PerlIO_fdupopen(f) (f) |
0f4eea8f |
297 | |
c5be433b |
298 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
299 | |
300 | #ifndef PERLIO_IS_STDIO |
301 | #ifdef USE_SFIO |
302 | #include "perlsfio.h" |
303 | #endif /* USE_SFIO */ |
304 | #endif /* PERLIO_IS_STDIO */ |
305 | |
306 | #ifndef EOF |
307 | #define EOF (-1) |
308 | #endif |
309 | |
310 | /* This is to catch case with no stdio */ |
311 | #ifndef BUFSIZ |
312 | #define BUFSIZ 1024 |
313 | #endif |
314 | |
315 | #ifndef SEEK_SET |
316 | #define SEEK_SET 0 |
317 | #endif |
318 | |
319 | #ifndef SEEK_CUR |
320 | #define SEEK_CUR 1 |
321 | #endif |
322 | |
323 | #ifndef SEEK_END |
324 | #define SEEK_END 2 |
325 | #endif |
326 | |
327 | #ifndef PerlIO |
328 | struct _PerlIO; |
329 | #define PerlIO struct _PerlIO |
330 | #endif /* No PerlIO */ |
331 | |
332 | #ifndef Fpos_t |
333 | #define Fpos_t long |
334 | #endif |
335 | |
336 | #ifndef NEXT30_NO_ATTRIBUTE |
337 | #ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */ |
338 | #ifdef __attribute__ /* Avoid possible redefinition errors */ |
339 | #undef __attribute__ |
340 | #endif |
341 | #define __attribute__(attr) |
342 | #endif |
343 | #endif |
344 | |
345 | #ifndef PerlIO_stdoutf |
20ce7b12 |
346 | extern int PerlIO_stdoutf (const char *,...) |
5db10396 |
347 | __attribute__((__format__ (__printf__, 1, 2))); |
0f4eea8f |
348 | #endif |
349 | #ifndef PerlIO_puts |
20ce7b12 |
350 | extern int PerlIO_puts (PerlIO *,const char *); |
0f4eea8f |
351 | #endif |
352 | #ifndef PerlIO_open |
20ce7b12 |
353 | extern PerlIO * PerlIO_open (const char *,const char *); |
0f4eea8f |
354 | #endif |
355 | #ifndef PerlIO_close |
20ce7b12 |
356 | extern int PerlIO_close (PerlIO *); |
0f4eea8f |
357 | #endif |
358 | #ifndef PerlIO_eof |
20ce7b12 |
359 | extern int PerlIO_eof (PerlIO *); |
0f4eea8f |
360 | #endif |
361 | #ifndef PerlIO_error |
20ce7b12 |
362 | extern int PerlIO_error (PerlIO *); |
0f4eea8f |
363 | #endif |
364 | #ifndef PerlIO_clearerr |
20ce7b12 |
365 | extern void PerlIO_clearerr (PerlIO *); |
0f4eea8f |
366 | #endif |
367 | #ifndef PerlIO_getc |
20ce7b12 |
368 | extern int PerlIO_getc (PerlIO *); |
0f4eea8f |
369 | #endif |
370 | #ifndef PerlIO_putc |
20ce7b12 |
371 | extern int PerlIO_putc (PerlIO *,int); |
0f4eea8f |
372 | #endif |
373 | #ifndef PerlIO_flush |
20ce7b12 |
374 | extern int PerlIO_flush (PerlIO *); |
0f4eea8f |
375 | #endif |
376 | #ifndef PerlIO_ungetc |
20ce7b12 |
377 | extern int PerlIO_ungetc (PerlIO *,int); |
0f4eea8f |
378 | #endif |
379 | #ifndef PerlIO_fileno |
20ce7b12 |
380 | extern int PerlIO_fileno (PerlIO *); |
0f4eea8f |
381 | #endif |
382 | #ifndef PerlIO_fdopen |
20ce7b12 |
383 | extern PerlIO * PerlIO_fdopen (int, const char *); |
0f4eea8f |
384 | #endif |
385 | #ifndef PerlIO_importFILE |
20ce7b12 |
386 | extern PerlIO * PerlIO_importFILE (FILE *,int); |
0f4eea8f |
387 | #endif |
388 | #ifndef PerlIO_exportFILE |
20ce7b12 |
389 | extern FILE * PerlIO_exportFILE (PerlIO *,int); |
0f4eea8f |
390 | #endif |
391 | #ifndef PerlIO_findFILE |
20ce7b12 |
392 | extern FILE * PerlIO_findFILE (PerlIO *); |
0f4eea8f |
393 | #endif |
394 | #ifndef PerlIO_releaseFILE |
20ce7b12 |
395 | extern void PerlIO_releaseFILE (PerlIO *,FILE *); |
0f4eea8f |
396 | #endif |
397 | #ifndef PerlIO_read |
20ce7b12 |
398 | extern SSize_t PerlIO_read (PerlIO *,void *,Size_t); |
0f4eea8f |
399 | #endif |
400 | #ifndef PerlIO_write |
20ce7b12 |
401 | extern SSize_t PerlIO_write (PerlIO *,const void *,Size_t); |
0f4eea8f |
402 | #endif |
403 | #ifndef PerlIO_setlinebuf |
20ce7b12 |
404 | extern void PerlIO_setlinebuf (PerlIO *); |
0f4eea8f |
405 | #endif |
406 | #ifndef PerlIO_printf |
20ce7b12 |
407 | extern int PerlIO_printf (PerlIO *, const char *,...) |
5db10396 |
408 | __attribute__((__format__ (__printf__, 2, 3))); |
0f4eea8f |
409 | #endif |
410 | #ifndef PerlIO_sprintf |
20ce7b12 |
411 | extern int PerlIO_sprintf (char *, int, const char *,...) |
5db10396 |
412 | __attribute__((__format__ (__printf__, 3, 4))); |
0f4eea8f |
413 | #endif |
414 | #ifndef PerlIO_vprintf |
20ce7b12 |
415 | extern int PerlIO_vprintf (PerlIO *, const char *, va_list); |
0f4eea8f |
416 | #endif |
417 | #ifndef PerlIO_tell |
20ce7b12 |
418 | extern Off_t PerlIO_tell (PerlIO *); |
0f4eea8f |
419 | #endif |
420 | #ifndef PerlIO_seek |
20ce7b12 |
421 | extern int PerlIO_seek (PerlIO *, Off_t, int); |
0f4eea8f |
422 | #endif |
423 | #ifndef PerlIO_rewind |
20ce7b12 |
424 | extern void PerlIO_rewind (PerlIO *); |
0f4eea8f |
425 | #endif |
426 | #ifndef PerlIO_has_base |
20ce7b12 |
427 | extern int PerlIO_has_base (PerlIO *); |
0f4eea8f |
428 | #endif |
429 | #ifndef PerlIO_has_cntptr |
20ce7b12 |
430 | extern int PerlIO_has_cntptr (PerlIO *); |
0f4eea8f |
431 | #endif |
432 | #ifndef PerlIO_fast_gets |
20ce7b12 |
433 | extern int PerlIO_fast_gets (PerlIO *); |
0f4eea8f |
434 | #endif |
435 | #ifndef PerlIO_canset_cnt |
20ce7b12 |
436 | extern int PerlIO_canset_cnt (PerlIO *); |
0f4eea8f |
437 | #endif |
438 | #ifndef PerlIO_get_ptr |
a20bf0c3 |
439 | extern STDCHAR * PerlIO_get_ptr (PerlIO *); |
0f4eea8f |
440 | #endif |
441 | #ifndef PerlIO_get_cnt |
a20bf0c3 |
442 | extern int PerlIO_get_cnt (PerlIO *); |
0f4eea8f |
443 | #endif |
444 | #ifndef PerlIO_set_cnt |
a20bf0c3 |
445 | extern void PerlIO_set_cnt (PerlIO *,int); |
0f4eea8f |
446 | #endif |
447 | #ifndef PerlIO_set_ptrcnt |
a20bf0c3 |
448 | extern void PerlIO_set_ptrcnt (PerlIO *,STDCHAR *,int); |
0f4eea8f |
449 | #endif |
450 | #ifndef PerlIO_get_base |
a20bf0c3 |
451 | extern STDCHAR * PerlIO_get_base (PerlIO *); |
0f4eea8f |
452 | #endif |
453 | #ifndef PerlIO_get_bufsiz |
a20bf0c3 |
454 | extern int PerlIO_get_bufsiz (PerlIO *); |
0f4eea8f |
455 | #endif |
456 | #ifndef PerlIO_tmpfile |
20ce7b12 |
457 | extern PerlIO * PerlIO_tmpfile (void); |
0f4eea8f |
458 | #endif |
459 | #ifndef PerlIO_stdin |
20ce7b12 |
460 | extern PerlIO * PerlIO_stdin (void); |
0f4eea8f |
461 | #endif |
462 | #ifndef PerlIO_stdout |
20ce7b12 |
463 | extern PerlIO * PerlIO_stdout (void); |
0f4eea8f |
464 | #endif |
465 | #ifndef PerlIO_stderr |
20ce7b12 |
466 | extern PerlIO * PerlIO_stderr (void); |
0f4eea8f |
467 | #endif |
468 | #ifndef PerlIO_getpos |
20ce7b12 |
469 | extern int PerlIO_getpos (PerlIO *,Fpos_t *); |
0f4eea8f |
470 | #endif |
471 | #ifndef PerlIO_setpos |
20ce7b12 |
472 | extern int PerlIO_setpos (PerlIO *,const Fpos_t *); |
0f4eea8f |
473 | #endif |
7766f137 |
474 | #ifndef PerlIO_fdupopen |
475 | extern PerlIO * PerlIO_fdupopen (PerlIO *); |
476 | #endif |
0f4eea8f |
477 | |
478 | |
479 | /* |
480 | * Interface for directory functions |
481 | */ |
482 | |
c5be433b |
483 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f |
484 | |
0cb96387 |
485 | /* IPerlDir */ |
486 | struct IPerlDir; |
7766f137 |
487 | struct IPerlDirInfo; |
0cb96387 |
488 | typedef int (*LPMakedir)(struct IPerlDir*, const char*, int); |
489 | typedef int (*LPChdir)(struct IPerlDir*, const char*); |
490 | typedef int (*LPRmdir)(struct IPerlDir*, const char*); |
491 | typedef int (*LPDirClose)(struct IPerlDir*, DIR*); |
492 | typedef DIR* (*LPDirOpen)(struct IPerlDir*, char*); |
493 | typedef struct direct* (*LPDirRead)(struct IPerlDir*, DIR*); |
494 | typedef void (*LPDirRewind)(struct IPerlDir*, DIR*); |
495 | typedef void (*LPDirSeek)(struct IPerlDir*, DIR*, long); |
496 | typedef long (*LPDirTell)(struct IPerlDir*, DIR*); |
7766f137 |
497 | #ifdef WIN32 |
498 | typedef char* (*LPDirMapPathA)(struct IPerlDir*, const char*); |
499 | typedef WCHAR* (*LPDirMapPathW)(struct IPerlDir*, const WCHAR*); |
500 | #endif |
0cb96387 |
501 | |
502 | struct IPerlDir |
0f4eea8f |
503 | { |
0cb96387 |
504 | LPMakedir pMakedir; |
505 | LPChdir pChdir; |
506 | LPRmdir pRmdir; |
507 | LPDirClose pClose; |
508 | LPDirOpen pOpen; |
509 | LPDirRead pRead; |
510 | LPDirRewind pRewind; |
511 | LPDirSeek pSeek; |
512 | LPDirTell pTell; |
7766f137 |
513 | #ifdef WIN32 |
514 | LPDirMapPathA pMapPathA; |
515 | LPDirMapPathW pMapPathW; |
516 | #endif |
0cb96387 |
517 | }; |
518 | |
519 | struct IPerlDirInfo |
520 | { |
521 | unsigned long nCount; /* number of entries expected */ |
522 | struct IPerlDir perlDirList; |
0f4eea8f |
523 | }; |
524 | |
525 | #define PerlDir_mkdir(name, mode) \ |
51371543 |
526 | (*PL_Dir->pMakedir)(PL_Dir, (name), (mode)) |
0f4eea8f |
527 | #define PerlDir_chdir(name) \ |
51371543 |
528 | (*PL_Dir->pChdir)(PL_Dir, (name)) |
0f4eea8f |
529 | #define PerlDir_rmdir(name) \ |
51371543 |
530 | (*PL_Dir->pRmdir)(PL_Dir, (name)) |
0f4eea8f |
531 | #define PerlDir_close(dir) \ |
51371543 |
532 | (*PL_Dir->pClose)(PL_Dir, (dir)) |
0f4eea8f |
533 | #define PerlDir_open(name) \ |
51371543 |
534 | (*PL_Dir->pOpen)(PL_Dir, (name)) |
0f4eea8f |
535 | #define PerlDir_read(dir) \ |
51371543 |
536 | (*PL_Dir->pRead)(PL_Dir, (dir)) |
0f4eea8f |
537 | #define PerlDir_rewind(dir) \ |
51371543 |
538 | (*PL_Dir->pRewind)(PL_Dir, (dir)) |
0f4eea8f |
539 | #define PerlDir_seek(dir, loc) \ |
51371543 |
540 | (*PL_Dir->pSeek)(PL_Dir, (dir), (loc)) |
0f4eea8f |
541 | #define PerlDir_tell(dir) \ |
51371543 |
542 | (*PL_Dir->pTell)(PL_Dir, (dir)) |
7766f137 |
543 | #ifdef WIN32 |
544 | #define PerlDir_mapA(dir) \ |
545 | (*PL_Dir->pMapPathA)(PL_Dir, (dir)) |
546 | #define PerlDir_mapW(dir) \ |
547 | (*PL_Dir->pMapPathW)(PL_Dir, (dir)) |
548 | #endif |
0f4eea8f |
549 | |
c5be433b |
550 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
551 | |
552 | #define PerlDir_mkdir(name, mode) Mkdir((name), (mode)) |
553 | #ifdef VMS |
554 | # define PerlDir_chdir(n) chdir(((n) && *(n)) ? (n) : "SYS$LOGIN") |
555 | #else |
556 | # define PerlDir_chdir(name) chdir((name)) |
557 | #endif |
558 | #define PerlDir_rmdir(name) rmdir((name)) |
559 | #define PerlDir_close(dir) closedir((dir)) |
560 | #define PerlDir_open(name) opendir((name)) |
561 | #define PerlDir_read(dir) readdir((dir)) |
562 | #define PerlDir_rewind(dir) rewinddir((dir)) |
563 | #define PerlDir_seek(dir, loc) seekdir((dir), (loc)) |
564 | #define PerlDir_tell(dir) telldir((dir)) |
7766f137 |
565 | #ifdef WIN32 |
566 | #define PerlDir_mapA(dir) dir |
567 | #define PerlDir_mapW(dir) dir |
568 | #endif |
0f4eea8f |
569 | |
c5be433b |
570 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
571 | |
572 | /* |
573 | Interface for perl environment functions |
574 | */ |
575 | |
c5be433b |
576 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f |
577 | |
0cb96387 |
578 | /* IPerlEnv */ |
579 | struct IPerlEnv; |
7766f137 |
580 | struct IPerlEnvInfo; |
0cb96387 |
581 | typedef char* (*LPEnvGetenv)(struct IPerlEnv*, const char*); |
582 | typedef int (*LPEnvPutenv)(struct IPerlEnv*, const char*); |
3075ddba |
583 | typedef char* (*LPEnvGetenv_len)(struct IPerlEnv*, |
0cb96387 |
584 | const char *varname, unsigned long *len); |
585 | typedef int (*LPEnvUname)(struct IPerlEnv*, struct utsname *name); |
586 | typedef void (*LPEnvClearenv)(struct IPerlEnv*); |
3075ddba |
587 | typedef void* (*LPEnvGetChildenv)(struct IPerlEnv*); |
588 | typedef void (*LPEnvFreeChildenv)(struct IPerlEnv*, void* env); |
589 | typedef char* (*LPEnvGetChilddir)(struct IPerlEnv*); |
590 | typedef void (*LPEnvFreeChilddir)(struct IPerlEnv*, char* dir); |
0cb96387 |
591 | #ifdef HAS_ENVGETENV |
3075ddba |
592 | typedef char* (*LPENVGetenv)(struct IPerlEnv*, const char *varname); |
593 | typedef char* (*LPENVGetenv_len)(struct IPerlEnv*, |
0cb96387 |
594 | const char *varname, unsigned long *len); |
595 | #endif |
596 | #ifdef WIN32 |
3075ddba |
597 | typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*); |
0cb96387 |
598 | typedef char* (*LPEnvLibPath)(struct IPerlEnv*, char*); |
599 | typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, char*); |
600 | #endif |
601 | |
602 | struct IPerlEnv |
0f4eea8f |
603 | { |
0cb96387 |
604 | LPEnvGetenv pGetenv; |
605 | LPEnvPutenv pPutenv; |
606 | LPEnvGetenv_len pGetenv_len; |
607 | LPEnvUname pEnvUname; |
608 | LPEnvClearenv pClearenv; |
3075ddba |
609 | LPEnvGetChildenv pGetChildenv; |
610 | LPEnvFreeChildenv pFreeChildenv; |
611 | LPEnvGetChilddir pGetChilddir; |
612 | LPEnvFreeChilddir pFreeChilddir; |
a6c40364 |
613 | #ifdef HAS_ENVGETENV |
0cb96387 |
614 | LPENVGetenv pENVGetenv; |
615 | LPENVGetenv_len pENVGetenv_len; |
616 | #endif |
617 | #ifdef WIN32 |
618 | LPEnvOsID pEnvOsID; |
619 | LPEnvLibPath pLibPath; |
620 | LPEnvSiteLibPath pSiteLibPath; |
a6c40364 |
621 | #endif |
0f4eea8f |
622 | }; |
623 | |
0cb96387 |
624 | struct IPerlEnvInfo |
625 | { |
626 | unsigned long nCount; /* number of entries expected */ |
627 | struct IPerlEnv perlEnvList; |
628 | }; |
629 | |
630 | #define PerlEnv_putenv(str) \ |
51371543 |
631 | (*PL_Env->pPutenv)(PL_Env,(str)) |
0cb96387 |
632 | #define PerlEnv_getenv(str) \ |
51371543 |
633 | (*PL_Env->pGetenv)(PL_Env,(str)) |
0cb96387 |
634 | #define PerlEnv_getenv_len(str,l) \ |
51371543 |
635 | (*PL_Env->pGetenv_len)(PL_Env,(str), (l)) |
3075ddba |
636 | #define PerlEnv_clearenv() \ |
51371543 |
637 | (*PL_Env->pClearenv)(PL_Env) |
3075ddba |
638 | #define PerlEnv_get_childenv() \ |
639 | (*PL_Env->pGetChildenv)(PL_Env) |
640 | #define PerlEnv_free_childenv(e) \ |
641 | (*PL_Env->pFreeChildenv)(PL_Env, (e)) |
642 | #define PerlEnv_get_childdir() \ |
643 | (*PL_Env->pGetChilddir)(PL_Env) |
644 | #define PerlEnv_free_childdir(d) \ |
645 | (*PL_Env->pFreeChilddir)(PL_Env, (d)) |
f675dbe5 |
646 | #ifdef HAS_ENVGETENV |
0cb96387 |
647 | # define PerlEnv_ENVgetenv(str) \ |
51371543 |
648 | (*PL_Env->pENVGetenv)(PL_Env,(str)) |
0cb96387 |
649 | # define PerlEnv_ENVgetenv_len(str,l) \ |
51371543 |
650 | (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l)) |
f675dbe5 |
651 | #else |
0cb96387 |
652 | # define PerlEnv_ENVgetenv(str) \ |
653 | PerlEnv_getenv((str)) |
654 | # define PerlEnv_ENVgetenv_len(str,l) \ |
655 | PerlEnv_getenv_len((str),(l)) |
f675dbe5 |
656 | #endif |
0cb96387 |
657 | #define PerlEnv_uname(name) \ |
51371543 |
658 | (*PL_Env->pEnvUname)(PL_Env,(name)) |
0f4eea8f |
659 | #ifdef WIN32 |
0cb96387 |
660 | #define PerlEnv_os_id() \ |
51371543 |
661 | (*PL_Env->pEnvOsID)(PL_Env) |
0cb96387 |
662 | #define PerlEnv_lib_path(str) \ |
51371543 |
663 | (*PL_Env->pLibPath)(PL_Env,(str)) |
0cb96387 |
664 | #define PerlEnv_sitelib_path(str) \ |
51371543 |
665 | (*PL_Env->pSiteLibPath)(PL_Env,(str)) |
0f4eea8f |
666 | #endif |
667 | |
c5be433b |
668 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
669 | |
670 | #define PerlEnv_putenv(str) putenv((str)) |
671 | #define PerlEnv_getenv(str) getenv((str)) |
a6c40364 |
672 | #define PerlEnv_getenv_len(str,l) getenv_len((str), (l)) |
7766f137 |
673 | #define PerlEnv_clearenv() clearenv() |
3075ddba |
674 | #define PerlEnv_get_childenv() get_childenv() |
675 | #define PerlEnv_free_childenv(e) free_childenv((e)) |
676 | #define PerlEnv_get_childdir() get_childdir() |
677 | #define PerlEnv_free_childdir(d) free_childdir((d)) |
f675dbe5 |
678 | #ifdef HAS_ENVGETENV |
679 | # define PerlEnv_ENVgetenv(str) ENVgetenv((str)) |
a6c40364 |
680 | # define PerlEnv_ENVgetenv_len(str,l) ENVgetenv_len((str), (l)) |
f675dbe5 |
681 | #else |
682 | # define PerlEnv_ENVgetenv(str) PerlEnv_getenv((str)) |
a6c40364 |
683 | # define PerlEnv_ENVgetenv_len(str,l) PerlEnv_getenv_len((str), (l)) |
f675dbe5 |
684 | #endif |
b2af26b1 |
685 | #define PerlEnv_uname(name) uname((name)) |
0f4eea8f |
686 | |
0cb96387 |
687 | #ifdef WIN32 |
688 | #define PerlEnv_os_id() win32_os_id() |
689 | #endif |
690 | |
c5be433b |
691 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
692 | |
693 | /* |
694 | Interface for perl low-level IO functions |
695 | */ |
696 | |
c5be433b |
697 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f |
698 | |
0cb96387 |
699 | /* IPerlLIO */ |
700 | struct IPerlLIO; |
7766f137 |
701 | struct IPerlLIOInfo; |
0cb96387 |
702 | typedef int (*LPLIOAccess)(struct IPerlLIO*, const char*, int); |
703 | typedef int (*LPLIOChmod)(struct IPerlLIO*, const char*, int); |
704 | typedef int (*LPLIOChown)(struct IPerlLIO*, const char*, uid_t, |
705 | gid_t); |
706 | typedef int (*LPLIOChsize)(struct IPerlLIO*, int, long); |
707 | typedef int (*LPLIOClose)(struct IPerlLIO*, int); |
708 | typedef int (*LPLIODup)(struct IPerlLIO*, int); |
709 | typedef int (*LPLIODup2)(struct IPerlLIO*, int, int); |
710 | typedef int (*LPLIOFlock)(struct IPerlLIO*, int, int); |
711 | typedef int (*LPLIOFileStat)(struct IPerlLIO*, int, struct stat*); |
712 | typedef int (*LPLIOIOCtl)(struct IPerlLIO*, int, unsigned int, |
713 | char*); |
714 | typedef int (*LPLIOIsatty)(struct IPerlLIO*, int); |
6b980173 |
715 | typedef int (*LPLIOLink)(struct IPerlLIO*, const char*, |
716 | const char *); |
0cb96387 |
717 | typedef long (*LPLIOLseek)(struct IPerlLIO*, int, long, int); |
718 | typedef int (*LPLIOLstat)(struct IPerlLIO*, const char*, |
719 | struct stat*); |
720 | typedef char* (*LPLIOMktemp)(struct IPerlLIO*, char*); |
721 | typedef int (*LPLIOOpen)(struct IPerlLIO*, const char*, int); |
722 | typedef int (*LPLIOOpen3)(struct IPerlLIO*, const char*, int, int); |
723 | typedef int (*LPLIORead)(struct IPerlLIO*, int, void*, unsigned int); |
724 | typedef int (*LPLIORename)(struct IPerlLIO*, const char*, |
725 | const char*); |
726 | typedef int (*LPLIOSetmode)(struct IPerlLIO*, int, int); |
727 | typedef int (*LPLIONameStat)(struct IPerlLIO*, const char*, |
728 | struct stat*); |
729 | typedef char* (*LPLIOTmpnam)(struct IPerlLIO*, char*); |
730 | typedef int (*LPLIOUmask)(struct IPerlLIO*, int); |
731 | typedef int (*LPLIOUnlink)(struct IPerlLIO*, const char*); |
732 | typedef int (*LPLIOUtime)(struct IPerlLIO*, char*, struct utimbuf*); |
733 | typedef int (*LPLIOWrite)(struct IPerlLIO*, int, const void*, |
734 | unsigned int); |
735 | |
736 | struct IPerlLIO |
737 | { |
738 | LPLIOAccess pAccess; |
739 | LPLIOChmod pChmod; |
740 | LPLIOChown pChown; |
741 | LPLIOChsize pChsize; |
742 | LPLIOClose pClose; |
743 | LPLIODup pDup; |
744 | LPLIODup2 pDup2; |
745 | LPLIOFlock pFlock; |
746 | LPLIOFileStat pFileStat; |
747 | LPLIOIOCtl pIOCtl; |
748 | LPLIOIsatty pIsatty; |
6b980173 |
749 | LPLIOLink pLink; |
0cb96387 |
750 | LPLIOLseek pLseek; |
751 | LPLIOLstat pLstat; |
752 | LPLIOMktemp pMktemp; |
753 | LPLIOOpen pOpen; |
754 | LPLIOOpen3 pOpen3; |
755 | LPLIORead pRead; |
756 | LPLIORename pRename; |
757 | LPLIOSetmode pSetmode; |
758 | LPLIONameStat pNameStat; |
759 | LPLIOTmpnam pTmpnam; |
760 | LPLIOUmask pUmask; |
761 | LPLIOUnlink pUnlink; |
762 | LPLIOUtime pUtime; |
763 | LPLIOWrite pWrite; |
764 | }; |
765 | |
766 | struct IPerlLIOInfo |
0f4eea8f |
767 | { |
0cb96387 |
768 | unsigned long nCount; /* number of entries expected */ |
769 | struct IPerlLIO perlLIOList; |
0f4eea8f |
770 | }; |
771 | |
772 | #define PerlLIO_access(file, mode) \ |
51371543 |
773 | (*PL_LIO->pAccess)(PL_LIO, (file), (mode)) |
0f4eea8f |
774 | #define PerlLIO_chmod(file, mode) \ |
51371543 |
775 | (*PL_LIO->pChmod)(PL_LIO, (file), (mode)) |
0f4eea8f |
776 | #define PerlLIO_chown(file, owner, group) \ |
51371543 |
777 | (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group)) |
0f4eea8f |
778 | #define PerlLIO_chsize(fd, size) \ |
51371543 |
779 | (*PL_LIO->pChsize)(PL_LIO, (fd), (size)) |
0f4eea8f |
780 | #define PerlLIO_close(fd) \ |
51371543 |
781 | (*PL_LIO->pClose)(PL_LIO, (fd)) |
0f4eea8f |
782 | #define PerlLIO_dup(fd) \ |
51371543 |
783 | (*PL_LIO->pDup)(PL_LIO, (fd)) |
0f4eea8f |
784 | #define PerlLIO_dup2(fd1, fd2) \ |
51371543 |
785 | (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2)) |
0f4eea8f |
786 | #define PerlLIO_flock(fd, op) \ |
51371543 |
787 | (*PL_LIO->pFlock)(PL_LIO, (fd), (op)) |
0f4eea8f |
788 | #define PerlLIO_fstat(fd, buf) \ |
51371543 |
789 | (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf)) |
0f4eea8f |
790 | #define PerlLIO_ioctl(fd, u, buf) \ |
51371543 |
791 | (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf)) |
0f4eea8f |
792 | #define PerlLIO_isatty(fd) \ |
51371543 |
793 | (*PL_LIO->pIsatty)(PL_LIO, (fd)) |
6b980173 |
794 | #define PerlLIO_link(oldname, newname) \ |
795 | (*PL_LIO->pLink)(PL_LIO, (oldname), (newname)) |
0f4eea8f |
796 | #define PerlLIO_lseek(fd, offset, mode) \ |
51371543 |
797 | (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode)) |
0f4eea8f |
798 | #define PerlLIO_lstat(name, buf) \ |
51371543 |
799 | (*PL_LIO->pLstat)(PL_LIO, (name), (buf)) |
0f4eea8f |
800 | #define PerlLIO_mktemp(file) \ |
51371543 |
801 | (*PL_LIO->pMktemp)(PL_LIO, (file)) |
0f4eea8f |
802 | #define PerlLIO_open(file, flag) \ |
51371543 |
803 | (*PL_LIO->pOpen)(PL_LIO, (file), (flag)) |
0f4eea8f |
804 | #define PerlLIO_open3(file, flag, perm) \ |
51371543 |
805 | (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm)) |
0f4eea8f |
806 | #define PerlLIO_read(fd, buf, count) \ |
51371543 |
807 | (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count)) |
8d9b2e3c |
808 | #define PerlLIO_rename(oname, newname) \ |
51371543 |
809 | (*PL_LIO->pRename)(PL_LIO, (oname), (newname)) |
0f4eea8f |
810 | #define PerlLIO_setmode(fd, mode) \ |
51371543 |
811 | (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode)) |
0f4eea8f |
812 | #define PerlLIO_stat(name, buf) \ |
51371543 |
813 | (*PL_LIO->pNameStat)(PL_LIO, (name), (buf)) |
0f4eea8f |
814 | #define PerlLIO_tmpnam(str) \ |
51371543 |
815 | (*PL_LIO->pTmpnam)(PL_LIO, (str)) |
0f4eea8f |
816 | #define PerlLIO_umask(mode) \ |
51371543 |
817 | (*PL_LIO->pUmask)(PL_LIO, (mode)) |
0f4eea8f |
818 | #define PerlLIO_unlink(file) \ |
51371543 |
819 | (*PL_LIO->pUnlink)(PL_LIO, (file)) |
0f4eea8f |
820 | #define PerlLIO_utime(file, time) \ |
51371543 |
821 | (*PL_LIO->pUtime)(PL_LIO, (file), (time)) |
0f4eea8f |
822 | #define PerlLIO_write(fd, buf, count) \ |
51371543 |
823 | (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count)) |
0f4eea8f |
824 | |
c5be433b |
825 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
826 | |
827 | #define PerlLIO_access(file, mode) access((file), (mode)) |
828 | #define PerlLIO_chmod(file, mode) chmod((file), (mode)) |
829 | #define PerlLIO_chown(file, owner, grp) chown((file), (owner), (grp)) |
830 | #define PerlLIO_chsize(fd, size) chsize((fd), (size)) |
831 | #define PerlLIO_close(fd) close((fd)) |
832 | #define PerlLIO_dup(fd) dup((fd)) |
833 | #define PerlLIO_dup2(fd1, fd2) dup2((fd1), (fd2)) |
834 | #define PerlLIO_flock(fd, op) FLOCK((fd), (op)) |
835 | #define PerlLIO_fstat(fd, buf) Fstat((fd), (buf)) |
836 | #define PerlLIO_ioctl(fd, u, buf) ioctl((fd), (u), (buf)) |
837 | #define PerlLIO_isatty(fd) isatty((fd)) |
6b980173 |
838 | #define PerlLIO_link(oldname, newname) link((oldname), (newname)) |
0f4eea8f |
839 | #define PerlLIO_lseek(fd, offset, mode) lseek((fd), (offset), (mode)) |
1f47e8e2 |
840 | #define PerlLIO_stat(name, buf) Stat((name), (buf)) |
9423c6fc |
841 | #ifdef HAS_LSTAT |
1f47e8e2 |
842 | # define PerlLIO_lstat(name, buf) lstat((name), (buf)) |
9423c6fc |
843 | #else |
1f47e8e2 |
844 | # define PerlLIO_lstat(name, buf) PerlLIO_stat((name), (buf)) |
9423c6fc |
845 | #endif |
0f4eea8f |
846 | #define PerlLIO_mktemp(file) mktemp((file)) |
847 | #define PerlLIO_mkstemp(file) mkstemp((file)) |
848 | #define PerlLIO_open(file, flag) open((file), (flag)) |
849 | #define PerlLIO_open3(file, flag, perm) open((file), (flag), (perm)) |
850 | #define PerlLIO_read(fd, buf, count) read((fd), (buf), (count)) |
851 | #define PerlLIO_rename(old, new) rename((old), (new)) |
852 | #define PerlLIO_setmode(fd, mode) setmode((fd), (mode)) |
0f4eea8f |
853 | #define PerlLIO_tmpnam(str) tmpnam((str)) |
854 | #define PerlLIO_umask(mode) umask((mode)) |
855 | #define PerlLIO_unlink(file) unlink((file)) |
856 | #define PerlLIO_utime(file, time) utime((file), (time)) |
857 | #define PerlLIO_write(fd, buf, count) write((fd), (buf), (count)) |
858 | |
c5be433b |
859 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
860 | |
861 | /* |
862 | Interface for perl memory allocation |
863 | */ |
864 | |
c5be433b |
865 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f |
866 | |
0cb96387 |
867 | /* IPerlMem */ |
868 | struct IPerlMem; |
7766f137 |
869 | struct IPerlMemInfo; |
0cb96387 |
870 | typedef void* (*LPMemMalloc)(struct IPerlMem*, size_t); |
871 | typedef void* (*LPMemRealloc)(struct IPerlMem*, void*, size_t); |
872 | typedef void (*LPMemFree)(struct IPerlMem*, void*); |
7766f137 |
873 | typedef void* (*LPMemCalloc)(struct IPerlMem*, size_t, size_t); |
874 | typedef void (*LPMemGetLock)(struct IPerlMem*); |
875 | typedef void (*LPMemFreeLock)(struct IPerlMem*); |
876 | typedef int (*LPMemIsLocked)(struct IPerlMem*); |
0cb96387 |
877 | |
878 | struct IPerlMem |
0f4eea8f |
879 | { |
0cb96387 |
880 | LPMemMalloc pMalloc; |
881 | LPMemRealloc pRealloc; |
882 | LPMemFree pFree; |
7766f137 |
883 | LPMemCalloc pCalloc; |
884 | LPMemGetLock pGetLock; |
885 | LPMemFreeLock pFreeLock; |
886 | LPMemIsLocked pIsLocked; |
0f4eea8f |
887 | }; |
888 | |
0cb96387 |
889 | struct IPerlMemInfo |
890 | { |
891 | unsigned long nCount; /* number of entries expected */ |
892 | struct IPerlMem perlMemList; |
893 | }; |
894 | |
7766f137 |
895 | /* Interpreter specific memory macros */ |
0cb96387 |
896 | #define PerlMem_malloc(size) \ |
51371543 |
897 | (*PL_Mem->pMalloc)(PL_Mem, (size)) |
0cb96387 |
898 | #define PerlMem_realloc(buf, size) \ |
51371543 |
899 | (*PL_Mem->pRealloc)(PL_Mem, (buf), (size)) |
0cb96387 |
900 | #define PerlMem_free(buf) \ |
51371543 |
901 | (*PL_Mem->pFree)(PL_Mem, (buf)) |
7766f137 |
902 | #define PerlMem_calloc(num, size) \ |
903 | (*PL_Mem->pCalloc)(PL_Mem, (num), (size)) |
904 | #define PerlMem_get_lock() \ |
905 | (*PL_Mem->pGetLock)(PL_Mem) |
906 | #define PerlMem_free_lock() \ |
907 | (*PL_Mem->pFreeLock)(PL_Mem) |
908 | #define PerlMem_is_locked() \ |
909 | (*PL_Mem->pIsLocked)(PL_Mem) |
910 | |
911 | /* Shared memory macros */ |
912 | #define PerlMemShared_malloc(size) \ |
913 | (*PL_MemShared->pMalloc)(PL_Mem, (size)) |
914 | #define PerlMemShared_realloc(buf, size) \ |
915 | (*PL_MemShared->pRealloc)(PL_Mem, (buf), (size)) |
916 | #define PerlMemShared_free(buf) \ |
917 | (*PL_MemShared->pFree)(PL_Mem, (buf)) |
918 | #define PerlMemShared_calloc(num, size) \ |
919 | (*PL_MemShared->pCalloc)(PL_Mem, (num), (size)) |
920 | #define PerlMemShared_get_lock() \ |
921 | (*PL_MemShared->pGetLock)(PL_Mem) |
922 | #define PerlMemShared_free_lock() \ |
923 | (*PL_MemShared->pFreeLock)(PL_Mem) |
924 | #define PerlMemShared_is_locked() \ |
925 | (*PL_MemShared->pIsLocked)(PL_Mem) |
926 | |
927 | |
928 | /* Parse tree memory macros */ |
929 | #define PerlMemParse_malloc(size) \ |
930 | (*PL_MemParse->pMalloc)(PL_Mem, (size)) |
931 | #define PerlMemParse_realloc(buf, size) \ |
932 | (*PL_MemParse->pRealloc)(PL_Mem, (buf), (size)) |
933 | #define PerlMemParse_free(buf) \ |
934 | (*PL_MemParse->pFree)(PL_Mem, (buf)) |
935 | #define PerlMemParse_calloc(num, size) \ |
936 | (*PL_MemParse->pCalloc)(PL_Mem, (num), (size)) |
937 | #define PerlMemParse_get_lock() \ |
938 | (*PL_MemParse->pGetLock)(PL_Mem) |
939 | #define PerlMemParse_free_lock() \ |
940 | (*PL_MemParse->pFreeLock)(PL_Mem) |
941 | #define PerlMemParse_is_locked() \ |
942 | (*PL_MemParse->pIsLocked)(PL_Mem) |
943 | |
0f4eea8f |
944 | |
c5be433b |
945 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
946 | |
7766f137 |
947 | /* Interpreter specific memory macros */ |
0f4eea8f |
948 | #define PerlMem_malloc(size) malloc((size)) |
949 | #define PerlMem_realloc(buf, size) realloc((buf), (size)) |
950 | #define PerlMem_free(buf) free((buf)) |
7766f137 |
951 | #define PerlMem_calloc(num, size) calloc((num), (size)) |
952 | #define PerlMem_get_lock() |
953 | #define PerlMem_free_lock() |
954 | #define PerlMem_is_locked() 0 |
955 | |
956 | /* Shared memory macros */ |
957 | #define PerlMemShared_malloc(size) malloc((size)) |
958 | #define PerlMemShared_realloc(buf, size) realloc((buf), (size)) |
959 | #define PerlMemShared_free(buf) free((buf)) |
960 | #define PerlMemShared_calloc(num, size) calloc((num), (size)) |
961 | #define PerlMemShared_get_lock() |
962 | #define PerlMemShared_free_lock() |
963 | #define PerlMemShared_is_locked() 0 |
964 | |
965 | /* Parse tree memory macros */ |
966 | #define PerlMemParse_malloc(size) malloc((size)) |
967 | #define PerlMemParse_realloc(buf, size) realloc((buf), (size)) |
968 | #define PerlMemParse_free(buf) free((buf)) |
969 | #define PerlMemParse_calloc(num, size) calloc((num), (size)) |
970 | #define PerlMemParse_get_lock() |
971 | #define PerlMemParse_free_lock() |
972 | #define PerlMemParse_is_locked() 0 |
0f4eea8f |
973 | |
c5be433b |
974 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
975 | |
976 | /* |
977 | Interface for perl process functions |
978 | */ |
979 | |
980 | |
c5be433b |
981 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f |
982 | |
0f4eea8f |
983 | #ifndef jmp_buf |
984 | #include <setjmp.h> |
985 | #endif |
986 | |
0cb96387 |
987 | /* IPerlProc */ |
988 | struct IPerlProc; |
7766f137 |
989 | struct IPerlProcInfo; |
0cb96387 |
990 | typedef void (*LPProcAbort)(struct IPerlProc*); |
991 | typedef char* (*LPProcCrypt)(struct IPerlProc*, const char*, |
992 | const char*); |
993 | typedef void (*LPProcExit)(struct IPerlProc*, int); |
994 | typedef void (*LPProc_Exit)(struct IPerlProc*, int); |
995 | typedef int (*LPProcExecl)(struct IPerlProc*, const char*, |
996 | const char*, const char*, const char*, |
997 | const char*); |
998 | typedef int (*LPProcExecv)(struct IPerlProc*, const char*, |
999 | const char*const*); |
1000 | typedef int (*LPProcExecvp)(struct IPerlProc*, const char*, |
1001 | const char*const*); |
1002 | typedef uid_t (*LPProcGetuid)(struct IPerlProc*); |
1003 | typedef uid_t (*LPProcGeteuid)(struct IPerlProc*); |
1004 | typedef gid_t (*LPProcGetgid)(struct IPerlProc*); |
1005 | typedef gid_t (*LPProcGetegid)(struct IPerlProc*); |
1006 | typedef char* (*LPProcGetlogin)(struct IPerlProc*); |
1007 | typedef int (*LPProcKill)(struct IPerlProc*, int, int); |
1008 | typedef int (*LPProcKillpg)(struct IPerlProc*, int, int); |
1009 | typedef int (*LPProcPauseProc)(struct IPerlProc*); |
1010 | typedef PerlIO* (*LPProcPopen)(struct IPerlProc*, const char*, |
1011 | const char*); |
1012 | typedef int (*LPProcPclose)(struct IPerlProc*, PerlIO*); |
1013 | typedef int (*LPProcPipe)(struct IPerlProc*, int*); |
1014 | typedef int (*LPProcSetuid)(struct IPerlProc*, uid_t); |
1015 | typedef int (*LPProcSetgid)(struct IPerlProc*, gid_t); |
1016 | typedef int (*LPProcSleep)(struct IPerlProc*, unsigned int); |
1017 | typedef int (*LPProcTimes)(struct IPerlProc*, struct tms*); |
1018 | typedef int (*LPProcWait)(struct IPerlProc*, int*); |
1019 | typedef int (*LPProcWaitpid)(struct IPerlProc*, int, int*, int); |
1020 | typedef Sighandler_t (*LPProcSignal)(struct IPerlProc*, int, Sighandler_t); |
7766f137 |
1021 | typedef int (*LPProcFork)(struct IPerlProc*); |
1022 | typedef int (*LPProcGetpid)(struct IPerlProc*); |
0cb96387 |
1023 | #ifdef WIN32 |
7766f137 |
1024 | typedef void* (*LPProcDynaLoader)(struct IPerlProc*, const char*); |
0cb96387 |
1025 | typedef void (*LPProcGetOSError)(struct IPerlProc*, |
1026 | SV* sv, DWORD dwErr); |
1027 | typedef void (*LPProcFreeBuf)(struct IPerlProc*, char*); |
1028 | typedef BOOL (*LPProcDoCmd)(struct IPerlProc*, char*); |
1029 | typedef int (*LPProcSpawn)(struct IPerlProc*, char*); |
1030 | typedef int (*LPProcSpawnvp)(struct IPerlProc*, int, const char*, |
1031 | const char*const*); |
1032 | typedef int (*LPProcASpawn)(struct IPerlProc*, void*, void**, void**); |
1033 | #endif |
1034 | |
1035 | struct IPerlProc |
0f4eea8f |
1036 | { |
0cb96387 |
1037 | LPProcAbort pAbort; |
1038 | LPProcCrypt pCrypt; |
1039 | LPProcExit pExit; |
1040 | LPProc_Exit p_Exit; |
1041 | LPProcExecl pExecl; |
1042 | LPProcExecv pExecv; |
1043 | LPProcExecvp pExecvp; |
1044 | LPProcGetuid pGetuid; |
1045 | LPProcGeteuid pGeteuid; |
1046 | LPProcGetgid pGetgid; |
1047 | LPProcGetegid pGetegid; |
1048 | LPProcGetlogin pGetlogin; |
1049 | LPProcKill pKill; |
1050 | LPProcKillpg pKillpg; |
1051 | LPProcPauseProc pPauseProc; |
1052 | LPProcPopen pPopen; |
1053 | LPProcPclose pPclose; |
1054 | LPProcPipe pPipe; |
1055 | LPProcSetuid pSetuid; |
1056 | LPProcSetgid pSetgid; |
1057 | LPProcSleep pSleep; |
1058 | LPProcTimes pTimes; |
1059 | LPProcWait pWait; |
1060 | LPProcWaitpid pWaitpid; |
1061 | LPProcSignal pSignal; |
7766f137 |
1062 | LPProcFork pFork; |
1063 | LPProcGetpid pGetpid; |
0f4eea8f |
1064 | #ifdef WIN32 |
0cb96387 |
1065 | LPProcDynaLoader pDynaLoader; |
1066 | LPProcGetOSError pGetOSError; |
1067 | LPProcDoCmd pDoCmd; |
1068 | LPProcSpawn pSpawn; |
1069 | LPProcSpawnvp pSpawnvp; |
1070 | LPProcASpawn pASpawn; |
0f4eea8f |
1071 | #endif |
1072 | }; |
1073 | |
0cb96387 |
1074 | struct IPerlProcInfo |
1075 | { |
1076 | unsigned long nCount; /* number of entries expected */ |
1077 | struct IPerlProc perlProcList; |
1078 | }; |
1079 | |
1080 | #define PerlProc_abort() \ |
51371543 |
1081 | (*PL_Proc->pAbort)(PL_Proc) |
0cb96387 |
1082 | #define PerlProc_crypt(c,s) \ |
51371543 |
1083 | (*PL_Proc->pCrypt)(PL_Proc, (c), (s)) |
0cb96387 |
1084 | #define PerlProc_exit(s) \ |
51371543 |
1085 | (*PL_Proc->pExit)(PL_Proc, (s)) |
0cb96387 |
1086 | #define PerlProc__exit(s) \ |
51371543 |
1087 | (*PL_Proc->p_Exit)(PL_Proc, (s)) |
0f4eea8f |
1088 | #define PerlProc_execl(c, w, x, y, z) \ |
51371543 |
1089 | (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z)) |
0cb96387 |
1090 | #define PerlProc_execv(c, a) \ |
51371543 |
1091 | (*PL_Proc->pExecv)(PL_Proc, (c), (a)) |
0cb96387 |
1092 | #define PerlProc_execvp(c, a) \ |
51371543 |
1093 | (*PL_Proc->pExecvp)(PL_Proc, (c), (a)) |
0cb96387 |
1094 | #define PerlProc_getuid() \ |
51371543 |
1095 | (*PL_Proc->pGetuid)(PL_Proc) |
0cb96387 |
1096 | #define PerlProc_geteuid() \ |
51371543 |
1097 | (*PL_Proc->pGeteuid)(PL_Proc) |
0cb96387 |
1098 | #define PerlProc_getgid() \ |
51371543 |
1099 | (*PL_Proc->pGetgid)(PL_Proc) |
0cb96387 |
1100 | #define PerlProc_getegid() \ |
51371543 |
1101 | (*PL_Proc->pGetegid)(PL_Proc) |
0cb96387 |
1102 | #define PerlProc_getlogin() \ |
51371543 |
1103 | (*PL_Proc->pGetlogin)(PL_Proc) |
0cb96387 |
1104 | #define PerlProc_kill(i, a) \ |
51371543 |
1105 | (*PL_Proc->pKill)(PL_Proc, (i), (a)) |
0cb96387 |
1106 | #define PerlProc_killpg(i, a) \ |
51371543 |
1107 | (*PL_Proc->pKillpg)(PL_Proc, (i), (a)) |
0cb96387 |
1108 | #define PerlProc_pause() \ |
51371543 |
1109 | (*PL_Proc->pPauseProc)(PL_Proc) |
0cb96387 |
1110 | #define PerlProc_popen(c, m) \ |
51371543 |
1111 | (*PL_Proc->pPopen)(PL_Proc, (c), (m)) |
0cb96387 |
1112 | #define PerlProc_pclose(f) \ |
51371543 |
1113 | (*PL_Proc->pPclose)(PL_Proc, (f)) |
0cb96387 |
1114 | #define PerlProc_pipe(fd) \ |
51371543 |
1115 | (*PL_Proc->pPipe)(PL_Proc, (fd)) |
0cb96387 |
1116 | #define PerlProc_setuid(u) \ |
51371543 |
1117 | (*PL_Proc->pSetuid)(PL_Proc, (u)) |
0cb96387 |
1118 | #define PerlProc_setgid(g) \ |
51371543 |
1119 | (*PL_Proc->pSetgid)(PL_Proc, (g)) |
0cb96387 |
1120 | #define PerlProc_sleep(t) \ |
51371543 |
1121 | (*PL_Proc->pSleep)(PL_Proc, (t)) |
0cb96387 |
1122 | #define PerlProc_times(t) \ |
51371543 |
1123 | (*PL_Proc->pTimes)(PL_Proc, (t)) |
0cb96387 |
1124 | #define PerlProc_wait(t) \ |
51371543 |
1125 | (*PL_Proc->pWait)(PL_Proc, (t)) |
0cb96387 |
1126 | #define PerlProc_waitpid(p,s,f) \ |
51371543 |
1127 | (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f)) |
0cb96387 |
1128 | #define PerlProc_signal(n, h) \ |
51371543 |
1129 | (*PL_Proc->pSignal)(PL_Proc, (n), (h)) |
7766f137 |
1130 | #define PerlProc_fork() \ |
1131 | (*PL_Proc->pFork)(PL_Proc) |
1132 | #define PerlProc_getpid() \ |
1133 | (*PL_Proc->pGetpid)(PL_Proc) |
0cb96387 |
1134 | #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n)) |
1135 | #define PerlProc_longjmp(b, n) Siglongjmp((b), (n)) |
0f4eea8f |
1136 | |
1137 | #ifdef WIN32 |
0cb96387 |
1138 | #define PerlProc_DynaLoad(f) \ |
51371543 |
1139 | (*PL_Proc->pDynaLoader)(PL_Proc, (f)) |
0cb96387 |
1140 | #define PerlProc_GetOSError(s,e) \ |
51371543 |
1141 | (*PL_Proc->pGetOSError)(PL_Proc, (s), (e)) |
0cb96387 |
1142 | #define PerlProc_Cmd(s) \ |
51371543 |
1143 | (*PL_Proc->pDoCmd)(PL_Proc, (s)) |
0cb96387 |
1144 | #define do_spawn(s) \ |
51371543 |
1145 | (*PL_Proc->pSpawn)(PL_Proc, (s)) |
0cb96387 |
1146 | #define do_spawnvp(m, c, a) \ |
51371543 |
1147 | (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a)) |
0cb96387 |
1148 | #define PerlProc_aspawn(m,c,a) \ |
51371543 |
1149 | (*PL_Proc->pASpawn)(PL_Proc, (m), (c), (a)) |
0f4eea8f |
1150 | #endif |
1151 | |
c5be433b |
1152 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
1153 | |
1154 | #define PerlProc_abort() abort() |
ff95b63e |
1155 | #define PerlProc_crypt(c,s) crypt((c), (s)) |
0f4eea8f |
1156 | #define PerlProc_exit(s) exit((s)) |
1157 | #define PerlProc__exit(s) _exit((s)) |
1158 | #define PerlProc_execl(c,w,x,y,z) \ |
1159 | execl((c), (w), (x), (y), (z)) |
1160 | #define PerlProc_execv(c, a) execv((c), (a)) |
1161 | #define PerlProc_execvp(c, a) execvp((c), (a)) |
1162 | #define PerlProc_getuid() getuid() |
1163 | #define PerlProc_geteuid() geteuid() |
1164 | #define PerlProc_getgid() getgid() |
1165 | #define PerlProc_getegid() getegid() |
1166 | #define PerlProc_getlogin() getlogin() |
1167 | #define PerlProc_kill(i, a) kill((i), (a)) |
1168 | #define PerlProc_killpg(i, a) killpg((i), (a)) |
1169 | #define PerlProc_pause() Pause() |
1170 | #define PerlProc_popen(c, m) my_popen((c), (m)) |
1171 | #define PerlProc_pclose(f) my_pclose((f)) |
1172 | #define PerlProc_pipe(fd) pipe((fd)) |
1173 | #define PerlProc_setuid(u) setuid((u)) |
1174 | #define PerlProc_setgid(g) setgid((g)) |
1175 | #define PerlProc_sleep(t) sleep((t)) |
1176 | #define PerlProc_times(t) times((t)) |
1177 | #define PerlProc_wait(t) wait((t)) |
1178 | #define PerlProc_waitpid(p,s,f) waitpid((p), (s), (f)) |
1179 | #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n)) |
1180 | #define PerlProc_longjmp(b, n) Siglongjmp((b), (n)) |
1181 | #define PerlProc_signal(n, h) signal((n), (h)) |
7766f137 |
1182 | #define PerlProc_fork() fork() |
1183 | #define PerlProc_getpid() getpid() |
0f4eea8f |
1184 | |
0cb96387 |
1185 | #ifdef WIN32 |
1186 | #define PerlProc_DynaLoad(f) \ |
c5be433b |
1187 | win32_dynaload((f)) |
0cb96387 |
1188 | #define PerlProc_GetOSError(s,e) \ |
c5be433b |
1189 | win32_str_os_error((s), (e)) |
0cb96387 |
1190 | #endif |
c5be433b |
1191 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
1192 | |
1193 | /* |
1194 | Interface for perl socket functions |
1195 | */ |
1196 | |
c5be433b |
1197 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f |
1198 | |
0cb96387 |
1199 | /* PerlSock */ |
1200 | struct IPerlSock; |
7766f137 |
1201 | struct IPerlSockInfo; |
0cb96387 |
1202 | typedef u_long (*LPHtonl)(struct IPerlSock*, u_long); |
1203 | typedef u_short (*LPHtons)(struct IPerlSock*, u_short); |
1204 | typedef u_long (*LPNtohl)(struct IPerlSock*, u_long); |
1205 | typedef u_short (*LPNtohs)(struct IPerlSock*, u_short); |
1206 | typedef SOCKET (*LPAccept)(struct IPerlSock*, SOCKET, |
1207 | struct sockaddr*, int*); |
1208 | typedef int (*LPBind)(struct IPerlSock*, SOCKET, |
1209 | const struct sockaddr*, int); |
1210 | typedef int (*LPConnect)(struct IPerlSock*, SOCKET, |
1211 | const struct sockaddr*, int); |
1212 | typedef void (*LPEndhostent)(struct IPerlSock*); |
1213 | typedef void (*LPEndnetent)(struct IPerlSock*); |
1214 | typedef void (*LPEndprotoent)(struct IPerlSock*); |
1215 | typedef void (*LPEndservent)(struct IPerlSock*); |
1216 | typedef int (*LPGethostname)(struct IPerlSock*, char*, int); |
1217 | typedef int (*LPGetpeername)(struct IPerlSock*, SOCKET, |
1218 | struct sockaddr*, int*); |
1219 | typedef struct hostent* (*LPGethostbyaddr)(struct IPerlSock*, const char*, |
1220 | int, int); |
1221 | typedef struct hostent* (*LPGethostbyname)(struct IPerlSock*, const char*); |
1222 | typedef struct hostent* (*LPGethostent)(struct IPerlSock*); |
1223 | typedef struct netent* (*LPGetnetbyaddr)(struct IPerlSock*, long, int); |
1224 | typedef struct netent* (*LPGetnetbyname)(struct IPerlSock*, const char*); |
1225 | typedef struct netent* (*LPGetnetent)(struct IPerlSock*); |
1226 | typedef struct protoent*(*LPGetprotobyname)(struct IPerlSock*, const char*); |
1227 | typedef struct protoent*(*LPGetprotobynumber)(struct IPerlSock*, int); |
1228 | typedef struct protoent*(*LPGetprotoent)(struct IPerlSock*); |
1229 | typedef struct servent* (*LPGetservbyname)(struct IPerlSock*, const char*, |
1230 | const char*); |
1231 | typedef struct servent* (*LPGetservbyport)(struct IPerlSock*, int, |
1232 | const char*); |
1233 | typedef struct servent* (*LPGetservent)(struct IPerlSock*); |
1234 | typedef int (*LPGetsockname)(struct IPerlSock*, SOCKET, |
1235 | struct sockaddr*, int*); |
1236 | typedef int (*LPGetsockopt)(struct IPerlSock*, SOCKET, int, int, |
1237 | char*, int*); |
1238 | typedef unsigned long (*LPInetAddr)(struct IPerlSock*, const char*); |
1239 | typedef char* (*LPInetNtoa)(struct IPerlSock*, struct in_addr); |
1240 | typedef int (*LPListen)(struct IPerlSock*, SOCKET, int); |
1241 | typedef int (*LPRecv)(struct IPerlSock*, SOCKET, char*, int, int); |
1242 | typedef int (*LPRecvfrom)(struct IPerlSock*, SOCKET, char*, int, |
1243 | int, struct sockaddr*, int*); |
1244 | typedef int (*LPSelect)(struct IPerlSock*, int, char*, char*, |
1245 | char*, const struct timeval*); |
1246 | typedef int (*LPSend)(struct IPerlSock*, SOCKET, const char*, int, |
1247 | int); |
1248 | typedef int (*LPSendto)(struct IPerlSock*, SOCKET, const char*, |
1249 | int, int, const struct sockaddr*, int); |
1250 | typedef void (*LPSethostent)(struct IPerlSock*, int); |
1251 | typedef void (*LPSetnetent)(struct IPerlSock*, int); |
1252 | typedef void (*LPSetprotoent)(struct IPerlSock*, int); |
1253 | typedef void (*LPSetservent)(struct IPerlSock*, int); |
1254 | typedef int (*LPSetsockopt)(struct IPerlSock*, SOCKET, int, int, |
1255 | const char*, int); |
1256 | typedef int (*LPShutdown)(struct IPerlSock*, SOCKET, int); |
1257 | typedef SOCKET (*LPSocket)(struct IPerlSock*, int, int, int); |
1258 | typedef int (*LPSocketpair)(struct IPerlSock*, int, int, int, |
1259 | int*); |
1260 | #ifdef WIN32 |
1261 | typedef int (*LPClosesocket)(struct IPerlSock*, SOCKET s); |
1262 | #endif |
1263 | |
1264 | struct IPerlSock |
0f4eea8f |
1265 | { |
0cb96387 |
1266 | LPHtonl pHtonl; |
1267 | LPHtons pHtons; |
1268 | LPNtohl pNtohl; |
1269 | LPNtohs pNtohs; |
1270 | LPAccept pAccept; |
1271 | LPBind pBind; |
1272 | LPConnect pConnect; |
1273 | LPEndhostent pEndhostent; |
1274 | LPEndnetent pEndnetent; |
1275 | LPEndprotoent pEndprotoent; |
1276 | LPEndservent pEndservent; |
1277 | LPGethostname pGethostname; |
1278 | LPGetpeername pGetpeername; |
1279 | LPGethostbyaddr pGethostbyaddr; |
1280 | LPGethostbyname pGethostbyname; |
1281 | LPGethostent pGethostent; |
1282 | LPGetnetbyaddr pGetnetbyaddr; |
1283 | LPGetnetbyname pGetnetbyname; |
1284 | LPGetnetent pGetnetent; |
1285 | LPGetprotobyname pGetprotobyname; |
1286 | LPGetprotobynumber pGetprotobynumber; |
1287 | LPGetprotoent pGetprotoent; |
1288 | LPGetservbyname pGetservbyname; |
1289 | LPGetservbyport pGetservbyport; |
1290 | LPGetservent pGetservent; |
1291 | LPGetsockname pGetsockname; |
1292 | LPGetsockopt pGetsockopt; |
1293 | LPInetAddr pInetAddr; |
1294 | LPInetNtoa pInetNtoa; |
1295 | LPListen pListen; |
1296 | LPRecv pRecv; |
1297 | LPRecvfrom pRecvfrom; |
1298 | LPSelect pSelect; |
1299 | LPSend pSend; |
1300 | LPSendto pSendto; |
1301 | LPSethostent pSethostent; |
1302 | LPSetnetent pSetnetent; |
1303 | LPSetprotoent pSetprotoent; |
1304 | LPSetservent pSetservent; |
1305 | LPSetsockopt pSetsockopt; |
1306 | LPShutdown pShutdown; |
1307 | LPSocket pSocket; |
1308 | LPSocketpair pSocketpair; |
0f4eea8f |
1309 | #ifdef WIN32 |
0cb96387 |
1310 | LPClosesocket pClosesocket; |
0f4eea8f |
1311 | #endif |
1312 | }; |
1313 | |
0cb96387 |
1314 | struct IPerlSockInfo |
1315 | { |
1316 | unsigned long nCount; /* number of entries expected */ |
1317 | struct IPerlSock perlSockList; |
1318 | }; |
1319 | |
1320 | #define PerlSock_htonl(x) \ |
51371543 |
1321 | (*PL_Sock->pHtonl)(PL_Sock, x) |
0cb96387 |
1322 | #define PerlSock_htons(x) \ |
51371543 |
1323 | (*PL_Sock->pHtons)(PL_Sock, x) |
0cb96387 |
1324 | #define PerlSock_ntohl(x) \ |
51371543 |
1325 | (*PL_Sock->pNtohl)(PL_Sock, x) |
0cb96387 |
1326 | #define PerlSock_ntohs(x) \ |
51371543 |
1327 | (*PL_Sock->pNtohs)(PL_Sock, x) |
0cb96387 |
1328 | #define PerlSock_accept(s, a, l) \ |
51371543 |
1329 | (*PL_Sock->pAccept)(PL_Sock, s, a, l) |
0cb96387 |
1330 | #define PerlSock_bind(s, n, l) \ |
51371543 |
1331 | (*PL_Sock->pBind)(PL_Sock, s, n, l) |
0cb96387 |
1332 | #define PerlSock_connect(s, n, l) \ |
51371543 |
1333 | (*PL_Sock->pConnect)(PL_Sock, s, n, l) |
0cb96387 |
1334 | #define PerlSock_endhostent() \ |
51371543 |
1335 | (*PL_Sock->pEndhostent)(PL_Sock) |
0cb96387 |
1336 | #define PerlSock_endnetent() \ |
51371543 |
1337 | (*PL_Sock->pEndnetent)(PL_Sock) |
0cb96387 |
1338 | #define PerlSock_endprotoent() \ |
51371543 |
1339 | (*PL_Sock->pEndprotoent)(PL_Sock) |
0cb96387 |
1340 | #define PerlSock_endservent() \ |
51371543 |
1341 | (*PL_Sock->pEndservent)(PL_Sock) |
0cb96387 |
1342 | #define PerlSock_gethostbyaddr(a, l, t) \ |
51371543 |
1343 | (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t) |
0cb96387 |
1344 | #define PerlSock_gethostbyname(n) \ |
51371543 |
1345 | (*PL_Sock->pGethostbyname)(PL_Sock, n) |
0cb96387 |
1346 | #define PerlSock_gethostent() \ |
51371543 |
1347 | (*PL_Sock->pGethostent)(PL_Sock) |
0cb96387 |
1348 | #define PerlSock_gethostname(n, l) \ |
51371543 |
1349 | (*PL_Sock->pGethostname)(PL_Sock, n, l) |
0cb96387 |
1350 | #define PerlSock_getnetbyaddr(n, t) \ |
51371543 |
1351 | (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t) |
0cb96387 |
1352 | #define PerlSock_getnetbyname(c) \ |
51371543 |
1353 | (*PL_Sock->pGetnetbyname)(PL_Sock, c) |
0cb96387 |
1354 | #define PerlSock_getnetent() \ |
51371543 |
1355 | (*PL_Sock->pGetnetent)(PL_Sock) |
0cb96387 |
1356 | #define PerlSock_getpeername(s, n, l) \ |
51371543 |
1357 | (*PL_Sock->pGetpeername)(PL_Sock, s, n, l) |
0cb96387 |
1358 | #define PerlSock_getprotobyname(n) \ |
51371543 |
1359 | (*PL_Sock->pGetprotobyname)(PL_Sock, n) |
0cb96387 |
1360 | #define PerlSock_getprotobynumber(n) \ |
51371543 |
1361 | (*PL_Sock->pGetprotobynumber)(PL_Sock, n) |
0cb96387 |
1362 | #define PerlSock_getprotoent() \ |
51371543 |
1363 | (*PL_Sock->pGetprotoent)(PL_Sock) |
0cb96387 |
1364 | #define PerlSock_getservbyname(n, p) \ |
51371543 |
1365 | (*PL_Sock->pGetservbyname)(PL_Sock, n, p) |
0cb96387 |
1366 | #define PerlSock_getservbyport(port, p) \ |
51371543 |
1367 | (*PL_Sock->pGetservbyport)(PL_Sock, port, p) |
0cb96387 |
1368 | #define PerlSock_getservent() \ |
51371543 |
1369 | (*PL_Sock->pGetservent)(PL_Sock) |
0cb96387 |
1370 | #define PerlSock_getsockname(s, n, l) \ |
51371543 |
1371 | (*PL_Sock->pGetsockname)(PL_Sock, s, n, l) |
0cb96387 |
1372 | #define PerlSock_getsockopt(s,l,n,v,i) \ |
51371543 |
1373 | (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i) |
0cb96387 |
1374 | #define PerlSock_inet_addr(c) \ |
51371543 |
1375 | (*PL_Sock->pInetAddr)(PL_Sock, c) |
0cb96387 |
1376 | #define PerlSock_inet_ntoa(i) \ |
51371543 |
1377 | (*PL_Sock->pInetNtoa)(PL_Sock, i) |
0cb96387 |
1378 | #define PerlSock_listen(s, b) \ |
51371543 |
1379 | (*PL_Sock->pListen)(PL_Sock, s, b) |
0cb96387 |
1380 | #define PerlSock_recv(s, b, l, f) \ |
51371543 |
1381 | (*PL_Sock->pRecv)(PL_Sock, s, b, l, f) |
0f4eea8f |
1382 | #define PerlSock_recvfrom(s,b,l,f,from,fromlen) \ |
51371543 |
1383 | (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen) |
0f4eea8f |
1384 | #define PerlSock_select(n, r, w, e, t) \ |
51371543 |
1385 | (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t) |
0cb96387 |
1386 | #define PerlSock_send(s, b, l, f) \ |
51371543 |
1387 | (*PL_Sock->pSend)(PL_Sock, s, b, l, f) |
0f4eea8f |
1388 | #define PerlSock_sendto(s, b, l, f, t, tlen) \ |
51371543 |
1389 | (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen) |
0cb96387 |
1390 | #define PerlSock_sethostent(f) \ |
51371543 |
1391 | (*PL_Sock->pSethostent)(PL_Sock, f) |
0cb96387 |
1392 | #define PerlSock_setnetent(f) \ |
51371543 |
1393 | (*PL_Sock->pSetnetent)(PL_Sock, f) |
0cb96387 |
1394 | #define PerlSock_setprotoent(f) \ |
51371543 |
1395 | (*PL_Sock->pSetprotoent)(PL_Sock, f) |
0cb96387 |
1396 | #define PerlSock_setservent(f) \ |
51371543 |
1397 | (*PL_Sock->pSetservent)(PL_Sock, f) |
0f4eea8f |
1398 | #define PerlSock_setsockopt(s, l, n, v, len) \ |
51371543 |
1399 | (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len) |
0cb96387 |
1400 | #define PerlSock_shutdown(s, h) \ |
51371543 |
1401 | (*PL_Sock->pShutdown)(PL_Sock, s, h) |
0cb96387 |
1402 | #define PerlSock_socket(a, t, p) \ |
51371543 |
1403 | (*PL_Sock->pSocket)(PL_Sock, a, t, p) |
0cb96387 |
1404 | #define PerlSock_socketpair(a, t, p, f) \ |
51371543 |
1405 | (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f) |
0cb96387 |
1406 | |
1407 | #ifdef WIN32 |
1408 | #define PerlSock_closesocket(s) \ |
51371543 |
1409 | (*PL_Sock->pClosesocket)(PL_Sock, s) |
0cb96387 |
1410 | #endif |
0f4eea8f |
1411 | |
c5be433b |
1412 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
1413 | |
1414 | #define PerlSock_htonl(x) htonl(x) |
1415 | #define PerlSock_htons(x) htons(x) |
1416 | #define PerlSock_ntohl(x) ntohl(x) |
1417 | #define PerlSock_ntohs(x) ntohs(x) |
1418 | #define PerlSock_accept(s, a, l) accept(s, a, l) |
1419 | #define PerlSock_bind(s, n, l) bind(s, n, l) |
1420 | #define PerlSock_connect(s, n, l) connect(s, n, l) |
1421 | |
1422 | #define PerlSock_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t) |
1423 | #define PerlSock_gethostbyname(n) gethostbyname(n) |
1424 | #define PerlSock_gethostent gethostent |
1425 | #define PerlSock_endhostent endhostent |
1426 | #define PerlSock_gethostname(n, l) gethostname(n, l) |
1427 | |
1428 | #define PerlSock_getnetbyaddr(n, t) getnetbyaddr(n, t) |
1429 | #define PerlSock_getnetbyname(n) getnetbyname(n) |
1430 | #define PerlSock_getnetent getnetent |
1431 | #define PerlSock_endnetent endnetent |
1432 | #define PerlSock_getpeername(s, n, l) getpeername(s, n, l) |
1433 | |
1434 | #define PerlSock_getprotobyname(n) getprotobyname(n) |
1435 | #define PerlSock_getprotobynumber(n) getprotobynumber(n) |
1436 | #define PerlSock_getprotoent getprotoent |
1437 | #define PerlSock_endprotoent endprotoent |
1438 | |
1439 | #define PerlSock_getservbyname(n, p) getservbyname(n, p) |
1440 | #define PerlSock_getservbyport(port, p) getservbyport(port, p) |
1441 | #define PerlSock_getservent getservent |
1442 | #define PerlSock_endservent endservent |
1443 | |
1444 | #define PerlSock_getsockname(s, n, l) getsockname(s, n, l) |
1445 | #define PerlSock_getsockopt(s,l,n,v,i) getsockopt(s, l, n, v, i) |
1446 | #define PerlSock_inet_addr(c) inet_addr(c) |
1447 | #define PerlSock_inet_ntoa(i) inet_ntoa(i) |
1448 | #define PerlSock_listen(s, b) listen(s, b) |
c6af7a1a |
1449 | #define PerlSock_recv(s, b, l, f) recv(s, b, l, f) |
0f4eea8f |
1450 | #define PerlSock_recvfrom(s, b, l, f, from, fromlen) \ |
1451 | recvfrom(s, b, l, f, from, fromlen) |
1452 | #define PerlSock_select(n, r, w, e, t) select(n, r, w, e, t) |
1453 | #define PerlSock_send(s, b, l, f) send(s, b, l, f) |
1454 | #define PerlSock_sendto(s, b, l, f, t, tlen) \ |
1455 | sendto(s, b, l, f, t, tlen) |
1456 | #define PerlSock_sethostent(f) sethostent(f) |
1457 | #define PerlSock_setnetent(f) setnetent(f) |
1458 | #define PerlSock_setprotoent(f) setprotoent(f) |
1459 | #define PerlSock_setservent(f) setservent(f) |
1460 | #define PerlSock_setsockopt(s, l, n, v, len) \ |
1461 | setsockopt(s, l, n, v, len) |
1462 | #define PerlSock_shutdown(s, h) shutdown(s, h) |
1463 | #define PerlSock_socket(a, t, p) socket(a, t, p) |
1464 | #define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f) |
1465 | |
0cb96387 |
1466 | #ifdef WIN32 |
1467 | #define PerlSock_closesocket(s) closesocket(s) |
1468 | #endif |
0f4eea8f |
1469 | |
c5be433b |
1470 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f |
1471 | |
1472 | #endif /* __Inc__IPerl___ */ |
1473 | |