-
Notifications
You must be signed in to change notification settings - Fork 91
/
js.h
226 lines (188 loc) · 6.47 KB
/
js.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* Copyright (c) 1990-2024, Jsoftware Inc. All rights reserved. */
/* Licensed use only. Any other use is in violation of copyright. */
/* */
/* SYS_ and friends */
// configuration - conditional compilation
// historical confusion that will slowly be sorted out
// complexity of autoconf et. al. seems overkill for J - we shall see
// C_? new style config - default value if not defined by builder
// #ifndef C_64 // 64/32 bits
// #define C_64 1
// #endif
// auto config C_64
#ifdef C_64
#undef C_64
#endif
#if defined(_WIN64)||defined(__LP64__)
#define C_64 1
#else
#define C_64 0
#endif
#ifndef C_LE // littleendian/bigendian
#define C_LE 1
#endif
/*
C_CD_?
cd ABI config for traditional J platorms done with SYS_? and SY_?
cd ABI config for new J platforms (raspberry pi, android, etc) done with C_CD_?
define one of the following in the build as required
-DC_CD_NODF
f result and f/d args gets 5 x error (rather than wrong result or crash when abi support not available)
-DC_CD_ARMHF
arm hardware float - result/args passed in float hardware - used by raspbian
-DC_CD_ARMEL
arm software float - result/args passed without using float hardware
*/
// auto config
#if defined(RASPI) && defined(__arm__)
#ifndef C_CD_ARMHF
#define C_CD_ARMHF
#endif
#endif
#if defined(ANDROID) && defined(__arm__)
#ifndef C_CD_ARMEL
#define C_CD_ARMEL
#endif
#endif
#if defined(_WIN32) && !defined(__MINGW32__)
#ifdef SY_GETTOD
#undef SY_GETTOD
#endif
#else
#ifndef SY_GETTOD
#define SY_GETTOD
#endif
#endif
/* Inclusion of a system herein does not necessarily mean that the source */
/* compiles or works under that system. */
#define SYS_AMIGA 1L /* DICE */
#define SYS_ARCHIMEDES 2L
#define SYS_ATARIST 4L /* GCC */
#define SYS_ATT3B1 8L /* System V C */
#define SYS_DEC5500 16L /* GCC */
#define SYS_IBMRS6000 32L /* AIX XL C */
#define SYS_MACINTOSH 64L /* Think C */
#define SYS_MIPS 128L /* GCC */
#define SYS_NEXT 256L /* GCC */
#define SYS_OS2 512L
#define SYS_PC 1024L /* Turbo C */
#define SYS_PCWIN 2048L /* Watcom C 386 */
#define SYS_PC386 4096L /* Watcom C 386 */
#define SYS_SGI 8192L /* GCC */
#define SYS_SUN3 16384L /* GCC */
#define SYS_SUN4 32768L /* GCC */
#define SYS_VAX 65536L /* GCC */
#define SYS_HPUX 131072L /* C89 */
#define SYS_LINUX 262144L /* GCC */
#define SYS_FREEBSD 524288L /* x86 only */
#define SYS_NETBSD 1048576L /* GCC */
#define SYS_SUNSOL2 2097152L /* GCC */
#define SYS_MACOSX 4194304L /* GCC (CC) */
#define SYS_OPENBSD 8388608L /* GCC */
#define SYS_WASM 16777216L /* clang */
#define SY_WIN32 0 /* any windows intel Visual Studio */
#define SY_WINCE 0 /* any windows ce versions */
#define SY_LINUX 0 /* any linux intel version */
#define SY_MAC 0 /* any macosx intel (once included ppc) */
#define SY_MACPPC 0 /* macosx powerpc */
#define SY_FREEBSD 0 /* any freebsd version */
#define SY_OPENBSD 0 /* any openbsd version */
#define SY_WASM 0 /* any wasm version */
#define SYS_DOS (SYS_PC + SYS_PC386 + SYS_PCWIN)
#define SYS_UNIX (SYS_ATT3B1 + SYS_DEC5500 + SYS_IBMRS6000 + \
SYS_MIPS + SYS_NEXT + SYS_SGI + SYS_SUN3 + \
SYS_SUN4 + SYS_VAX + SYS_LINUX + SYS_MACOSX + SYS_OPENBSD + SYS_WASM + \
SYS_FREEBSD + SYS_NETBSD + SYS_SUNSOL2 + SYS_HPUX)
#if defined(__FreeBSD__)
#define SYS SYS_FREEBSD
#undef SY_FREEBSD
#define SY_FREEBSD 1
#endif
#if defined(__NetBSD__)
#define SYS SYS_NETBSD
#endif
#if defined(__OpenBSD__)
#define SYS SYS_OPENBSD
#undef SY_OPENBSD
#define SY_OPENBSD 1
#endif
#if defined(__wasm__)
#define SYS SYS_WASM
#undef SY_WASM
#define SY_WASM 1
#endif
#if defined(sparc) && ! defined(__svr4__)
#define SYS SYS_SUN4
#endif
#if defined(sparc) && defined(__svr4__)
#define SYS SYS_SUNSOL2
#endif
#if defined(__sgi__)
#define SYS SYS_SGI
#endif
#if defined (_AIX)
#define SYS SYS_IBMRS6000
#endif
#ifdef __linux__
#define SYS SYS_LINUX
#undef SY_LINUX
#define SY_LINUX 1
#endif
#if defined _PA_RISC1_1
#define SYS SYS_HPUX
#endif
#ifdef __MACH__
#ifdef __ppc__
#ifdef __GNUC__
#define SYS SYS_MACOSX // powerpc
#undef SY_MAC
#define SY_MAC 1
#undef SY_MACPPC
#def SY_MACPPC 1
#endif
#endif
#endif
#ifdef __MACH__
#ifndef __ppc__
#ifdef __GNUC__
#define SYS SYS_MACOSX // intel
#undef SY_MAC
#define SY_MAC 1
#endif
#endif
#endif
#ifdef _WIN32
#define SYS SYS_PCWIN
#undef SY_WIN32
#define SY_WIN32 1
#endif
#ifdef UNDER_CE
#undef SY_WINCE
#define SY_WINCE 1
#endif
// SY_ALIGN 1 for compilers requiring strict alignment
// e.g. if (I*)av is not allowed for arbitrary av of type C*
#define SY_ALIGN 1 // always use 1 so all use same code; required by nvr stack in parser
/* Windows CE target autoconfiguration: */
#if SY_WINCE
#ifdef SH3
#define SY_WINCE_SH 1
#else
#define SY_WINCE_SH 0
#endif
#ifdef MIPS
#define SY_WINCE_MIPS 1
#else
#define SY_WINCE_MIPS 0
#endif
#ifdef ARM
#define SY_WINCE_ARM 1
#else
#define SY_WINCE_ARM 0
#endif
#endif
#ifndef SYS /* must be defined */
error: "SYS must be defined"
#endif
// map C_?? config to old stuff until it is no longer necessary
#define SY_64 C_64 // eventually replace SY_64 with C_64