home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D2.iso / workshop / apache / files / ActivePerl-5.6.1.638-MSWin32-x86.msi / _0aed848adb34f01472904d368f1c0584 < prev    next >
Encoding:
Text File  |  2004-04-13  |  49.3 KB  |  1,498 lines

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