📄 iperlsys.h
字号:
/* * iperlsys.h - Perl's interface to the system * * This file defines the system level functionality that perl needs. * * When using C, this definition is in the form of a set of macros * that can be #defined to the system-level function (or a wrapper * provided elsewhere). * * When using C++ with -DPERL_OBJECT, this definition is in the * form of a set of virtual base classes which must be subclassed to * provide a real implementation. The Perl Object will use instances * of this implementation to use the system-level functionality. * * GSAR 21-JUN-98 */#ifndef __Inc__IPerl___#define __Inc__IPerl___/* * PerlXXX_YYY explained - DickH and DougL @ ActiveState.com * * XXX := functional group * YYY := stdlib/OS function name * * Continuing with the theme of PerlIO, all OS functionality was * encapsulated into one of several interfaces. * * PerlIO - stdio * PerlLIO - low level I/O * PerlMem - malloc, realloc, free * PerlDir - directory related * PerlEnv - process environment handling * PerlProc - process control * PerlSock - socket functions * * * The features of this are: * 1. All OS dependant code is in the Perl Host and not the Perl Core. * (At least this is the holy grail goal of this work) * 2. The Perl Host (see perl.h for description) can provide a new and * improved interface to OS functionality if required. * 3. Developers can easily hook into the OS calls for instrumentation * or diagnostic purposes. * * What was changed to do this: * 1. All calls to OS functions were replaced with PerlXXX_YYY * *//* Interface for perl stdio functions*//* Clean up (or at least document) the various possible #defines. This section attempts to match the 5.003_03 Configure variables onto the 5.003_02 header file values. I can't figure out where USE_STDIO was supposed to be set. --AD*/#ifndef USE_PERLIO# define PERLIO_IS_STDIO#endif/* Below is the 5.003_02 stuff. */#ifdef USE_STDIO# ifndef PERLIO_IS_STDIO# define PERLIO_IS_STDIO# endif#elseextern void PerlIO_init (void);#endif#ifndef Sighandler_ttypedef Signal_t (*Sighandler_t) (int);#endif#if defined(PERL_IMPLICIT_SYS)#ifndef PerlIOtypedef struct _PerlIO PerlIO;#endif/* IPerlStdIO */struct IPerlStdIO;struct IPerlStdIOInfo;typedef PerlIO* (*LPStdin)(struct IPerlStdIO*);typedef PerlIO* (*LPStdout)(struct IPerlStdIO*);typedef PerlIO* (*LPStderr)(struct IPerlStdIO*);typedef PerlIO* (*LPOpen)(struct IPerlStdIO*, const char*, const char*);typedef int (*LPClose)(struct IPerlStdIO*, PerlIO*);typedef int (*LPEof)(struct IPerlStdIO*, PerlIO*);typedef int (*LPError)(struct IPerlStdIO*, PerlIO*);typedef void (*LPClearerr)(struct IPerlStdIO*, PerlIO*);typedef int (*LPGetc)(struct IPerlStdIO*, PerlIO*);typedef char* (*LPGetBase)(struct IPerlStdIO*, PerlIO*);typedef int (*LPGetBufsiz)(struct IPerlStdIO*, PerlIO*);typedef int (*LPGetCnt)(struct IPerlStdIO*, PerlIO*);typedef char* (*LPGetPtr)(struct IPerlStdIO*, PerlIO*);typedef char* (*LPGets)(struct IPerlStdIO*, PerlIO*, char*, int);typedef int (*LPPutc)(struct IPerlStdIO*, PerlIO*, int);typedef int (*LPPuts)(struct IPerlStdIO*, PerlIO*, const char*);typedef int (*LPFlush)(struct IPerlStdIO*, PerlIO*);typedef int (*LPUngetc)(struct IPerlStdIO*, PerlIO*,int);typedef int (*LPFileno)(struct IPerlStdIO*, PerlIO*);typedef PerlIO* (*LPFdopen)(struct IPerlStdIO*, int, const char*);typedef PerlIO* (*LPReopen)(struct IPerlStdIO*, const char*, const char*, PerlIO*);typedef SSize_t (*LPRead)(struct IPerlStdIO*, PerlIO*, void*, Size_t);typedef SSize_t (*LPWrite)(struct IPerlStdIO*, PerlIO*, const void*, Size_t);typedef void (*LPSetBuf)(struct IPerlStdIO*, PerlIO*, char*);typedef int (*LPSetVBuf)(struct IPerlStdIO*, PerlIO*, char*, int, Size_t);typedef void (*LPSetCnt)(struct IPerlStdIO*, PerlIO*, int);typedef void (*LPSetPtrCnt)(struct IPerlStdIO*, PerlIO*, char*, int);typedef void (*LPSetlinebuf)(struct IPerlStdIO*, PerlIO*);typedef int (*LPPrintf)(struct IPerlStdIO*, PerlIO*, const char*, ...);typedef int (*LPVprintf)(struct IPerlStdIO*, PerlIO*, const char*, va_list);typedef long (*LPTell)(struct IPerlStdIO*, PerlIO*);typedef int (*LPSeek)(struct IPerlStdIO*, PerlIO*, Off_t, int);typedef void (*LPRewind)(struct IPerlStdIO*, PerlIO*);typedef PerlIO* (*LPTmpfile)(struct IPerlStdIO*);typedef int (*LPGetpos)(struct IPerlStdIO*, PerlIO*, Fpos_t*);typedef int (*LPSetpos)(struct IPerlStdIO*, PerlIO*, const Fpos_t*);typedef void (*LPInit)(struct IPerlStdIO*);typedef void (*LPInitOSExtras)(struct IPerlStdIO*);typedef PerlIO* (*LPFdupopen)(struct IPerlStdIO*, PerlIO*);struct IPerlStdIO{ LPStdin pStdin; LPStdout pStdout; LPStderr pStderr; LPOpen pOpen; LPClose pClose; LPEof pEof; LPError pError; LPClearerr pClearerr; LPGetc pGetc; LPGetBase pGetBase; LPGetBufsiz pGetBufsiz; LPGetCnt pGetCnt; LPGetPtr pGetPtr; LPGets pGets; LPPutc pPutc; LPPuts pPuts; LPFlush pFlush; LPUngetc pUngetc; LPFileno pFileno; LPFdopen pFdopen; LPReopen pReopen; LPRead pRead; LPWrite pWrite; LPSetBuf pSetBuf; LPSetVBuf pSetVBuf; LPSetCnt pSetCnt; LPSetPtrCnt pSetPtrCnt; LPSetlinebuf pSetlinebuf; LPPrintf pPrintf; LPVprintf pVprintf; LPTell pTell; LPSeek pSeek; LPRewind pRewind; LPTmpfile pTmpfile; LPGetpos pGetpos; LPSetpos pSetpos; LPInit pInit; LPInitOSExtras pInitOSExtras; LPFdupopen pFdupopen;};struct IPerlStdIOInfo{ unsigned long nCount; /* number of entries expected */ struct IPerlStdIO perlStdIOList;};#ifdef USE_STDIO_PTR# define PerlIO_has_cntptr(f) 1 # ifdef STDIO_PTR_LVALUE# ifdef STDIO_CNT_LVALUE# define PerlIO_canset_cnt(f) 1 # ifdef STDIO_PTR_LVAL_NOCHANGE_CNT# define PerlIO_fast_gets(f) 1 # endif# else /* STDIO_CNT_LVALUE */# define PerlIO_canset_cnt(f) 0 # endif# else /* STDIO_PTR_LVALUE */# ifdef STDIO_PTR_LVAL_SETS_CNT# define PerlIO_fast_gets(f) 1 # endif# endif#else /* USE_STDIO_PTR */# define PerlIO_has_cntptr(f) 0# define PerlIO_canset_cnt(f) 0#endif /* USE_STDIO_PTR */#ifndef PerlIO_fast_gets#define PerlIO_fast_gets(f) 0 #endif#ifdef FILE_base#define PerlIO_has_base(f) 1#else#define PerlIO_has_base(f) 0#endif#define PerlIO_stdin() \ (*PL_StdIO->pStdin)(PL_StdIO)#define PerlIO_stdout() \ (*PL_StdIO->pStdout)(PL_StdIO)#define PerlIO_stderr() \ (*PL_StdIO->pStderr)(PL_StdIO)#define PerlIO_open(x,y) \ (*PL_StdIO->pOpen)(PL_StdIO, (x),(y))#define PerlIO_close(f) \ (*PL_StdIO->pClose)(PL_StdIO, (f))#define PerlIO_eof(f) \ (*PL_StdIO->pEof)(PL_StdIO, (f))#define PerlIO_error(f) \ (*PL_StdIO->pError)(PL_StdIO, (f))#define PerlIO_clearerr(f) \ (*PL_StdIO->pClearerr)(PL_StdIO, (f))#define PerlIO_getc(f) \ (*PL_StdIO->pGetc)(PL_StdIO, (f))#define PerlIO_get_base(f) \ (*PL_StdIO->pGetBase)(PL_StdIO, (f))#define PerlIO_get_bufsiz(f) \ (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f))#define PerlIO_get_cnt(f) \ (*PL_StdIO->pGetCnt)(PL_StdIO, (f))#define PerlIO_get_ptr(f) \ (*PL_StdIO->pGetPtr)(PL_StdIO, (f))#define PerlIO_putc(f,c) \ (*PL_StdIO->pPutc)(PL_StdIO, (f),(c))#define PerlIO_puts(f,s) \ (*PL_StdIO->pPuts)(PL_StdIO, (f),(s))#define PerlIO_flush(f) \ (*PL_StdIO->pFlush)(PL_StdIO, (f))#define PerlIO_gets(s, n, fp) \ (*PL_StdIO->pGets)(PL_StdIO, (fp), s, n)#define PerlIO_ungetc(f,c) \ (*PL_StdIO->pUngetc)(PL_StdIO, (f),(c))#define PerlIO_fileno(f) \ (*PL_StdIO->pFileno)(PL_StdIO, (f))#define PerlIO_fdopen(f, s) \ (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s))#define PerlIO_reopen(p, m, f) \ (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f))#define PerlIO_read(f,buf,count) \ (SSize_t)(*PL_StdIO->pRead)(PL_StdIO, (f), (buf), (count))#define PerlIO_write(f,buf,count) \ (*PL_StdIO->pWrite)(PL_StdIO, (f), (buf), (count))#define PerlIO_setbuf(f,b) \ (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b))#define PerlIO_setvbuf(f,b,t,s) \ (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s))#define PerlIO_set_cnt(f,c) \ (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c))#define PerlIO_set_ptrcnt(f,p,c) \ (*PL_StdIO->pSetPtrCnt)(PL_StdIO, (f), (p), (c))#define PerlIO_setlinebuf(f) \ (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f))#define PerlIO_printf Perl_fprintf_nocontext#define PerlIO_stdoutf Perl_printf_nocontext#define PerlIO_vprintf(f,fmt,a) \ (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a) #define PerlIO_tell(f) \ (*PL_StdIO->pTell)(PL_StdIO, (f))#define PerlIO_seek(f,o,w) \ (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w))#define PerlIO_getpos(f,p) \ (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p))#define PerlIO_setpos(f,p) \ (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p))#define PerlIO_rewind(f) \ (*PL_StdIO->pRewind)(PL_StdIO, (f))#define PerlIO_tmpfile() \ (*PL_StdIO->pTmpfile)(PL_StdIO)#define PerlIO_init() \ (*PL_StdIO->pInit)(PL_StdIO)#undef init_os_extras#define init_os_extras() \ (*PL_StdIO->pInitOSExtras)(PL_StdIO)#define PerlIO_fdupopen(f) \ (*PL_StdIO->pFdupopen)(PL_StdIO, (f))#else /* PERL_IMPLICIT_SYS */#include "perlsdio.h"#include "perl.h"#define PerlIO_fdupopen(f) (f)#endif /* PERL_IMPLICIT_SYS */#ifndef PERLIO_IS_STDIO#ifdef USE_SFIO#include "perlsfio.h"#endif /* USE_SFIO */#endif /* PERLIO_IS_STDIO */#ifndef EOF#define EOF (-1)#endif/* This is to catch case with no stdio */#ifndef BUFSIZ#define BUFSIZ 1024#endif#ifndef SEEK_SET#define SEEK_SET 0#endif#ifndef SEEK_CUR#define SEEK_CUR 1#endif#ifndef SEEK_END#define SEEK_END 2#endif#ifndef PerlIOstruct _PerlIO;#define PerlIO struct _PerlIO#endif /* No PerlIO */#ifndef Fpos_t#define Fpos_t long#endif#ifndef NEXT30_NO_ATTRIBUTE#ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */#ifdef __attribute__ /* Avoid possible redefinition errors */#undef __attribute__#endif#define __attribute__(attr)#endif#endif#ifndef PerlIO_stdoutfextern int PerlIO_stdoutf (const char *,...) __attribute__((__format__ (__printf__, 1, 2)));#endif#ifndef PerlIO_putsextern int PerlIO_puts (PerlIO *,const char *);#endif#ifndef PerlIO_openextern PerlIO * PerlIO_open (const char *,const char *);#endif#ifndef PerlIO_closeextern int PerlIO_close (PerlIO *);#endif#ifndef PerlIO_eofextern int PerlIO_eof (PerlIO *);#endif#ifndef PerlIO_errorextern int PerlIO_error (PerlIO *);#endif#ifndef PerlIO_clearerrextern void PerlIO_clearerr (PerlIO *);#endif#ifndef PerlIO_getcextern int PerlIO_getc (PerlIO *);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -