Merge all static runtime libs into libmono-static.
[mono.git] / support / minizip / ioapi.h
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
9 #ifndef _ZLIBIOAPI_H
10 #define _ZLIBIOAPI_H
11
12
13 #define ZLIB_FILEFUNC_SEEK_CUR (1)
14 #define ZLIB_FILEFUNC_SEEK_END (2)
15 #define ZLIB_FILEFUNC_SEEK_SET (0)
16
17 #define ZLIB_FILEFUNC_MODE_READ      (1)
18 #define ZLIB_FILEFUNC_MODE_WRITE     (2)
19 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
20
21 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
22 #define ZLIB_FILEFUNC_MODE_CREATE   (8)
23
24
25 #ifndef ZCALLBACK
26 // Nothing defines 'CALLBACK' anyway so to avoid accidentally changing
27 // the calling convention by including a header which defines this, just
28 // define ZCALLBACK as empty so we always get cdecl and our P/Invokes don't break.
29 #define 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 char* 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