From: Nick Ing-Simmons Date: Sun, 3 Dec 2000 16:53:00 +0000 (+0000) Subject: Make iperlsys.h vector stdio not PerlIO. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eaf8b6989fc5883b4cde6853803087e4b807b2b7;p=p5sagit%2Fp5-mst-13.2.git Make iperlsys.h vector stdio not PerlIO. p4raw-id: //depot/perlio@7961 --- diff --git a/iperlsys.h b/iperlsys.h index 206cf8e..1019784 100644 --- a/iperlsys.h +++ b/iperlsys.h @@ -64,54 +64,53 @@ typedef Signal_t (*Sighandler_t) (int); /* 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*, +typedef FILE* (*LPStdin)(struct IPerlStdIO*); +typedef FILE* (*LPStdout)(struct IPerlStdIO*); +typedef FILE* (*LPStderr)(struct IPerlStdIO*); +typedef FILE* (*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*, +typedef int (*LPClose)(struct IPerlStdIO*, FILE*); +typedef int (*LPEof)(struct IPerlStdIO*, FILE*); +typedef int (*LPError)(struct IPerlStdIO*, FILE*); +typedef void (*LPClearerr)(struct IPerlStdIO*, FILE*); +typedef int (*LPGetc)(struct IPerlStdIO*, FILE*); +typedef char* (*LPGetBase)(struct IPerlStdIO*, FILE*); +typedef int (*LPGetBufsiz)(struct IPerlStdIO*, FILE*); +typedef int (*LPGetCnt)(struct IPerlStdIO*, FILE*); +typedef char* (*LPGetPtr)(struct IPerlStdIO*, FILE*); +typedef char* (*LPGets)(struct IPerlStdIO*, FILE*, char*, int); +typedef int (*LPPutc)(struct IPerlStdIO*, FILE*, int); +typedef int (*LPPuts)(struct IPerlStdIO*, FILE*, const char*); +typedef int (*LPFlush)(struct IPerlStdIO*, FILE*); +typedef int (*LPUngetc)(struct IPerlStdIO*, FILE*,int); +typedef int (*LPFileno)(struct IPerlStdIO*, FILE*); +typedef FILE* (*LPFdopen)(struct IPerlStdIO*, int, const char*); +typedef FILE* (*LPReopen)(struct IPerlStdIO*, const char*, + const char*, FILE*); +typedef SSize_t (*LPRead)(struct IPerlStdIO*, FILE*, void*, Size_t); +typedef SSize_t (*LPWrite)(struct IPerlStdIO*, FILE*, const void*, Size_t); -typedef void (*LPSetBuf)(struct IPerlStdIO*, PerlIO*, char*); -typedef int (*LPSetVBuf)(struct IPerlStdIO*, PerlIO*, char*, int, +typedef void (*LPSetBuf)(struct IPerlStdIO*, FILE*, char*); +typedef int (*LPSetVBuf)(struct IPerlStdIO*, FILE*, char*, int, Size_t); -typedef void (*LPSetCnt)(struct IPerlStdIO*, PerlIO*, int); -typedef void (*LPSetPtrCnt)(struct IPerlStdIO*, PerlIO*, char*, +typedef void (*LPSetCnt)(struct IPerlStdIO*, FILE*, int); +typedef void (*LPSetPtrCnt)(struct IPerlStdIO*, FILE*, char*, int); -typedef void (*LPSetlinebuf)(struct IPerlStdIO*, PerlIO*); -typedef int (*LPPrintf)(struct IPerlStdIO*, PerlIO*, const char*, +typedef void (*LPSetlinebuf)(struct IPerlStdIO*, FILE*); +typedef int (*LPPrintf)(struct IPerlStdIO*, FILE*, const char*, ...); -typedef int (*LPVprintf)(struct IPerlStdIO*, PerlIO*, const char*, +typedef int (*LPVprintf)(struct IPerlStdIO*, FILE*, 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*, +typedef long (*LPTell)(struct IPerlStdIO*, FILE*); +typedef int (*LPSeek)(struct IPerlStdIO*, FILE*, Off_t, int); +typedef void (*LPRewind)(struct IPerlStdIO*, FILE*); +typedef FILE* (*LPTmpfile)(struct IPerlStdIO*); +typedef int (*LPGetpos)(struct IPerlStdIO*, FILE*, Fpos_t*); +typedef int (*LPSetpos)(struct IPerlStdIO*, FILE*, const Fpos_t*); typedef void (*LPInit)(struct IPerlStdIO*); typedef void (*LPInitOSExtras)(struct IPerlStdIO*); -typedef PerlIO* (*LPFdupopen)(struct IPerlStdIO*, PerlIO*); -typedef int (*LPIsUtf8)(struct IPerlStdIO*, PerlIO*); +typedef FILE* (*LPFdupopen)(struct IPerlStdIO*, FILE*); struct IPerlStdIO { @@ -154,7 +153,6 @@ struct IPerlStdIO LPInit pInit; LPInitOSExtras pInitOSExtras; LPFdupopen pFdupopen; - LPIsUtf8 pIsUtf8; }; struct IPerlStdIOInfo @@ -166,119 +164,178 @@ struct IPerlStdIOInfo /* These do not belong here ... NI-S, 14 Nov 2000 */ #ifdef USE_STDIO_PTR -# define PerlIO_has_cntptr(f) 1 +# define PerlSIO_has_cntptr(f) 1 # ifdef STDIO_PTR_LVALUE # ifdef STDIO_CNT_LVALUE -# define PerlIO_canset_cnt(f) 1 +# define PerlSIO_canset_cnt(f) 1 # ifdef STDIO_PTR_LVAL_NOCHANGE_CNT -# define PerlIO_fast_gets(f) 1 +# define PerlSIO_fast_gets(f) 1 # endif # else /* STDIO_CNT_LVALUE */ -# define PerlIO_canset_cnt(f) 0 +# define PerlSIO_canset_cnt(f) 0 # endif # else /* STDIO_PTR_LVALUE */ # ifdef STDIO_PTR_LVAL_SETS_CNT -# define PerlIO_fast_gets(f) 1 +# define PerlSIO_fast_gets(f) 1 # endif # endif #else /* USE_STDIO_PTR */ -# define PerlIO_has_cntptr(f) 0 -# define PerlIO_canset_cnt(f) 0 +# define PerlSIO_has_cntptr(f) 0 +# define PerlSIO_canset_cnt(f) 0 #endif /* USE_STDIO_PTR */ -#ifndef PerlIO_fast_gets -#define PerlIO_fast_gets(f) 0 +#ifndef PerlSIO_fast_gets +#define PerlSIO_fast_gets(f) 0 #endif #ifdef FILE_base -#define PerlIO_has_base(f) 1 +#define PerlSIO_has_base(f) 1 #else -#define PerlIO_has_base(f) 0 +#define PerlSIO_has_base(f) 0 #endif -/* Now take PerlIO * via function table */ +/* Now take FILE * via function table */ -#define PerlIO_stdin() \ +#define PerlSIO_stdin \ (*PL_StdIO->pStdin)(PL_StdIO) -#define PerlIO_stdout() \ +#define PerlSIO_stdout \ (*PL_StdIO->pStdout)(PL_StdIO) -#define PerlIO_stderr() \ +#define PerlSIO_stderr \ (*PL_StdIO->pStderr)(PL_StdIO) -#define PerlIO_open(x,y) \ +#define PerlSIO_fopen(x,y) \ (*PL_StdIO->pOpen)(PL_StdIO, (x),(y)) -#define PerlIO_close(f) \ +#define PerlSIO_fclose(f) \ (*PL_StdIO->pClose)(PL_StdIO, (f)) -#define PerlIO_eof(f) \ +#define PerlSIO_feof(f) \ (*PL_StdIO->pEof)(PL_StdIO, (f)) -#define PerlIO_error(f) \ +#define PerlSIO_ferror(f) \ (*PL_StdIO->pError)(PL_StdIO, (f)) -#define PerlIO_clearerr(f) \ +#define PerlSIO_clearerr(f) \ (*PL_StdIO->pClearerr)(PL_StdIO, (f)) -#define PerlIO_getc(f) \ +#define PerlSIO_fgetc(f) \ (*PL_StdIO->pGetc)(PL_StdIO, (f)) -#define PerlIO_get_base(f) \ +#define PerlSIO_get_base(f) \ (*PL_StdIO->pGetBase)(PL_StdIO, (f)) -#define PerlIO_get_bufsiz(f) \ +#define PerlSIO_get_bufsiz(f) \ (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f)) -#define PerlIO_get_cnt(f) \ +#define PerlSIO_get_cnt(f) \ (*PL_StdIO->pGetCnt)(PL_StdIO, (f)) -#define PerlIO_get_ptr(f) \ +#define PerlSIO_get_ptr(f) \ (*PL_StdIO->pGetPtr)(PL_StdIO, (f)) -#define PerlIO_putc(f,c) \ +#define PerlSIO_fputc(f,c) \ (*PL_StdIO->pPutc)(PL_StdIO, (f),(c)) -#define PerlIO_puts(f,s) \ +#define PerlSIO_fputs(f,s) \ (*PL_StdIO->pPuts)(PL_StdIO, (f),(s)) -#define PerlIO_flush(f) \ +#define PerlSIO_fflush(f) \ (*PL_StdIO->pFlush)(PL_StdIO, (f)) -#define PerlIO_gets(s, n, fp) \ +#define PerlSIO_fgets(s, n, fp) \ (*PL_StdIO->pGets)(PL_StdIO, (fp), s, n) -#define PerlIO_ungetc(f,c) \ +#define PerlSIO_ungetc(f,c) \ (*PL_StdIO->pUngetc)(PL_StdIO, (f),(c)) -#define PerlIO_fileno(f) \ +#define PerlSIO_fileno(f) \ (*PL_StdIO->pFileno)(PL_StdIO, (f)) -#define PerlIO_fdopen(f, s) \ +#define PerlSIO_fdopen(f, s) \ (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s)) -#define PerlIO_reopen(p, m, f) \ +#define PerlSIO_freopen(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) \ +#define PerlSIO_fread(buf,sz,count,f) \ + (SSize_t)(*PL_StdIO->pRead)(PL_StdIO, (sz), (buf), (count), (f)) +#define PerlSIO_write(buf,sz,count,f) \ + (*PL_StdIO->pWrite)(PL_StdIO, (sz), (buf), (count), (f)) +#define PerlSIO_setbuf(f,b) \ (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b)) -#define PerlIO_setvbuf(f,b,t,s) \ +#define PerlSIO_setvbuf(f,b,t,s) \ (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s)) -#define PerlIO_set_cnt(f,c) \ +#define PerlSIO_set_cnt(f,c) \ (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c)) -#define PerlIO_set_ptrcnt(f,p,c) \ +#define PerlSIO_set_ptrcnt(f,p,c) \ (*PL_StdIO->pSetPtrCnt)(PL_StdIO, (f), (p), (c)) -#define PerlIO_setlinebuf(f) \ +#define PerlSIO_setlinebuf(f) \ (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f)) -#define PerlIO_printf Perl_fprintf_nocontext -#define PerlIO_stdoutf *PL_StdIO->pPrintf -#define PerlIO_vprintf(f,fmt,a) \ +#define PerlSIO_printf Perl_fprintf_nocontext +#define PerlSIO_stdoutf *PL_StdIO->pPrintf +#define PerlSIO_vprintf(f,fmt,a) \ (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a) -#define PerlIO_tell(f) \ +#define PerlSIO_ftell(f) \ (*PL_StdIO->pTell)(PL_StdIO, (f)) -#define PerlIO_seek(f,o,w) \ +#define PerlSIO_fseek(f,o,w) \ (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w)) -#define PerlIO_getpos(f,p) \ +#define PerlSIO_fgetpos(f,p) \ (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p)) -#define PerlIO_setpos(f,p) \ +#define PerlSIO_fsetpos(f,p) \ (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p)) -#define PerlIO_rewind(f) \ +#define PerlSIO_rewind(f) \ (*PL_StdIO->pRewind)(PL_StdIO, (f)) -#define PerlIO_tmpfile() \ +#define PerlSIO_tmpfile() \ (*PL_StdIO->pTmpfile)(PL_StdIO) -#define PerlIO_init() \ +#define PerlSIO_init() \ (*PL_StdIO->pInit)(PL_StdIO) #undef init_os_extras #define init_os_extras() \ (*PL_StdIO->pInitOSExtras)(PL_StdIO) -#define PerlIO_fdupopen(f) \ +#define PerlSIO_fdupopen(f) \ (*PL_StdIO->pFdupopen)(PL_StdIO, (f)) -#define PerlIO_isutf8(f) \ - (*PL_StdIO->pIsUtf8)(PL_StdIO, (f)) + +#else /* PERL_IMPLICIT_SYS */ + +#define PerlSIO_stdin stdin +#define PerlSIO_stdout stdout +#define PerlSIO_stderr stderr +#define PerlSIO_fopen(x,y) fopen(x,y) +#define PerlSIO_fclose(f) fclose(f) +#define PerlSIO_feof(f) feof(f) +#define PerlSIO_ferror(f) ferror(f) +#define PerlSIO_clearerr(f) clearerr(f) +#define PerlSIO_fgetc(f) fgetc(f) +#if PerlSIO_has_base +#define PerlSIO_get_base(f) FILE_base(f) +#define PerlSIO_get_bufsiz(f) FILE_bufsiz(f) +#else +#define PerlSIO_get_base(f) NULL +#define PerlSIO_get_bufsiz(f) 0 +#endif +#ifdef USE_STDIO_PTR +#define PerlSIO_get_cnt(f) FILE_cnt(f) +#define PerlSIO_get_ptr(f) FILE_ptr(f) +#else +#define PerlSIO_get_cnt(f) 0 +#define PerlSIO_get_ptr(f) NULL +#endif +#define PerlSIO_fputc(f,c) fputc(c,f) +#define PerlSIO_fputs(f,s) fputs(s,f) +#define PerlSIO_fflush(f) Fflush(f) +#define PerlSIO_fgets(s, n, fp) fgets(s,n,fp) +#define PerlSIO_ungetc(f,c) ungetc(f,c) +#define PerlSIO_fileno(f) fileno(f) +#define PerlSIO_fdopen(f, s) fdopen(f,s) +#define PerlSIO_freopen(p, m, f) freopen(p,m,f) +#define PerlSIO_fread(buf,sz,count,f) fread(buf,sz,count,f) +#define PerlSIO_fwrite(buf,sz,count,f) fwrite(buf,sz,count,f) +#define PerlSIO_setbuf(f,b) setbuf(f,b) +#define PerlSIO_setvbuf(f,b,t,s) setvbuf(f,b,t,s) +#if defined(USE_STDIO_PTR) && defined(STDIO_CNT_LVALUE) +#define PerlSIO_set_cnt(f,c) FILE_cnt(f) = (c) +#else +#define PerlSIO_set_cnt(f,c) PerlIOProc_abort() +#endif +#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) +#define PerlSIO_set_ptr(f,p) FILE_ptr(f) = (p) +#else +#define PerlSIO_set_ptr(f,p) PerlIOProc_abort() +#endif +#define PerlSIO_setlinebuf(f) setlinebuf(f) +#define PerlSIO_printf Perl_fprintf_nocontext +#define PerlSIO_stdoutf *PL_StdIO->pPrintf +#define PerlSIO_vprintf(f,fmt,a) +#define PerlSIO_ftell(f) ftell(f) +#define PerlSIO_fseek(f,o,w) fseek(f,o,w) +#define PerlSIO_fgetpos(f,p) fgetpos(f,p) +#define PerlSIO_fsetpos(f,p) fsetpos(f,p) +#define PerlSIO_rewind(f) rewind(f) +#define PerlSIO_tmpfile() tmpfile() +#undef init_os_extras +#define init_os_extras() +#define PerlSIO_fdupopen(f) (f) #endif /* PERL_IMPLICIT_SYS */ @@ -667,12 +724,7 @@ struct IPerlLIOInfo #define PerlLIO_open3(file, flag, perm) open((file), (flag), (perm)) #define PerlLIO_read(fd, buf, count) read((fd), (buf), (count)) #define PerlLIO_rename(old, new) rename((old), (new)) -#if O_BINARY != O_TEXT #define PerlLIO_setmode(fd, mode) setmode((fd), (mode)) -#else -/* Until we have a "host" on UNIX to supply a stub #define it out */ -#define PerlLIO_setmode(fd, mode) 0 -#endif #define PerlLIO_tmpnam(str) tmpnam((str)) #define PerlLIO_umask(mode) umask((mode)) #define PerlLIO_unlink(file) unlink((file)) diff --git a/perlio.c b/perlio.c index d0c3b2e..69d9283 100644 --- a/perlio.c +++ b/perlio.c @@ -1310,7 +1310,7 @@ typedef struct IV PerlIOStdio_fileno(PerlIO *f) { - return fileno(PerlIOSelf(f,PerlIOStdio)->stdio); + return PerlSIO_fileno(PerlIOSelf(f,PerlIOStdio)->stdio); } const char * @@ -1349,19 +1349,19 @@ PerlIOStdio_fdopen(PerlIO_funcs *self, int fd,const char *mode) switch(fd) { case 0: - stdio = stdin; + stdio = PerlSIO_stdin; break; case 1: - stdio = stdout; + stdio = PerlSIO_stdout; break; case 2: - stdio = stderr; + stdio = PerlSIO_stderr; break; } } else { - stdio = fdopen(fd,mode = PerlIOStdio_mode(mode,tmode)); + stdio = PerlSIO_fdopen(fd,mode = PerlIOStdio_mode(mode,tmode)); } if (stdio) { @@ -1389,7 +1389,7 @@ PerlIO * PerlIOStdio_open(PerlIO_funcs *self, const char *path,const char *mode) { PerlIO *f = NULL; - FILE *stdio = fopen(path,mode); + FILE *stdio = PerlSIO_fopen(path,mode); if (stdio) { char tmode[8]; @@ -1406,7 +1406,7 @@ PerlIOStdio_reopen(const char *path, const char *mode, PerlIO *f) { PerlIOStdio *s = PerlIOSelf(f,PerlIOStdio); char tmode[8]; - FILE *stdio = freopen(path,(mode = PerlIOStdio_mode(mode,tmode)),s->stdio); + FILE *stdio = PerlSIO_freopen(path,(mode = PerlIOStdio_mode(mode,tmode)),s->stdio); if (!s->stdio) return -1; s->stdio = stdio; @@ -1424,7 +1424,7 @@ PerlIOStdio_read(PerlIO *f, void *vbuf, Size_t count) /* Perl is expecting PerlIO_getc() to fill the buffer * Linux's stdio does not do that for fread() */ - int ch = fgetc(s); + int ch = PerlSIO_fgetc(s); if (ch != EOF) { *buf = ch; @@ -1432,7 +1432,7 @@ PerlIOStdio_read(PerlIO *f, void *vbuf, Size_t count) } } else - got = fread(vbuf,1,count,s); + got = PerlSIO_fread(vbuf,1,count,s); return got; } @@ -1445,7 +1445,7 @@ PerlIOStdio_unread(PerlIO *f, const void *vbuf, Size_t count) while (count > 0) { int ch = *buf-- & 0xff; - if (ungetc(ch,s) != ch) + if (PerlSIO_ungetc(ch,s) != ch) break; unread++; count--; @@ -1456,21 +1456,21 @@ PerlIOStdio_unread(PerlIO *f, const void *vbuf, Size_t count) SSize_t PerlIOStdio_write(PerlIO *f, const void *vbuf, Size_t count) { - return fwrite(vbuf,1,count,PerlIOSelf(f,PerlIOStdio)->stdio); + return PerlSIO_fwrite(vbuf,1,count,PerlIOSelf(f,PerlIOStdio)->stdio); } IV PerlIOStdio_seek(PerlIO *f, Off_t offset, int whence) { FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; - return fseek(stdio,offset,whence); + return PerlSIO_fseek(stdio,offset,whence); } Off_t PerlIOStdio_tell(PerlIO *f) { FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; - return ftell(stdio); + return PerlSIO_ftell(stdio); } IV @@ -1480,7 +1480,7 @@ PerlIOStdio_close(PerlIO *f) FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; return( (getsockopt(PerlIO_fileno(f), SOL_SOCKET, SO_TYPE, (char *)&optval, &optlen) < 0) ? - fclose(stdio) : + PerlSIO_fclose(stdio) : close(PerlIO_fileno(f))); } @@ -1490,7 +1490,7 @@ PerlIOStdio_flush(PerlIO *f) FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; if (PerlIOBase(f)->flags & PERLIO_F_CANWRITE) { - return fflush(stdio); + return PerlSIO_fflush(stdio); } else { @@ -1502,7 +1502,7 @@ PerlIOStdio_flush(PerlIO *f) */ /* Not writeable - sync by attempting a seek */ int err = errno; - if (fseek(stdio,(Off_t) 0, SEEK_CUR) != 0) + if (PerlSIO_fseek(stdio,(Off_t) 0, SEEK_CUR) != 0) errno = err; #endif } @@ -1517,11 +1517,11 @@ PerlIOStdio_fill(PerlIO *f) /* fflush()ing read-only streams can cause trouble on some stdio-s */ if ((PerlIOBase(f)->flags & PERLIO_F_CANWRITE)) { - if (fflush(stdio) != 0) + if (PerlSIO_fflush(stdio) != 0) return EOF; } - c = fgetc(stdio); - if (c == EOF || ungetc(c,stdio) != c) + c = PerlSIO_fgetc(stdio); + if (c == EOF || PerlSIO_ungetc(c,stdio) != c) return EOF; return 0; } @@ -1529,28 +1529,28 @@ PerlIOStdio_fill(PerlIO *f) IV PerlIOStdio_eof(PerlIO *f) { - return feof(PerlIOSelf(f,PerlIOStdio)->stdio); + return PerlSIO_feof(PerlIOSelf(f,PerlIOStdio)->stdio); } IV PerlIOStdio_error(PerlIO *f) { - return ferror(PerlIOSelf(f,PerlIOStdio)->stdio); + return PerlSIO_ferror(PerlIOSelf(f,PerlIOStdio)->stdio); } void PerlIOStdio_clearerr(PerlIO *f) { - clearerr(PerlIOSelf(f,PerlIOStdio)->stdio); + PerlSIO_clearerr(PerlIOSelf(f,PerlIOStdio)->stdio); } void PerlIOStdio_setlinebuf(PerlIO *f) { #ifdef HAS_SETLINEBUF - setlinebuf(PerlIOSelf(f,PerlIOStdio)->stdio); + PerlSIO_setlinebuf(PerlIOSelf(f,PerlIOStdio)->stdio); #else - setvbuf(PerlIOSelf(f,PerlIOStdio)->stdio, Nullch, _IOLBF, 0); + PerlSIO_setvbuf(PerlIOSelf(f,PerlIOStdio)->stdio, Nullch, _IOLBF, 0); #endif } @@ -1559,14 +1559,14 @@ STDCHAR * PerlIOStdio_get_base(PerlIO *f) { FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; - return FILE_base(stdio); + return PerlSIO_get_base(stdio); } Size_t PerlIOStdio_get_bufsiz(PerlIO *f) { FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; - return FILE_bufsiz(stdio); + return PerlSIO_get_bufsiz(stdio); } #endif @@ -1575,14 +1575,14 @@ STDCHAR * PerlIOStdio_get_ptr(PerlIO *f) { FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; - return FILE_ptr(stdio); + return PerlSIO_get_ptr(stdio); } SSize_t PerlIOStdio_get_cnt(PerlIO *f) { FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; - return FILE_cnt(stdio); + return PerlSIO_get_cnt(stdio); } void @@ -1592,12 +1592,12 @@ PerlIOStdio_set_ptrcnt(PerlIO *f,STDCHAR *ptr,SSize_t cnt) if (ptr != NULL) { #ifdef STDIO_PTR_LVALUE - FILE_ptr(stdio) = ptr; + PerlSIO_set_ptr(stdio,ptr); #ifdef STDIO_PTR_LVAL_SETS_CNT - if (FILE_cnt(stdio) != (cnt)) + if (PerlSIO_get_cnt(stdio) != (cnt)) { dTHX; - assert(FILE_cnt(stdio) == (cnt)); + assert(PerlSIO_get_cnt(stdio) == (cnt)); } #endif #if (!defined(STDIO_PTR_LVAL_NOCHANGE_CNT)) @@ -1605,17 +1605,17 @@ PerlIOStdio_set_ptrcnt(PerlIO *f,STDCHAR *ptr,SSize_t cnt) return; #endif #else /* STDIO_PTR_LVALUE */ - abort(); + PerlProc_abort(); #endif /* STDIO_PTR_LVALUE */ } /* Now (or only) set cnt */ #ifdef STDIO_CNT_LVALUE - FILE_cnt(stdio) = cnt; + PerlSIO_set_cnt(stdio,cnt); #else /* STDIO_CNT_LVALUE */ #if (defined(STDIO_PTR_LVALUE) && defined(STDIO_PTR_LVAL_SETS_CNT)) - FILE_ptr(stdio) = FILE_ptr(stdio)+(FILE_cnt(stdio)-cnt); + PerlSIO_set_ptr(stdio,PerlSIO_get_ptr(stdio)+(PerlSIO_get_cnt(stdio)-cnt)); #else /* STDIO_PTR_LVAL_SETS_CNT */ - abort(); + PerlProc_abort(); #endif /* STDIO_PTR_LVAL_SETS_CNT */ #endif /* STDIO_CNT_LVALUE */ } @@ -3018,7 +3018,7 @@ PerlIO_tmpfile(void) /* I have no idea how portable mkstemp() is ... */ #if defined(WIN32) || !defined(HAVE_MKSTEMP) PerlIO *f = NULL; - FILE *stdio = tmpfile(); + FILE *stdio = PerlSIO_tmpfile(); if (stdio) { PerlIOStdio *s = PerlIOSelf(PerlIO_push(f = PerlIO_allocate(),&PerlIO_stdio,"w+"),PerlIOStdio);