source: trunk/libs/newlib/src/newlib/libc/include/stdio_ext.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.8 KB
Line 
1/*
2 * stdio_ext.h
3 *
4 * Definitions for I/O internal operations, originally from Solaris.
5 */
6
7#ifndef _STDIO_EXT_H_
8#define _STDIO_EXT_H_
9
10#ifdef __rtems__
11#error "<stdio_ext.h> not supported"
12#endif
13
14#include <stdio.h>
15
16#define FSETLOCKING_QUERY       0
17#define FSETLOCKING_INTERNAL    1
18#define FSETLOCKING_BYCALLER    2
19
20_BEGIN_STD_C
21
22void     __fpurge (FILE *);
23int      __fsetlocking (FILE *, int);
24
25/* TODO:
26
27   void _flushlbf (void);
28*/
29
30#ifdef  __GNUC__
31
32_ELIDABLE_INLINE size_t
33__fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; }
34
35_ELIDABLE_INLINE int
36__freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; }
37
38_ELIDABLE_INLINE int
39__fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; }
40
41_ELIDABLE_INLINE int
42__freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; }
43
44_ELIDABLE_INLINE int
45__fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; }
46
47_ELIDABLE_INLINE int
48__flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; }
49
50_ELIDABLE_INLINE size_t
51__fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; }
52
53#else
54
55size_t   __fbufsize (FILE *);
56int      __freading (FILE *);
57int      __fwriting (FILE *);
58int      __freadable (FILE *);
59int      __fwritable (FILE *);
60int      __flbf (FILE *);
61size_t   __fpending (FILE *);
62
63#ifndef __cplusplus
64
65#define __fbufsize(__fp) ((size_t) (__fp)->_bf._size)
66#define __freading(__fp) (((__fp)->_flags & __SRD) != 0)
67#define __fwriting(__fp) (((__fp)->_flags & __SWR) != 0)
68#define __freadable(__fp) (((__fp)->_flags & (__SRD | __SRW)) != 0)
69#define __fwritable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0)
70#define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0)
71#define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base))
72
73#endif /* __cplusplus */
74
75#endif /* __GNUC__ */
76
77_END_STD_C
78
79#endif /* _STDIO_EXT_H_ */
Note: See TracBrowser for help on using the repository browser.