home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2001 January / VPR0101A.BIN / OLS / BZ2L003 / bz2l003.lzh / BZ2LIB / BZ2LIB.H < prev    next >
C/C++ Source or Header  |  1998-06-02  |  2KB  |  74 lines

  1. /*
  2.     bz2lib
  3.     
  4.       a library for compress/uncompress bzip2 library
  5.       by Yoshioka Tsuneo
  6.       This file(bz2lib.h/bz2lib.c) can copy,edit,re-distribute FREE.
  7.       
  8.       bzip2.c is GPL'ed file. so bz2lib package is GPL'ed.
  9.       please see the file "copying" for GPL(GNU Public License).
  10. */
  11.  
  12. #ifndef __BZ2LIB_H
  13. #define __BZ2LIB_H
  14.  
  15. #include <stdio.h>
  16. #ifdef _WIN32
  17. #include <windows.h>
  18. #define EXPORTAPI WINAPI
  19. #else
  20. #define EXPORTAPI
  21. #endif
  22.  
  23. struct STRINGQ_;    /* stringq.h */
  24. #ifndef TYPEDEF_STRINGQ
  25. #define TYPEDEF_STRINGQ
  26. typedef struct STRINGQ_ STRINGQ;
  27. #endif
  28.  
  29. /* preserve bzip2 compess/uncompress processing state */
  30. typedef struct{
  31.     FILE *fp;        /* File Pointer of compressed file */
  32.     STRINGQ *sq;    /* String Queue for uncompress input/output stream */
  33.     char mode;        /* 'r' for read ,or 'w' for write*/
  34.     int level;        /* compress level( 1(fast) - 9(best)) */
  35.  
  36.     int blocking;    /* internal state whether String Queue is blocking or not */
  37.     int error;        /* whether error was happened or not */
  38.  
  39.     int getRLEpair_state;    /* current executing code position(label) of function getRLEpair */
  40.     int loadAndRLEsource_state;    /* - */
  41.     int compressStream_state;    /* - */
  42.  
  43.     int undoReversibleTransformation_small_state;
  44.     int undoReversibleTransformation_fast_state;
  45.     int uncompressStream_state;
  46.  
  47. }BZ2FILE;
  48.  
  49. #define BZ2LIB_VERSION 3 /* x 0.01 */
  50. /*    Get Version Number (x 100) of bz2lib */
  51. int EXPORTAPI BZ2GetVersion(void);
  52. /*    return 1 if bz2lib is already running (check for multithreading) */
  53. int EXPORTAPI BZ2GetRunning(void);
  54. /*  get bz2 file's level. if not bzip2 file,return -1 */
  55. int EXPORTAPI BZ2GetLevelStream(FILE *zStream);
  56. int EXPORTAPI BZ2GetLevel(char *file);
  57. /* open bzip2 file like fdopen */
  58. BZ2FILE * EXPORTAPI BZ2OpenStream(FILE *fp,char *mode);
  59. /* open bzip2 file like fopen */
  60. /* mode can contain 'r','w', '1'..'9'(for level) */
  61. BZ2FILE * EXPORTAPI BZ2Open(char *file,char *mode);
  62. /* close bzip2 file opened by BZ2OpenStream */
  63. void EXPORTAPI BZ2CloseStream(BZ2FILE *BZ2fp);
  64. /* close bzip2 file opened by BZ2Open */
  65. void EXPORTAPI BZ2Close(BZ2FILE *BZ2fp);
  66. /* compress and write to the file */
  67. int EXPORTAPI BZ2Write(BZ2FILE *BZ2fp,char *buff,int size);
  68. /* read and uncompress from the file */
  69. int EXPORTAPI BZ2Read(BZ2FILE *BZ2fp,char *buff,int size);
  70.  
  71. #define STRING_QUEUE_BUFFER_SIZE 0x10000
  72.  
  73. #endif
  74.