Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

stdio_ext.h 1.8KB

3 år sedan
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * stdio_ext.h
  3. *
  4. * Definitions for I/O internal operations, originally from Solaris.
  5. */
  6. #ifndef _STDIO_EXT_H_
  7. #define _STDIO_EXT_H_
  8. #ifdef __rtems__
  9. #error "<stdio_ext.h> not supported"
  10. #endif
  11. #include <stdio.h>
  12. #define FSETLOCKING_QUERY 0
  13. #define FSETLOCKING_INTERNAL 1
  14. #define FSETLOCKING_BYCALLER 2
  15. _BEGIN_STD_C
  16. void __fpurge (FILE *);
  17. int __fsetlocking (FILE *, int);
  18. /* TODO:
  19. void _flushlbf (void);
  20. */
  21. #ifdef __GNUC__
  22. _ELIDABLE_INLINE size_t
  23. __fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; }
  24. _ELIDABLE_INLINE int
  25. __freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; }
  26. _ELIDABLE_INLINE int
  27. __fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; }
  28. _ELIDABLE_INLINE int
  29. __freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; }
  30. _ELIDABLE_INLINE int
  31. __fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; }
  32. _ELIDABLE_INLINE int
  33. __flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; }
  34. _ELIDABLE_INLINE size_t
  35. __fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; }
  36. #else
  37. size_t __fbufsize (FILE *);
  38. int __freading (FILE *);
  39. int __fwriting (FILE *);
  40. int __freadable (FILE *);
  41. int __fwritable (FILE *);
  42. int __flbf (FILE *);
  43. size_t __fpending (FILE *);
  44. #ifndef __cplusplus
  45. #define __fbufsize(__fp) ((size_t) (__fp)->_bf._size)
  46. #define __freading(__fp) (((__fp)->_flags & __SRD) != 0)
  47. #define __fwriting(__fp) (((__fp)->_flags & __SWR) != 0)
  48. #define __freadable(__fp) (((__fp)->_flags & (__SRD | __SRW)) != 0)
  49. #define __fwritable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0)
  50. #define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0)
  51. #define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base))
  52. #endif /* __cplusplus */
  53. #endif /* __GNUC__ */
  54. _END_STD_C
  55. #endif /* _STDIO_EXT_H_ */