Debian Codegraph @

rexx.h

raw
1 /*
2 * The Regina Rexx Interpreter
3 * Copyright (C) 1992-1994 Anders Christensen <[email protected]>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 #ifndef __REXX_H_INCLUDED
20 #define __REXX_H_INCLUDED
21
22 #include "wrappers.h"
23
24 #if defined(OS2) || defined(DOS)
25 # include "reginaver.h"
26 #endif
27
28 #if defined(__WATCOMC__) && defined(DOS)
29 # define NO_EXTERNAL_QUEUES
30 #endif
31
32 #if defined(__APPLE__) && defined(__MACH__)
33 # undef REGINA_BITS
34 # if defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__)
35 # define REGINA_BITS 64
36 # else
37 # define REGINA_BITS 32
38 # endif
39 #endif
40
41 /* Things you might want to change .... (at your own risk!!!) */
42
43 /*
44 * define NOFLISTS if you DON'T want to use the internal memory
45 * allocation functions. By not using FLISTS, execution speed is reduced
46 * by some 50%. The use of NOFLISTS is useful for bounds checking
47 * features of some compilers, but should be avoided for general use.
48 *
49 * It is available under Unix by using the --disable-flists switch
50 * in autoconf script.
51 * NOFLISTS can be be set on other ports by using FLISTS=N on the
52 * 'make' command.
53 */
54 #ifndef NOFLISTS
55 # define FLISTS
56 #endif
57
58 /*
59 * define TRACEMEM to use tracing of dynamically allocated memory. This
60 * is only useful when debugging memory management of the interpreter.
61 * Some conditions must be fullfilled when using this (see memory.c).
62 *
63 * TRACEMEM is a subset of the debugging functionality. It is
64 * available under Unix by using the --enable-tracemem switch
65 * in autoconf script.
66 * TRACEMEM can be be set on other ports by using TRACMEM=Y on the
67 * 'make' command (you MUST also specify DEBUG=Y).
68 */
69 #ifdef NDEBUG
70 # ifdef TRACEMEM
71 # undef TRACEMEM
72 # endif
73 #endif
74
75
76 #ifdef CHECK_MEMORY /* Don't allow manual setting! */
77 # undef CHECK_MEMORY
78 #endif
79 #if defined(__GNUC__) && (defined(__BOUNDS_CHECKING_ON) || defined(__CHECKER__))
80 /*
81 * Automatically define CHECK_MEMORY in case of GNU's bound checking
82 * methods. Undef other memory checker settings since they are useless
83 * in this case.
84 */
85 # define CHECK_MEMORY
86 # ifdef FLISTS
87 # undef FLISTS
88 # endif
89 # ifdef TRACEMEM
90 # undef TRACEMEM
91 # endif
92 #endif
93
94
95 /*
96 * define PATTERN_MEMORY to initiate newly allocated dynamic memory to
97 * a particular value, and freed memory to be set to another value
98 * before it is freed. Useful for debugging only.
99 */
100 #define PATTERN_MEMORY
101
102 #if defined(__SASC)
103 # define REG_FAR __far
104 #else
105 # define REG_FAR
106 #endif
107
108 /*
109 * define MAX_ARGS_TO_REXXSTART to specify the maximum number of arguments that
110 * can be passed to the RexxStart() and RexxCallBack() API functions.
111 */
112 #define MAX_ARGS_TO_REXXSTART 32
113
114 /*
115 * define MAX_CONCURRENT_REGINA_THREADS to change how many concurrent Regina
116 * instances (threads) can be running.
117 */
118 #define MAX_CONCURRENT_REGINA_THREADS 1000
119
120 #include "defs.h"
121 #if defined(HAVE_CONFIG_H)
122 # include "config.h"
123 #endif
124 #include "configur.h"
125
126 #ifdef HAVE_LIMITS_H
127 # include <limits.h>
128 #endif
129
130 #ifdef HAVE_INTTYPES_H
131 # include <inttypes.h>
132 #endif
133
134 #ifdef HAVE_STDINT_H
135 # include <stdint.h>
136 #endif
137
138 #define MAXNUMERIC 64 /* Max setting for NUMERIC DIGITS */
139 /* #define REXXDEBUG */ /* You probably don't want this ... :-) */
140
141 /* #define HAVE_STRMATH */ /* Do we have *real* REXX string math ? */
142 /* #define HAVE_MPMATH */ /* Do we have C ``mp'' math */
143 #define HAVE_CMATH /* Do we have std. C math calls ? */
144 #define MATH_TYPES 1 /* How many different types available */
145
146 /*#define LINELENGTH 1024 not used */ /* max linelength of source code */
147 /* #define STACKSIZE 400 not used ? */ /* Was 256, then 512 (too much) */
148 /*
149 * If you increase BUFFERSIZE you MUST ensure that YY_BUF_SIZE in lexsrc.c
150 * is made larger than BUFFERSIZE.
151 * Increasing this value will slow down parsing a bit.
152 */
153 #define BUFFERSIZE 100000 /* Was 512 */ /* Size of input buffer, longest line */
154 #define LOOKAHEAD 256 /* Size of input lookahead */
155
156 /*
157 * Buffer size for reading/writing with ADDRESS SYSTEM ... WITH
158 * REGINA_MAX_BUFFER_SIZE must be larger than REGINA_BUFFER_SIZE.
159 * Keep it on a page size for best performance in unix systems.
160 */
161 #if defined(__WINS__) || defined(__EPOC32__)
162 # define REGINA_BUFFER_SIZE 128
163 #else
164 # define REGINA_BUFFER_SIZE 0x1000
165 #endif
166 #define REGINA_MAX_BUFFER_SIZE REGINA_BUFFER_SIZE * 2
167
168 #define SMALLSTR 5 /* For holding small integers */
169 #define NULL_STR_LENGTH 1
170 #define BOOL_STR_LENGTH 2
171
172 #define DEFAULT_TRACING 'N'
173 #define DEFAULT_INT_TRACING 0
174 #define DEFAULT_NUMFORM NUM_FORM_SCI
175 #define DEFAULT_ENVIRONMENT ENV_SYSTEM
176 #define NESTEDCOMMENTS /* The Standard wants them .... */
177
178 #if defined(__WINS__) || defined(__EPOC32__)
179 # include "epoc32.h"
180 # define REXX_PATH_MAX MAXPATHLEN
181 #else
182 # ifndef REXX_PATH_MAX
183 # ifndef PATH_MAX
184 # ifndef _POSIX_PATH_MAX
185 # ifndef _MAX_PATH
186 # define REXX_PATH_MAX 1024
187 # else
188 # define REXX_PATH_MAX _MAX_PATH
189 # endif
190 # else
191 # define REXX_PATH_MAX _POSIX_PATH_MAX
192 # endif
193 # else
194 # define REXX_PATH_MAX PATH_MAX
195 # endif
196 # endif
197 #endif
198
199 #include "regina_c.h"
200
201 #define HEXVAL( c ) ( rx_isdigit(c) ? ( ( c ) - '0' ) : ( rx_tolower(c) - 'a' + 10 ) )
202
203 /*
204 * Which character is used to delimit lines in text files? Actually,
205 * this should have been a bit more general, since the use of LF as
206 * EOL-marker is a bit Unix-ish. We have to change this before porting
207 * to other platforms.
208 */
209 #define REGINA_CR (0x0d)
210 #if defined(MAC)
211 # define REGINA_EOL REGINA_CR
212 #else
213 # define REGINA_EOL (0x0a)
214 #endif
215
216 #define TRUE 1
217 #define FALSE 0
218
219 /* Things you probably don't want to change .... */
220
221 #include <stdlib.h>
222 #include <stdio.h>
223 #if defined(VMS) || defined(MAC)
224 # include <types.h>
225 #else
226 # include <sys/types.h>
227 #endif
228
229 #ifdef HAVE_SETJMP_H
230 # include <setjmp.h>
231 #endif
232
233 #if defined(TIME_WITH_SYS_TIME)
234 # include <sys/time.h>
235 # include <time.h>
236 #else
237 # if defined(HAVE_SYS_TIME_H)
238 # include <sys/time.h>
239 # else
240 # include <time.h>
241 # endif
242 #endif
243
244 #if defined(HAVE_FTIME)
245 # include <sys/timeb.h>
246 #endif
247
248 #if defined(HAVE_STRING_H)
249 # include <string.h>
250 #endif
251
252 #if defined(HAVE_SIGNAL_H)
253 # include <signal.h>
254 #endif
255
256 #if !defined(HAVE_RAISE)
257 # define raise(_s) kill(getpid(), (_s))
258 #endif
259
260 #if defined(WIN32) && defined(__BORLANDC__)
261 # include <mem.h>
262 #endif
263
264 #include "strengs.h" /* definitions of REXX strings */
265
266 #if defined(_MSC_VER) && !defined(__WINS__)
267 # include "contrib/time64.h"
268 #endif
269
270 #include "regina_t.h" /* various Regina types */
271
272 #include "mt.h" /* multi-threading support */
273 #include "extern.h" /* function prototypes */
274
275 #define FREE_IF_DEFINED(a,b) { if (b) Free_TSD(a,b); b=NULL ; }
276
277 #ifdef VMS /* F*ck DEC */
278 # ifdef EXIT_SUCCESS
279 # undef EXIT_SUCCESS
280 # endif
281 # define EXIT_SUCCESS 1
282 #endif
283
284 #ifdef HAVE_GETOPT_LONG
285 # include <getopt.h>
286 # define my_getopt_long getopt_long
287 # define my_getopt_option option
288 #endif
289
290 /* For some mysterious reason, this macro is very difficult for some vendors */
291 #ifndef EXIT_SUCCESS
292 # define EXIT_SUCCESS 0
293 #endif
294
295 #define STRIP_TRAILING 1
296 #define STRIP_LEADING 2
297 #define STRIP_BOTH (STRIP_TRAILING|STRIP_LEADING)
298
299 /* NOFUNC must be different from NULL and illegal, too */
300 #define NOFUNC ((streng *) (void *) -1l)
301
302 #if defined(MULTI_THREADED)
303 # ifdef __MINGW32__
304 # define REGINA_VERSION_THREAD "(MT MINGW)"
305 # else
306 # define REGINA_VERSION_THREAD "(MT)"
307 # endif
308 #else
309 # define REGINA_VERSION_THREAD ""
310 #endif
311
312 /*
313 #define REGINA_VERSION_MAJOR "3"
314 #define REGINA_VERSION_MINOR "4"
315 #define REGINA_VERSION_SUPP "beta1"
316 */
317
318 #define PARSE_VERSION_STRING "REXX-Regina_" REGINA_VERSION_MAJOR "." \
319 REGINA_VERSION_MINOR "." REGINA_VERSION_RELEASE REGINA_VERSION_SUPP \
320 REGINA_VERSION_THREAD \
321 " 5.00 " REGINA_VERSION_DATE
322
323 #define INSTORE_VERSION 10 /* Must be incremented each time the parser/lexer
324 * or data structure changes something.
325 */
326
327 #endif