UFO: Alien Invasion
Loading...
Searching...
No Matches
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
38extern "C" {
39#endif
40
41typedef voidpf (ZCALLBACK* open_file_func) OF((voidpf opaque, const char* filename, int mode));
42typedef uLong (ZCALLBACK* read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
43typedef uLong (ZCALLBACK* write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
44typedef long (ZCALLBACK* tell_file_func) OF((voidpf opaque, voidpf stream));
45typedef long (ZCALLBACK* seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
46typedef int (ZCALLBACK* close_file_func) OF((voidpf opaque, voidpf stream));
47typedef int (ZCALLBACK* testerror_file_func) OF((voidpf opaque, voidpf stream));
48
49typedef 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
63void 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
void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def)
Definition ioapi.cpp:95
voidpf void uLong size
Definition ioapi.h:42
typedef voidpf(ZCALLBACK *open_file_func) OF((voidpf opaque
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
voidpf stream
Definition ioapi.h:42
typedef uLong(ZCALLBACK *read_file_func) OF((voidpf opaque
voidpf uLong int origin
Definition ioapi.h:45
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
const char * filename
Definition ioapi.h:41
voidpf void * buf
Definition ioapi.h:42
#define OF(args)
Definition ioapi.h:34
#define ZCALLBACK
Definition ioapi.h:29
const char int mode
Definition ioapi.h:41
voidpf uLong offset
Definition ioapi.h:45
seek_file_func zseek_file
Definition ioapi.h:55
open_file_func zopen_file
Definition ioapi.h:51
write_file_func zwrite_file
Definition ioapi.h:53
voidpf opaque
Definition ioapi.h:58
testerror_file_func zerror_file
Definition ioapi.h:57
read_file_func zread_file
Definition ioapi.h:52
tell_file_func ztell_file
Definition ioapi.h:54
close_file_func zclose_file
Definition ioapi.h:56