Mercurial > libpst
annotate src/define.h @ 405:af8ae7bd3fed stable-0-6-75
allow building on el8
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 16 Jun 2020 16:21:47 -0700 |
parents | ad7b880ad3d1 |
children |
rev | line source |
---|---|
16 | 1 /*** |
2 * define.h | |
3 * Part of the LibPST project | |
4 * Written by David Smith | |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
5 * dave.s@earthcorp.com |
16 | 6 */ |
7 | |
120
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
8 #ifndef DEFINEH_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
9 #define DEFINEH_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
10 |
163
03fbb0269f3c
fix large file support, some sytems require config.h to be included earlier in the compilation.
Carl Byington <carl@five-ten-sg.com>
parents:
153
diff
changeset
|
11 #ifdef HAVE_CONFIG_H |
03fbb0269f3c
fix large file support, some sytems require config.h to be included earlier in the compilation.
Carl Byington <carl@five-ten-sg.com>
parents:
153
diff
changeset
|
12 #include "config.h" |
03fbb0269f3c
fix large file support, some sytems require config.h to be included earlier in the compilation.
Carl Byington <carl@five-ten-sg.com>
parents:
153
diff
changeset
|
13 #endif |
03fbb0269f3c
fix large file support, some sytems require config.h to be included earlier in the compilation.
Carl Byington <carl@five-ten-sg.com>
parents:
153
diff
changeset
|
14 |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
15 #include "libpst.h" |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
16 #include "timeconv.h" |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
17 #include "libstrfunc.h" |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
18 #include "vbuf.h" |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
19 |
16 | 20 |
120
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
21 #ifdef HAVE_STRING_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
22 #include <string.h> |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
23 #endif |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
24 |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
25 #ifdef HAVE_CTYPE_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
26 #include <ctype.h> |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
27 #endif |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
28 |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
29 #ifdef HAVE_LIMITS_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
30 #include <limits.h> |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
31 #endif |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
32 |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
33 #ifdef HAVE_WCHAR_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
34 #include <wchar.h> |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
35 #endif |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
36 |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
37 #ifdef HAVE_SIGNAL_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
38 #include <signal.h> |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
39 #endif |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
40 |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
41 #ifdef HAVE_ERRNO_H |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
42 #include <errno.h> |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
43 #endif |
6395ced2b8b2
disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents:
118
diff
changeset
|
44 |
153
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
133
diff
changeset
|
45 #ifdef HAVE_ICONV |
123
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
46 #include <iconv.h> |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
47 #endif |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
48 |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
49 #ifdef HAVE_REGEX_H |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
50 #include <regex.h> |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
51 #endif |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
52 |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
53 #ifdef HAVE_GD_H |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
54 #include <gd.h> |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
55 #endif |
ab2a11e72250
more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents:
122
diff
changeset
|
56 |
16 | 57 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
58 #define PERM_DIRS 0777 |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
59 |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
60 #ifdef _WIN32 |
133
2ec889a79e51
patch from Fridrich Strba, some systems need extra library for regex
Carl Byington <carl@five-ten-sg.com>
parents:
130
diff
changeset
|
61 #include <direct.h> |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
62 |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
63 #define D_MKDIR(x) mkdir(x) |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
64 #define chdir _chdir |
122
bdb38b434c0a
more changes from Fridrich Strba to avoid installing our config.h
Carl Byington <carl@five-ten-sg.com>
parents:
120
diff
changeset
|
65 #define strcasecmp _stricmp |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
66 #define vsnprintf _vsnprintf |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
67 #define snprintf _snprintf |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
68 #ifdef _MSC_VER |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
69 #define ftello _ftelli64 |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
70 #define fseeko _fseeki64 |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
71 #elif defined (__MINGW32__) |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
72 #define ftello ftello64 |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
73 #define fseeko fseeko64 |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
74 #else |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
75 #error Only MSC and mingw supported for Windows |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
76 #endif |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
77 #ifndef UINT64_MAX |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
78 #define UINT64_MAX ((uint64_t)0xffffffffffffffff) |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
79 #endif |
377
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
80 #ifndef PRIx64 |
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
81 #define PRIx64 "I64x" |
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
82 #endif |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
83 int __cdecl _fseeki64(FILE *, __int64, int); |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
84 __int64 __cdecl _ftelli64(FILE *); |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
85 |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
86 #ifdef __MINGW32__ |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
87 #include <getopt.h> |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
88 #else |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
89 #include "XGetopt.h" |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
90 #endif |
212
8e17efed33c1
patch from Fridrich Strba to build on win32
Carl Byington <carl@five-ten-sg.com>
parents:
205
diff
changeset
|
91 #include <process.h> |
8e17efed33c1
patch from Fridrich Strba to build on win32
Carl Byington <carl@five-ten-sg.com>
parents:
205
diff
changeset
|
92 #undef gmtime_r |
8e17efed33c1
patch from Fridrich Strba to build on win32
Carl Byington <carl@five-ten-sg.com>
parents:
205
diff
changeset
|
93 #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) |
229
e7f363452178
patch from Fridrich Strba for undefined ENDIAN
Carl Byington <carl@five-ten-sg.com>
parents:
228
diff
changeset
|
94 #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
95 #else |
228
be1009c92ac2
patch from Fridrich Strba to build with DJGPP DOS cross-compiler
Carl Byington <carl@five-ten-sg.com>
parents:
212
diff
changeset
|
96 #ifdef __DJGPP__ |
be1009c92ac2
patch from Fridrich Strba to build with DJGPP DOS cross-compiler
Carl Byington <carl@five-ten-sg.com>
parents:
212
diff
changeset
|
97 #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) |
be1009c92ac2
patch from Fridrich Strba to build with DJGPP DOS cross-compiler
Carl Byington <carl@five-ten-sg.com>
parents:
212
diff
changeset
|
98 #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) |
377
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
99 #define fseeko(stream, offset, whence) fseek(stream, (long)offset, whence) |
229
e7f363452178
patch from Fridrich Strba for undefined ENDIAN
Carl Byington <carl@five-ten-sg.com>
parents:
228
diff
changeset
|
100 #define ftello ftell |
228
be1009c92ac2
patch from Fridrich Strba to build with DJGPP DOS cross-compiler
Carl Byington <carl@five-ten-sg.com>
parents:
212
diff
changeset
|
101 #endif |
118
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
102 #ifdef HAVE_UNISTD_H |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
103 #include <unistd.h> |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
104 #else |
0f1492b7fe8b
patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
105 #include "XGetopt.h" |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
106 #endif |
133
2ec889a79e51
patch from Fridrich Strba, some systems need extra library for regex
Carl Byington <carl@five-ten-sg.com>
parents:
130
diff
changeset
|
107 #define D_MKDIR(x) mkdir(x, PERM_DIRS) |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
108 #endif |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
109 |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
110 #ifdef HAVE_SYS_STAT_H |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
111 #include <sys/stat.h> |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
112 #endif |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
113 |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
114 #ifdef HAVE_SYS_TYPES_H |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
115 #include <sys/types.h> |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
116 #endif |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
117 |
201
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
118 #ifdef HAVE_SYS_SHM_H |
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
119 #include <sys/shm.h> |
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
120 #endif |
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
121 |
200
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
122 #ifdef HAVE_SYS_WAIT_H |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
123 #include <sys/wait.h> |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
124 #endif |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
125 |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
126 #ifdef HAVE_DIRENT_H |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
127 #include <dirent.h> |
16 | 128 #endif |
129 | |
200
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
130 #ifdef HAVE_SEMAPHORE_H |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
131 #include <semaphore.h> |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
132 #endif |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
133 |
16 | 134 |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
135 void pst_debug_lock(); |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
136 void pst_debug_unlock(); |
350
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
137 void pst_debug_setlevel(int level); |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
138 void pst_debug_init(const char* fname, void* output_mutex); |
350
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
139 void pst_debug_func(int level, const char* function); |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
140 void pst_debug_func_ret(int level); |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
141 void pst_debug(int level, int line, const char *file, const char *fmt, ...); |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
142 void pst_debug_hexdump(int level, int line, const char *file, const char* buf, size_t size, int cols, int delta); |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
143 void pst_debug_hexdumper(FILE* out, const char* buf, size_t size, int cols, int delta); |
350
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
144 void pst_debug_close(); |
176
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
145 void* pst_malloc(size_t size); |
289
cc8ee701f190
pst_block_offset elements are unsigned; consistent usage of pst_malloc and pst_realloc
Carl Byington <carl@five-ten-sg.com>
parents:
242
diff
changeset
|
146 void *pst_realloc(void *ptr, size_t size); |
16 | 147 |
350
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
148 #define MESSAGEPRINT1(...) pst_debug(1, __LINE__, __FILE__, __VA_ARGS__) |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
149 #define MESSAGEPRINT2(...) pst_debug(2, __LINE__, __FILE__, __VA_ARGS__) |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
150 #define MESSAGEPRINT3(...) pst_debug(3, __LINE__, __FILE__, __VA_ARGS__) |
16 | 151 |
200
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
152 #define WARN(x) { \ |
377
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
153 MESSAGEPRINT3 x; \ |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
154 pst_debug_lock(); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
155 printf x; \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
156 fflush(stdout); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
157 pst_debug_unlock(); \ |
16 | 158 } |
159 | |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
160 #define DIE(x) { \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
161 WARN(x); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
162 exit(EXIT_FAILURE); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
163 } |
16 | 164 |
350
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
165 #define DEBUG_WARN(x) MESSAGEPRINT3 x |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
166 #define DEBUG_INFO(x) MESSAGEPRINT2 x |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
167 #define DEBUG_HEXDUMP(x, s) pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, 0x10, 0) |
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
168 #define DEBUG_HEXDUMPC(x, s, c) pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, c, 0) |
16 | 169 |
170 | |
242
67b24d6a45d6
patch from Hugo DesRosiers to export categories and notes into vcards.
Carl Byington <carl@five-ten-sg.com>
parents:
229
diff
changeset
|
171 #define DEBUG_ENT(x) \ |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
172 { \ |
350
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
173 pst_debug_func(1, x); \ |
377
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
174 pst_debug(1, __LINE__, __FILE__, "Entering function\n"); \ |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
175 } |
242
67b24d6a45d6
patch from Hugo DesRosiers to export categories and notes into vcards.
Carl Byington <carl@five-ten-sg.com>
parents:
229
diff
changeset
|
176 #define DEBUG_RET() \ |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
177 { \ |
350
7a91e30826d8
Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents:
289
diff
changeset
|
178 pst_debug(1, __LINE__, __FILE__, "Leaving function\n"); \ |
377
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
179 pst_debug_func_ret(1); \ |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
180 } |
16 | 181 |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
182 #define DEBUG_INIT(fname,mutex) {pst_debug_init(fname,mutex);} |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
183 #define DEBUG_CLOSE() {pst_debug_close();} |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
184 #define RET_DERROR(res, ret_val, x) if (res) { DIE(x);} |
16 | 185 |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
186 |
16 | 187 |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
188 #if BYTE_ORDER == BIG_ENDIAN |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
189 # define LE64_CPU(x) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
190 x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
191 (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
192 (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
193 (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
194 (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
195 (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
196 (((x) & UINT64_C(0x000000000000ff00)) << 40) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
197 (((x) & UINT64_C(0x00000000000000ff)) << 56)); |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
198 # define LE32_CPU(x) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
199 x = ((((x) & 0xff000000) >> 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
200 (((x) & 0x00ff0000) >> 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
201 (((x) & 0x0000ff00) << 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
202 (((x) & 0x000000ff) << 24)); |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
203 # define LE16_CPU(x) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
204 x = ((((x) & 0xff00) >> 8) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
205 (((x) & 0x00ff) << 8)); |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
206 #elif BYTE_ORDER == LITTLE_ENDIAN |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
207 # define LE64_CPU(x) {} |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
208 # define LE32_CPU(x) {} |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
209 # define LE16_CPU(x) {} |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
210 #else |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
211 # error "Byte order not supported by this library" |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
212 #endif // BYTE_ORDER |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
213 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
214 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
215 #define PST_LE_GET_UINT64(p) \ |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
216 (uint64_t)((((uint8_t const *)(p))[0] << 0) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
217 (((uint8_t const *)(p))[1] << 8) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
218 (((uint8_t const *)(p))[2] << 16) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
219 (((uint8_t const *)(p))[3] << 24) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
220 (((uint8_t const *)(p))[4] << 32) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
221 (((uint8_t const *)(p))[5] << 40) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
222 (((uint8_t const *)(p))[6] << 48) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
223 (((uint8_t const *)(p))[7] << 56)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
224 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
225 #define PST_LE_GET_INT64(p) \ |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
226 (int64_t)((((uint8_t const *)(p))[0] << 0) | \ |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
227 (((uint8_t const *)(p))[1] << 8) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
228 (((uint8_t const *)(p))[2] << 16) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
229 (((uint8_t const *)(p))[3] << 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
230 (((uint8_t const *)(p))[4] << 32) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
231 (((uint8_t const *)(p))[5] << 40) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
232 (((uint8_t const *)(p))[6] << 48) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
233 (((uint8_t const *)(p))[7] << 56)) |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
234 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
235 #define PST_LE_GET_UINT32(p) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
236 (uint32_t)((((uint8_t const *)(p))[0] << 0) | \ |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
237 (((uint8_t const *)(p))[1] << 8) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
238 (((uint8_t const *)(p))[2] << 16) | \ |
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
239 (((uint8_t const *)(p))[3] << 24)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
240 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
241 #define PST_LE_GET_INT32(p) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
242 (int32_t)((((uint8_t const *)(p))[0] << 0) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
243 (((uint8_t const *)(p))[1] << 8) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
244 (((uint8_t const *)(p))[2] << 16) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
245 (((uint8_t const *)(p))[3] << 24)) |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
246 |
377
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
247 #define PST_LE_GET_UINT16(p) \ |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
248 (uint16_t)((((uint8_t const *)(p))[0] << 0) | \ |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
249 (((uint8_t const *)(p))[1] << 8)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
250 |
377
506e266f930d
Vitaliy Didik - fix MSVC build
Carl Byington <carl@five-ten-sg.com>
parents:
350
diff
changeset
|
251 #define PST_LE_GET_INT16(p) \ |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
252 (int16_t)((((uint8_t const *)(p))[0] << 0) | \ |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
253 (((uint8_t const *)(p))[1] << 8)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
254 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
255 #define PST_LE_GET_UINT8(p) (*(uint8_t const *)(p)) |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
256 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
257 #define PST_LE_GET_INT8(p) (*(int8_t const *)(p)) |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
258 |
378
ad7b880ad3d1
Alfredo Esteban - add -l and -f options to lspst
Carl Byington <carl@five-ten-sg.com>
parents:
377
diff
changeset
|
259 #define MAXDATEFMTLEN 40 |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
260 |
16 | 261 #endif //DEFINEH_H |