1 /* -*-C-*-
2 
3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
4     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Massachusetts
6     Institute of Technology
7 
8 This file is part of MIT/GNU Scheme.
9 
10 MIT/GNU Scheme is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or (at
13 your option) any later version.
14 
15 MIT/GNU Scheme is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with MIT/GNU Scheme; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
23 USA.
24 
25 */
26 
27 /* Named constants used throughout the interpreter */
28 
29 #define PI 3.1415926535
30 
31 /* Assorted sizes used in various places */
32 
33 /* Maximum # of chars in a file name.  */
34 #ifdef MAXPATHLEN
35 #  define FILE_NAME_LENGTH MAXPATHLEN
36 #else
37 #  define FILE_NAME_LENGTH 1024
38 #endif
39 
40 /* Interning hash table */
41 #define OBARRAY_SIZE 32771
42 
43 /* Cells between constant and stack before overflow occurs.  */
44 #ifndef STACK_GUARD_SIZE
45 #  define STACK_GUARD_SIZE 4096
46 #endif
47 
48 /* Some versions of stdio define this. */
49 #ifndef _NFILE
50 #  define _NFILE 15
51 #endif
52 
53 #define FILE_CHANNELS _NFILE
54 
55 #define MAX_LIST_PRINT 10
56 
57 #define ILLEGAL_PRIMITIVE -1
58 
59 /* Primitive flow control codes: directs computation after processing
60    a primitive application.  */
61 
62 #define PRIM_DONE			-1
63 #define PRIM_DO_EXPRESSION		-2
64 #define PRIM_APPLY			-3
65 #define PRIM_INTERRUPT			-4
66 #define PRIM_NO_TRAP_EVAL		-5
67 #define PRIM_NO_TRAP_APPLY		-6
68 #define PRIM_POP_RETURN			-7
69 #define PRIM_TOUCH			-8
70 #define PRIM_APPLY_INTERRUPT		-9
71 #define PRIM_APPLY_ERROR		-10
72 #define PRIM_NO_TRAP_POP_RETURN		-11
73 #define PRIM_RETURN_TO_C		-12
74 #define PRIM_ABORT_TO_C			-13
75 
76 #define ABORT_NAME_TABLE						\
77 {									\
78   /* -1 */	"DONE",							\
79   /* -2 */	"DO-EXPRESSION",					\
80   /* -3 */	"APPLY",						\
81   /* -4 */	"INTERRUPT",						\
82   /* -5 */	"NO-TRAP-EVAL",						\
83   /* -6 */	"NO-TRAP_APPLY",					\
84   /* -7 */	"POP-RETURN",						\
85   /* -8 */	"TOUCH",						\
86   /* -9 */	"APPLY-INTERRUPT",					\
87   /* -10 */	"REENTER",						\
88   /* -11 */	"NO-TRAP-POP-RETURN",					\
89   /* -12 */	"RETURN-TO-C",						\
90   /* -13 */	"ABORT-TO-C"						\
91 }
92 
93 /* Some numbers of parameters which mean something special */
94 
95 #define LEXPR_PRIMITIVE_ARITY		-1
96 #define UNKNOWN_PRIMITIVE_ARITY		-2
97 
98 /* Error case detection for precomputed constants */
99 /* VMS preprocessor does not like line continuations in conditionals */
100 
101 #define Are_The_Constants_Incompatible					\
102 ((TC_NULL != 0x00) || (TC_CONSTANT != 0x08) ||				\
103  (TC_FIXNUM != 0x1A) || (TC_BROKEN_HEART != 0x22) || 			\
104  (TC_CHARACTER_STRING != 0x1E))
105 
106 /* The values used above are in sdata.h and types.h,
107    check for consistency if the check below fails. */
108 
109 #if Are_The_Constants_Incompatible
110 #include "Error: const.h and types.h disagree"
111 #endif
112 
113 /* These are the only entries in Registers[] needed by the microcode.
114    All other entries are used only by the compiled code interface. */
115 
116 #define REGBLOCK_MEMTOP			0
117 #define REGBLOCK_INT_MASK		1
118 #define REGBLOCK_VAL			2
119 #define REGBLOCK_ENV			3
120 #define REGBLOCK_CC_TEMP		4	/* For use by compiler */
121 #define REGBLOCK_EXPR			5
122 #define REGBLOCK_RETURN			6
123 #define REGBLOCK_LEXPR_ACTUALS		7
124 #define REGBLOCK_PRIMITIVE		8
125 #define REGBLOCK_CLOSURE_FREE		9	/* For use by compiler */
126 #define REGBLOCK_CLOSURE_SPACE		10	/* For use by compiler */
127 #define REGBLOCK_STACK_GUARD		11
128 #define REGBLOCK_INT_CODE		12
129 #define REGBLOCK_REFLECT_TO_INTERFACE	13	/* For use by compiler */
130 
131 #define REGBLOCK_MINIMUM_LENGTH		14
132