Imported Upstream version 0.2.0+beta
[debian/yforth] / config.h
1 /* yForth? - A Forth interpreter written in ANSI C
2  * Copyright (C) 2012 Luca Padovani
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  * ------------------------------------------------------------------------
17  * Module name:     config.h
18  * Abstract:        configuration file. Before any compilation please check
19  *                  that actual configuration is consistent with your
20  *                  hardware AND your compiler.
21  */
22
23 /* module definition: 1 indicates that a module should be included in the
24  * base vocabulary, 0 excludes a module. Note however that some words in
25  * excluded word lists may be linked to final code if used by other words.
26  */
27
28 #include <endian.h>
29
30 #define COREE_DEF           1L
31 #define DOUBLE_DEF          1L
32 #define DOUBLEE_DEF         1L
33 #define FLOAT_DEF           1L
34 #define FLOATE_DEF          1L
35 #define MEMALL_DEF          1L
36 #define MEMALLE_DEF         0L
37 #define SEARCH_DEF          1L
38 #define SEARCHE_DEF         1L
39 #define TOOLS_DEF           1L
40 #define TOOLSE_DEF          1L
41 #define LOCALS_DEF          1L
42 #define LOCALSE_DEF         1L
43 #define FACILITY_DEF        1L
44 #define FACILITYE_DEF       0L
45 #define BLOCK_DEF           1L
46 #define BLOCKE_DEF          1L
47 #define EXCEPTION_DEF       1L
48 #define EXCEPTIONE_DEF      0L
49 #define FILE_DEF            1L
50 #define FILEE_DEF           1L
51 #define STRING_DEF          1L
52 #define STRINGE_DEF         0L
53
54 #define VERSION_PATTERN     (COREE_DEF | (DOUBLE_DEF << 1) |\
55                                                          (DOUBLEE_DEF << 2) | (FLOAT_DEF << 3) |\
56                              (FLOATE_DEF << 4) | (MEMALL_DEF << 5) |\
57                              (MEMALLE_DEF << 6) | (SEARCH_DEF << 7) |\
58                              (SEARCHE_DEF << 8) | (TOOLS_DEF << 9) |\
59                              (TOOLSE_DEF << 10) | (LOCALS_DEF << 11) |\
60                              (LOCALSE_DEF << 12) | (FACILITY_DEF << 13) |\
61                              (FACILITYE_DEF << 14) | (BLOCK_DEF << 15) |\
62                              (BLOCKE_DEF << 16) | (EXCEPTION_DEF << 17) |\
63                              (EXCEPTIONE_DEF << 18) | (FILE_DEF << 19) |\
64                              (FILEE_DEF << 20) | (STRING_DEF << 21) |\
65                              (STRINGE_DEF << 22)\
66                             )
67
68 /************************************************************************/
69 /* compilation and machine dependent definitions                        */
70 /************************************************************************/
71
72 /* Define LITTLE_ENDIAN if you machine is little-endian (e.g. Intel), undefine
73  * it if your machine is big-endian (e.g. Motorola, Sparc...)
74  * Note that some compilers have LITTLE_ENDIAN yet defined.
75  */
76 #ifndef LITTLE_ENDIAN
77 # if __BYTE_ORDER == __LITTLE_ENDIAN
78 #       define LITTLE_ENDIAN
79 # else
80 #       undef  LITTLE_ENDIAN
81 # endif
82 #endif
83
84 /* When DCELL_MEM is defined, double cell transfer is realized by memory
85  * copy, if not defined shift and logical operators are used to combine
86  * or isolate cell values
87  */
88 #define DCELL_MEM
89  
90 /* DATA TYPES: please modify this list accordingly to your system. Note that
91  * sizeof(DCell) == 2 * sizeof(Cell) MUST BE satisfied.
92  * For example, using Borland C for DOS Cell may be "int" and DCell "long int".
93  * Under Linux, Cell may be "int" and DCell "long long".
94  */
95
96 /* this might work for other 64 bit architectures, too? */
97 #if defined(__alpha__)
98 # define Cell                           long
99 #else
100 # define Cell                           int
101 #endif /* __alpha__ */
102
103 #define Char                            char
104 #define Real                            float
105
106 #define UCell                           unsigned Cell
107 #define DCell               long long
108 #define UDCell                          unsigned DCell
109 #define UChar                           unsigned Char
110
111 #define CellBits            (sizeof(Cell) * 8)
112 #define CellLog             (sizeof(Cell) - 1)
113 #define RealLog                         (sizeof(Real) - 1)
114
115 #define FFLAG(n)            (-(n))
116
117 /* Please modify this definitions accordingly with your data types */
118
119 #define MAX_CHAR                        UCHAR_MAX
120 #define MAX_D                           LONG_MAX
121 #define MAX_N                           INT_MAX
122 #define MAX_U                           UINT_MAX
123 #define MAX_UD                          ULONG_MAX
124 #define MAX_F                           0.0
125
126 /* Some compilers doesn't provide some functions in the standard library.
127  * If you don't have, turn 1s into 0s 
128  */
129 #define HAVE_ACOSH                      1
130 #define HAVE_ASINH                      1
131 #define HAVE_ATANH                      1
132
133 /* Set following define to 1 if you're compiling under Turbo C, Borland C,
134  * or GCC for DOS.
135  */
136 #define HAVE_CONIO                      0