This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PerlIO #include and #ifdef re-work.
[perl5.git] / fakesdio.h
1 /*
2  * This is "source level" stdio compatibility mode.
3  * We try and #define stdio functions in terms of PerlIO.
4  */
5 #define _CANNOT "CANNOT"
6 #undef FILE
7 #define FILE                    PerlIO
8 #undef fprintf
9 #undef tmpfile
10 #undef fclose
11 #undef fopen
12 #undef vfprintf
13 #undef fgetc
14 #undef getc_unlocked
15 #undef fputc
16 #undef putc_unlocked
17 #undef fputs
18 #undef ungetc
19 #undef fread
20 #undef fwrite
21 #undef fgetpos
22 #undef fseek
23 #undef fsetpos
24 #undef ftell
25 #undef rewind
26 #undef fdopen
27 #undef popen
28 #undef pclose
29 #undef getw
30 #undef putw
31 #undef freopen
32 #undef setbuf
33 #undef setvbuf
34 #undef fscanf
35 #undef fgets
36 #undef stdin
37 #undef stdout
38 #undef stderr
39 #undef getc
40 #undef putc
41 #undef clearerr
42 #undef feof
43 #undef ferror
44 #define fprintf                 PerlIO_printf
45 #define stdin                   PerlIO_stdin()
46 #define stdout                  PerlIO_stdout()
47 #define stderr                  PerlIO_stderr()
48 #define tmpfile()               PerlIO_tmpfile()
49 #define fclose(f)               PerlIO_close(f)
50 #define fflush(f)               PerlIO_flush(f)
51 #define fopen(p,m)              PerlIO_open(p,m)
52 #define vfprintf(f,fmt,a)       PerlIO_vprintf(f,fmt,a)
53 #define fgetc(f)                PerlIO_getc(f)
54 #define fputc(c,f)              PerlIO_putc(f,c)
55 #define fputs(s,f)              PerlIO_puts(f,s)
56 #define getc(f)                 PerlIO_getc(f)
57 #ifdef getc_unlocked
58 #undef getc_unlocked
59 #endif
60 #define getc_unlocked(f)        PerlIO_getc(f)
61 #define putc(c,f)               PerlIO_putc(f,c)
62 #ifdef putc_unlocked
63 #undef putc_unlocked
64 #endif
65 #define putc_unlocked(c,f)      PerlIO_putc(c,f)
66 #define ungetc(c,f)             PerlIO_ungetc(f,c)
67 #if 0
68 /* return values of read/write need work */
69 #define fread(b,s,c,f)          PerlIO_read(f,b,(s*c))
70 #define fwrite(b,s,c,f)         PerlIO_write(f,b,(s*c))
71 #else
72 #define fread(b,s,c,f)          _CANNOT fread
73 #define fwrite(b,s,c,f)         _CANNOT fwrite
74 #endif
75 #define fgetpos(f,p)            PerlIO_getpos(f,p)
76 #define fseek(f,o,w)            PerlIO_seek(f,o,w)
77 #define fsetpos(f,p)            PerlIO_setpos(f,p)
78 #define ftell(f)                PerlIO_tell(f)
79 #define rewind(f)               PerlIO_rewind(f)
80 #define clearerr(f)             PerlIO_clearerr(f)
81 #define feof(f)                 PerlIO_eof(f)
82 #define ferror(f)               PerlIO_error(f)
83 #define fdopen(fd,p)            PerlIO_fdopen(fd,p)
84 #define fileno(f)               PerlIO_fileno(f)
85 #define popen(c,m)              my_popen(c,m)
86 #define pclose(f)               my_pclose(f)
87
88 #define __filbuf(f)             _CANNOT __filbuf_
89 #define _filbuf(f)              _CANNOT _filbuf_
90 #define __flsbuf(c,f)           _CANNOT __flsbuf_
91 #define _flsbuf(c,f)            _CANNOT _flsbuf_
92 #define getw(f)                 _CANNOT _getw_
93 #define putw(v,f)               _CANNOT _putw_
94 #if SFIO_VERSION < 20000101L
95 #define flockfile(f)            _CANNOT _flockfile_
96 #define ftrylockfile(f)         _CANNOT _ftrylockfile_
97 #define funlockfile(f)          _CANNOT _funlockfile_
98 #endif
99 #define freopen(p,m,f)          _CANNOT _freopen_
100 #define setbuf(f,b)             _CANNOT _setbuf_
101 #define setvbuf(f,b,x,s)        _CANNOT _setvbuf_
102 #define fscanf                  _CANNOT _fscanf_
103 #define fgets(s,n,f)            _CANNOT _fgets_
104