annotate src/define.h @ 129:fc11b1d1ad34

fix initial from header in mbox format. start moving to PST_LE_GET* rather than LE*_CPU macros so we can eventually remove the pragma packing.
author Carl Byington <carl@five-ten-sg.com>
date Thu, 05 Feb 2009 12:09:04 -0800
parents 7f747c8c9d02
children e35fd42bac05
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
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
11 #include "common.h"
129
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
12 #include "libpst.h"
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
13 #include "timeconv.h"
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
14 #include "libstrfunc.h"
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
15 #include "vbuf.h"
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
16
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
17
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
18
31
b88ceb81dba2 mege changes from Joe Nahmias
carl
parents: 28
diff changeset
19 #ifdef HAVE_CONFIG_H
122
bdb38b434c0a more changes from Fridrich Strba to avoid installing our config.h
Carl Byington <carl@five-ten-sg.com>
parents: 120
diff changeset
20 #include "config.h"
31
b88ceb81dba2 mege changes from Joe Nahmias
carl
parents: 28
diff changeset
21 #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
22
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
23 #ifdef _WIN32
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
24 #undef 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
25 #define HAVE_DIRECT_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
26 #define HAVE_WINDOWS_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
27 #endif
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
28
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
29 #define DEBUG_MODE_GEN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
30 #define DEBUGPRINT
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
31 #define DEBUG_MODE_WARN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
32 #define DEBUG_MODE_READ
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
33 #define DEBUG_MODE_EMAIL
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
34 #define DEBUG_MODE_MAIN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
35 #define DEBUG_MODE_INDEX
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
36 #define DEBUG_MODE_CODE
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
37 #define DEBUG_MODE_INFO
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
38 #define DEBUG_MODE_HEXDUMP
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
39 #define DEBUG_MODE_FUNC
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
40
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
41 //number of items to save in memory between writes
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
42 #define DEBUG_MAX_ITEMS 0
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
43
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
44 #define DEBUG_FILE_NO 1
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
45 #define DEBUG_INDEX_NO 2
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
46 #define DEBUG_EMAIL_NO 3
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
47 #define DEBUG_WARN_NO 4
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
48 #define DEBUG_READ_NO 5
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
49 #define DEBUG_INFO_NO 6
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
50 #define DEBUG_MAIN_NO 7
36
6fe121a971c9 valgrind fixes
carl
parents: 34
diff changeset
51 #define DEBUG_DECRYPT_NO 8
6fe121a971c9 valgrind fixes
carl
parents: 34
diff changeset
52 #define DEBUG_FUNCENT_NO 9
6fe121a971c9 valgrind fixes
carl
parents: 34
diff changeset
53 #define DEBUG_FUNCRET_NO 10
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
54 #define DEBUG_HEXDUMP_NO 11
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
55
120
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
56 #ifdef HAVE_TIME_H
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
57 #include <time.h>
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
58 #endif
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
59
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
60 #ifdef HAVE_STRING_H
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
61 #include <string.h>
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
62 #endif
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
63
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
64 #ifdef HAVE_CTYPE_H
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
65 #include <ctype.h>
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
66 #endif
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
67
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
68 #ifdef HAVE_LIMITS_H
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
69 #include <limits.h>
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
70 #endif
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
71
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
72 #ifdef HAVE_WCHAR_H
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
73 #include <wchar.h>
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
74 #endif
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
75
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
76 #ifdef HAVE_SIGNAL_H
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
77 #include <signal.h>
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
78 #endif
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
79
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
80 #ifdef HAVE_ERRNO_H
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
81 #include <errno.h>
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
82 #endif
6395ced2b8b2 disable building pst2dii on cygwin
Carl Byington <carl@five-ten-sg.com>
parents: 118
diff changeset
83
123
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
84 #ifdef HAVE_ICONV_H
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
85 #include <iconv.h>
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
86 #endif
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
87
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
88 #ifdef HAVE_REGEX_H
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
89 #include <regex.h>
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
90 #endif
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
91
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
92 #ifdef HAVE_GD_H
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
93 #include <gd.h>
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
94 #endif
ab2a11e72250 more cleanup of #include files.
Carl Byington <carl@five-ten-sg.com>
parents: 122
diff changeset
95
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
96
75
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
97 #define PERM_DIRS 0777
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
98
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
99 #ifdef _WIN32
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
100 #include <direct.h> // win32
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
101
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 #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
103 #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
104 #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
105 #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
106 #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
107 #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
108 #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
109 #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
110 #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
111 #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
112 #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
113 #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
114 #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
115 #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
116 #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
117 #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
118 #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
119 #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
120 #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
121 #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
122 #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
123 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
124 __int64 __cdecl _ftelli64(FILE *);
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
125
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
126 #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
127 #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
128 #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
129 #include "XGetopt.h"
75
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
130 #endif
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
131
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
132 #include <windows.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
133 #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
134 #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
135 #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
136 #define D_MKDIR(x) mkdir(x, PERM_DIRS)
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
137 #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
138 #include "XGetopt.h"
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
139 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
140 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
141
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
142 #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
143 #include <sys/stat.h>
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
144 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
145
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
146 #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
147 #include <sys/types.h>
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
148 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
149
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
150 #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
151 #include <dirent.h>
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
152 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
153
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
154
73
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
155 void pst_debug(const char *fmt, ...);
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
156 void pst_debug_hexdumper(FILE* out, char* buf, size_t size, int col, int delta);
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
157 void pst_debug_hexprint(char *data, int size);
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
158
73
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
159 void pst_debug_init(const char *fname);
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
160 void pst_debug_msg_info (int line, const char *file, int type);
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
161 void pst_debug_msg_text(const char* fmt, ...);
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
162 void pst_debug_hexdump(char *x, size_t y, int cols, int delta);
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
163 void pst_debug_func(const char *function);
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
164 void pst_debug_func_ret();
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
165 void pst_debug_close(void);
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
166 void pst_debug_write();
73
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
167 size_t pst_debug_fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
168
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
169 void * xmalloc(size_t size);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
170
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
171 #define MESSAGEPRINT(x,y) {pst_debug_msg_info(__LINE__,__FILE__,y);\
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 pst_debug_msg_text x;}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
173
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
174 #define LOGSTOP() {MESSAGESTOP();DEBUGSTOP();}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
175
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
176 #define DIE(x) {\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
177 MESSAGEPRINT(x, 0);\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
178 printf x;\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
179 exit(EXIT_FAILURE);\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
180 }
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
181 #define WARN(x) {\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
182 MESSAGEPRINT(x, 0);\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
183 printf x;\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
184 }
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
185
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
186 #ifdef DEBUGPRINT
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
187 #define DEBUG_PRINT(x) pst_debug x;
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
188 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
189 #define DEBUG_PRINT(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
190 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
191
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
192 #ifdef DEBUG_MODE_GEN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
193 #define DEBUG(x) {DEBUG_PRINT(x);}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
194 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
195 #define DEBUG(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
196 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
197
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
198 #ifdef DEBUG_MODE_INDEX
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
199 #define DEBUG_INDEX(x) MESSAGEPRINT(x, DEBUG_INDEX_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
200 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
201 #define DEBUG_INDEX(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
202 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
203
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
204 #ifdef DEBUG_MODE_EMAIL
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
205 #define DEBUG_EMAIL(x) MESSAGEPRINT(x, DEBUG_EMAIL_NO);
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
206 #define DEBUG_EMAIL_HEXPRINT(x,y) {pst_debug_msg_info(__LINE__, __FILE__, 11);\
73
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
207 pst_debug_hexdump((char*)x, y, 0x10, 0);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
208 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
209 #define DEBUG_EMAIL(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
210 #define DEBUG_EMAIL_HEXPRINT(x,y) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
211 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
212
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
213 #ifdef DEBUG_MODE_WARN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
214 #define DEBUG_WARN(x) MESSAGEPRINT(x, DEBUG_WARN_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
215 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
216 #define DEBUG_WARN(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
217 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
218
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
219 #ifdef DEBUG_MODE_READ
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
220 #define DEBUG_READ(x) MESSAGEPRINT(x, DEBUG_READ_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
221 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
222 #define DEBUG_READ(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
223 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
224
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
225 #ifdef DEBUG_MODE_INFO
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
226 #define DEBUG_INFO(x) MESSAGEPRINT(x, DEBUG_INFO_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
227 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
228 #define DEBUG_INFO(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
229 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
230
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
231 #ifdef DEBUG_MODE_MAIN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
232 #define DEBUG_MAIN(x) MESSAGEPRINT(x, DEBUG_MAIN_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
233 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
234 #define DEBUG_MAIN(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
235 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
236
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
237 #ifdef DEBUG_MODE_CODE
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
238 #define DEBUG_CODE(x) {x}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
239 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
240 #define DEBUG_CODE(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
241 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
242
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
243 #ifdef DEBUG_MODE_DECRYPT
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
244 #define DEBUG_DECRYPT(x) MESSAGEPRINT(x, DEBUG_DECRYPT_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
245 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
246 #define DEBUG_DECRYPT(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
247 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
248
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
249 #ifdef DEBUG_MODE_HEXDUMP
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
250 #define DEBUG_HEXDUMP(x, s)\
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
251 {pst_debug_msg_info(__LINE__, __FILE__, DEBUG_HEXDUMP_NO);\
73
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
252 pst_debug_hexdump((char*)x, s, 0x10, 0);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
253 #define DEBUG_HEXDUMPC(x, s, c)\
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
254 {pst_debug_msg_info(__LINE__, __FILE__, DEBUG_HEXDUMP_NO);\
73
3cb02cb1e6cd Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents: 63
diff changeset
255 pst_debug_hexdump((char*)x, s, c, 0);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
256 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
257 #define DEBUG_HEXDUMP(x, s) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
258 #define DEBUG_HEXDUMPC(x, s, c) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
259 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
260
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
261 #define DEBUG_FILE(x) {pst_debug_msg_info(__LINE__, __FILE__, DEBUG_FILE_NO);\
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
262 pst_debug_msg_text x;}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
263
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
264 #ifdef DEBUG_MODE_FUNC
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
265 # 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
266 { \
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
267 pst_debug_func(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
268 MESSAGEPRINT(("Entering function %s\n",x),DEBUG_FUNCENT_NO); \
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
269 }
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
270 # 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
271 { \
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
272 MESSAGEPRINT(("Leaving function\n"),DEBUG_FUNCRET_NO); \
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
273 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
274 }
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
275 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
276 # define DEBUG_ENT(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
277 # define DEBUG_RET() {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
278 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
279
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
280 #define DEBUG_INIT(fname) {pst_debug_init(fname);}
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
281 #define DEBUG_CLOSE() {pst_debug_close();}
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
282 #define DEBUG_REGISTER_CLOSE() {if(atexit(pst_debug_close)!=0) fprintf(stderr, "Error registering atexit function\n");}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
283
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
284 #define RET_DERROR(res, ret_val, 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
285 if (res) { DIE(x);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
286
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
287 #define RET_ERROR(res, ret_val)\
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
288 if (res) {return ret_val;}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
289
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
290 #define DEBUG_VERSION 1
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
291 struct pst_debug_file_rec_m {
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
292 unsigned short int funcname;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
293 unsigned short int filename;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
294 unsigned short int text;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
295 unsigned short int end;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
296 unsigned int line;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
297 unsigned int type;
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
298 };
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
299
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
300 struct pst_debug_file_rec_l {
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
301 unsigned int funcname;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
302 unsigned int filename;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
303 unsigned int text;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
304 unsigned int end;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
305 unsigned int line;
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
306 unsigned int type;
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
307 };
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
308
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
309 #if BYTE_ORDER == BIG_ENDIAN
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
310 # define LE64_CPU(x) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
311 x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
312 (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
313 (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
314 (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
315 (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
316 (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
317 (((x) & UINT64_C(0x000000000000ff00)) << 40) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
318 (((x) & UINT64_C(0x00000000000000ff)) << 56));
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
319 # define LE32_CPU(x) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
320 x = ((((x) & 0xff000000) >> 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
321 (((x) & 0x00ff0000) >> 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
322 (((x) & 0x0000ff00) << 8 ) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
323 (((x) & 0x000000ff) << 24));
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
324 # define LE16_CPU(x) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
325 x = ((((x) & 0xff00) >> 8) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
326 (((x) & 0x00ff) << 8));
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
327 #elif BYTE_ORDER == LITTLE_ENDIAN
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
328 # define LE64_CPU(x) {}
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
329 # define LE32_CPU(x) {}
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
330 # define LE16_CPU(x) {}
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
331 #else
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
332 # error "Byte order not supported by this library"
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
333 #endif // BYTE_ORDER
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
334
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
335
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
336 #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
337 (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
338 (((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
339 (((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
340 (((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
341 (((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
342 (((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
343 (((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
344 (((uint8_t const *)(p))[7] << 56))
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
345
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
346 #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
347 (int64_t)((((uint8_t const *)(p))[0] << 0) | \
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
348 (((uint8_t const *)(p))[1] << 8) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
349 (((uint8_t const *)(p))[2] << 16) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
350 (((uint8_t const *)(p))[3] << 24) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
351 (((uint8_t const *)(p))[4] << 32) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
352 (((uint8_t const *)(p))[5] << 40) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
353 (((uint8_t const *)(p))[6] << 48) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
354 (((uint8_t const *)(p))[7] << 56))
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
355
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
356 #define PST_LE_GET_UINT32(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
357 (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
358 (((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
359 (((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
360 (((uint8_t const *)(p))[3] << 24))
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
361
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
362 #define PST_LE_GET_INT32(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
363 (int32_t)((((uint8_t const *)(p))[0] << 0) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
364 (((uint8_t const *)(p))[1] << 8) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
365 (((uint8_t const *)(p))[2] << 16) | \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
366 (((uint8_t const *)(p))[3] << 24))
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
367
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
368 #define PST_LE_GET_UINT16(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
369 (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
370 (((uint8_t const *)(p))[1] << 8))
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
371
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
372 #define PST_LE_GET_INT16(p) \
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
373 (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
374 (((uint8_t const *)(p))[1] << 8))
128
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
375
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
376 #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
377
7f747c8c9d02 cleanup installed headers
Carl Byington <carl@five-ten-sg.com>
parents: 123
diff changeset
378 #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
379
129
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
380
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
381 // switch to maximal packing for our own internal structures
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
382 // use the same code as in common.h
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
383 #ifdef _MSC_VER
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
384 #pragma pack(push, 1)
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
385 #endif
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
386 #if defined(__GNUC__) || defined (__SUNPRO_C) || defined(__SUNPRO_CC)
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
387 #pragma pack(1)
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
388 #endif
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
389
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
390
fc11b1d1ad34 fix initial from header in mbox format.
Carl Byington <carl@five-ten-sg.com>
parents: 128
diff changeset
391
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
392 #endif //DEFINEH_H