bzlib_stdio_private.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. /*
  10. * THIS FILE IS NOT IDENTICAL TO THE ORIGINAL
  11. * FROM THE BZIP2 DISTRIBUTION.
  12. *
  13. * It has been modified, mainly to break the library
  14. * into smaller pieces.
  15. *
  16. * Russ Cox
  17. * rsc@plan9.bell-labs.com
  18. * July 2000
  19. */
  20. extern void BZ2_bz__AssertH__fail ( int errcode );
  21. /* undo definitions in bzlib_private.h */
  22. #undef AssertH
  23. #undef AssertD
  24. #undef VPrintf0
  25. #undef VPrintf1
  26. #undef VPrintf2
  27. #undef VPrintf3
  28. #undef VPrintf4
  29. #undef VPrintf5
  30. #define AssertH(cond,errcode) \
  31. { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
  32. #if BZ_DEBUG
  33. #define AssertD(cond,msg) \
  34. { if (!(cond)) { \
  35. fprintf ( stderr, \
  36. "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
  37. exit(1); \
  38. }}
  39. #else
  40. #define AssertD(cond,msg) /* */
  41. #endif
  42. #define VPrintf0(zf) \
  43. fprintf(stderr,zf)
  44. #define VPrintf1(zf,za1) \
  45. fprintf(stderr,zf,za1)
  46. #define VPrintf2(zf,za1,za2) \
  47. fprintf(stderr,zf,za1,za2)
  48. #define VPrintf3(zf,za1,za2,za3) \
  49. fprintf(stderr,zf,za1,za2,za3)
  50. #define VPrintf4(zf,za1,za2,za3,za4) \
  51. fprintf(stderr,zf,za1,za2,za3,za4)
  52. #define VPrintf5(zf,za1,za2,za3,za4,za5) \
  53. fprintf(stderr,zf,za1,za2,za3,za4,za5)
  54. #define BZ_SETERR(eee) \
  55. { \
  56. if (bzerror != NULL) *bzerror = eee; \
  57. if (bzf != NULL) bzf->lastErr = eee; \
  58. }
  59. typedef
  60. struct {
  61. FILE* handle;
  62. Char buf[BZ_MAX_UNUSED];
  63. Int32 bufN;
  64. Bool writing;
  65. bz_stream strm;
  66. Int32 lastErr;
  67. Bool initialisedOk;
  68. }
  69. bzFile;
  70. extern Bool bz_feof( FILE* );