summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-24 05:51:53 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-24 05:51:53 +0000
commitc78749f2c1dc7ab348159cae5136d33e33ca5c90 (patch)
treebe5069dd42f2d820c341e32303553e0f73437248
parent606974b21cdb98866563c221c06d21c01db0cf0d (diff)
downloadperl-c78749f2c1dc7ab348159cae5136d33e33ca5c90.tar.gz
ansify perlio.c, fix PerlIO-ish typos
p4raw-id: //depot/perl@3021
-rw-r--r--ext/DynaLoader/dl_beos.xs4
-rw-r--r--ext/DynaLoader/dl_cygwin32.xs10
-rw-r--r--iperlsys.h6
-rw-r--r--perlio.c164
4 files changed, 58 insertions, 126 deletions
diff --git a/ext/DynaLoader/dl_beos.xs b/ext/DynaLoader/dl_beos.xs
index 515d187260..42a27cb1f1 100644
--- a/ext/DynaLoader/dl_beos.xs
+++ b/ext/DynaLoader/dl_beos.xs
@@ -51,7 +51,7 @@ dl_load_file(filename, flags=0)
ST(0) = sv_newmortal() ;
if (bogo < 0) {
SaveError("%s", strerror(bogo));
- fprintf(stderr, "load_add_on(%s) : %d (%s)\n", path, bogo, strerror(bogo));
+ PerlIO_printf(PerlIO_stderr(), "load_add_on(%s) : %d (%s)\n", path, bogo, strerror(bogo));
} else {
RETVAL = (void *) bogo;
sv_setiv( ST(0), (IV)RETVAL);
@@ -81,7 +81,7 @@ dl_find_symbol(libhandle, symbolname)
ST(0) = sv_newmortal() ;
if (RETVAL == NULL) {
SaveError("%s", strerror(retcode)) ;
- fprintf(stderr, "retcode = %p (%s)\n", retcode, strerror(retcode));
+ PerlIO_printf(PerlIO_stderr(), "retcode = %p (%s)\n", retcode, strerror(retcode));
} else
sv_setiv( ST(0), (IV)RETVAL);
diff --git a/ext/DynaLoader/dl_cygwin32.xs b/ext/DynaLoader/dl_cygwin32.xs
index 2b7563764e..b64ab3e345 100644
--- a/ext/DynaLoader/dl_cygwin32.xs
+++ b/ext/DynaLoader/dl_cygwin32.xs
@@ -82,11 +82,11 @@ dl_load_file(filename,flags=0)
int flags
PREINIT:
CODE:
- DLDEBUG(1,fprintf(stderr,"dl_load_file(%s):\n", filename));
+ DLDEBUG(1,PerlIO_printf(PerlIO_stderr(),"dl_load_file(%s):\n", filename));
RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ;
- DLDEBUG(2,fprintf(stderr," libref=%x\n", RETVAL));
+ DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," libref=%x\n", RETVAL));
ST(0) = sv_newmortal() ;
if (RETVAL == NULL){
SaveError("%d",GetLastError()) ;
@@ -113,10 +113,10 @@ dl_find_symbol(libhandle, symbolname)
void * libhandle
char * symbolname
CODE:
- DLDEBUG(2,fprintf(stderr,"dl_find_symbol(handle=%x, symbol=%s)\n",
+ DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_find_symbol(handle=%x, symbol=%s)\n",
libhandle, symbolname));
RETVAL = (void*) GetProcAddress((HINSTANCE) libhandle, symbolname);
- DLDEBUG(2,fprintf(stderr," symbolref = %x\n", RETVAL));
+ DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," symbolref = %x\n", RETVAL));
ST(0) = sv_newmortal() ;
if (RETVAL == NULL)
SaveError("%d",GetLastError()) ;
@@ -138,7 +138,7 @@ dl_install_xsub(perl_name, symref, filename="$Package")
void * symref
char * filename
CODE:
- DLDEBUG(2,fprintf(stderr,"dl_install_xsub(name=%s, symref=%x)\n",
+ DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_install_xsub(name=%s, symref=%x)\n",
perl_name, symref));
ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename)));
diff --git a/iperlsys.h b/iperlsys.h
index cfdc39f9de..67ef90aec1 100644
--- a/iperlsys.h
+++ b/iperlsys.h
@@ -114,7 +114,7 @@ public:
virtual int Printf(PerlIO*, int &err, const char *,...) = 0;
virtual int Vprintf(PerlIO*, int &err, const char *, va_list) = 0;
virtual long Tell(PerlIO*, int &err) = 0;
- virtual int Seek(PerlIO*, off_t, int, int &err) = 0;
+ virtual int Seek(PerlIO*, Off_t, int, int &err) = 0;
virtual void Rewind(PerlIO*, int &err) = 0;
virtual PerlIO * Tmpfile(int &err) = 0;
virtual int Getpos(PerlIO*, Fpos_t *, int &err) = 0;
@@ -322,10 +322,10 @@ extern int PerlIO_sprintf _((char *, int, const char *,...))
extern int PerlIO_vprintf _((PerlIO *, const char *, va_list));
#endif
#ifndef PerlIO_tell
-extern long PerlIO_tell _((PerlIO *));
+extern Off_t PerlIO_tell _((PerlIO *));
#endif
#ifndef PerlIO_seek
-extern int PerlIO_seek _((PerlIO *,off_t,int));
+extern int PerlIO_seek _((PerlIO *, Off_t, int));
#endif
#ifndef PerlIO_rewind
extern void PerlIO_rewind _((PerlIO *));
diff --git a/perlio.c b/perlio.c
index a1af870132..5655792c0d 100644
--- a/perlio.c
+++ b/perlio.c
@@ -55,13 +55,13 @@ PerlIO_tmpfile(void)
#undef PerlIO_tmpfile
PerlIO *
-PerlIO_tmpfile()
+PerlIO_tmpfile(void)
{
return sftmp(0);
}
void
-PerlIO_init()
+PerlIO_init(void)
{
/* Force this file to be included in perl binary. Which allows
* this file to force inclusion of other functions that may be
@@ -84,29 +84,28 @@ PerlIO_init()
#undef PerlIO_stderr
PerlIO *
-PerlIO_stderr()
+PerlIO_stderr(void)
{
return (PerlIO *) stderr;
}
#undef PerlIO_stdin
PerlIO *
-PerlIO_stdin()
+PerlIO_stdin(void)
{
return (PerlIO *) stdin;
}
#undef PerlIO_stdout
PerlIO *
-PerlIO_stdout()
+PerlIO_stdout(void)
{
return (PerlIO *) stdout;
}
#undef PerlIO_fast_gets
int
-PerlIO_fast_gets(f)
-PerlIO *f;
+PerlIO_fast_gets(PerlIO *f)
{
#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
return 1;
@@ -117,8 +116,7 @@ PerlIO *f;
#undef PerlIO_has_cntptr
int
-PerlIO_has_cntptr(f)
-PerlIO *f;
+PerlIO_has_cntptr(PerlIO *f)
{
#if defined(USE_STDIO_PTR)
return 1;
@@ -129,8 +127,7 @@ PerlIO *f;
#undef PerlIO_canset_cnt
int
-PerlIO_canset_cnt(f)
-PerlIO *f;
+PerlIO_canset_cnt(PerlIO *f)
{
#if defined(USE_STDIO_PTR) && defined(STDIO_CNT_LVALUE)
return 1;
@@ -141,9 +138,7 @@ PerlIO *f;
#undef PerlIO_set_cnt
void
-PerlIO_set_cnt(f,cnt)
-PerlIO *f;
-int cnt;
+PerlIO_set_cnt(PerlIO *f, int cnt)
{
if (cnt < -1)
warn("Setting cnt to %d\n",cnt);
@@ -156,10 +151,7 @@ int cnt;
#undef PerlIO_set_ptrcnt
void
-PerlIO_set_ptrcnt(f,ptr,cnt)
-PerlIO *f;
-STDCHAR *ptr;
-int cnt;
+PerlIO_set_ptrcnt(PerlIO *f, STDCHAR *ptr, int cnt)
{
#ifdef FILE_bufsiz
STDCHAR *e = FILE_base(f) + FILE_bufsiz(f);
@@ -183,8 +175,7 @@ int cnt;
#undef PerlIO_get_cnt
int
-PerlIO_get_cnt(f)
-PerlIO *f;
+PerlIO_get_cnt(PerlIO *f)
{
#ifdef FILE_cnt
return FILE_cnt(f);
@@ -196,8 +187,7 @@ PerlIO *f;
#undef PerlIO_get_bufsiz
int
-PerlIO_get_bufsiz(f)
-PerlIO *f;
+PerlIO_get_bufsiz(PerlIO *f)
{
#ifdef FILE_bufsiz
return FILE_bufsiz(f);
@@ -209,8 +199,7 @@ PerlIO *f;
#undef PerlIO_get_ptr
STDCHAR *
-PerlIO_get_ptr(f)
-PerlIO *f;
+PerlIO_get_ptr(PerlIO *f)
{
#ifdef FILE_ptr
return FILE_ptr(f);
@@ -222,8 +211,7 @@ PerlIO *f;
#undef PerlIO_get_base
STDCHAR *
-PerlIO_get_base(f)
-PerlIO *f;
+PerlIO_get_base(PerlIO *f)
{
#ifdef FILE_base
return FILE_base(f);
@@ -235,8 +223,7 @@ PerlIO *f;
#undef PerlIO_has_base
int
-PerlIO_has_base(f)
-PerlIO *f;
+PerlIO_has_base(PerlIO *f)
{
#ifdef FILE_base
return 1;
@@ -247,62 +234,49 @@ PerlIO *f;
#undef PerlIO_puts
int
-PerlIO_puts(f,s)
-PerlIO *f;
-const char *s;
+PerlIO_puts(PerlIO *f, const char *s)
{
return fputs(s,f);
}
#undef PerlIO_open
PerlIO *
-PerlIO_open(path,mode)
-const char *path;
-const char *mode;
+PerlIO_open(const char *path, const char *mode)
{
return fopen(path,mode);
}
#undef PerlIO_fdopen
PerlIO *
-PerlIO_fdopen(fd,mode)
-int fd;
-const char *mode;
+PerlIO_fdopen(int fd, const char *mode)
{
return fdopen(fd,mode);
}
#undef PerlIO_reopen
PerlIO *
-PerlIO_reopen(name, mode, f)
-const char *name;
-const char *mode;
-PerlIO *f;
+PerlIO_reopen(const char *name, const char *mode, PerlIO *f)
{
return freopen(name,mode,f);
}
#undef PerlIO_close
int
-PerlIO_close(f)
-PerlIO *f;
+PerlIO_close(PerlIO *f)
{
return fclose(f);
}
#undef PerlIO_eof
int
-PerlIO_eof(f)
-PerlIO *f;
+PerlIO_eof(PerlIO *f)
{
return feof(f);
}
#undef PerlIO_getname
char *
-PerlIO_getname(f,buf)
-PerlIO *f;
-char *buf;
+PerlIO_getname(PerlIO *f, char *buf)
{
#ifdef VMS
return fgetname(f,buf);
@@ -314,48 +288,42 @@ char *buf;
#undef PerlIO_getc
int
-PerlIO_getc(f)
-PerlIO *f;
+PerlIO_getc(PerlIO *f)
{
return fgetc(f);
}
#undef PerlIO_error
int
-PerlIO_error(f)
-PerlIO *f;
+PerlIO_error(PerlIO *f)
{
return ferror(f);
}
#undef PerlIO_clearerr
void
-PerlIO_clearerr(f)
-PerlIO *f;
+PerlIO_clearerr(PerlIO *f)
{
clearerr(f);
}
#undef PerlIO_flush
int
-PerlIO_flush(f)
-PerlIO *f;
+PerlIO_flush(PerlIO *f)
{
return Fflush(f);
}
#undef PerlIO_fileno
int
-PerlIO_fileno(f)
-PerlIO *f;
+PerlIO_fileno(PerlIO *f)
{
return fileno(f);
}
#undef PerlIO_setlinebuf
void
-PerlIO_setlinebuf(f)
-PerlIO *f;
+PerlIO_setlinebuf(PerlIO *f)
{
#ifdef HAS_SETLINEBUF
setlinebuf(f);
@@ -370,56 +338,42 @@ PerlIO *f;
#undef PerlIO_putc
int
-PerlIO_putc(f,ch)
-PerlIO *f;
-int ch;
+PerlIO_putc(PerlIO *f, int ch)
{
return putc(ch,f);
}
#undef PerlIO_ungetc
int
-PerlIO_ungetc(f,ch)
-PerlIO *f;
-int ch;
+PerlIO_ungetc(PerlIO *f, int ch)
{
return ungetc(ch,f);
}
#undef PerlIO_read
SSize_t
-PerlIO_read(f,buf,count)
-PerlIO *f;
-void *buf;
-Size_t count;
+PerlIO_read(PerlIO *f, void *buf, Size_t count)
{
return fread(buf,1,count,f);
}
#undef PerlIO_write
SSize_t
-PerlIO_write(f,buf,count)
-PerlIO *f;
-const void *buf;
-Size_t count;
+PerlIO_write(PerlIO *f, const void *buf, Size_t count)
{
return fwrite1(buf,1,count,f);
}
#undef PerlIO_vprintf
int
-PerlIO_vprintf(f,fmt,ap)
-PerlIO *f;
-const char *fmt;
-va_list ap;
+PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap)
{
return vfprintf(f,fmt,ap);
}
#undef PerlIO_tell
Off_t
-PerlIO_tell(f)
-PerlIO *f;
+PerlIO_tell(PerlIO *f)
{
#ifdef HAS_FTELLO
return ftello(f);
@@ -430,10 +384,7 @@ PerlIO *f;
#undef PerlIO_seek
int
-PerlIO_seek(f,offset,whence)
-PerlIO *f;
-Off_t offset;
-int whence;
+PerlIO_seek(PerlIO *f, Off_t offset, int whence)
{
#ifdef HAS_FSEEKO
return fseeko(f,offset,whence);
@@ -444,8 +395,7 @@ int whence;
#undef PerlIO_rewind
void
-PerlIO_rewind(f)
-PerlIO *f;
+PerlIO_rewind(PerlIO *f)
{
rewind(f);
}
@@ -476,47 +426,40 @@ PerlIO_stdoutf(const char *fmt,...)
#undef PerlIO_tmpfile
PerlIO *
-PerlIO_tmpfile()
+PerlIO_tmpfile(void)
{
return tmpfile();
}
#undef PerlIO_importFILE
PerlIO *
-PerlIO_importFILE(f,fl)
-FILE *f;
-int fl;
+PerlIO_importFILE(FILE *f, int fl)
{
return f;
}
#undef PerlIO_exportFILE
FILE *
-PerlIO_exportFILE(f,fl)
-PerlIO *f;
-int fl;
+PerlIO_exportFILE(PerlIO *f, int fl)
{
return f;
}
#undef PerlIO_findFILE
FILE *
-PerlIO_findFILE(f)
-PerlIO *f;
+PerlIO_findFILE(PerlIO *f)
{
return f;
}
#undef PerlIO_releaseFILE
void
-PerlIO_releaseFILE(p,f)
-PerlIO *p;
-FILE *f;
+PerlIO_releaseFILE(PerlIO *p, FILE *f)
{
}
void
-PerlIO_init()
+PerlIO_init(void)
{
/* Does nothing (yet) except force this file to be included
in perl binary. That allows this file to force inclusion
@@ -531,9 +474,7 @@ PerlIO_init()
#ifndef HAS_FSETPOS
#undef PerlIO_setpos
int
-PerlIO_setpos(f,pos)
-PerlIO *f;
-const Fpos_t *pos;
+PerlIO_setpos(PerlIO *f, const Fpos_t *pos)
{
return PerlIO_seek(f,*pos,0);
}
@@ -541,9 +482,7 @@ const Fpos_t *pos;
#ifndef PERLIO_IS_STDIO
#undef PerlIO_setpos
int
-PerlIO_setpos(f,pos)
-PerlIO *f;
-const Fpos_t *pos;
+PerlIO_setpos(PerlIO *f, const Fpos_t *pos)
{
return fsetpos(f, pos);
}
@@ -553,9 +492,7 @@ const Fpos_t *pos;
#ifndef HAS_FGETPOS
#undef PerlIO_getpos
int
-PerlIO_getpos(f,pos)
-PerlIO *f;
-Fpos_t *pos;
+PerlIO_getpos(PerlIO *f, Fpos_t *pos)
{
*pos = PerlIO_tell(f);
return 0;
@@ -564,9 +501,7 @@ Fpos_t *pos;
#ifndef PERLIO_IS_STDIO
#undef PerlIO_getpos
int
-PerlIO_getpos(f,pos)
-PerlIO *f;
-Fpos_t *pos;
+PerlIO_getpos(PerlIO *f, Fpos_t *pos)
{
return fgetpos(f, pos);
}
@@ -576,17 +511,14 @@ Fpos_t *pos;
#if (defined(PERLIO_IS_STDIO) || !defined(USE_SFIO)) && !defined(HAS_VPRINTF)
int
-vprintf(pat, args)
-char *pat, *args;
+vprintf(char *pat, char *args)
{
_doprnt(pat, args, stdout);
return 0; /* wrong, but perl doesn't use the return value */
}
int
-vfprintf(fd, pat, args)
-FILE *fd;
-char *pat, *args;
+vfprintf(FILE *fd, char *pat, char *args)
{
_doprnt(pat, args, fd);
return 0; /* wrong, but perl doesn't use the return value */