home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2001 January / VPR0101A.BIN / OLS / TAR32053 / tar32053.exe / SRC / BZ2DLL.H < prev    next >
C/C++ Source or Header  |  1999-05-23  |  3KB  |  79 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 __BZ2DLL_H
  13. #define __BZ2DLL_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. typedef struct _STRINGQ STRINGQ;    /* string queue (stringq.h) */
  24.  
  25. /* preserve bzip2 compess/uncompress processing state structure */
  26. /* This structure will change. don't access each member. */
  27. typedef struct{
  28.     FILE *fp;        /* File Pointer of compressed file */
  29.     STRINGQ *sq;    /* String Queue for uncompress input/output stream */
  30.     char mode;        /* 'r' for read ,or 'w' for write*/
  31.     int level;        /* compress level( 1(fast) - 9(best)) */
  32.  
  33.     int blocking;    /* internal state whether String Queue is blocking or not */
  34.     int error;        /* whether error was happened or not */
  35.  
  36.     int getRLEpair_state;    /* current executing code position(label) of function getRLEpair */
  37.     int loadAndRLEsource_state;    /* - */
  38.     int compressStream_state;    /* - */
  39.  
  40.     int undoReversibleTransformation_small_state;
  41.     int undoReversibleTransformation_fast_state;
  42.     int uncompressStream_state;
  43.  
  44. }BZ2FILE;
  45.  
  46. #define BZ2LIB_VERSION 1 /* x 0.01 */
  47. /*    Get Version Number (x 100) of bz2lib */
  48. int (EXPORTAPI *BZ2GetVersion)(void);
  49. /*    return 1 if bz2lib is already running (check for multithreading) */
  50. int (EXPORTAPI *BZ2GetRunning)(void);
  51. /*  get bz2 file's level. if not bzip2 file,return -1 */
  52. int (EXPORTAPI *BZ2GetLevelStream)(FILE *zStream);
  53. int (EXPORTAPI *BZ2GetLevel)(char *file);
  54. /* open bzip2 file like fdopen */
  55. /* At windows DLL, File Pointer cant send to dll,so comment outed.*/
  56. /* BZ2FILE * (EXPORTAPI *BZ2OpenStream)(FILE * zStream,char *mode);*/
  57. /* open bzip2 file like fopen */
  58. /* mode can contain 'r','w', '1'..'9'(for level) */
  59. BZ2FILE * (EXPORTAPI *BZ2Open)(char *file,char *mode);
  60. /* close bzip2 file opened by BZ2OpenStream */
  61. /* At windows DLL, File Pointer cant send to dll,so comment outed*/
  62. /* void (EXPORTAPI *BZ2CloseStream)(BZ2FILE *BZ2fp); */
  63. /* close bzip2 file opened by BZ2Open */
  64. void (EXPORTAPI *BZ2Close)(BZ2FILE *BZ2fp);
  65. /* compress and write to the file */
  66. int (EXPORTAPI *BZ2Write)(BZ2FILE *BZ2fp,char *buff,int size);
  67. /* read and uncompress from the file */
  68. int (EXPORTAPI *BZ2Read)(BZ2FILE *BZ2fp,char *buff,int size);
  69.  
  70. /*  First,please call this function. then you can access each BZ2LIB.DLL API */
  71. int BZ2DLLLoadLibrary(void);
  72. /*  Release BZ2LIB.DLL */
  73. int BZ2DLLFreeLibrary(void);
  74.  
  75.  
  76. #define STRING_QUEUE_BUFFER_SIZE 0x10000
  77.  
  78. #endif
  79.