2 #define PERLIO_NOT_STDIO 1
10 #if defined(__GNUC__) && defined(__cplusplus) && defined(WIN32)
14 #if defined(__GNUC__) && defined(__cplusplus) && defined(WIN32)
22 typedef PerlIO * InputStream;
23 typedef PerlIO * OutputStream;
25 #define PERLIO_IS_STDIO 1
27 typedef FILE * InputStream;
28 typedef FILE * OutputStream;
34 croak("%s not implemented on this architecture", s);
39 constant(char *name, IV *pval)
43 if (strEQ(name, "_IOFBF"))
45 { *pval = _IOFBF; return TRUE; }
49 if (strEQ(name, "_IOLBF"))
51 { *pval = _IOLBF; return TRUE; }
55 if (strEQ(name, "_IONBF"))
57 { *pval = _IONBF; return TRUE; }
63 if (strEQ(name, "SEEK_SET"))
65 { *pval = SEEK_SET; return TRUE; }
69 if (strEQ(name, "SEEK_CUR"))
71 { *pval = SEEK_CUR; return TRUE; }
75 if (strEQ(name, "SEEK_END"))
77 { *pval = SEEK_END; return TRUE; }
88 MODULE = IO PACKAGE = IO::Seekable PREFIX = f
97 PerlIO_getpos(handle, &pos);
99 fgetpos(handle, &pos);
101 ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t)));
104 ST(0) = &PL_sv_undef;
114 if (handle && (p = SvPVx(pos, PL_na)) && PL_na == sizeof(Fpos_t))
116 RETVAL = PerlIO_setpos(handle, (Fpos_t*)p);
118 RETVAL = fsetpos(handle, (Fpos_t*)p);
127 MODULE = IO PACKAGE = IO::File PREFIX = f
130 new_tmpfile(packname = "IO::File")
137 fp = PerlIO_tmpfile();
141 gv = (GV*)SvREFCNT_inc(newGVgen(packname));
142 hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD);
143 if (do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) {
144 ST(0) = sv_2mortal(newRV((SV*)gv));
145 sv_bless(ST(0), gv_stashpv(packname, TRUE));
146 SvREFCNT_dec(gv); /* undo increment in newRV() */
149 ST(0) = &PL_sv_undef;
153 MODULE = IO PACKAGE = IO::Handle PREFIX = f
160 if (constant(name, &i))
161 ST(0) = sv_2mortal(newSViv(i));
163 ST(0) = &PL_sv_undef;
172 RETVAL = PerlIO_ungetc(handle, c);
174 RETVAL = ungetc(c, handle);
189 RETVAL = PerlIO_error(handle);
191 RETVAL = ferror(handle);
206 PerlIO_clearerr(handle);
227 IoFLAGS(io) |= IOf_UNTAINT;
246 RETVAL = PerlIO_flush(handle);
248 RETVAL = Fflush(handle);
260 char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), BUFSIZ) : 0;
263 #ifdef PERLIO_IS_STDIO
266 not_here("IO::Handle::setbuf");
270 setvbuf(handle, buf, type, size)
272 char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
276 /* Should check HAS_SETVBUF once Configure tests for that */
277 #if defined(PERLIO_IS_STDIO) && defined(_IOFBF)
278 if (!handle) /* Try input stream. */
279 handle = IoIFP(sv_2io(ST(0)));
281 RETVAL = setvbuf(handle, buf, type, size);
287 RETVAL = (SysRet) not_here("IO::Handle::setvbuf");