Debian Codegraph @

Contrib/zip2exe/zlib/ioapi.h

raw
1 /* ioapi.h -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API
3
4 Version 1.01e, February 12th, 2005
5
6 Copyright (C) 1998-2005 Gilles Vollant
7
8 Unicode support by Jim Park -- 08/28/2007
9 */
10
11 #ifndef _ZLIBIOAPI_H
12 #define _ZLIBIOAPI_H
13
14 #include <tchar.h>
15
16
17 #define ZLIB_FILEFUNC_SEEK_CUR (1)
18 #define ZLIB_FILEFUNC_SEEK_END (2)
19 #define ZLIB_FILEFUNC_SEEK_SET (0)
20
21 #define ZLIB_FILEFUNC_MODE_READ (1)
22 #define ZLIB_FILEFUNC_MODE_WRITE (2)
23 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
24
25 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
26 #define ZLIB_FILEFUNC_MODE_CREATE (8)
27
28
29 #ifndef ZCALLBACK
30
31 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
32 #define ZCALLBACK CALLBACK
33 #else
34 #define ZCALLBACK
35 #endif
36 #endif
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const TCHAR* filename, int mode));
43 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
44 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
45 typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
46 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
47 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
48 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
49
50 typedef struct zlib_filefunc_def_s
51 {
52 open_file_func zopen_file;
53 read_file_func zread_file;
54 write_file_func zwrite_file;
55 tell_file_func ztell_file;
56 seek_file_func zseek_file;
57 close_file_func zclose_file;
58 testerror_file_func zerror_file;
59 voidpf opaque;
60 } zlib_filefunc_def;
61
62
63
64 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
65
66 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
67 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
68 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
69 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
70 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
71 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
72
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif
79