Subversion Repositories Kolibri OS

Rev

Rev 4874 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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. _BEGIN_STD_C
  17.  
  18. void     _EXFUN(__fpurge,(FILE *));
  19.  
  20. /* TODO:
  21.  
  22.    void _flushlbf (void);
  23.    int __fsetlocking (FILE *__fp, int __type);
  24. */
  25.  
  26. #ifdef  __GNUC__
  27.  
  28. _ELIDABLE_INLINE inline size_t
  29. __fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; }
  30.  
  31. _ELIDABLE_INLINE inline int
  32. __freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; }
  33.  
  34. _ELIDABLE_INLINE inline int
  35. __fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; }
  36.  
  37. _ELIDABLE_INLINE inline int
  38. __freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; }
  39.  
  40. _ELIDABLE_INLINE inline int
  41. __fwriteable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; }
  42.  
  43. _ELIDABLE_INLINE inline int
  44. __flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; }
  45.  
  46. _ELIDABLE_INLINE inline size_t
  47. __fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; }
  48.  
  49. #else
  50.  
  51. #define __fbufsize(__fp) ((size_t) (__fp)->_bf._size)
  52. #define __freading(__fp) (((__fp)->_flags & __SRD) != 0)
  53. #define __fwriting(__fp) (((__fp)->_flags & __SWR) != 0)
  54. #define __freadable(__fp) (((__fp)->_flags & (__SRD | __SRW)) != 0)
  55. #define __fwriteable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0)
  56. #define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0)
  57. #define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base))
  58.  
  59. #endif /* __GNUC__ */
  60.  
  61. _END_STD_C
  62.  
  63. #endif /* _STDIO_EXT_H_ */
  64.