webperimental: killstack decides stack protects.
[freeciv.git] / utility / ioz.h
bloba14d77a73bdcbbaf1da1c5597a56af628f2e7e59
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)
6 any later version.
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 ***********************************************************************/
14 #ifndef FC__IOZ_H
15 #define FC__IOZ_H
17 #ifdef __cplusplus
18 extern "C" {
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 freeciv_config.h). */
36 enum fz_method {
37 FZ_PLAIN = 0,
38 #ifdef FREECIV_HAVE_LIBZ
39 FZ_ZLIB,
40 #endif
41 #ifdef FREECIV_HAVE_LIBBZ2
42 FZ_BZIP2,
43 #endif
44 #ifdef FREECIV_HAVE_LIBLZMA
45 FZ_XZ,
46 #endif
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);
61 #ifdef __cplusplus
63 #endif /* __cplusplus */
65 #endif /* FC__IOZ_H */