Fetch Flex from Sourceforge.
[AROS-Contrib.git] / regina / rexx.h
blob31d57994f38f7cf685e1a5ef1e1132cf2be43367
1 /*
2 * The Regina Rexx Interpreter
3 * Copyright (C) 1992-1994 Anders Christensen <anders@pvv.unit.no>
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.
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.
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.
21 * $Id$
23 #ifndef __REXX_H_INCLUDED
24 #define __REXX_H_INCLUDED
26 #include "wrappers.h"
28 /* Things you might want to change .... (at your own risk!!!) */
31 * define NOFLISTS if you DON'T want to use the internal memory
32 * allocation functions. By not using FLISTS, execution speed is reduced
33 * by some 50%. The use of NOFLISTS is useful for bounds checking
34 * features of some compilers, but should be avoided for general use.
36 * It is available under Unix by using the --disable-flists switch
37 * in autoconf script.
38 * NOFLISTS can be be set on other ports by using FLISTS=N on the
39 * 'make' command.
41 #ifndef NOFLISTS
42 # define FLISTS
43 #endif
46 * define TRACEMEM to use tracing of dynamically allocated memory. This
47 * is only useful when debugging memory management of the interpreter.
48 * Some conditions must be fullfilled when using this (see memory.c).
50 * TRACEMEM is a subset of the debugging functionality. It is
51 * available under Unix by using the --enable-tracemem switch
52 * in autoconf script.
53 * TRACEMEM can be be set on other ports by using TRACMEM=Y on the
54 * 'make' command (you MUST also specify DEBUG=Y).
56 #ifdef NDEBUG
57 # ifdef TRACEMEM
58 # undef TRACEMEM
59 # endif
60 #endif
63 #ifdef CHECK_MEMORY /* Don't allow manual setting! */
64 # undef CHECK_MEMORY
65 #endif
66 #if defined(__GNUC__) && (defined(__BOUNDS_CHECKING_ON) || defined(__CHECKER__))
68 * Automatically define CHECK_MEMORY in case of GNU's bound checking
69 * methods. Undef other memory checker settings since they are useless
70 * in this case.
72 # define CHECK_MEMORY
73 # ifdef FLISTS
74 # undef FLISTS
75 # endif
76 # ifdef TRACEMEM
77 # undef TRACEMEM
78 # endif
79 #endif
83 * define PATTERN_MEMORY to initiate newly allocated dynamic memory to
84 * a particular value, and freed memory to be set to another value
85 * before it is freed. Useful for debugging only.
87 #define PATTERN_MEMORY
89 #if defined(__SASC)
90 # define REG_FAR __far
91 #else
92 # define REG_FAR
93 #endif
95 #include "defs.h"
96 #if defined(HAVE_CONFIG_H)
97 # include "config.h"
98 #endif
99 #include "configur.h"
101 #ifdef HAVE_LIMITS_H
102 # include <limits.h>
103 #endif
105 #define MAXNUMERIC 64 /* Max setting for NUMERIC DIGITS */
106 /* #define REXXDEBUG */ /* You probably don't want this ... :-) */
108 /* #define HAVE_STRMATH */ /* Do we have *real* REXX string math ? */
109 /* #define HAVE_MPMATH */ /* Do we have C ``mp'' math */
110 #define HAVE_CMATH /* Do we have std. C math calls ? */
111 #define MATH_TYPES 1 /* How many different types available */
113 #define LINELENGTH 1024 /* max linelength of source code */
114 /* #define STACKSIZE 400 not used ? */ /* Was 256, then 512 (too much) */
115 #define BUFFERSIZE 1024 /* Was 512 */ /* Size of input buffer, longest line */
116 #define LOOKAHEAD 256 /* Size of input lookahead */
118 #define SMALLSTR 5 /* For holding small integers */
119 #define NULL_STR_LENGTH 1
120 #define BOOL_STR_LENGTH 2
122 #define DEFAULT_TRACING 'N'
123 #define DEFAULT_INT_TRACING 0
124 #define DEFAULT_NUMFORM NUM_FORM_SCI
125 #define DEFAULT_ENVIRONMENT ENV_SYSTEM
126 #define NESTEDCOMMENTS /* The Standard wants them .... */
128 #if defined(__WINS__) || defined(__EPOC32__)
129 # include "epoc32.h"
130 # define REXX_PATH_MAX MAXPATHLEN
131 #else
132 # ifndef REXX_PATH_MAX
133 # ifndef PATH_MAX
134 # ifndef _POSIX_PATH_MAX
135 # ifndef _MAX_PATH
136 # define REXX_PATH_MAX 1024
137 # else
138 # define REXX_PATH_MAX _MAX_PATH
139 # endif
140 # else
141 # define REXX_PATH_MAX _POSIX_PATH_MAX
142 # endif
143 # else
144 # define REXX_PATH_MAX PATH_MAX
145 # endif
146 # endif
147 #endif
149 /* The following have been included to support national languages. */
150 /* English has a small set of letters. In the ASCII alphabet the */
151 /* English uppercase letters occupy the range from d2c(65) to d2c(90) */
152 /* and the lowercase version of each letter have an offset of +32 */
153 /* from the corresponding uppercase letter. */
154 /* */
155 /* You may define FIRST_CHAR and LAST_CHAR to the lowermost and the */
156 /* uppermost letters of the uppercase alphabet. And you may define */
157 /* CHAR_OFFSET as the difference between upper- and lowercase. */
158 /* other Western European languages */
160 #define FIRST_CHAR 'A'
161 #define LAST_CHAR 'Z'
162 #define CHAR_OFFSET 32
164 #define HEXNUM(c) (((c>='0')&&(c<='9'))||((c>='a')&&(c<='f')))
165 #define HEXVAL(c) (((c)>'9')?(RXTOLOW(c)-'a'+10):((c)-'0'))
168 * Which character is used to delimit lines in text files? Actually,
169 * this should have been a bit more general, since the use of LF as
170 * EOL-marker is a bit Unix-ish. We have to change this before porting
171 * to other platforms.
173 #define REGINA_CR (0x0d)
174 #if defined(MAC)
175 # define REGINA_EOL REGINA_CR
176 #else
177 # define REGINA_EOL (0x0a)
178 #endif
180 #ifndef TRUE
181 #define TRUE 1
182 #endif
183 #ifndef FALSE
184 #define FALSE 0
185 #endif
187 /* Things you probably don't want to change .... */
189 #include <stdlib.h>
190 #include <stdio.h>
191 #if defined(VMS) || defined(MAC)
192 # include <types.h>
193 #else
194 # include <sys/types.h>
195 #endif
197 #ifdef HAVE_SETJMP_H
198 # include <setjmp.h>
199 #endif
201 #if defined(TIME_WITH_SYS_TIME)
202 # include <sys/time.h>
203 # include <time.h>
204 #else
205 # if defined(HAVE_SYS_TIME_H)
206 # include <sys/time.h>
207 # else
208 # include <time.h>
209 # endif
210 #endif
212 #if defined(HAVE_FTIME)
213 # include <sys/timeb.h>
214 #endif
216 #if defined(HAVE_STRING_H)
217 # include <string.h>
218 #endif
220 #if defined(WIN32) && defined(__BORLANDC__)
221 # include <mem.h>
222 #endif
223 #include "strings.h" /* definitions of REXX strings */
224 #include "types.h" /* various types */
225 #include "mt.h" /* multi-threading support */
226 #include "extern.h" /* function prototypes */
228 #define FREE_IF_DEFINED(a) { if (a) Free(a); a=NULL ; }
230 #ifdef VMS /* F*ck DEC */
231 # ifdef EXIT_SUCCESS
232 # undef EXIT_SUCCESS
233 # endif
234 # define EXIT_SUCCESS 1
235 #endif
237 /* For some mysterious reason, this macro is very difficult for some vendors */
238 #ifndef EXIT_SUCCESS
239 # define EXIT_SUCCESS 0
240 #endif
242 #define STRIP_TRAILING 1
243 #define STRIP_LEADING 2
244 #define STRIP_BOTH (STRIP_TRAILING|STRIP_LEADING)
246 /* NOFUNC must be different from NULL and illegal, too */
247 #define NOFUNC ((streng *) (void *) -1l)
249 #if defined(MULTI_THREADED)
250 # define REGINA_VERSION_THREAD "(MT)"
251 #else
252 # define REGINA_VERSION_THREAD ""
253 #endif
255 #define REGINA_VERSION_MAJOR "3"
256 #define REGINA_VERSION_MINOR "0"
258 #define PARSE_VERSION_STRING "REXX-Regina_" REGINA_VERSION_MAJOR "." \
259 REGINA_VERSION_MINOR REGINA_VERSION_THREAD \
260 " 4.95 25 Apr 2002"
262 #define INSTORE_VERSION 3 /* Must be incremented each time the parser/lexer
263 * or data structure changes something.
266 #endif