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 (*LPUngetc)(struct IPerlStdIO*, int,FILE*);
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 SSize_t (*LPRead)(struct IPerlStdIO*, void*, Size_t, Size_t, FILE *);
+typedef SSize_t (*LPWrite)(struct IPerlStdIO*, const void*, Size_t, Size_t, FILE *);
typedef void (*LPSetBuf)(struct IPerlStdIO*, FILE*, char*);
typedef int (*LPSetVBuf)(struct IPerlStdIO*, FILE*, char*, int,
Size_t);
typedef void (*LPSetCnt)(struct IPerlStdIO*, FILE*, int);
-typedef void (*LPSetPtrCnt)(struct IPerlStdIO*, FILE*, char*,
- int);
+typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, char*);
typedef void (*LPSetlinebuf)(struct IPerlStdIO*, FILE*);
typedef int (*LPPrintf)(struct IPerlStdIO*, FILE*, const char*,
...);
LPSetBuf pSetBuf;
LPSetVBuf pSetVBuf;
LPSetCnt pSetCnt;
- LPSetPtrCnt pSetPtrCnt;
+ LPSetPtr pSetPtr;
LPSetlinebuf pSetlinebuf;
LPPrintf pPrintf;
LPVprintf pVprintf;
(*PL_StdIO->pFlush)(PL_StdIO, (f))
#define PerlSIO_fgets(s, n, fp) \
(*PL_StdIO->pGets)(PL_StdIO, (fp), s, n)
-#define PerlSIO_ungetc(f,c) \
- (*PL_StdIO->pUngetc)(PL_StdIO, (f),(c))
+#define PerlSIO_ungetc(c,f) \
+ (*PL_StdIO->pUngetc)(PL_StdIO, (c),(f))
#define PerlSIO_fileno(f) \
(*PL_StdIO->pFileno)(PL_StdIO, (f))
#define PerlSIO_fdopen(f, s) \
#define PerlSIO_freopen(p, m, f) \
(*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f))
#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))
+ (*PL_StdIO->pRead)(PL_StdIO, (buf), (sz), (count), (f))
+#define PerlSIO_fwrite(buf,sz,count,f) \
+ (*PL_StdIO->pWrite)(PL_StdIO, (buf), (sz), (count), (f))
#define PerlSIO_setbuf(f,b) \
(*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b))
#define PerlSIO_setvbuf(f,b,t,s) \
(*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s))
#define PerlSIO_set_cnt(f,c) \
(*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c))
-#define PerlSIO_set_ptrcnt(f,p,c) \
- (*PL_StdIO->pSetPtrCnt)(PL_StdIO, (f), (p), (c))
+#define PerlSIO_set_ptr(f,p) \
+ (*PL_StdIO->pSetPtr)(PL_StdIO, (f), (p))
#define PerlSIO_setlinebuf(f) \
(*PL_StdIO->pSetlinebuf)(PL_StdIO, (f))
#define PerlSIO_printf Perl_fprintf_nocontext
#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_ungetc(c,f) ungetc(c,f)
#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_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 */
#endif
-#if !defined(PERL_IMPLICIT_SYS)
#ifdef PERLIO_IS_STDIO
void
PerlIO_debug(const char *fmt,...)
{
+ dTHX;
static int dbg = 0;
va_list ap;
va_start(ap,fmt);
PerlIO *
PerlIOUnix_open(PerlIO_funcs *self, const char *path,const char *mode)
{
+ dTHX;
PerlIO *f = NULL;
int oflags = PerlIOUnix_oflags(mode);
if (oflags != -1)
(*PerlIOBase(f)->tab->Close)(f);
if (oflags != -1)
{
+ dTHX;
int fd = PerlLIO_open3(path,oflags,0666);
if (fd >= 0)
{
SSize_t
PerlIOUnix_read(PerlIO *f, void *vbuf, Size_t count)
{
+ dTHX;
int fd = PerlIOSelf(f,PerlIOUnix)->fd;
if (!(PerlIOBase(f)->flags & PERLIO_F_CANREAD))
return 0;
SSize_t
PerlIOUnix_write(PerlIO *f, const void *vbuf, Size_t count)
{
+ dTHX;
int fd = PerlIOSelf(f,PerlIOUnix)->fd;
while (1)
{
IV
PerlIOUnix_seek(PerlIO *f, Off_t offset, int whence)
{
+ dTHX;
Off_t new = PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,offset,whence);
PerlIOBase(f)->flags &= ~PERLIO_F_EOF;
return (new == (Off_t) -1) ? -1 : 0;
Off_t
PerlIOUnix_tell(PerlIO *f)
{
+ dTHX;
return PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,0,SEEK_CUR);
}
IV
PerlIOUnix_close(PerlIO *f)
{
+ dTHX;
int fd = PerlIOSelf(f,PerlIOUnix)->fd;
int code = 0;
while (PerlLIO_close(fd) != 0)
IV
PerlIOStdio_fileno(PerlIO *f)
{
+ dTHX;
return PerlSIO_fileno(PerlIOSelf(f,PerlIOStdio)->stdio);
}
PerlIO *
PerlIOStdio_fdopen(PerlIO_funcs *self, int fd,const char *mode)
{
+ dTHX;
PerlIO *f = NULL;
int init = 0;
char tmode[8];
PerlIO *
PerlIOStdio_open(PerlIO_funcs *self, const char *path,const char *mode)
{
+ dTHX;
PerlIO *f = NULL;
FILE *stdio = PerlSIO_fopen(path,mode);
if (stdio)
int
PerlIOStdio_reopen(const char *path, const char *mode, PerlIO *f)
{
+ dTHX;
PerlIOStdio *s = PerlIOSelf(f,PerlIOStdio);
char tmode[8];
FILE *stdio = PerlSIO_freopen(path,(mode = PerlIOStdio_mode(mode,tmode)),s->stdio);
SSize_t
PerlIOStdio_read(PerlIO *f, void *vbuf, Size_t count)
{
+ dTHX;
FILE *s = PerlIOSelf(f,PerlIOStdio)->stdio;
SSize_t got = 0;
if (count == 1)
SSize_t
PerlIOStdio_unread(PerlIO *f, const void *vbuf, Size_t count)
{
+ dTHX;
FILE *s = PerlIOSelf(f,PerlIOStdio)->stdio;
STDCHAR *buf = ((STDCHAR *)vbuf)+count-1;
SSize_t unread = 0;
SSize_t
PerlIOStdio_write(PerlIO *f, const void *vbuf, Size_t count)
{
+ dTHX;
return PerlSIO_fwrite(vbuf,1,count,PerlIOSelf(f,PerlIOStdio)->stdio);
}
IV
PerlIOStdio_seek(PerlIO *f, Off_t offset, int whence)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
return PerlSIO_fseek(stdio,offset,whence);
}
Off_t
PerlIOStdio_tell(PerlIO *f)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
return PerlSIO_ftell(stdio);
}
IV
PerlIOStdio_close(PerlIO *f)
{
+ dTHX;
int optval, optlen = sizeof(int);
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
return(
IV
PerlIOStdio_flush(PerlIO *f)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
if (PerlIOBase(f)->flags & PERLIO_F_CANWRITE)
{
IV
PerlIOStdio_fill(PerlIO *f)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
int c;
/* fflush()ing read-only streams can cause trouble on some stdio-s */
IV
PerlIOStdio_eof(PerlIO *f)
{
+ dTHX;
return PerlSIO_feof(PerlIOSelf(f,PerlIOStdio)->stdio);
}
IV
PerlIOStdio_error(PerlIO *f)
{
+ dTHX;
return PerlSIO_ferror(PerlIOSelf(f,PerlIOStdio)->stdio);
}
void
PerlIOStdio_clearerr(PerlIO *f)
{
+ dTHX;
PerlSIO_clearerr(PerlIOSelf(f,PerlIOStdio)->stdio);
}
void
PerlIOStdio_setlinebuf(PerlIO *f)
{
+ dTHX;
#ifdef HAS_SETLINEBUF
PerlSIO_setlinebuf(PerlIOSelf(f,PerlIOStdio)->stdio);
#else
STDCHAR *
PerlIOStdio_get_base(PerlIO *f)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
return PerlSIO_get_base(stdio);
}
Size_t
PerlIOStdio_get_bufsiz(PerlIO *f)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
return PerlSIO_get_bufsiz(stdio);
}
STDCHAR *
PerlIOStdio_get_ptr(PerlIO *f)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
return PerlSIO_get_ptr(stdio);
}
SSize_t
PerlIOStdio_get_cnt(PerlIO *f)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
return PerlSIO_get_cnt(stdio);
}
void
PerlIOStdio_set_ptrcnt(PerlIO *f,STDCHAR *ptr,SSize_t cnt)
{
+ dTHX;
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
if (ptr != NULL)
{
PerlIO *
PerlIOBuf_fdopen(PerlIO_funcs *self, int fd, const char *mode)
{
+ dTHX;
PerlIO_funcs *tab = PerlIO_default_btm();
int init = 0;
PerlIO *f;
{
/* I have no idea how portable mkstemp() is ... */
#if defined(WIN32) || !defined(HAVE_MKSTEMP)
+ dTHX;
PerlIO *f = NULL;
FILE *stdio = PerlSIO_tmpfile();
if (stdio)
}
#endif
-#endif /* !PERL_IMPLICIT_SYS */
/* --------------------- Now prototypes for functions --------------- */
+START_EXTERN_C
+
#ifndef NEXT30_NO_ATTRIBUTE
#ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */
#ifdef __attribute__ /* Avoid possible redefinition errors */
extern int PerlIO_binmode (pTHX_ PerlIO *f, int iotype, int omode, const char *names);
#endif
+extern void PerlIO_cleanup(void);
+
extern void PerlIO_debug(const char *fmt,...);
+END_EXTERN_C
+
#endif /* _PERLIO_H */
# uncomment to enable multiple interpreters. This is need for fork()
# emulation.
#
-#USE_MULTI *= define
+USE_MULTI *= define
#
# Beginnings of interpreter cloning/threads; still very incomplete.
# This should be enabled to get the fork() emulation. This needs
# USE_MULTI as well.
#
-#USE_ITHREADS *= define
+USE_ITHREADS *= define
#
# uncomment to enable the implicit "host" layer for all system calls
# made by perl. This needs USE_MULTI above. This is also needed to
# get fork().
#
-#USE_IMP_SYS *= define
+USE_IMP_SYS *= define
#
# WARNING! This option is deprecated and will eventually go away (enable
IMPLIB = dlltool
RSC = rc
+i = .i
o = .o
a = .a
# Rules
#
-.SUFFIXES : .c $(o) .dll $(a) .exe .rc .res
+.SUFFIXES : .c .i $(o) .dll $(a) .exe .rc .res
.c$(o):
$(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
+.c.i:
+ $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) -E $< >$@
+
.y.c:
$(NOOP)
#define IPERL2HOST(x) IPerlStdIO2Host(x)
/* PerlStdIO */
-PerlIO*
+FILE*
PerlStdIOStdin(struct IPerlStdIO* piPerl)
{
- return (PerlIO*)win32_stdin();
+ return win32_stdin();
}
-PerlIO*
+FILE*
PerlStdIOStdout(struct IPerlStdIO* piPerl)
{
- return (PerlIO*)win32_stdout();
+ return win32_stdout();
}
-PerlIO*
+FILE*
PerlStdIOStderr(struct IPerlStdIO* piPerl)
{
- return (PerlIO*)win32_stderr();
+ return win32_stderr();
}
-PerlIO*
+FILE*
PerlStdIOOpen(struct IPerlStdIO* piPerl, const char *path, const char *mode)
{
- return (PerlIO*)win32_fopen(path, mode);
+ return win32_fopen(path, mode);
}
int
-PerlStdIOClose(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOClose(struct IPerlStdIO* piPerl, FILE* pf)
{
- return win32_fclose(((FILE*)pf));
+ return win32_fclose((pf));
}
int
-PerlStdIOEof(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOEof(struct IPerlStdIO* piPerl, FILE* pf)
{
- return win32_feof((FILE*)pf);
+ return win32_feof(pf);
}
int
-PerlStdIOError(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOError(struct IPerlStdIO* piPerl, FILE* pf)
{
- return win32_ferror((FILE*)pf);
+ return win32_ferror(pf);
}
void
-PerlStdIOClearerr(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOClearerr(struct IPerlStdIO* piPerl, FILE* pf)
{
- win32_clearerr((FILE*)pf);
+ win32_clearerr(pf);
}
int
-PerlStdIOGetc(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOGetc(struct IPerlStdIO* piPerl, FILE* pf)
{
- return win32_getc((FILE*)pf);
+ return win32_getc(pf);
}
char*
-PerlStdIOGetBase(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOGetBase(struct IPerlStdIO* piPerl, FILE* pf)
{
#ifdef FILE_base
- FILE *f = (FILE*)pf;
+ FILE *f = pf;
return FILE_base(f);
#else
return Nullch;
}
int
-PerlStdIOGetBufsiz(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOGetBufsiz(struct IPerlStdIO* piPerl, FILE* pf)
{
#ifdef FILE_bufsiz
- FILE *f = (FILE*)pf;
+ FILE *f = pf;
return FILE_bufsiz(f);
#else
return (-1);
}
int
-PerlStdIOGetCnt(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOGetCnt(struct IPerlStdIO* piPerl, FILE* pf)
{
#ifdef USE_STDIO_PTR
- FILE *f = (FILE*)pf;
+ FILE *f = pf;
return FILE_cnt(f);
#else
return (-1);
}
char*
-PerlStdIOGetPtr(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOGetPtr(struct IPerlStdIO* piPerl, FILE* pf)
{
#ifdef USE_STDIO_PTR
- FILE *f = (FILE*)pf;
+ FILE *f = pf;
return FILE_ptr(f);
#else
return Nullch;
}
char*
-PerlStdIOGets(struct IPerlStdIO* piPerl, PerlIO* pf, char* s, int n)
+PerlStdIOGets(struct IPerlStdIO* piPerl, FILE* pf, char* s, int n)
{
- return win32_fgets(s, n, (FILE*)pf);
+ return win32_fgets(s, n, pf);
}
int
-PerlStdIOPutc(struct IPerlStdIO* piPerl, PerlIO* pf, int c)
+PerlStdIOPutc(struct IPerlStdIO* piPerl, FILE* pf, int c)
{
- return win32_fputc(c, (FILE*)pf);
+ return win32_fputc(c, pf);
}
int
-PerlStdIOPuts(struct IPerlStdIO* piPerl, PerlIO* pf, const char *s)
+PerlStdIOPuts(struct IPerlStdIO* piPerl, FILE* pf, const char *s)
{
- return win32_fputs(s, (FILE*)pf);
+ return win32_fputs(s, pf);
}
int
-PerlStdIOFlush(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOFlush(struct IPerlStdIO* piPerl, FILE* pf)
{
- return win32_fflush((FILE*)pf);
+ return win32_fflush(pf);
}
int
-PerlStdIOUngetc(struct IPerlStdIO* piPerl, PerlIO* pf,int c)
+PerlStdIOUngetc(struct IPerlStdIO* piPerl,int c, FILE* pf)
{
- return win32_ungetc(c, (FILE*)pf);
+ return win32_ungetc(c, pf);
}
int
-PerlStdIOFileno(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOFileno(struct IPerlStdIO* piPerl, FILE* pf)
{
- return win32_fileno((FILE*)pf);
+ return win32_fileno(pf);
}
-PerlIO*
+FILE*
PerlStdIOFdopen(struct IPerlStdIO* piPerl, int fd, const char *mode)
{
- return (PerlIO*)win32_fdopen(fd, mode);
+ return win32_fdopen(fd, mode);
}
-PerlIO*
-PerlStdIOReopen(struct IPerlStdIO* piPerl, const char*path, const char*mode, PerlIO* pf)
+FILE*
+PerlStdIOReopen(struct IPerlStdIO* piPerl, const char*path, const char*mode, FILE* pf)
{
- return (PerlIO*)win32_freopen(path, mode, (FILE*)pf);
+ return win32_freopen(path, mode, (FILE*)pf);
}
SSize_t
-PerlStdIORead(struct IPerlStdIO* piPerl, PerlIO* pf, void *buffer, Size_t size)
+PerlStdIORead(struct IPerlStdIO* piPerl, void *buffer, Size_t size, Size_t count, FILE* pf)
{
- return win32_fread(buffer, 1, size, (FILE*)pf);
+ return win32_fread(buffer, size, count, pf);
}
SSize_t
-PerlStdIOWrite(struct IPerlStdIO* piPerl, PerlIO* pf, const void *buffer, Size_t size)
+PerlStdIOWrite(struct IPerlStdIO* piPerl, const void *buffer, Size_t size, Size_t count, FILE* pf)
{
- return win32_fwrite(buffer, 1, size, (FILE*)pf);
+ return win32_fwrite(buffer, size, count, pf);
}
void
-PerlStdIOSetBuf(struct IPerlStdIO* piPerl, PerlIO* pf, char* buffer)
+PerlStdIOSetBuf(struct IPerlStdIO* piPerl, FILE* pf, char* buffer)
{
- win32_setbuf((FILE*)pf, buffer);
+ win32_setbuf(pf, buffer);
}
int
-PerlStdIOSetVBuf(struct IPerlStdIO* piPerl, PerlIO* pf, char* buffer, int type, Size_t size)
+PerlStdIOSetVBuf(struct IPerlStdIO* piPerl, FILE* pf, char* buffer, int type, Size_t size)
{
- return win32_setvbuf((FILE*)pf, buffer, type, size);
+ return win32_setvbuf(pf, buffer, type, size);
}
void
-PerlStdIOSetCnt(struct IPerlStdIO* piPerl, PerlIO* pf, int n)
+PerlStdIOSetCnt(struct IPerlStdIO* piPerl, FILE* pf, int n)
{
#ifdef STDIO_CNT_LVALUE
- FILE *f = (FILE*)pf;
+ FILE *f = pf;
FILE_cnt(f) = n;
#endif
}
void
-PerlStdIOSetPtrCnt(struct IPerlStdIO* piPerl, PerlIO* pf, char * ptr, int n)
+PerlStdIOSetPtr(struct IPerlStdIO* piPerl, FILE* pf, char * ptr)
{
#ifdef STDIO_PTR_LVALUE
- FILE *f = (FILE*)pf;
+ FILE *f = pf;
FILE_ptr(f) = ptr;
- FILE_cnt(f) = n;
#endif
}
void
-PerlStdIOSetlinebuf(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOSetlinebuf(struct IPerlStdIO* piPerl, FILE* pf)
{
- win32_setvbuf((FILE*)pf, NULL, _IOLBF, 0);
+ win32_setvbuf(pf, NULL, _IOLBF, 0);
}
int
-PerlStdIOPrintf(struct IPerlStdIO* piPerl, PerlIO* pf, const char *format,...)
+PerlStdIOPrintf(struct IPerlStdIO* piPerl, FILE* pf, const char *format,...)
{
va_list(arglist);
va_start(arglist, format);
- return win32_vfprintf((FILE*)pf, format, arglist);
+ return win32_vfprintf(pf, format, arglist);
}
int
-PerlStdIOVprintf(struct IPerlStdIO* piPerl, PerlIO* pf, const char *format, va_list arglist)
+PerlStdIOVprintf(struct IPerlStdIO* piPerl, FILE* pf, const char *format, va_list arglist)
{
- return win32_vfprintf((FILE*)pf, format, arglist);
+ return win32_vfprintf(pf, format, arglist);
}
long
-PerlStdIOTell(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIOTell(struct IPerlStdIO* piPerl, FILE* pf)
{
- return win32_ftell((FILE*)pf);
+ return win32_ftell(pf);
}
int
-PerlStdIOSeek(struct IPerlStdIO* piPerl, PerlIO* pf, off_t offset, int origin)
+PerlStdIOSeek(struct IPerlStdIO* piPerl, FILE* pf, off_t offset, int origin)
{
- return win32_fseek((FILE*)pf, offset, origin);
+ return win32_fseek(pf, offset, origin);
}
void
-PerlStdIORewind(struct IPerlStdIO* piPerl, PerlIO* pf)
+PerlStdIORewind(struct IPerlStdIO* piPerl, FILE* pf)
{
- win32_rewind((FILE*)pf);
+ win32_rewind(pf);
}
-PerlIO*
+FILE*
PerlStdIOTmpfile(struct IPerlStdIO* piPerl)
{
- return (PerlIO*)win32_tmpfile();
+ return win32_tmpfile();
}
int
-PerlStdIOGetpos(struct IPerlStdIO* piPerl, PerlIO* pf, Fpos_t *p)
+PerlStdIOGetpos(struct IPerlStdIO* piPerl, FILE* pf, Fpos_t *p)
{
- return win32_fgetpos((FILE*)pf, p);
+ return win32_fgetpos(pf, p);
}
int
-PerlStdIOSetpos(struct IPerlStdIO* piPerl, PerlIO* pf, const Fpos_t *p)
+PerlStdIOSetpos(struct IPerlStdIO* piPerl, FILE* pf, const Fpos_t *p)
{
- return win32_fsetpos((FILE*)pf, p);
+ return win32_fsetpos(pf, p);
}
void
PerlStdIOInit(struct IPerlStdIO* piPerl)
return win32_get_osfhandle(filenum);
}
-PerlIO*
-PerlStdIOFdupopen(struct IPerlStdIO* piPerl, PerlIO* pf)
+FILE*
+PerlStdIOFdupopen(struct IPerlStdIO* piPerl, FILE* pf)
{
- PerlIO* pfdup;
+ FILE* pfdup;
fpos_t pos;
char mode[3];
- int fileno = win32_dup(win32_fileno((FILE*)pf));
+ int fileno = win32_dup(win32_fileno(pf));
/* open the file in the same mode */
#ifdef __BORLANDC__
- if(((FILE*)pf)->flags & _F_READ) {
+ if((pf)->flags & _F_READ) {
mode[0] = 'r';
mode[1] = 0;
}
- else if(((FILE*)pf)->flags & _F_WRIT) {
+ else if((pf)->flags & _F_WRIT) {
mode[0] = 'a';
mode[1] = 0;
}
- else if(((FILE*)pf)->flags & _F_RDWR) {
+ else if((pf)->flags & _F_RDWR) {
mode[0] = 'r';
mode[1] = '+';
mode[2] = 0;
}
#else
- if(((FILE*)pf)->_flag & _IOREAD) {
+ if((pf)->_flag & _IOREAD) {
mode[0] = 'r';
mode[1] = 0;
}
- else if(((FILE*)pf)->_flag & _IOWRT) {
+ else if((pf)->_flag & _IOWRT) {
mode[0] = 'a';
mode[1] = 0;
}
- else if(((FILE*)pf)->_flag & _IORW) {
+ else if((pf)->_flag & _IORW) {
mode[0] = 'r';
mode[1] = '+';
mode[2] = 0;
* file descriptor so binmode files will be handled
* correctly
*/
- pfdup = (PerlIO*)win32_fdopen(fileno, mode);
+ pfdup = win32_fdopen(fileno, mode);
/* move the file pointer to the same position */
- if (!fgetpos((FILE*)pf, &pos)) {
- fsetpos((FILE*)pfdup, &pos);
+ if (!fgetpos(pf, &pos)) {
+ fsetpos(pfdup, &pos);
}
return pfdup;
}
PerlStdIOSetBuf,
PerlStdIOSetVBuf,
PerlStdIOSetCnt,
- PerlStdIOSetPtrCnt,
+ PerlStdIOSetPtr,
PerlStdIOSetlinebuf,
PerlStdIOPrintf,
PerlStdIOVprintf,
{
dTHXo;
PERL_FLUSHALL_FOR_CHILD;
- return (PerlIO*)win32_popen(command, mode);
+ return win32_popen(command, mode);
}
int
PerlProcPclose(struct IPerlProc* piPerl, PerlIO *stream)
{
- return win32_pclose((FILE*)stream);
+ return win32_pclose(stream);
}
int
/*
* "The Road goes ever on and on, down from the door where it began."
*/
-
-
+#define PERLIO_NOT_STDIO 0
#include "EXTERN.h"
#include "perl.h"
#endif
#endif
+#define PERLIO_NOT_STDIO 0
+
+#include "perlio.h"
+
/*
* This provides a layer of functions and macros to ensure extensions will
* get to use the same RTL functions as the core.
DllExport int win32_fstat(int fd,struct stat *sbufptr);
DllExport int win32_stat(const char *name,struct stat *sbufptr);
DllExport int win32_pipe( int *phandles, unsigned int psize, int textmode );
-DllExport FILE* win32_popen( const char *command, const char *mode );
-DllExport int win32_pclose( FILE *pf);
+DllExport PerlIO* win32_popen( const char *command, const char *mode );
+DllExport int win32_pclose( PerlIO *pf);
DllExport int win32_rename( const char *oname, const char *newname);
DllExport int win32_setmode( int fd, int mode);
DllExport long win32_lseek( int fd, long offset, int origin);
#define ALLOC_THREAD_KEY \
STMT_START { \
if ((PL_thr_key = TlsAlloc()) == TLS_OUT_OF_INDEXES) { \
- fprintf(stderr,"panic: TlsAlloc"); \
+ PerlIO_printf(PerlIO_stderr(),"panic: TlsAlloc"); \
exit(1); \
} \
} STMT_END