2 #define PERLIO_NOT_STDIO 1
15 typedef PerlIO * InputStream;
16 typedef PerlIO * OutputStream;
18 #define PERLIO_IS_STDIO 1
20 typedef FILE * InputStream;
21 typedef FILE * OutputStream;
27 croak("%s not implemented on this architecture", s);
32 constant(char *name, IV *pval)
36 if (strEQ(name, "_IOFBF"))
38 { *pval = _IOFBF; return TRUE; }
42 if (strEQ(name, "_IOLBF"))
44 { *pval = _IOLBF; return TRUE; }
48 if (strEQ(name, "_IONBF"))
50 { *pval = _IONBF; return TRUE; }
56 if (strEQ(name, "SEEK_SET"))
58 { *pval = SEEK_SET; return TRUE; }
62 if (strEQ(name, "SEEK_CUR"))
64 { *pval = SEEK_CUR; return TRUE; }
68 if (strEQ(name, "SEEK_END"))
70 { *pval = SEEK_END; return TRUE; }
81 MODULE = IO PACKAGE = IO::Seekable PREFIX = f
90 PerlIO_getpos(handle, &pos);
92 fgetpos(handle, &pos);
94 ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t)));
107 if (handle && (p = SvPVx(pos, na)) && na == sizeof(Fpos_t))
109 RETVAL = PerlIO_setpos(handle, (Fpos_t*)p);
111 RETVAL = fsetpos(handle, (Fpos_t*)p);
120 MODULE = IO PACKAGE = IO::File PREFIX = f
123 new_tmpfile(packname = "IO::File")
130 fp = PerlIO_tmpfile();
134 gv = (GV*)SvREFCNT_inc(newGVgen(packname));
135 hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD);
136 if (do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) {
137 ST(0) = sv_2mortal(newRV((SV*)gv));
138 sv_bless(ST(0), gv_stashpv(packname, TRUE));
139 SvREFCNT_dec(gv); /* undo increment in newRV() */
146 MODULE = IO PACKAGE = IO::Handle PREFIX = f
153 if (constant(name, &i))
154 ST(0) = sv_2mortal(newSViv(i));
165 RETVAL = PerlIO_ungetc(handle, c);
167 RETVAL = ungetc(c, handle);
182 RETVAL = PerlIO_error(handle);
184 RETVAL = ferror(handle);
199 PerlIO_clearerr(handle);
220 IoFLAGS(io) |= IOf_UNTAINT;
239 RETVAL = PerlIO_flush(handle);
241 RETVAL = Fflush(handle);
253 char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), BUFSIZ) : 0;
256 #ifdef PERLIO_IS_STDIO
259 not_here("IO::Handle::setbuf");
263 setvbuf(handle, buf, type, size)
265 char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
269 /* Should check HAS_SETVBUF once Configure tests for that */
270 #if defined(PERLIO_IS_STDIO) && defined(_IOFBF)
271 if (!handle) /* Try input stream. */
272 handle = IoIFP(sv_2io(ST(0)));
274 RETVAL = setvbuf(handle, buf, type, size);
280 RETVAL = (SysRet) not_here("IO::Handle::setvbuf");