![]() |
Ignite Tools
|
00001 /* ioapi.h -- IO base function header for compress/uncompress .zip 00002 files using zlib + zip or unzip API 00003 00004 Version 1.01e, February 12th, 2005 00005 00006 Copyright (C) 1998-2005 Gilles Vollant 00007 */ 00008 00009 #ifndef _ZLIBIOAPI_H 00010 #define _ZLIBIOAPI_H 00011 00012 00013 #define ZLIB_FILEFUNC_SEEK_CUR (1) 00014 #define ZLIB_FILEFUNC_SEEK_END (2) 00015 #define ZLIB_FILEFUNC_SEEK_SET (0) 00016 00017 #define ZLIB_FILEFUNC_MODE_READ (1) 00018 #define ZLIB_FILEFUNC_MODE_WRITE (2) 00019 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 00020 00021 #define ZLIB_FILEFUNC_MODE_EXISTING (4) 00022 #define ZLIB_FILEFUNC_MODE_CREATE (8) 00023 00024 00025 #ifndef ZCALLBACK 00026 00027 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 00028 #define ZCALLBACK CALLBACK 00029 #else 00030 #define ZCALLBACK 00031 #endif 00032 #endif 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00038 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 00039 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 00040 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 00041 typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 00042 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 00043 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 00044 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 00045 00046 typedef struct zlib_filefunc_def_s 00047 { 00048 open_file_func zopen_file; 00049 read_file_func zread_file; 00050 write_file_func zwrite_file; 00051 tell_file_func ztell_file; 00052 seek_file_func zseek_file; 00053 close_file_func zclose_file; 00054 testerror_file_func zerror_file; 00055 voidpf opaque; 00056 } zlib_filefunc_def; 00057 00058 00059 00060 void UA_fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 00061 00062 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 00063 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 00064 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 00065 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 00066 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 00067 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 00068 00069 00070 #ifdef __cplusplus 00071 } 00072 #endif 00073 00074 #endif 00075