annotate src/define.h @ 118:0f1492b7fe8b

patch from Fridrich Strba for building on mingw and general cleanup of autoconf files add processing for pst files of type 0x0f start adding support for properly building and installing libpst.so and the header files required to use it. remove version.h since the version number is now in config.h more const correctness issues regarding getopt()
author Carl Byington <carl@five-ten-sg.com>
date Sat, 31 Jan 2009 12:12:36 -0800
parents 987aa872294e
children 6395ced2b8b2
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
31
b88ceb81dba2 mege changes from Joe Nahmias
carl
parents: 28
diff changeset
8 #ifdef HAVE_CONFIG_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
9 #include <libpst/config.h>
31
b88ceb81dba2 mege changes from Joe Nahmias
carl
parents: 28
diff changeset
10 #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
11
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
12 #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
13 #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
14 #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
15 #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
16 #endif
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
17
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
18 #ifndef DEFINEH_H
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
19 #define DEFINEH_H
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
20
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
21 #define DEBUG_MODE_GEN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
22 #define DEBUGPRINT
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
23 #define DEBUG_MODE_WARN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
24 #define DEBUG_MODE_READ
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
25 #define DEBUG_MODE_EMAIL
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
26 #define DEBUG_MODE_MAIN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
27 #define DEBUG_MODE_INDEX
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
28 #define DEBUG_MODE_CODE
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
29 #define DEBUG_MODE_INFO
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
30 #define DEBUG_MODE_HEXDUMP
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
31 #define DEBUG_MODE_FUNC
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
32
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
33 //number of items to save in memory between writes
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
34 #define DEBUG_MAX_ITEMS 0
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
35
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
36 #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
37 #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
38 #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
39 #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
40 #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
41 #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
42 #define DEBUG_MAIN_NO 7
36
6fe121a971c9 valgrind fixes
carl
parents: 34
diff changeset
43 #define DEBUG_DECRYPT_NO 8
6fe121a971c9 valgrind fixes
carl
parents: 34
diff changeset
44 #define DEBUG_FUNCENT_NO 9
6fe121a971c9 valgrind fixes
carl
parents: 34
diff changeset
45 #define DEBUG_FUNCRET_NO 10
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
46 #define DEBUG_HEXDUMP_NO 11
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
47
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
48 #include <stdio.h>
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
49 #include <stdlib.h>
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
50 #include <stdarg.h>
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
51 #include <time.h>
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
52 #include <string.h>
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
53 #include <ctype.h>
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
54 #include <limits.h>
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
55 #include <wchar.h>
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
56 #include <signal.h>
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
57 #include <errno.h>
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
58
75
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
59 #define PERM_DIRS 0777
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
60
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
61 #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
62 #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
63
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 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
65 #define chdir _chdir
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
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 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
68 #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
69 #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
70 #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
71 #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
72 #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
73 #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
74 #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
75 #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
76 #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
77 #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
78 #define strcasecmp _stricmp
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 #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
80 #define off_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
81 #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
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 int64_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
84 #define uint64_t unsigned __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
85 #define int32_t __int32
0f1492b7fe8b patch from Fridrich Strba for building on mingw and general cleanup of autoconf files
Carl Byington <carl@five-ten-sg.com>
parents: 75
diff changeset
86 #define uint32_t unsigned 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
87 #define int16_t short 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
88 #define uint16_t unsigned short 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
89 #define int8_t signed char
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 #define uint8_t unsigned char
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
91 #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
92 #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
93 #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
94 #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
95 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
96 __int64 __cdecl _ftelli64(FILE *);
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
97
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
98 #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
99 #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
100 #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
101 #include "XGetopt.h"
75
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
102 #endif
987aa872294e Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents: 73
diff changeset
103
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
104 #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
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 #ifdef HAVE_INTTYPES_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
107 #include <inttypes.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
108 #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
109 #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
110 #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
111 #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
112 #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
113 #include "XGetopt.h"
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
114 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
115 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
116
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
117 #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
118 #include <sys/stat.h>
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
119 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
120
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
121 #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
122 #include <sys/types.h>
59
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
123 #endif
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
124
7d5c637aaafb General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents: 48
diff changeset
125 #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
126 #include <dirent.h>
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
127 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
128
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
129
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
130 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
131 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
132 void pst_debug_hexprint(char *data, int size);
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
133
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
134 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
135 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
136 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
137 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
138 void pst_debug_func(const char *function);
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
139 void pst_debug_func_ret();
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
140 void pst_debug_close(void);
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
141 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
142 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
143
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
144 void * xmalloc(size_t size);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
145
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
146 #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
147 pst_debug_msg_text x;}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
148
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
149 #define LOGSTOP() {MESSAGESTOP();DEBUGSTOP();}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
150
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
151 #define DIE(x) {\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
152 MESSAGEPRINT(x, 0);\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
153 printf x;\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
154 exit(EXIT_FAILURE);\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
155 }
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
156 #define WARN(x) {\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
157 MESSAGEPRINT(x, 0);\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
158 printf x;\
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
159 }
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
160
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
161 #ifdef DEBUGPRINT
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
162 #define DEBUG_PRINT(x) pst_debug x;
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
163 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
164 #define DEBUG_PRINT(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
165 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
166
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
167 #ifdef DEBUG_MODE_GEN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
168 #define DEBUG(x) {DEBUG_PRINT(x);}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
169 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
170 #define DEBUG(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
171 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
172
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
173 #ifdef DEBUG_MODE_INDEX
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
174 #define DEBUG_INDEX(x) MESSAGEPRINT(x, DEBUG_INDEX_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
175 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
176 #define DEBUG_INDEX(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
177 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
178
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
179 #ifdef DEBUG_MODE_EMAIL
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
180 #define DEBUG_EMAIL(x) MESSAGEPRINT(x, DEBUG_EMAIL_NO);
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
181 #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
182 pst_debug_hexdump((char*)x, y, 0x10, 0);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
183 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
184 #define DEBUG_EMAIL(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
185 #define DEBUG_EMAIL_HEXPRINT(x,y) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
186 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
187
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
188 #ifdef DEBUG_MODE_WARN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
189 #define DEBUG_WARN(x) MESSAGEPRINT(x, DEBUG_WARN_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
190 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
191 #define DEBUG_WARN(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
192 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
193
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
194 #ifdef DEBUG_MODE_READ
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
195 #define DEBUG_READ(x) MESSAGEPRINT(x, DEBUG_READ_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
196 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
197 #define DEBUG_READ(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
198 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
199
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
200 #ifdef DEBUG_MODE_INFO
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
201 #define DEBUG_INFO(x) MESSAGEPRINT(x, DEBUG_INFO_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
202 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
203 #define DEBUG_INFO(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
204 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
205
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
206 #ifdef DEBUG_MODE_MAIN
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
207 #define DEBUG_MAIN(x) MESSAGEPRINT(x, DEBUG_MAIN_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
208 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
209 #define DEBUG_MAIN(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
210 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
211
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
212 #ifdef DEBUG_MODE_CODE
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
213 #define DEBUG_CODE(x) {x}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
214 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
215 #define DEBUG_CODE(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
216 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
217
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
218 #ifdef DEBUG_MODE_DECRYPT
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
219 #define DEBUG_DECRYPT(x) MESSAGEPRINT(x, DEBUG_DECRYPT_NO);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
220 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
221 #define DEBUG_DECRYPT(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
222 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
223
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
224 #ifdef DEBUG_MODE_HEXDUMP
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
225 #define DEBUG_HEXDUMP(x, s)\
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
226 {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
227 pst_debug_hexdump((char*)x, s, 0x10, 0);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
228 #define DEBUG_HEXDUMPC(x, s, c)\
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
229 {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
230 pst_debug_hexdump((char*)x, s, c, 0);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
231 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
232 #define DEBUG_HEXDUMP(x, s) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
233 #define DEBUG_HEXDUMPC(x, s, c) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
234 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
235
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
236 #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
237 pst_debug_msg_text x;}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
238
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
239 #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
240 # 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
241 { \
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
242 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
243 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
244 }
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
245 # 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
246 { \
cfd6175f9334 Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents: 59
diff changeset
247 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
248 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
249 }
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
250 #else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
251 # define DEBUG_ENT(x) {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
252 # define DEBUG_RET() {}
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
253 #endif
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
254
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
255 #define DEBUG_INIT(fname) {pst_debug_init(fname);}
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
256 #define DEBUG_CLOSE() {pst_debug_close();}
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
257 #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
258
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
259 #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
260 if (res) { DIE(x);}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
261
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
262 #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
263 if (res) {return ret_val;}
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
264
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
265 #define DEBUG_VERSION 1
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
266 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
267 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
268 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
269 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
270 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
271 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
272 unsigned int type;
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
273 };
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
274
46
b2a7f2e0926a more fixes for 64 bit format
carl
parents: 43
diff changeset
275 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
276 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
277 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
278 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
279 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
280 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
281 unsigned int type;
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
282 };
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
283
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
284 #endif //DEFINEH_H