Subversion Repositories Kolibri OS

Rev

Rev 4921 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 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 " not supported"
12
#endif
13
 
14
#include 
15
 
6099 serge 16
#define	FSETLOCKING_QUERY	0
17
#define	FSETLOCKING_INTERNAL	1
18
#define	FSETLOCKING_BYCALLER	2
19
 
4349 Serge 20
_BEGIN_STD_C
21
 
22
void	 _EXFUN(__fpurge,(FILE *));
6099 serge 23
int	 _EXFUN(__fsetlocking,(FILE *, int));
4349 Serge 24
 
4921 Serge 25
/* TODO:
26
 
27
   void _flushlbf (void);
28
*/
29
 
30
#ifdef  __GNUC__
31
 
6099 serge 32
_ELIDABLE_INLINE size_t
4921 Serge 33
__fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; }
34
 
6099 serge 35
_ELIDABLE_INLINE int
4921 Serge 36
__freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; }
37
 
6099 serge 38
_ELIDABLE_INLINE int
4921 Serge 39
__fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; }
40
 
6099 serge 41
_ELIDABLE_INLINE int
4921 Serge 42
__freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; }
43
 
6099 serge 44
_ELIDABLE_INLINE int
45
__fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; }
4921 Serge 46
 
6099 serge 47
_ELIDABLE_INLINE int
4921 Serge 48
__flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; }
49
 
6099 serge 50
_ELIDABLE_INLINE size_t
4921 Serge 51
__fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; }
52
 
53
#else
54
 
6099 serge 55
size_t	 _EXFUN(__fbufsize,(FILE *));
56
int	 _EXFUN(__freading,(FILE *));
57
int	 _EXFUN(__fwriting,(FILE *));
58
int	 _EXFUN(__freadable,(FILE *));
59
int	 _EXFUN(__fwritable,(FILE *));
60
int	 _EXFUN(__flbf,(FILE *));
61
size_t	 _EXFUN(__fpending,(FILE *));
62
 
63
#ifndef __cplusplus
64
 
4921 Serge 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)
6099 serge 69
#define __fwritable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0)
4921 Serge 70
#define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0)
71
#define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base))
72
 
6099 serge 73
#endif /* __cplusplus */
74
 
4921 Serge 75
#endif /* __GNUC__ */
76
 
4349 Serge 77
_END_STD_C
78
 
79
#endif /* _STDIO_EXT_H_ */