annotate src/define.h @ 355:d1f930be4711

From Jeffrey Morlan: pst_build_id_ptr and pst_build_desc_ptr require that the first child of a BTree page have the same starting ID as itself. This is not required by the spec, and is not true in many real-world PSTs (presumably, the original first child of the page got deleted). Because of this, many emails are not being extracted from these PSTs. It also triggers an infinite loop in lspst (a separate bug, also fixed)
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:12:22 -0700
parents 7a91e30826d8
children 506e266f930d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
1 /***
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
2 * define.h
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
3 * Part of the LibPST project
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
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
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
6 */
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
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
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
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
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
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
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
129 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
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
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
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();
350
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
138 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
139 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
140 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
141 void pst_debug_func_ret(int level);
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
142 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
143 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
144 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
145 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
146 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
147 void *pst_realloc(void *ptr, size_t size);
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
148
350
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
149 #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
150 #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
151 #define MESSAGEPRINT3(...) pst_debug(3, __LINE__, __FILE__, __VA_ARGS__)
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
152
200
d360f96f71f6 start changes for parallel readpst on multi-processor machines
Carl Byington <carl@five-ten-sg.com>
parents: 176
diff changeset
153 #define WARN(x) { \
350
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
154 MESSAGEPRINT3 x; \
202
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
155 pst_debug_lock(); \
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
156 printf x; \
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
157 fflush(stdout); \
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
158 pst_debug_unlock(); \
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
159 }
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
160
202
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
161 #define DIE(x) { \
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
162 WARN(x); \
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
163 exit(EXIT_FAILURE); \
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
164 }
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
165
350
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
166 #define DEBUG_WARN(x) MESSAGEPRINT3 x
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
167 #define DEBUG_INFO(x) MESSAGEPRINT2 x
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
168 #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
169 #define DEBUG_HEXDUMPC(x, s, c) pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, c, 0)
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
170
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
171
242
67b24d6a45d6 patch from Hugo DesRosiers to export categories and notes into vcards.
Carl Byington <carl@five-ten-sg.com>
parents: 229
diff changeset
172 #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
173 { \
350
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
174 pst_debug_func(1, x); \
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
175 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
176 }
242
67b24d6a45d6 patch from Hugo DesRosiers to export categories and notes into vcards.
Carl Byington <carl@five-ten-sg.com>
parents: 229
diff changeset
177 #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
178 { \
350
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
179 pst_debug(1, __LINE__, __FILE__, "Leaving function\n"); \
7a91e30826d8 Hans Liss - debug level output
Carl Byington <carl@five-ten-sg.com>
parents: 289
diff changeset
180 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
181 }
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
182
202
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
183 #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
184 #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
185 #define RET_DERROR(res, ret_val, x) if (res) { DIE(x);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
186
202
2f38c4ce606f remove readpstlog, switch to plain ascii debug log files
Carl Byington <carl@five-ten-sg.com>
parents: 201
diff changeset
187
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
188
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
189 #if BYTE_ORDER == BIG_ENDIAN
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
190 # define LE64_CPU(x) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
191 x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
192 (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
193 (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
194 (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
195 (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
196 (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
197 (((x) & UINT64_C(0x000000000000ff00)) << 40) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
198 (((x) & UINT64_C(0x00000000000000ff)) << 56));
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
199 # define LE32_CPU(x) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
200 x = ((((x) & 0xff000000) >> 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
201 (((x) & 0x00ff0000) >> 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
202 (((x) & 0x0000ff00) << 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
203 (((x) & 0x000000ff) << 24));
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
204 # define LE16_CPU(x) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
205 x = ((((x) & 0xff00) >> 8) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
206 (((x) & 0x00ff) << 8));
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
207 #elif BYTE_ORDER == LITTLE_ENDIAN
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
208 # define LE64_CPU(x) {}
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
209 # define LE32_CPU(x) {}
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
210 # define LE16_CPU(x) {}
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
211 #else
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
212 # error "Byte order not supported by this library"
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
213 #endif // BYTE_ORDER
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
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
216 #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
217 (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
218 (((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
219 (((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
220 (((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
221 (((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
222 (((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
223 (((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
224 (((uint8_t const *)(p))[7] << 56))
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
225
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
226 #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
227 (int64_t)((((uint8_t const *)(p))[0] << 0) | \
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
228 (((uint8_t const *)(p))[1] << 8) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
229 (((uint8_t const *)(p))[2] << 16) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
230 (((uint8_t const *)(p))[3] << 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
231 (((uint8_t const *)(p))[4] << 32) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
232 (((uint8_t const *)(p))[5] << 40) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
233 (((uint8_t const *)(p))[6] << 48) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
234 (((uint8_t const *)(p))[7] << 56))
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
235
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
236 #define PST_LE_GET_UINT32(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
237 (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
238 (((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
239 (((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
240 (((uint8_t const *)(p))[3] << 24))
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
241
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
242 #define PST_LE_GET_INT32(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
243 (int32_t)((((uint8_t const *)(p))[0] << 0) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
244 (((uint8_t const *)(p))[1] << 8) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
245 (((uint8_t const *)(p))[2] << 16) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
246 (((uint8_t const *)(p))[3] << 24))
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_UINT16(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
249 (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
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_INT16(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
253 (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
254 (((uint8_t const *)(p))[1] << 8))
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
255
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
256 #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
257
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
258 #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
259
129
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
260
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
261 #endif //DEFINEH_H