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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
|
/* SCHEME->C */
/* Copyright 1989-1993 Digital Equipment Corporation
* All Rights Reserved
*
* Permission to use, copy, and modify this software and its documentation is
* hereby granted only under the following terms and conditions. Both the
* above copyright notice and this permission notice must appear in all copies
* of the software, derivative works or modified versions, and any portions
* thereof, and both notices must appear in supporting documentation.
*
* Users of this software agree to the terms and conditions set forth herein,
* and hereby grant back to Digital a non-exclusive, unrestricted, royalty-free
* right and license under any changes, enhancements or extensions made to the
* core functions of the software, including but not limited to those affording
* compatibility with other hardware or software environments, but excluding
* applications which incorporate this software. Users further agree to use
* their best efforts to return to Digital any such changes, enhancements or
* extensions that they make and inform Digital of noteworthy uses of this
* software. Correspondence should be provided to Digital at:
*
* Director of Licensing
* Western Research Laboratory
* Digital Equipment Corporation
* 250 University Avenue
* Palo Alto, California 94301
*
* This software may be distributed (but not offered for sale or transferred
* for compensation) to third parties, provided such third parties agree to
* abide by the terms and conditions of this notice.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/* This file defines compilation options for a specific implementation */
#define CHECKSTACK 1 /* 0 = don't check stack height */
/* 1 = check stack height */
#define TIMESLICE 0 /* 0 = don't time slice execution */
/* 1 = time slice execution */
#define COMPACTPUSHTRACE 0 /* 0 = inline procedure entry checks.
1 = emit procedure call for procedure
entry checks.
*/
#define COMPACTPOPTRACE 0 /* 0 = inline procedure exit cleanup.
1 = emit procedure call for procedure exit
cleanup.
*/
#define S2CSIGNALS 1 /* 0 = Scheme->C doesn't handle signals */
/* 1 = Scheme->C does handle signals */
#define MATHTRAPS 0 /* 0 = don't detect fixed point overflow */
/* 1 = recover on fixed point overflow */
/* Define only one of the supported processor types:
AOSF Alpha AXP OSF/1
HP700 HP 9000/700
MAC Macintosh system 7.1 with Think-C 5.0
MC680X0 HP 9000/300, Sun 3, Next
MIPS DECstation, SGI, Sony News
VAX Vax ULTRIX
FREEBSD x86 FreeBSD
WIN16 Microsoft Windows 3.1
*/
#define FREEBSD 1
/* Attributes of the selected architecture:
The following four macros define specific aspects of the system. They
are defined as strings, or specifically undefined:
IMPLEMENTATION_MACHINE machine type
IMPLEMENTATION_CPU cpu type
IMPLEMENTATION_OS operating system
IMPLEMENTATION_FS file system
Big endian vs. little endian:
BIGENDIAN defined to 1 to denote bigendian systems
C compiler:
OLD_FASHIONED_C defined to 1 for pre-ANSI compilers
Alignment:
DOUBLE_ALIGN defined to 1 to force doubles to be aligned on
an even S2CINT boundary
Macro expansion:
NEED_MACRO_ARGS defined to 1 to declare a macro like X() as
X(dummy)
The types S2CINT and S2CUINT are defined to be signed and unsigned integers
that are the same size as pointers. This is the basic "word" used by
Scheme->C.
The machine state when a continuation is created is captured in the
sc_jmp_buf data structure.
STACKPTR( x ) is a define that stores the address of the stack pointer
in x.
Unix flavors:
POSIX POSIX.1 compliant
SYSV System V or derivative
SYSV4 System V release 4 (also define SYSV, POSIX)
*/
/**************/
/* AOSF */
/**************/
#ifdef AOSF
#define IMPLEMENTATION_MACHINE "Alpha AXP"
#undef IMPLEMENTATION_CPU
#define IMPLEMENTATION_OS "OSF/1"
#undef IMPLEMENTATION_FS
typedef long int S2CINT; /* Signed pointer size integer */
typedef long unsigned S2CUINT; /* Unsigned pointer size interger */
typedef int PAGELINK; /* 32-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffffffffffffL /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x8000000000000000L /* S2CUINT with 1 in the MSB */
typedef long int sc_jmp_buf[ 9 ]; /* The buffer contains the following items:
s0-s6 saved registers
ra return address
sp stack pointer
*/
#define STACKPTR( x ) x = sc_getsp()
extern S2CINT* sc_getsp();
#define NEED_MACRO_ARGS 1
#endif
/***************/
/* HP700 */
/***************/
#ifdef HP700
#ifdef __hp9000s700
#define IMPLEMENTATION_MACHINE "HP9000/700"
#else
#ifdef __hp9000s800
#define IMPLEMENTATION_MACHINE "HP9000/800"
#endif
#endif
#define IMPLEMENTATION_CPU "HP-PA"
#define BIGENDIAN 1
#define DOUBLE_ALIGN 1
typedef int S2CINT; /* Signed pointer size integer */
typedef unsigned S2CUINT; /* Unsigned pointer size interger */
typedef int PAGELINK; /* 32-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */
#define STACKPTR(x) ((x) = (sc_processor_register (30)))
#define STACK_GROWS_POSITIVE 1
#endif
#ifdef __hpux
#define IMPLEMENTATION_OS "HP-UX"
#undef IMPLEMENTATION_FS
#ifdef __STDC__
#undef OLD_FASHIONED_C
#else
#define OLD_FASHIONED_C 1
#endif
#include <setjmp.h>
typedef jmp_buf sc_jmp_buf;
#define SYSV 1
#define POSIX 1
#endif
/*************/
/* MAC */
/*************/
#ifdef MAC
#define IMPLEMENTATION_MACHINE "Apple Macintosh"
#define IMPLEMENTATION_CPU "680x0"
#define IMPLEMENTATION_OS "7.1"
#undef IMPLEMENTATION_FS
#define BIGENDIAN 1
typedef long int S2CINT; /* Signed pointer size integer */
typedef long unsigned S2CUINT; /* Unsigned pointer size interger */
typedef short int PAGELINK; /* 16-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffffL /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x80000000L /* S2CUINT with 1 in the MSB */
#include <setjmp.h>
typedef jmp_buf sc_jmp_buf;
#undef TRUE
#undef FALSE
#define STACKPTR( x ) x = sc_getsp()
extern S2CINT* sc_getsp();
#define SCHEAP 1
#define SCMAXHEAP 15
#endif
/****************/
/* MC680X0 */
/****************/
#ifdef MC680X0
#define IMPLEMENTATION_CPU "680x0"
#define BIGENDIAN 1
typedef int S2CINT; /* Signed pointer size integer */
typedef unsigned S2CUINT; /* Unsigned pointer size interger */
typedef int PAGELINK; /* 32-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */
#define STACKPTR(x) ((x) = (sc_processor_register (15)))
#ifdef __hp9000s400
#define IMPLEMENTATION_MACHINE "HP9000/400"
#else
#ifdef __hp9000s300
#define IMPLEMENTATION_MACHINE "HP9000/300"
#endif
#endif
/* HP-UX dependent conditionalizations performed above. */
#endif
/**************/
/* MIPS */
/**************/
#ifdef MIPS
#define IMPLEMENTATION_MACHINE "DECstation"
#define IMPLEMENTATION_CPU "Rx000"
#define IMPLEMENTATION_OS "ULTRIX"
#undef IMPLEMENTATION_FS
#define DOUBLE_ALIGN 1
typedef int S2CINT; /* Signed pointer size integer */
typedef unsigned S2CUINT; /* Unsigned pointer size interger */
typedef int PAGELINK; /* 32-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */
#ifndef MIPSEL
#define BIGMIPS 1
#define BIGENDIAN 1
#undef IMPLEMENTATION_MACHINE
#define IMPLEMENTATION_MACHINE "Big Endian MIPS"
#undef IMPLEMENTATION_OS
/* Not sure what the correct conditionalization is here -- NEWS-OS
5.xx defines both "sony" and "sonyrisc", but apparently NEWS-OS
4.xx defines "sony_mips", because the previous version of Scheme->C
was conditionalized on "sony_mips" which is *not* defined by
NEWS-OS 5.xx. If there's an intersection between the symbols
defined by 4.xx and 5.xx then a member of that intersection should
be used for the conditionalization; otherwise test for both.
*/
#ifdef sonyrisc
#undef IMPLEMENTATION_MACHINE
#define IMPLEMENTATION_MACHINE "Sony MIPS"
#undef IMPLEMENTATION_CPU
#define IMPLEMENTATION_CPU "R3000"
#undef IMPLEMENTATION_OS
#define IMPLEMENTATION_OS "NEWS-OS"
#ifdef SYSTYPE_SYSV
#define SYSV4 1
#define SYSV 1
#define POSIX 1
/* This can be implemented but requires generalizing the signal
handler to know about SYSV4 siginfo structure.
*/
#undef MATHTRAPS
#define MATHTRAPS 0
#define NEED_MACRO_ARGS 1
#define COPY_STACK_BEFORE_LONGJMP 1
#endif
#endif
#endif
#include <setjmp.h>
typedef jmp_buf sc_jmp_buf;
#define STACKPTR( x ) x = sc_processor_register( 29 )
#endif
/*************/
/* VAX */
/*************/
#ifdef VAX
#define IMPLEMENTATION_MACHINE "VAX"
#undef IMPLEMENTATION_CPU
#define IMPLEMENTATION_OS "ULTRIX"
#undef IMPLEMENTATION_FS
#define OLD_FASHIONED_C 1
typedef int S2CINT; /* Signed pointer size integer */
typedef unsigned S2CUINT; /* Unsigned pointer size interger */
typedef int PAGELINK; /* 32-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */
typedef int sc_jmp_buf[ 16 ]; /* The buffer contains the following items:
R2-R11 saved registers
SIGM saved signal mask
SP stack pointer on entry to
setjmp
PSW PSW word from stack frame
AP saved argument ptr from frame
FP saved frame ptr from frame
PC saved program cntr from frame
*/
#define STACKPTR( x ) x = sc_processor_register( 14 )
#endif
/***************/
/* FREEBSD */
/***************/
#ifdef FREEBSD
#define IMPLEMENTATION_MACHINE "Generic PC"
#define IMPLEMENTATION_CPU "Intelx86"
#define IMPLEMENTATION_OS "FreeBSD"
#undef IMPLEMENTATION_FS
typedef int S2CINT; /* Signed pointer size integer */
typedef unsigned S2CUINT; /* Unsigned pointer size interger */
typedef int PAGELINK; /* 32-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */
#define STACKPTR( x ) x = sc_processor_register( 0 )
#include <setjmp.h>
typedef jmp_buf sc_jmp_buf;
/* Horrid kludge. See callcc.c for the full story: */
#define LAZY_STACK_POP 1
#define LAZY_STACK_INCREMENT 4
#endif
/***************/
/* WIN16 */
/***************/
#ifdef WIN16
#define IMPLEMENTATION_MACHINE "Generic PC"
#define IMPLEMENTATION_CPU "Intelx86"
#define IMPLEMENTATION_OS "Microsoft Windows 3.1"
#undef IMPLEMENTATION_FS
typedef long int S2CINT; /* Signed pointer size integer */
typedef long unsigned S2CUINT; /* Unsigned pointer size interger */
typedef short int PAGELINK; /* 16-bit sc_pagelink values */
#define MAXS2CINT 0x7fffffffL /* Maximum value of an S2CINT */
#define MSBS2CUINT 0x80000000L /* S2CUINT with 1 in the MSB */
#include <windows.h>
#undef TRUE
#undef FALSE
typedef CATCHBUF sc_jmp_buf;
#define STACKPTR( x ) x = sc_processor_register( 0 )
#define MAXSTRINGSIZE ((S2CINT)65532)
#define MAXVECTORSIZE ((S2CINT)16383)
#define SCHEAP 2
#define SCMAXHEAP 15
#endif
|