Clone of Akilla's ac2d @ https://github.com/deregtd/AC2D

ioapi.h 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* ioapi.h -- IO base function header for compress/uncompress .zip
  2. files using zlib + zip or unzip API
  3. Version 0.18 beta, Feb 26th, 2002
  4. Copyright (C) 1998-2002 Gilles Vollant
  5. */
  6. #ifndef _ZLIBIOAPI_H
  7. #define _ZLIBIOAPI_H
  8. #define ZLIB_FILEFUNC_SEEK_CUR (1)
  9. #define ZLIB_FILEFUNC_SEEK_END (2)
  10. #define ZLIB_FILEFUNC_SEEK_SET (0)
  11. #define ZLIB_FILEFUNC_MODE_READ (1)
  12. #define ZLIB_FILEFUNC_MODE_WRITE (2)
  13. #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
  14. #define ZLIB_FILEFUNC_MODE_EXISTING (4)
  15. #define ZLIB_FILEFUNC_MODE_CREATE (8)
  16. #ifndef ZCALLBACK
  17. #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK)
  18. #define ZCALLBACK CALLBACK
  19. #else
  20. #define ZCALLBACK
  21. #endif
  22. #endif
  23. typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
  24. typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
  25. typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
  26. typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
  27. typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
  28. typedef long (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
  29. typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
  30. typedef struct zlib_filefunc_def_s
  31. {
  32. open_file_func zopen_file;
  33. read_file_func zread_file;
  34. write_file_func zwrite_file;
  35. tell_file_func ztell_file;
  36. seek_file_func zseek_file;
  37. close_file_func zclose_file;
  38. testerror_file_func zerror_file;
  39. voidpf opaque;
  40. } zlib_filefunc_def;
  41. void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
  42. #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
  43. #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
  44. #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
  45. #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
  46. #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
  47. #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
  48. #endif