diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-10-06 22:08:34 +0000 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1996-10-06 22:08:34 +0000 |
commit | 2a0cf7534305b208c8a33f74a84757c0894c6439 (patch) | |
tree | 2db0991e7fe414b5826d85851226722ffb03c7ad | |
parent | f6aff53ad72449dfefc5f6d9d303886bbb4ae545 (diff) | |
download | perl-2a0cf7534305b208c8a33f74a84757c0894c6439.tar.gz |
Updated to IO-1.12.
-rw-r--r-- | ext/IO/IO.pm | 27 | ||||
-rw-r--r-- | ext/IO/IO.xs | 50 |
2 files changed, 64 insertions, 13 deletions
diff --git a/ext/IO/IO.pm b/ext/IO/IO.pm index cb6d5d89f0..1ba05ca916 100644 --- a/ext/IO/IO.pm +++ b/ext/IO/IO.pm @@ -2,14 +2,6 @@ package IO; -use IO::Handle; -use IO::Seekable; -use IO::File; -use IO::Pipe; -use IO::Socket; - -1; - =head1 NAME IO - load various IO modules @@ -23,13 +15,22 @@ IO - load various IO modules C<IO> provides a simple mechanism to load all of the IO modules at one go. Currently this includes: - IO::Handle - IO::Seekable - IO::File - IO::Pipe - IO::Socket + IO::Handle + IO::Seekable + IO::File + IO::Pipe + IO::Socket For more information on any of these modules, please see its respective documentation. =cut + +use IO::Handle; +use IO::Seekable; +use IO::File; +use IO::Pipe; +use IO::Socket; + +1; + diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs index 82dce85cb1..bfe1f5ae42 100644 --- a/ext/IO/IO.xs +++ b/ext/IO/IO.xs @@ -10,9 +10,16 @@ # include <fcntl.h> #endif +#ifdef PerlIO typedef int SysRet; typedef PerlIO * InputStream; typedef PerlIO * OutputStream; +#else +#define PERLIO_IS_STDIO 1 +typedef int SysRet; +typedef FILE * InputStream; +typedef FILE * OutputStream; +#endif static int not_here(s) @@ -82,7 +89,11 @@ fgetpos(handle) CODE: if (handle) { Fpos_t pos; +#ifdef PerlIO PerlIO_getpos(handle, &pos); +#else + fgetpos(handle, &pos); +#endif ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t))); } else { @@ -96,7 +107,11 @@ fsetpos(handle, pos) SV * pos CODE: if (handle) +#ifdef PerlIO RETVAL = PerlIO_setpos(handle, (Fpos_t*)SvPVX(pos)); +#else + RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos)); +#endif else { RETVAL = -1; errno = EINVAL; @@ -110,7 +125,11 @@ OutputStream new_tmpfile(packname = "IO::File") char * packname CODE: +#ifdef PerlIO RETVAL = PerlIO_tmpfile(); +#else + RETVAL = tmpfile(); +#endif OUTPUT: RETVAL @@ -132,7 +151,11 @@ ungetc(handle, c) int c CODE: if (handle) +#ifdef PerlIO RETVAL = PerlIO_ungetc(handle, c); +#else + RETVAL = ungetc(c, handle); +#endif else { RETVAL = -1; errno = EINVAL; @@ -145,7 +168,30 @@ ferror(handle) InputStream handle CODE: if (handle) +#ifdef PerlIO RETVAL = PerlIO_error(handle); +#else + RETVAL = ferror(handle); +#endif + else { + RETVAL = -1; + errno = EINVAL; + } + OUTPUT: + RETVAL + +int +clearerr(handle) + InputStream handle + CODE: + if (handle) { +#ifdef PerlIO + PerlIO_clearerr(handle); +#else + clearerr(handle); +#endif + RETVAL = 0; + } else { RETVAL = -1; errno = EINVAL; @@ -158,7 +204,11 @@ fflush(handle) OutputStream handle CODE: if (handle) +#ifdef PerlIO RETVAL = PerlIO_flush(handle); +#else + RETVAL = Fflush(handle); +#endif else { RETVAL = -1; errno = EINVAL; |