]> git.mxchange.org Git - simgear.git/blob - simgear/sg_zlib.h
Various mingwin patches contributed by Norman Vine.
[simgear.git] / simgear / sg_zlib.h
1 /**
2  * \file sg_zlib.h
3  * A file IO wrapper system that can select at compile time if the system
4  * should use zlib calls or normal uncompressed calls for systems that have
5  * problems building zlib.
6  * Define AVOID_USING_ZLIB to use standard uncompressed calls.
7  */
8
9 /*
10  * Written by Curtis Olson, started April 1998.
11  *
12  * Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library; if not, write to the
26  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27  * Boston, MA  02111-1307, USA.
28  *
29  * $Id$
30  **************************************************************************/
31
32
33 #ifndef _SG_ZLIB_H
34 #define _SG_ZLIB_H
35
36
37 #ifdef HAVE_CONFIG_H
38 #  include <config.h>
39 #endif
40
41
42 #ifdef AVOID_USING_ZLIB
43
44   #include <stdio.h>
45
46   #define sgFile FILE *
47
48   /* sgFile sgopen(char *filename, const char *flags) */
49   #define sgopen(P, F)  (fopen((P), (F)))
50
51   /* int sgseek(sgFile *file, long offset, int whence) */
52   #define sgseek(F, O, W)  (fseek((F), (O), (W)))
53
54   /* sgread(sgFile file, void *buf, int size); */
55   #define sgread(F, B, S)  (fread((B), (S), 1, (F)))
56
57   /* int sggets(sgFile fd, char *buffer, int len) */
58   #define sggets(F, B, L)  (sgets((B), (L), (F)))
59
60   /* int sgclose(sgFile fd) */
61   #define sgclose(F)  (fclose((F)))
62 #else
63
64   #include <zlib.h>
65
66   #define sgFile gzFile
67
68   /* sgFile sgopen(char *filename, const char *flags) */
69   #define sgopen(P, F)  (gzopen((P), (F)))
70
71   /* int sgseek(sgFile *file, long offset, int whence) */
72   #define sgseek(F, O, W)  (gzseek((F), (O), (W)))
73
74   /* sgread(sgFile file, void *buf, int size); */
75   #define sgread(F, B, S)  (gzread((F), (B), (S)))
76
77   /* int sggets(sgFile fd, char *buffer, int len) */
78   #define sggets(F, B, L)  (gzgets((F), (B), (L)))
79
80   /* int sgclose(sgFile fd) */
81   #define sgclose(F)  (gzclose((F)))
82
83 #endif /* #ifdef AVOID_USING_ZLIB #else #endif */
84
85
86 #endif /* _SG_ZLIB_H */
87
88