29
30 /*
31 * An application should not include this header directly. Instead it
32 * should be included only through the inclusion of other Sun headers.
33 *
34 * The contents of this header is limited to identifiers specified in the
35 * C Standard. Any new identifiers specified in future amendments to the
36 * C Standard must be placed in this header. If these new identifiers
37 * are required to also be in the C++ Standard "std" namespace, then for
38 * anything other than macro definitions, corresponding "using" directives
39 * must also be added to <stdio.h>.
40 */
41
42 /*
43 * User-visible pieces of the ANSI C standard I/O package.
44 */
45
46 #ifndef _ISO_STDIO_ISO_H
47 #define _ISO_STDIO_ISO_H
48
49 #pragma ident "%Z%%M% %I% %E% SMI"
50
51 #include <sys/feature_tests.h>
52 #include <sys/va_list.h>
53 #include <stdio_tag.h>
54 #include <stdio_impl.h>
55
56 /*
57 * If feature test macros are set that enable interfaces that use types
58 * defined in <sys/types.h>, get those types by doing the include.
59 *
60 * Note that in asking for the interfaces associated with this feature test
61 * macro one also asks for definitions of the POSIX types.
62 */
63
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67
68 #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE))
69 /*
70 * The following typedefs are adopted from ones in <sys/types.h> (with leading
314 extern long ftell();
315 extern void rewind();
316 extern void clearerr();
317 extern int feof();
318 extern int ferror();
319 extern void perror();
320
321 #ifndef _LP64
322 extern int _filbuf();
323 extern int _flsbuf();
324 #endif /* _LP64 */
325
326 #endif /* __STDC__ */
327
328 #if __cplusplus >= 199711L
329 }
330 #endif /* end of namespace std */
331
332 #if !defined(__lint)
333
334 #if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)
335
336 #ifdef __STDC__
337 #if __cplusplus >= 199711L
338 namespace std {
339 inline int getc(FILE *_p) {
340 return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
341 inline int putc(int _x, FILE *_p) {
342 return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
343 : (int)(*_p->_ptr++ = (unsigned char) _x)); }
344 }
345 #else /* __cplusplus >= 199711L */
346 #define getc(p) (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
347 #define putc(x, p) (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
348 : (int)(*(p)->_ptr++ = (unsigned char) (x)))
349 #endif /* __cplusplus >= 199711L */
350 #else /* __STDC__ */
351 #define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++)
352 #define putc(x, p) (--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \
353 (int)(*(p)->_ptr++ = (unsigned char) (x)))
354 #endif /* __STDC__ */
355
356 #endif /* !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC) */
357
358 #ifndef _REENTRANT
359
360 #if __cplusplus >= 199711L
361 namespace std {
362 inline int getchar() { return getc(stdin); }
363 inline int putchar(int _x) { return putc(_x, stdout); }
364 }
365 #else
366 #define getchar() getc(stdin)
367 #define putchar(x) putc((x), stdout)
368 #endif /* __cplusplus >= 199711L */
369
370 #ifndef _LP64
371 #if __cplusplus >= 199711L
372 namespace std {
373 inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
374 inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
375 inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
376 }
|
29
30 /*
31 * An application should not include this header directly. Instead it
32 * should be included only through the inclusion of other Sun headers.
33 *
34 * The contents of this header is limited to identifiers specified in the
35 * C Standard. Any new identifiers specified in future amendments to the
36 * C Standard must be placed in this header. If these new identifiers
37 * are required to also be in the C++ Standard "std" namespace, then for
38 * anything other than macro definitions, corresponding "using" directives
39 * must also be added to <stdio.h>.
40 */
41
42 /*
43 * User-visible pieces of the ANSI C standard I/O package.
44 */
45
46 #ifndef _ISO_STDIO_ISO_H
47 #define _ISO_STDIO_ISO_H
48
49 #include <sys/feature_tests.h>
50 #include <sys/va_list.h>
51 #include <stdio_tag.h>
52 #include <stdio_impl.h>
53
54 /*
55 * If feature test macros are set that enable interfaces that use types
56 * defined in <sys/types.h>, get those types by doing the include.
57 *
58 * Note that in asking for the interfaces associated with this feature test
59 * macro one also asks for definitions of the POSIX types.
60 */
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE))
67 /*
68 * The following typedefs are adopted from ones in <sys/types.h> (with leading
312 extern long ftell();
313 extern void rewind();
314 extern void clearerr();
315 extern int feof();
316 extern int ferror();
317 extern void perror();
318
319 #ifndef _LP64
320 extern int _filbuf();
321 extern int _flsbuf();
322 #endif /* _LP64 */
323
324 #endif /* __STDC__ */
325
326 #if __cplusplus >= 199711L
327 }
328 #endif /* end of namespace std */
329
330 #if !defined(__lint)
331
332 #if !defined(_REENTRANT) && !defined(_LP64)
333
334 #ifdef __STDC__
335 #if __cplusplus >= 199711L
336 namespace std {
337 inline int getc(FILE *_p) {
338 return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
339 inline int putc(int _x, FILE *_p) {
340 return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
341 : (int)(*_p->_ptr++ = (unsigned char) _x)); }
342 }
343 #else /* __cplusplus >= 199711L */
344 #define getc(p) (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
345 #define putc(x, p) (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
346 : (int)(*(p)->_ptr++ = (unsigned char) (x)))
347 #endif /* __cplusplus >= 199711L */
348 #else /* __STDC__ */
349 #define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++)
350 #define putc(x, p) (--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \
351 (int)(*(p)->_ptr++ = (unsigned char) (x)))
352 #endif /* __STDC__ */
353
354 #endif /* !defined(_REENTRANT) && !defined(_LP64) */
355
356 #ifndef _REENTRANT
357
358 #if __cplusplus >= 199711L
359 namespace std {
360 inline int getchar() { return getc(stdin); }
361 inline int putchar(int _x) { return putc(_x, stdout); }
362 }
363 #else
364 #define getchar() getc(stdin)
365 #define putchar(x) putc((x), stdout)
366 #endif /* __cplusplus >= 199711L */
367
368 #ifndef _LP64
369 #if __cplusplus >= 199711L
370 namespace std {
371 inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
372 inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
373 inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
374 }
|