UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ioapi.h
Go to the documentation of this file.
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 #pragma once
10 
11 
12 #define ZLIB_FILEFUNC_SEEK_CUR (1)
13 #define ZLIB_FILEFUNC_SEEK_END (2)
14 #define ZLIB_FILEFUNC_SEEK_SET (0)
15 
16 #define ZLIB_FILEFUNC_MODE_READ (1)
17 #define ZLIB_FILEFUNC_MODE_WRITE (2)
18 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
19 
20 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
21 #define ZLIB_FILEFUNC_MODE_CREATE (8)
22 
23 
24 #ifndef ZCALLBACK
25 
26 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
27 #define ZCALLBACK CALLBACK
28 #else
29 #define ZCALLBACK
30 #endif
31 #endif
32 
33 #ifndef OF
34 #define OF(args) args
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 typedef voidpf (ZCALLBACK* open_file_func) OF((voidpf opaque, const char* filename, int mode));
42 typedef uLong (ZCALLBACK* read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
43 typedef uLong (ZCALLBACK* write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
44 typedef long (ZCALLBACK* tell_file_func) OF((voidpf opaque, voidpf stream));
45 typedef long (ZCALLBACK* seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
46 typedef int (ZCALLBACK* close_file_func) OF((voidpf opaque, voidpf stream));
47 typedef int (ZCALLBACK* testerror_file_func) OF((voidpf opaque, voidpf stream));
48 
49 typedef struct zlib_filefunc_def_s
50 {
51  open_file_func zopen_file;
52  read_file_func zread_file;
53  write_file_func zwrite_file;
54  tell_file_func ztell_file;
55  seek_file_func zseek_file;
56  close_file_func zclose_file;
57  testerror_file_func zerror_file;
60 
61 
62 
63 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
64 
65 #define ZREAD(filefunc, filestream, buf, size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
66 #define ZWRITE(filefunc, filestream, buf, size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
67 #define ZTELL(filefunc, filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
68 #define ZSEEK(filefunc, filestream, pos, mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
69 #define ZCLOSE(filefunc, filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
70 #define ZERROR(filefunc, filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
71 
72 
73 #ifdef __cplusplus
74 }
75 #endif
testerror_file_func zerror_file
Definition: ioapi.h:57
voidpf uLong int origin
Definition: ioapi.h:45
write_file_func zwrite_file
Definition: ioapi.h:53
const char * filename
Definition: ioapi.h:41
#define ZCALLBACK
Definition: ioapi.h:29
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
voidpf void * buf
Definition: ioapi.h:42
struct zlib_filefunc_def_s zlib_filefunc_def
GLsizei size
Definition: r_gl.h:152
typedef voidpf(ZCALLBACK *open_file_func) OF((voidpf opaque
read_file_func zread_file
Definition: ioapi.h:52
seek_file_func zseek_file
Definition: ioapi.h:55
#define OF(args)
Definition: ioapi.h:34
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
voidpf opaque
Definition: ioapi.h:58
void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def)
Definition: ioapi.cpp:95
tell_file_func ztell_file
Definition: ioapi.h:54
close_file_func zclose_file
Definition: ioapi.h:56
voidpf stream
Definition: ioapi.h:42
open_file_func zopen_file
Definition: ioapi.h:51
const char int mode
Definition: ioapi.h:41
voidpf uLong offset
Definition: ioapi.h:45
typedef uLong(ZCALLBACK *read_file_func) OF((voidpf opaque