1 /*
2 **	ficllocal.h
3 **
4 ** Put all local settings here.  This file will always ship empty.
5 **
6 */
7 /*
8 ** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu)
9 ** All rights reserved.
10 **
11 ** Get the latest Ficl release at http://ficl.sourceforge.net
12 **
13 ** I am interested in hearing from anyone who uses Ficl. If you have
14 ** a problem, a success story, a defect, an enhancement request, or
15 ** if you would like to contribute to the Ficl release, please
16 ** contact me by email at the address above.
17 **
18 ** L I C E N S E  and  D I S C L A I M E R
19 **
20 ** Redistribution and use in source and binary forms, with or without
21 ** modification, are permitted provided that the following conditions
22 ** are met:
23 ** 1. Redistributions of source code must retain the above copyright
24 **    notice, this list of conditions and the following disclaimer.
25 ** 2. Redistributions in binary form must reproduce the above copyright
26 **    notice, this list of conditions and the following disclaimer in the
27 **    documentation and/or other materials provided with the distribution.
28 **
29 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
30 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 ** ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
33 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 ** SUCH DAMAGE.
40 */
41 
42 /*-
43  * Adapted to work with FTH
44  *
45  * Copyright (c) 2004-2019 Michael Scholz <mi-scholz@users.sourceforge.net>
46  * All rights reserved.
47  *
48  * Redistribution and use in source and binary forms, with or without
49  * modification, are permitted provided that the following conditions
50  * are met:
51  * 1. Redistributions of source code must retain the above copyright
52  *    notice, this list of conditions and the following disclaimer.
53  * 2. Redistributions in binary form must reproduce the above copyright
54  *    notice, this list of conditions and the following disclaimer in the
55  *    documentation and/or other materials provided with the distribution.
56  *
57  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
58  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
61  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
63  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
65  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67  * SUCH DAMAGE.
68  *
69  * @(#)ficllocal.h	1.72 11/18/19
70  */
71 
72 #if !defined(_FICLLOCAL_H_)
73 #define _FICLLOCAL_H_
74 
75 #include "fth-config.h"
76 
77 typedef char	ficlInteger8;
78 typedef unsigned char ficlUnsigned8;
79 typedef short	ficlInteger16;
80 typedef unsigned short ficlUnsigned16;
81 typedef int	ficlInteger32;
82 typedef unsigned int ficlUnsigned32;
83 #if (FTH_SIZEOF_LONG == 4)
84 typedef long long ficlInteger64;
85 typedef unsigned long long ficlUnsigned64;
86 #else
87 typedef long	ficlInteger64;
88 typedef unsigned long ficlUnsigned64;
89 #endif
90 
91 /* It's not a pointer but the base for type FTH. */
92 #if (FTH_SIZEOF_LONG == FTH_SIZEOF_VOID_P)
93 typedef unsigned long ficlPointer;
94 typedef long	ficlSignedPointer;
95 #elif (FTH_SIZEOF_LONG_LONG == FTH_SIZEOF_VOID_P)
96 typedef unsigned long long ficlPointer;
97 typedef long long ficlSignedPointer;
98 #else
99 #error *** FTH requires sizeof(void*) == (sizeof(long) || sizeof(long long))
100 #endif
101 
102 typedef long ficlInteger;
103 typedef unsigned long ficlUnsigned;
104 typedef long long ficl2Integer;
105 typedef unsigned long long ficl2Unsigned;
106 /*
107  * XXX: typedef ficlInteger64 ficl2Integer;
108  *	typedef ficlUnsigned64 ficl2Unsigned;
109  */
110 typedef double ficlFloat;
111 typedef ficlPointer FTH;
112 typedef ficlSignedPointer SIGNED_FTH;
113 
114 #if defined(lint)
115 /* numbers.c */
116 #undef HAVE_COMPLEX_H
117 #undef HAVE_COMPLEX_I
118 #undef HAVE_1_0_FI
119 #endif
120 
121 #if defined(HAVE_COMPLEX_H)
122 #include <complex.h>
123 #endif
124 
125 #if defined(HAVE_1_0_FI)
126 #define HAVE_COMPLEX	1
127 /*
128  * Minix doesn't have complex.h.
129  * With gcc Minix provides 1.0fi, cimag(), and creal().
130  */
131 #if !defined(HAVE_COMPLEX_I)
132 /* snippet from /usr/include/complex.h */
133 #if defined(__GNUC__)
134 #if __STDC_VERSION__ < 199901
135 #define	_Complex	__complex__
136 #endif
137 #define	_Complex_I	1.0fi
138 #endif /* __GNUC__ */
139 
140 #define	complex		_Complex
141 #define	I		_Complex_I
142 
143 double		cimag(double complex);
144 double		creal(double complex);
145 /* end /usr/include/complex.h */
146 #endif /* !HAVE_COMPLEX_I */
147 #else				/* !HAVE_1_0_FI */
148 #define HAVE_COMPLEX	0
149 #endif				/* HAVE_1_0_FI */
150 
151 #if HAVE_COMPLEX
152 typedef complex double ficlComplex;
153 #endif
154 
155 /*
156  * Author: Paulo Cesar Pereira de Andrade
157  *	from xedit/lisp/mp
158  */
159 #include <mp.h>
160 typedef mpi * ficlBignum;
161 typedef mpr * ficlRatio;
162 
163 #if !defined(true)
164 #define false 		0
165 #define true 		1
166 #endif
167 
168 #define FICL_FORTH_NAME			FTH_PACKAGE_TARNAME
169 #define FICL_FORTH_VERSION		FTH_PACKAGE_VERSION
170 #define FICL_PLATFORM_BASIC_TYPES	1
171 #define FICL_DEFAULT_DICTIONARY_SIZE	(1024 * 1024)
172 #define FICL_DEFAULT_STACK_SIZE		(1024 * 8)
173 #define FICL_DEFAULT_RETURN_SIZE	1024
174 #define FICL_DEFAULT_ENVIRONMENT_SIZE	(1024 * 8)
175 #define FICL_MIN_DICTIONARY_SIZE	(1024 * 512)
176 #define FICL_MIN_STACK_SIZE		512
177 #define FICL_MIN_RETURN_SIZE		512
178 #define FICL_MIN_ENVIRONMENT_SIZE	(1024 * 4)
179 #define FICL_MAX_LOCALS			2048
180 #define FICL_MAX_WORDLISTS		32
181 #define FICL_MAX_PARSE_STEPS		16
182 #define FICL_PAD_SIZE			1024
183 #define FICL_NAME_LENGTH		256
184 #define FICL_HASH_SIZE			241
185 #define FICL_USER_CELLS			1024
186 #define FICL_PLATFORM_ALIGNMENT		FTH_ALIGNOF_VOID_P
187 #define FICL_PLATFORM_EXTERN		/* empty */
188 
189 #define FICL_PRIMITIVE_SET(Dict, Name, Code, Type)			\
190 	ficlDictionaryAppendPrimitive(Dict, Name, Code, (ficlUnsigned)(Type))
191 
192 #define FICL_PRIM(Dict, Name, Code)					\
193 	FICL_PRIMITIVE_SET(Dict, Name, Code, FICL_WORD_DEFAULT)
194 
195 #define FICL_PRIM_IM(Dict, Name, Code)					\
196 	FICL_PRIMITIVE_SET(Dict, Name, Code, FICL_WORD_IMMEDIATE)
197 
198 #define FICL_PRIM_CO(Dict, Name, Code)					\
199 	FICL_PRIMITIVE_SET(Dict, Name, Code, FICL_WORD_COMPILE_ONLY)
200 
201 #define FICL_PRIM_CO_IM(Dict, Name, Code)				\
202 	FICL_PRIMITIVE_SET(Dict, Name, Code, FICL_WORD_COMPILE_ONLY_IMMEDIATE)
203 
204 #define FICL_PRIMITIVE_DOC_SET(Dict, Name, Code, Type, Docs) do {	\
205 	ficlWord *word;							\
206 									\
207 	word = ficlDictionaryAppendPrimitive(Dict, Name, Code,		\
208 	    (ficlUnsigned)(Type));					\
209 									\
210 	fth_word_doc_set(word, Docs);					\
211 } while (0)
212 
213 #define FICL_PRIM_DOC(Dict, Name, Code)					\
214 	FICL_PRIMITIVE_DOC_SET(Dict, Name, Code,			\
215 	    FICL_WORD_DEFAULT, h_ ## Code)
216 #define FICL_PRIM_IM_DOC(Dict, Name, Code)				\
217 	FICL_PRIMITIVE_DOC_SET(Dict, Name, Code,			\
218 	    FICL_WORD_IMMEDIATE, h_ ## Code)
219 #define FICL_PRIM_CO_DOC(Dict, Name, Code)				\
220 	FICL_PRIMITIVE_DOC_SET(Dict, Name, Code,			\
221 	    FICL_WORD_COMPILE_ONLY, h_ ## Code)
222 #define FICL_PRIM_CO_IM_DOC(Dict, Name, Code)				\
223 	FICL_PRIMITIVE_DOC_SET(Dict, Name, Code,			\
224 	    FICL_WORD_COMPILE_ONLY_IMMEDIATE, h_ ## Code)
225 
226 #endif				/* _FICLLOCAL_H_ */
227 
228 /* ficllocal.h ends here */
229