Mercurial > libpst
annotate src/define.h @ 239:aa50c23a6935
patch from Lee Ayres to add file name extensions in separate mode; allow mixed items types in a folder in separate mode
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 14 Sep 2009 10:56:39 -0700 |
parents | e7f363452178 |
children | 67b24d6a45d6 |
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 __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
|
78 #define size_t __int64 |
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 |
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
|
80 #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
|
81 #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
|
82 #endif |
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 #define PRIx64 "I64x" |
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 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
|
85 __int64 __cdecl _ftelli64(FILE *); |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
86 |
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
|
87 #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
|
88 #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
|
89 #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
|
90 #include "XGetopt.h" |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
91 #endif |
212
8e17efed33c1
patch from Fridrich Strba to build on win32
Carl Byington <carl@five-ten-sg.com>
parents:
205
diff
changeset
|
92 #include <process.h> |
8e17efed33c1
patch from Fridrich Strba to build on win32
Carl Byington <carl@five-ten-sg.com>
parents:
205
diff
changeset
|
93 #undef gmtime_r |
8e17efed33c1
patch from Fridrich Strba to build on win32
Carl Byington <carl@five-ten-sg.com>
parents:
205
diff
changeset
|
94 #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
|
95 #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
|
96 #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
|
97 #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
|
98 #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
|
99 #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((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
|
100 #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
|
101 #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
|
102 #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
|
103 #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
|
104 #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
|
105 #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
|
106 #include "XGetopt.h" |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
107 #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
|
108 #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
|
109 #endif |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
110 |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
111 #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
|
112 #include <sys/stat.h> |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
113 #endif |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
114 |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
115 #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
|
116 #include <sys/types.h> |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
117 #endif |
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
118 |
201
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
119 #ifdef HAVE_SYS_SHM_H |
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
120 #include <sys/shm.h> |
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
121 #endif |
3850a3b11745
fixes for parallel readpst
Carl Byington <carl@five-ten-sg.com>
parents:
200
diff
changeset
|
122 |
200
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
123 #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
|
124 #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
|
125 #endif |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
126 |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
127 #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
|
128 #include <dirent.h> |
16 | 129 #endif |
130 | |
200
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
131 #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
|
132 #include <semaphore.h> |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
133 #endif |
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
134 |
16 | 135 |
202
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_lock(); |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
137 void pst_debug_unlock(); |
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); |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
139 void pst_debug_func(const char* function); |
176
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
140 void pst_debug_func_ret(); |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
141 void pst_debug(int line, const char *file, const char *fmt, ...); |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
142 void pst_debug_hexdump(int line, const char *file, const char* buf, size_t size, int cols, int delta); |
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); |
176
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
144 void pst_debug_close(void); |
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); |
16 | 146 |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
147 #define MESSAGEPRINT(...) pst_debug(__LINE__, __FILE__, __VA_ARGS__) |
16 | 148 |
200
d360f96f71f6
start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents:
176
diff
changeset
|
149 #define WARN(x) { \ |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
150 MESSAGEPRINT x; \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
151 pst_debug_lock(); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
152 printf x; \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
153 fflush(stdout); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
154 pst_debug_unlock(); \ |
16 | 155 } |
156 | |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
157 #define DIE(x) { \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
158 WARN(x); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
159 exit(EXIT_FAILURE); \ |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
160 } |
16 | 161 |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
162 #define DEBUG_WARN(x) MESSAGEPRINT x |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
163 #define DEBUG_INFO(x) MESSAGEPRINT x |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
164 #define DEBUG_HEXDUMP(x, s) pst_debug_hexdump(__LINE__, __FILE__, (char*)x, s, 0x10, 0) |
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
165 #define DEBUG_HEXDUMPC(x, s, c) pst_debug_hexdump(__LINE__, __FILE__, (char*)x, s, c, 0) |
16 | 166 |
167 | |
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
|
168 # define DEBUG_ENT(x) \ |
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
169 { \ |
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
170 pst_debug_func(x); \ |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
171 pst_debug(__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
|
172 } |
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
173 # define DEBUG_RET() \ |
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
174 { \ |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
175 pst_debug(__LINE__, __FILE__, "Leaving 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
|
176 pst_debug_func_ret(); \ |
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 } |
16 | 178 |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
179 #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
|
180 #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
|
181 #define RET_DERROR(res, ret_val, x) if (res) { DIE(x);} |
16 | 182 |
202
2f38c4ce606f
remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents:
201
diff
changeset
|
183 |
16 | 184 |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
185 #if BYTE_ORDER == BIG_ENDIAN |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
186 # define LE64_CPU(x) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
187 x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
188 (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
189 (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
190 (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
191 (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
192 (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
193 (((x) & UINT64_C(0x000000000000ff00)) << 40) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
194 (((x) & UINT64_C(0x00000000000000ff)) << 56)); |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
195 # define LE32_CPU(x) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
196 x = ((((x) & 0xff000000) >> 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
197 (((x) & 0x00ff0000) >> 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
198 (((x) & 0x0000ff00) << 8 ) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
199 (((x) & 0x000000ff) << 24)); |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
200 # define LE16_CPU(x) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
201 x = ((((x) & 0xff00) >> 8) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
202 (((x) & 0x00ff) << 8)); |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
203 #elif BYTE_ORDER == LITTLE_ENDIAN |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
204 # define LE64_CPU(x) {} |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
205 # define LE32_CPU(x) {} |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
206 # define LE16_CPU(x) {} |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
207 #else |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
208 # error "Byte order not supported by this library" |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
209 #endif // BYTE_ORDER |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
210 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
211 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
212 #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
|
213 (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
|
214 (((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
|
215 (((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
|
216 (((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
|
217 (((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
|
218 (((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
|
219 (((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
|
220 (((uint8_t const *)(p))[7] << 56)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
221 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
222 #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
|
223 (int64_t)((((uint8_t const *)(p))[0] << 0) | \ |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
224 (((uint8_t const *)(p))[1] << 8) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
225 (((uint8_t const *)(p))[2] << 16) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
226 (((uint8_t const *)(p))[3] << 24) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
227 (((uint8_t const *)(p))[4] << 32) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
228 (((uint8_t const *)(p))[5] << 40) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
229 (((uint8_t const *)(p))[6] << 48) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
230 (((uint8_t const *)(p))[7] << 56)) |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
231 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
232 #define PST_LE_GET_UINT32(p) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
233 (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
|
234 (((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
|
235 (((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
|
236 (((uint8_t const *)(p))[3] << 24)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
237 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
238 #define PST_LE_GET_INT32(p) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
239 (int32_t)((((uint8_t const *)(p))[0] << 0) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
240 (((uint8_t const *)(p))[1] << 8) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
241 (((uint8_t const *)(p))[2] << 16) | \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
242 (((uint8_t const *)(p))[3] << 24)) |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
243 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
244 #define PST_LE_GET_UINT16(p) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
245 (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
|
246 (((uint8_t const *)(p))[1] << 8)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
247 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
248 #define PST_LE_GET_INT16(p) \ |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
249 (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
|
250 (((uint8_t const *)(p))[1] << 8)) |
128
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
251 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
252 #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
|
253 |
7f747c8c9d02
cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
254 #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
|
255 |
129
fc11b1d1ad34
fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
256 |
16 | 257 #endif //DEFINEH_H |