This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Install perlfaq and perlglossary manpages in section 1 of the manual
[perl5.git] / fakesdio.h
1 /*    fakestdio.h
2  *
3  *    Copyright (C) 2000, by Larry Wall and others
4  *
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.
7  *
8  */
9
10 /*
11  * This is "source level" stdio compatibility mode.
12  * We try and #define stdio functions in terms of PerlIO.
13  */
14 #define _CANNOT "CANNOT"
15 #undef FILE
16 #define FILE                    PerlIO
17 #undef clearerr
18 #undef fclose
19 #undef fdopen
20 #undef feof
21 #undef ferror
22 #undef fflush
23 #undef fgetc
24 #undef fgetpos
25 #undef fgets
26 #undef fileno
27 #undef flockfile
28 #undef fopen
29 #undef fprintf
30 #undef fputc
31 #undef fputs
32 #undef fread
33 #undef freopen
34 #undef fscanf
35 #undef fseek
36 #undef fsetpos
37 #undef ftell
38 #undef ftrylockfile
39 #undef funlockfile
40 #undef fwrite
41 #undef getc
42 #undef getc_unlocked
43 #undef getw
44 #undef pclose
45 #undef popen
46 #undef putc
47 #undef putc_unlocked
48 #undef putw
49 #undef rewind
50 #undef setbuf
51 #undef setvbuf
52 #undef stderr
53 #undef stdin
54 #undef stdout
55 #undef tmpfile
56 #undef ungetc
57 #undef vfprintf
58 #undef printf
59
60 /* printf used to live in perl.h like this - more sophisticated 
61    than the rest 
62  */
63 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(PERL_GCC_PEDANTIC)
64 #define printf(fmt,args...) PerlIO_stdoutf(fmt,##args)
65 #else
66 #define printf PerlIO_stdoutf
67 #endif
68
69 #define fprintf                 PerlIO_printf
70 #define stdin                   PerlIO_stdin()
71 #define stdout                  PerlIO_stdout()
72 #define stderr                  PerlIO_stderr()
73 #define tmpfile()               PerlIO_tmpfile()
74 #define fclose(f)               PerlIO_close(f)
75 #define fflush(f)               PerlIO_flush(f)
76 #define fopen(p,m)              PerlIO_open(p,m)
77 #define vfprintf(f,fmt,a)       PerlIO_vprintf(f,fmt,a)
78 #define fgetc(f)                PerlIO_getc(f)
79 #define fputc(c,f)              PerlIO_putc(f,c)
80 #define fputs(s,f)              PerlIO_puts(f,s)
81 #define getc(f)                 PerlIO_getc(f)
82 #define getc_unlocked(f)        PerlIO_getc(f)
83 #define putc(c,f)               PerlIO_putc(f,c)
84 #define putc_unlocked(c,f)      PerlIO_putc(c,f)
85 #define ungetc(c,f)             PerlIO_ungetc(f,c)
86 #if 0
87 /* return values of read/write need work */
88 #define fread(b,s,c,f)          PerlIO_read(f,b,(s*c))
89 #define fwrite(b,s,c,f)         PerlIO_write(f,b,(s*c))
90 #else
91 #define fread(b,s,c,f)          _CANNOT fread
92 #define fwrite(b,s,c,f)         _CANNOT fwrite
93 #endif
94 #define fseek(f,o,w)            PerlIO_seek(f,o,w)
95 #define ftell(f)                PerlIO_tell(f)
96 #define rewind(f)               PerlIO_rewind(f)
97 #define clearerr(f)             PerlIO_clearerr(f)
98 #define feof(f)                 PerlIO_eof(f)
99 #define ferror(f)               PerlIO_error(f)
100 #define fdopen(fd,p)            PerlIO_fdopen(fd,p)
101 #define fileno(f)               PerlIO_fileno(f)
102 #define popen(c,m)              my_popen(c,m)
103 #define pclose(f)               my_pclose(f)
104
105 #define fsetpos(f,p)            _CANNOT _fsetpos_
106 #define fgetpos(f,p)            _CANNOT _fgetpos_
107
108 #define __filbuf(f)             _CANNOT __filbuf_
109 #define _filbuf(f)              _CANNOT _filbuf_
110 #define __flsbuf(c,f)           _CANNOT __flsbuf_
111 #define _flsbuf(c,f)            _CANNOT _flsbuf_
112 #define getw(f)                 _CANNOT _getw_
113 #define putw(v,f)               _CANNOT _putw_
114 #if SFIO_VERSION < 20000101L
115 #define flockfile(f)            _CANNOT _flockfile_
116 #define ftrylockfile(f)         _CANNOT _ftrylockfile_
117 #define funlockfile(f)          _CANNOT _funlockfile_
118 #endif
119 #define freopen(p,m,f)          _CANNOT _freopen_
120 #define setbuf(f,b)             _CANNOT _setbuf_
121 #define setvbuf(f,b,x,s)        _CANNOT _setvbuf_
122 #define fscanf                  _CANNOT _fscanf_
123 #define fgets(s,n,f)            _CANNOT _fgets_
124
125 /*
126  * Local variables:
127  * c-indentation-style: bsd
128  * c-basic-offset: 4
129  * indent-tabs-mode: t
130  * End:
131  *
132  * ex: set ts=8 sts=4 sw=4 noet:
133  */