1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
19 #endif /* __cplusplus */
21 /**********************************************************************
22 An IO layer to support transparent compression/uncompression.
23 (Currently only "required" functionality is supported.)
24 ***********************************************************************/
26 #include <stdio.h> /* FILE */
28 #include <freeciv_config.h>
30 #include "shared.h" /* fc__attribute */
32 struct fz_FILE_s
; /* opaque */
33 typedef struct fz_FILE_s fz_FILE
;
35 /* (Possibly) supported methods (depending on fc_config.h). */
38 #ifdef FREECIV_HAVE_LIBZ
41 #ifdef FREECIV_HAVE_LIBBZ2
44 #ifdef FREECIV_HAVE_LIBLZMA
49 fz_FILE
*fz_from_file(const char *filename
, const char *in_mode
,
50 enum fz_method method
, int compress_level
);
51 fz_FILE
*fz_from_stream(FILE *stream
);
52 fz_FILE
*fz_from_memory(char *buffer
, int size
, bool control
);
53 int fz_fclose(fz_FILE
*fp
);
54 char *fz_fgets(char *buffer
, int size
, fz_FILE
*fp
);
55 int fz_fprintf(fz_FILE
*fp
, const char *format
, ...)
56 fc__attribute((__format__ (__printf__
, 2, 3)));
58 int fz_ferror(fz_FILE
*fp
);
59 const char *fz_strerror(fz_FILE
*fp
);
63 #endif /* __cplusplus */
65 #endif /* FC__IOZ_H */