3 * Copyright (c) 2000-2003, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
11 * This is "source level" stdio compatibility mode.
12 * We try and #define stdio functions in terms of PerlIO.
14 #define _CANNOT "CANNOT"
60 /* printf used to live in perl.h like this - more sophisticated
63 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(PERL_GCC_PEDANTIC)
64 #define printf(fmt,args...) PerlIO_stdoutf(fmt,##args)
66 #define printf PerlIO_stdoutf
70 #define fprintf PerlIO_printf
71 #define stdin PerlIO_stdin()
72 #define stdout PerlIO_stdout()
73 #define stderr PerlIO_stderr()
74 #define tmpfile() PerlIO_tmpfile()
75 #define fclose(f) PerlIO_close(f)
76 #define fflush(f) PerlIO_flush(f)
77 #define fopen(p,m) PerlIO_open(p,m)
78 #define vfprintf(f,fmt,a) PerlIO_vprintf(f,fmt,a)
79 #define fgetc(f) PerlIO_getc(f)
80 #define fputc(c,f) PerlIO_putc(f,c)
81 #define fputs(s,f) PerlIO_puts(f,s)
82 #define getc(f) PerlIO_getc(f)
83 #define getc_unlocked(f) PerlIO_getc(f)
84 #define putc(c,f) PerlIO_putc(f,c)
85 #define putc_unlocked(c,f) PerlIO_putc(c,f)
86 #define ungetc(c,f) PerlIO_ungetc(f,c)
88 /* return values of read/write need work */
89 #define fread(b,s,c,f) PerlIO_read(f,b,(s*c))
90 #define fwrite(b,s,c,f) PerlIO_write(f,b,(s*c))
92 #define fread(b,s,c,f) _CANNOT fread
93 #define fwrite(b,s,c,f) _CANNOT fwrite
95 #define fseek(f,o,w) PerlIO_seek(f,o,w)
96 #define ftell(f) PerlIO_tell(f)
97 #define rewind(f) PerlIO_rewind(f)
98 #define clearerr(f) PerlIO_clearerr(f)
99 #define feof(f) PerlIO_eof(f)
100 #define ferror(f) PerlIO_error(f)
101 #define fdopen(fd,p) PerlIO_fdopen(fd,p)
102 #define fileno(f) PerlIO_fileno(f)
103 #define popen(c,m) my_popen(c,m)
104 #define pclose(f) my_pclose(f)
106 #define fsetpos(f,p) _CANNOT _fsetpos_
107 #define fgetpos(f,p) _CANNOT _fgetpos_
109 #define __filbuf(f) _CANNOT __filbuf_
110 #define _filbuf(f) _CANNOT _filbuf_
111 #define __flsbuf(c,f) _CANNOT __flsbuf_
112 #define _flsbuf(c,f) _CANNOT _flsbuf_
113 #define getw(f) _CANNOT _getw_
114 #define putw(v,f) _CANNOT _putw_
115 #if SFIO_VERSION < 20000101L
116 #define flockfile(f) _CANNOT _flockfile_
117 #define ftrylockfile(f) _CANNOT _ftrylockfile_
118 #define funlockfile(f) _CANNOT _funlockfile_
120 #define freopen(p,m,f) _CANNOT _freopen_
121 #define setbuf(f,b) _CANNOT _setbuf_
122 #define setvbuf(f,b,x,s) _CANNOT _setvbuf_
123 #define fscanf _CANNOT _fscanf_
124 #define fgets(s,n,f) _CANNOT _fgets_