bzlib_stdio_private.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * THIS FILE IS NOT IDENTICAL TO THE ORIGINAL
  3. * FROM THE BZIP2 DISTRIBUTION.
  4. *
  5. * It has been modified, mainly to break the library
  6. * into smaller pieces.
  7. *
  8. * Russ Cox
  9. * rsc@plan9.bell-labs.com
  10. * July 2000
  11. */
  12. extern void BZ2_bz__AssertH__fail ( int errcode );
  13. /* undo definitions in bzlib_private.h */
  14. #undef AssertH
  15. #undef AssertD
  16. #undef VPrintf0
  17. #undef VPrintf1
  18. #undef VPrintf2
  19. #undef VPrintf3
  20. #undef VPrintf4
  21. #undef VPrintf5
  22. #define AssertH(cond,errcode) \
  23. { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
  24. #if BZ_DEBUG
  25. #define AssertD(cond,msg) \
  26. { if (!(cond)) { \
  27. fprintf ( stderr, \
  28. "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
  29. exit(1); \
  30. }}
  31. #else
  32. #define AssertD(cond,msg) /* */
  33. #endif
  34. #define VPrintf0(zf) \
  35. fprintf(stderr,zf)
  36. #define VPrintf1(zf,za1) \
  37. fprintf(stderr,zf,za1)
  38. #define VPrintf2(zf,za1,za2) \
  39. fprintf(stderr,zf,za1,za2)
  40. #define VPrintf3(zf,za1,za2,za3) \
  41. fprintf(stderr,zf,za1,za2,za3)
  42. #define VPrintf4(zf,za1,za2,za3,za4) \
  43. fprintf(stderr,zf,za1,za2,za3,za4)
  44. #define VPrintf5(zf,za1,za2,za3,za4,za5) \
  45. fprintf(stderr,zf,za1,za2,za3,za4,za5)
  46. #define BZ_SETERR(eee) \
  47. { \
  48. if (bzerror != NULL) *bzerror = eee; \
  49. if (bzf != NULL) bzf->lastErr = eee; \
  50. }
  51. typedef
  52. struct {
  53. FILE* handle;
  54. Char buf[BZ_MAX_UNUSED];
  55. Int32 bufN;
  56. Bool writing;
  57. bz_stream strm;
  58. Int32 lastErr;
  59. Bool initialisedOk;
  60. }
  61. bzFile;
  62. extern Bool bz_feof( FILE* );