Back to index

scribus-ng  1.3.4.dfsg+svn20071115
ioapi.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /* ioapi.h -- IO base function header for compress/uncompress .zip
00008    files using zlib + zip or unzip API
00009 
00010    Version 1.01, May 8th, 2004
00011 
00012    Copyright (C) 1998-2004 Gilles Vollant
00013 */
00014 
00015 #include "scconfig.h"
00016 
00017 #ifndef _ZLIBIOAPI_H
00018 #define _ZLIBIOAPI_H
00019 
00020 
00021 #define ZLIB_FILEFUNC_SEEK_CUR (1)
00022 #define ZLIB_FILEFUNC_SEEK_END (2)
00023 #define ZLIB_FILEFUNC_SEEK_SET (0)
00024 
00025 #define ZLIB_FILEFUNC_MODE_READ      (1)
00026 #define ZLIB_FILEFUNC_MODE_WRITE     (2)
00027 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
00028 
00029 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
00030 #define ZLIB_FILEFUNC_MODE_CREATE   (8)
00031 
00032 
00033 #ifndef ZCALLBACK
00034 
00035 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
00036 #define ZCALLBACK CALLBACK
00037 #else
00038 #define ZCALLBACK
00039 #endif
00040 #endif
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
00047 typedef uLong  (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
00048 typedef uLong  (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
00049 typedef long   (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
00050 typedef long   (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
00051 typedef int    (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
00052 typedef int    (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
00053 
00054 typedef struct zlib_filefunc_def_s
00055 {
00056     open_file_func      zopen_file;
00057     read_file_func      zread_file;
00058     write_file_func     zwrite_file;
00059     tell_file_func      ztell_file;
00060     seek_file_func      zseek_file;
00061     close_file_func     zclose_file;
00062     testerror_file_func zerror_file;
00063     voidpf              opaque;
00064 } zlib_filefunc_def;
00065 
00066 
00067 
00068 void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
00069 
00070 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
00071 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
00072 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
00073 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
00074 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
00075 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
00076 
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081 
00082 #endif
00083