From: Perl 5 Porters Date: Sun, 6 Oct 1996 22:08:34 +0000 (+0000) Subject: Updated to IO-1.12. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2a0cf7534305b208c8a33f74a84757c0894c6439;p=p5sagit%2Fp5-mst-13.2.git Updated to IO-1.12. --- diff --git a/ext/IO/IO.pm b/ext/IO/IO.pm index cb6d5d8..1ba05ca 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 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 82dce85..bfe1f5a 100644 --- a/ext/IO/IO.xs +++ b/ext/IO/IO.xs @@ -10,9 +10,16 @@ # include #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;