iso/stdio_iso.h
1 /* Copyright (c) 1988 AT&T */
2 /* All Rights Reserved */
3
4 /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
5 /* The copyright notice above does not evidence any */
6 /* actual or intended publication of such source code. */
7
8 /*
9 * Copyright (c) 1993-1999 by Sun Microsystems, Inc.
10 * All rights reserved.
11 */
12
13 /*
14 * An application should not include this header directly. Instead it <__XML_GLOBALS_H>
15 * should be included only through the inclusion of other Sun headers. <isa_defs.h>
16 * <parser.h>
17 * The contents of this header is limited to identifiers specified in the <time.h> <xmlerror.h>
18 * C Standard. Any new identifiers specified in future amendments to the <SAX.h>
19 * C Standard must be placed in this header. If these new identifiers <xmlmemory.h>
20 * are required to also be in the C++ Standard "std" namespace, then for
21 * anything other than macro definitions, corresponding "using" directives
22 * must also be added to .
23 */
24
25 /*
26 * User-visible pieces of the ANSI C standard I/O package.
27 */
28
29 #ifndef _ISO_STDIO_ISO_H <LIBXML_DOTTED_VERSION>
30 #define _ISO_STDIO_ISO_H
31
32 #pragma ident "@(#)stdio_iso.h 1.2 99/10/25 SMI"
33 /* SVr4.0 2.34.1.2 */
34
35 #include
36 #include <LIBXML_VERSION>
37 #include
38 #include
39
40 /* <tree.h>
41 * If feature test macros are set that enable interfaces that use types
42 * defined in , get those types by doing the include.
43 * <LIBXML_VERSION_STRING>
44 * Note that in asking for the interfaces associated with this feature test
45 * macro one also asks for definitions of the POSIX types.
46 */
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 <LIBXML_TEST_VERSION>
52 #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE))
53 /*
54 * The following typedefs are adopted from ones in (with leading
55 * underscores added to avoid polluting the ANSI C name space). See the
56 * commentary there for further explanation.
57 */
58 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
59 typedef long long __longlong_t; <typedef:__longlong_t>
60 #else
61 /* used to reserve space and generate alignment */
62 typedef union {
63 double _d;
64 int _l[2];
65 } __longlong_t;
66 #endif
67 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE) */ <WITHOUT_TRIO>
68
69 #if __cplusplus >= 199711L
70 namespace std {
71 #endif
72
73 #if !defined(_FILEDEFED) || __cplusplus >= 199711L
74 #define _FILEDEFED
75 typedef __FILE FILE; <typedef:FILE>
76 #endif
77
78 #if !defined(_SIZE_T) || __cplusplus >= 199711L
79 #define _SIZE_T
80 #if defined(_LP64) || defined(_I32LPx)
81 typedef unsigned long size_t; /* size of something in bytes */
82 #else
83 typedef unsigned int size_t; /* (historical version) */ <typedef:size_t>
84 #endif
85 #endif /* !_SIZE_T */
86
87 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
88 typedef long fpos_t; <typedef:fpos_t>
89 #else
90 typedef __longlong_t fpos_t; <LIBXML_FTP_ENABLED>
91 #endif
92
93 #if __cplusplus >= 199711L
94 }
95 #endif /* end of namespace std */
96
97 #ifndef NULL <threads.h>
98 #if defined(_LP64) && !defined(__cplusplus)
99 #define NULL 0L <LIBXML_HTTP_ENABLED>
100 #else
101 #define NULL 0
102 #endif
103 #endif
104
105 #define BUFSIZ 1024
106
107 /*
108 * The value of _NFILE is defined in the Processor Specific ABI. The value <LIBXML_HTML_ENABLED>
109 * is chosen for historical reasons rather than for truly processor related
110 * attribute. Note that the SPARC Processor Specific ABI uses the common
111 * UNIX historical value of 20 so it is allowed to fall through.
112 */
113 #if defined(__i386)
114 #define _NFILE 60 /* initial number of streams: Intel x86 ABI */
115 #else
116 #define _NFILE 20 /* initial number of streams: SPARC ABI and default */
117 #endif <LIBXML_C14N_ENABLED>
118
119 #define _SBFSIZ 8 /* compatibility with shared libs */
120
121 #define _IOFBF 0000 /* full buffered */
122 #define _IOLBF 0100 /* line buffered */
123 #define _IONBF 0004 /* not buffered */
124 #define _IOEOF 0020 /* EOF reached on read */
125 #define _IOERR 0040 /* I/O error from system */
126 <LIBXML_CATALOG_ENABLED>
127 #define _IOREAD 0001 /* currently reading */
128 #define _IOWRT 0002 /* currently writing */
129 #define _IORW 0200 /* opened for reading and writing */
130 #define _IOMYBUF 0010 /* stdio malloc()'d buffer */
131
132 #ifndef EOF
133 #define EOF (-1)
134 #endif
135 <LIBXML_DOCB_ENABLED>
136 #define FOPEN_MAX _NFILE
137 #define FILENAME_MAX 1024 /* max # of characters in a path name */
138
139 #define SEEK_SET 0
140 #define SEEK_CUR 1
141 #define SEEK_END 2
142 #define TMP_MAX 17576 /* 26 * 26 * 26 */
143
144 #define L_tmpnam 25 /* (sizeof(P_tmpdir) + 15) */ <LIBXML_XPATH_ENABLED>
145
146 #if defined(__STDC__)
147 extern __FILE __iob[_NFILE]; <__iob>
148 #define stdin (&__iob[0])
149 #define stdout (&__iob[1])
150 #define stderr (&__iob[2])
151 #else
152 extern __FILE _iob[_NFILE];
153 #define stdin (&_iob[0]) <LIBXML_XPTR_ENABLED>
154 #define stdout (&_iob[1])
155 #define stderr (&_iob[2])
156 #endif /* __STDC__ */
157
158 #if __cplusplus >= 199711L
159 namespace std {
160 #endif
161
162 #if defined(__STDC__) <LIBXML_XINCLUDE_ENABLED>
163
164 extern int remove(const char *);
165 extern int rename(const char *, const char *);
166 extern FILE *tmpfile(void);
167 extern char *tmpnam(char *);
168 extern int fclose(FILE *);
169 extern int fflush(FILE *);
170 extern FILE *fopen(const char *, const char *);
171 extern FILE *freopen(const char *, const char *, FILE *); <LIBXML_ICONV_ENABLED>
172 extern void setbuf(FILE *, char *);
173 extern int setvbuf(FILE *, char *, int, size_t);
174 /* PRINTFLIKE2 */
175 extern int fprintf(FILE *, const char *, ...);
176 /* SCANFLIKE2 */
177 extern int fscanf(FILE *, const char *, ...);
178 /* PRINTFLIKE1 */
179 extern int printf(const char *, ...);
180 /* SCANFLIKE1 */ <LIBXML_DEBUG_ENABLED>
181 extern int scanf(const char *, ...);
182 /* PRINTFLIKE2 */
183 extern int sprintf(char *, const char *, ...);
184 /* SCANFLIKE2 */
185 extern int sscanf(const char *, const char *, ...);
186 extern int vfprintf(FILE *, const char *, __va_list);
187 extern int vprintf(const char *, __va_list);
188 extern int vsprintf(char *, const char *, __va_list);
189 extern int fgetc(FILE *);
190 extern char *fgets(char *, int, FILE *);
191 extern int fputc(int, FILE *);
192 extern int fputs(const char *, FILE *);
193 #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
194 __cplusplus < 199711L
195 extern int getc(FILE *);
196 extern int putc(int, FILE *);
197 #endif
198 #if (__cplusplus >= 199711L && defined(_REENTRANT)) || \ <LIBXML_UNICODE_ENABLED>
199 __cplusplus < 199711L
200 extern int getchar(void);
201 extern int putchar(int);
202 #endif
203 extern char *gets(char *);
204 extern int puts(const char *);
205 extern int ungetc(int, FILE *);
206 extern size_t fread(void *, size_t, size_t, FILE *);
207 extern size_t fwrite(const void *, size_t, size_t, FILE *); <LIBXML_REGEXP_ENABLED>
208 extern int fgetpos(FILE *, fpos_t *);
209 extern int fseek(FILE *, long, int);
210 extern int fsetpos(FILE *, const fpos_t *);
211 extern long ftell(FILE *);
212 extern void rewind(FILE *);
213 #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
214 __cplusplus < 199711L
215 extern void clearerr(FILE *);
216 extern int feof(FILE *); <LIBXML_AUTOMATA_ENABLED>
217 extern int ferror(FILE *);
218 #endif
219 extern void perror(const char *);
220
221 #ifndef _LP64
222 extern int __filbuf(FILE *);
223 extern int __flsbuf(int, FILE *);
224 #endif /* _LP64 */
225
226 #else /* !defined __STDC__ */
227
228 extern int remove();
229 extern int rename();
230 extern FILE *tmpfile();
231 extern char *tmpnam();
232 extern int fclose();
233 extern int fflush();
234 extern FILE *fopen();
235 extern FILE *freopen();
236 extern void setbuf();
237 extern int setvbuf();
238 extern int fprintf();
239 extern int fscanf();
240 extern int printf();
241 extern int scanf();
242 extern int sprintf();
243 extern int sscanf();
244 extern int vfprintf();
245 extern int vprintf();
246 extern int vsprintf();
247 extern int fgetc(); <LIBXML_DLL_IMPORT>
248 extern char *fgets();
249 extern int fputc();
250 extern int fputs();
251 extern int getc();
252 extern int getchar();
253 extern char *gets();
254 extern int putc();
255 extern int putchar();
256 extern int puts();
257 extern int ungetc();
258 extern size_t fread();
259 extern size_t fwrite();
260 extern int fgetpos();
261 extern int fseek(); <ATTRIBUTE_UNUSED>
262 extern int fsetpos();
263 extern long ftell();
264 extern void rewind();
265 extern void clearerr();
266 extern int feof();
267 extern int ferror();
268 extern void perror();
269
270 #ifndef _LP64
271 extern int _filbuf();
272 extern int _flsbuf();
273 #endif /* _LP64 */
274
275 #endif /* __STDC__ */
276
277 #if __cplusplus >= 199711L
278 }
279 #endif /* end of namespace std */
280
281 #if !defined(__lint)
282
283 #ifndef _REENTRANT
284
285 #ifndef _LP64
286 #ifdef __STDC__
287 #if __cplusplus >= 199711L
288 namespace std {
289 inline int getc(FILE *_p) {
290 return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
291 inline int putc(int _x, FILE *_p) {
292 return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
293 : (int)(*_p->_ptr++ = (unsigned char) _x)); }
294 }
295 #else /* __cplusplus >= 199711L */
296 #define getc(p) (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
297 #define putc(x, p) (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
298 : (int)(*(p)->_ptr++ = (unsigned char) (x)))
299 #endif /* __cplusplus >= 199711L */
300 #else /* __STDC__ */
301 #define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++)
302 #define putc(x, p) (--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \
303 (int) (*(p)->_ptr++ = (unsigned char) (x)))
304 #endif /* __STDC__ */
305 #endif /* _LP64 */
306
307 #if __cplusplus >= 199711L
308 namespace std {
309 inline int getchar() { return getc(stdin); }
310 inline int putchar(int _x) { return putc(_x, stdout); }
311 }
312 #else
313 #define getchar() getc(stdin)
314 #define putchar(x) putc((x), stdout)
315 #endif /* __cplusplus >= 199711L */
316
317 #ifndef _LP64
318 #if __cplusplus >= 199711L
319 namespace std {
320 inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
321 inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
322 inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
323 }
324 #else /* __cplusplus >= 199711L */
325 #define clearerr(p) ((void)((p)->_flag &= ~(_IOERR | _IOEOF)))
326 #define feof(p) ((p)->_flag & _IOEOF)
327 #define ferror(p) ((p)->_flag & _IOERR)
328 #endif /* __cplusplus >= 199711L */
329 #endif /* _LP64 */
330
331 #endif /* _REENTRANT */
332
333 #endif /* !defined(__lint) */
334
335 #ifdef __cplusplus
336 }
337 #endif
338
339 #endif /* _ISO_STDIO_ISO_H */