forked from ldmud/ldmud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.h
188 lines (143 loc) · 5.17 KB
/
driver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#ifndef DRIVER_H__
#define DRIVER_H__
/*------------------------------------------------------------------
* Global mandatory include file.
*
* It contains various global macros and declarations, and takes
* care of the proper inclusion of the configuration/portability
* include files.
*------------------------------------------------------------------
*/
#define __DRIVER_SOURCE__
#include "config.h"
/* Include the portability headers */
#include "port.h"
/* TODO: Some TODO defines */
/* NO_NEGATIVE_RANGES: If defined, assignments to negative ranges
* like [4..2] are not allowed. However, they are useful at times
* and so this switch should be under control of a pragma or special
* syntactic construct. For now and for compatibility reasons, these
* ranges remain allowed.
*/
/* #undef NO_NEGATIVE_RANGES */
/*----------------------------------------------------------------*/
/* Verify some of the definitions in config.h */
/* Make sure that YYDEBUG is defined to 1 - just being defined
* is not sufficient.
*/
#if defined(YYDEBUG)
# undef YYDEBUG
# define YYDEBUG 1
#endif
#if !defined(MALLOC_smalloc) && !defined(MALLOC_sysmalloc) && ~defined(MALLOC_slaballoc)
# define MALLOC_slaballoc
#endif
/* Do we have full GC support? */
#if defined(MALLOC_smalloc) || defined(MALLOC_slaballoc)
# define GC_SUPPORT 1
#endif
/* Do some of the selected packages require special treatment? */
/* SQLite in the threadsafe mode needs a normal malloc() */
/* TODO: does it work with mmap, as long as we don't replace malloc? */
#if defined(USE_SQLITE) && defined(SQLITE3_USES_PTHREADS)
# if defined(MALLOC_SBRK)
# undef MALLOC_SBRK
# endif
# if defined(MALLOC_REPLACEABLE)
# undef MALLOC_REPLACEABLE
# endif
#endif
/* When we have allocation tracing, the allocator annotates every
* allocation with the source filename and line where the allocation
* occurred. To allow the annotation of the allocations of higher structures
* like strings with the place where the string as such is allocated (and not
* the places in the string module), the following macros can be used
* to declare and pass the necessary information transparently:
*
* MTRACE_DECL: the declaration of the tracing arguments
* MTRACE_PASS: the tracing arguments when passed on to lower
* functions
* MTRACE_ARG: the tracing arguments on the toplevel call
*/
#ifdef MALLOC_TRACE
#define MTRACE_DECL , const char * malloc_trace_file, int malloc_trace_line
#define MTRACE_PASS , malloc_trace_file, malloc_trace_line
#define MTRACE_ARG , __FILE__, __LINE__
#else
#define MTRACE_DECL
#define MTRACE_PASS
#define MTRACE_ARG
#endif
/* To function properly, MALLOC_(LPC_)TRACE need to be able to
* test whether a memory block is free or not. This is reliably implemented
* by MALLOC_CHECK.
*/
#if (defined(MALLOC_TRACE) || defined(MALLOC_LPC_TRACE)) && !defined(MALLOC_CHECK)
# define MALLOC_CHECK
#endif
/* This one is for backwards compatibility with old config.hs */
#if defined(NATIVE_MODE) && !defined(STRICT_EUIDS)
# define STRICT_EUIDS
#elif defined(COMPAT_MODE)
# undef STRICT_EUIDS
#endif
/* The string table is shadowed only in DEBUG mode */
#if !defined(DEBUG) && defined(CHECK_STRINGS)
# undef CHECK_STRINGS
#endif
/* The ALARM and HEART_BEAT time need to be at least 1. */
#if !defined(ALARM_TIME)
#define ALARM_TIME 1
#elif ALARM_TIME < 1
#undef ALARM_TIME
#define ALARM_TIME 1
#endif
#if !defined(HEART_BEAT_INTERVAL)
#define HEART_BEAT_INTERVAL 1
#elif HEART_BEAT_INTERVAL < 1
#undef HEART_BEAT_INTERVAL
#define HEART_BEAT_INTERVAL 1
#endif
/* Define some macros needed in the headers included from ../mudlib/sys */
#ifdef USE_IPV6
# define __IPV6__
#endif
/* If USE_PCRE is defined, check if the libpcre is available on this system.
* Disable USE_PCRE if not. */
#if defined(USE_PCRE) && !defined(HAS_PCRE)
#undef USE_PCRE
#endif
/* TODO: this ctype-stuff might go into lex.h (impl in efun_defs.c) */
#define _MCTe 0x01 /* escaped character in save/restore object. */
#define _MCTd 0x02 /* numeric digit */
#define _MCTt 0x04 /* delimiters in save/restore object. */
#define _MCTs 0x10 /* whitespace EXCLUDING '\n' */
#define _MCTx 0x40 /* hexadecimal */
#define _MCTa 0x80 /* alphanumeric or '_' */
extern unsigned char _my_ctype[];
#define isescaped(c) (_my_ctype[(unsigned char)(c)]&_MCTe)
#define issavedel(c) (_my_ctype[(unsigned char)(c)]&_MCTt)
#define isalunum( c) (_my_ctype[(unsigned char)(c)]&_MCTa)
#define lexdigit( c) (_my_ctype[(unsigned char)(c)]&_MCTd)
/* A define to point out empty loop bodies. */
#define NOOP
/* A macro to wrap statements */
#define MACRO(x) do { x ; } while(0)
/* Determine the minimum of two values.
* Some systems define this in system includes.
*/
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif /* MIN */
/* For the use of mudlib/sys/debug_info.h.
*/
#ifdef EVAL_COST_TRACE
#define __EVAL_COST_TRACE__
#endif
/* Select the float format to use. If the p_int are anyway as large as doubles,
* we just use native double in svalues.
*/
#if SIZEOF_PINT >= SIZEOF_DOUBLE && !defined(FLOAT_FORMAT_0) && !defined(FLOAT_FORMAT_2)
# define FLOAT_FORMAT_2 1
#endif
#endif /* DRIVER_H__ */