1 | #ifndef COMMON_H |
---|
2 | #define COMMON_H 1 |
---|
3 | |
---|
4 | #include "config.h" |
---|
5 | |
---|
6 | #ifdef __cplusplus |
---|
7 | # define BEGIN_C_DECLS extern "C" { |
---|
8 | # define END_C_DECLS } |
---|
9 | #else /* !__cplusplus */ |
---|
10 | # define BEGIN_C_DECLS |
---|
11 | # define END_C_DECLS |
---|
12 | #endif /* __cplusplus */ |
---|
13 | |
---|
14 | #if HAVE_ZLIB |
---|
15 | # include <zlib.h> |
---|
16 | # define LIBTRACE_READ(file,buf,len) gzread(file,buf,len) |
---|
17 | # define LIBTRACE_FDOPEN(fd,mode) gzdopen(fd,mode) |
---|
18 | # define LIBTRACE_OPEN(path,mode) gzopen(path,mode) |
---|
19 | # define LIBTRACE_CLOSE(file) gzclose(file) |
---|
20 | # define LIBTRACE_WRITE(file,buf,len) gzwrite(file,buf,len) |
---|
21 | # define LIBTRACE_FILE gzFile* |
---|
22 | # define LIBTRACE_SEEK(file,offset,whence) gzseek(file,offset,whence) |
---|
23 | # define LIBTRACE_TELL(file) gztell(file) |
---|
24 | #else |
---|
25 | # define LIBTRACE_READ(file,buf,len) read(file,buf,len) |
---|
26 | # define LIBTRACE_FDOPEN(fd,mode) dup(fd) |
---|
27 | # define LIBTRACE_OPEN(path,mode) open(path,mode) |
---|
28 | # define LIBTRACE_CLOSE(file) close(file) |
---|
29 | # define LIBTRACE_WRITE(file,buf,len) write(file,buf,len) |
---|
30 | # define LIBTRACE_FILE int |
---|
31 | # define LIBTRACE_SEEK(file,offset,whence) lseek(file,offset,whence) |
---|
32 | # define LIBTRACE_TELL(file) lseek(file,0,SEEK_CUR) |
---|
33 | #endif |
---|
34 | |
---|
35 | #endif /* COMMON_H */ |
---|