BSD 4_3_Tahoe development
[unix-history] / usr / src / ucb / lisp / franz / data.c
CommitLineData
0fa44b46
C
1#ifndef lint
2static char *rcsid =
3 "$Header: data.c,v 1.8 85/03/24 11:02:24 sklower Exp $";
4#endif
5
6/* -[Sun Jun 19 14:41:00 1983 by jkf]-
7 * data.c $Locker: $
8 * static storage declarations
9 *
10 * (c) copyright 1982, Regents of the University of California
11 */
12
13
14
15#include "global.h"
16#include "gtabs.h"
17#include "structs.h"
18#include "frame.h"
19#include <stdio.h>
20
21/*char firstalloc[NBPG] = { 'x' }; /* first thing allocated in file */
22lispval lispsys[SIGNIF]; /* lisp data used by system */
23
24lispval gftab[GFTABLEN]; /* global function table for interpreter */
25
26lispval gctab[GCTABLEN] = /* global constant table for interpreter */
27 {nil,0,SMALL(-1),SMALL(0),SMALL(1),SMALL(2),SMALL(3),SMALL(4)};
28
29
30/* Port definitions *****************************************************/
31FILE *piport, /* standard input port */
32 *poport, /* standard output port */
33 *errport, /* port for error messages */
34 *rdrport, /* temporary port for readr */
35 *proport; /* port for protocal */
36int lineleng = 80; /* line length desired */
37int rlevel; /* used to indicate depth of recursion
38 in reader. No longer really necessary */
39char keybin = FALSE; /* logical flag: using keyboard */
40char protflag = FALSE; /* logical flag: want protocall */
41char rbktf; /* logical flag: ] mode */
42
43#ifdef RTPORTS
44lispval ioname[128]; /* strings of names of files currently open */
45#else
46lispval ioname[_NFILE]; /* strings of names of files currently open */
47#endif
48
49/* name stack ***********************************************************/
50struct argent *orgnp; /* used by top level to reset to start */
51struct argent *namptr, /* temporary pointer */
52#ifndef NPINREG
53 *lbot, /* beginning of frame */
54 *np, /* first free entry */
55#endif
56 *nplim; /* don't have this = np */
57struct nament *bnp, /* top of bind stack */
58 *orgbnp, /* absolute bottom of ""*/
59 *bnplim; /* absolute top of "" */
60
61
62
63/* hashing things *******************************************************/
64int hash; /* set by ratom */
65int atmlen; /* length of atom including final null */
66
67
68/* big string buffer for whomever needs it ******************************/
69static char i_strbuf[600];
70char *strbuf = i_strbuf;
71char *endstrb = i_strbuf + 599;
72
73/* in the case we can't use the C stack for extending automatics */
74#ifdef SPISFP
75long xstack[16384];
76long *xsp;
77long *exsp = xstack + ((sizeof xstack)/(sizeof (long)));
78#endif
79
80/* strings needed by the two hand crafted atoms, nil and eof */
81char nilpname[] = "nil";
82char eofpname[] = "eof";
83
84/* set by sstatus commands */
85int uctolc = 0; /* when set, uc chars in atoms go to lc */
86 /* default mode for dumplisp
87 (note this is decimal not octal) */
88#if os_unisoft || os_unix_ts
89int dmpmode = 410;
90#else
91int dmpmode = 413;
92#endif
93
94/* break and error declarations *****************************************/
95int depth = 0; /* depth of nested breaks */
96lispval contval; /* the value being returned up */
97int retval; /* used by each error/prog call */
98lispval lispretval; /* used by non-local goto's */
99int rsetsw; /* when set, trace frames built */
100int bcdtrsw; /* when set with rsetsw, trace bcd too */
101int evalhcallsw; /* when set will not evalhook next eval */
102int funhcallsw; /* when set will not funcallhook next eval */
103
104
105/* exception handling stuff *********************************************/
106int exception; /* true if an exception is pending */
107int sigintcnt; /* number of SIGINT's pending */
108
109/* current state of the hole (for fasling into) *************************/
110#ifndef HOLE
111#define HOLE 0
112#endif
113extern char holbeg[];
114char *curhbeg = holbeg; /* next location to fasl into */
115int usehole = HOLE; /* if TRUE, fasl tries to use hole */
116int holesize = HOLE; /* This avoids an ifdef in dumplisp */
117
118/* other stuff **********************************************************/
119lispval ftemp,vtemp,argptr,ttemp; /* temporaries: use briefly */
120int itemp;
121lispval sigacts[16]; /* for catching interrupts */
122int sigstruck,sigdelay; /* for catching interrupts */
123lispval stattab[16]; /* miscelleneous options */
124lispval Vprintsym; /* value is the symbol 'print' */
125
126/* interpreter globals */
127
128int lctrace;
129int fvirgin = 1; /* set to 1 initially */
130int gctime;
131struct frame *errp; /* stack of error frames */
132
133
134/* global pointers to the transfer tables */
135
136
137struct trtab *trhead= /* first in list of transfer tables */
138 (struct trtab *) 0;
139struct trent *trcur; /* next entry to allocate */
140int trleft = 0; /* number of entries left in current table */
141
142/* globals from sysat.c */
143
144int *beginsweep; /* place for sweeper to begin */
145int initflag = TRUE; /* inhibit gcing initially */
146int tgcthresh = 15;
147int page_limit = (5 * TTSIZE) / 6;
148int ttsize = TTSIZE;
149
150
151/* global used in io.c */
152
153lispval lastrtab;
154
155/* globals from [VT]alloc.c */
156
157
158char purepage[TTSIZE];
159int fakettsize = TTSIZE - 8;
160int gcstrings; /* Do we mark and sweep strings? */
161int *bind_lists = (int *) CNIL; /* lisp data for compiled code */
162
163
164struct str_x str_current[2]; /* next free string spaces */
165
166struct types
167 atom_str =
168 {
169 (char *)CNIL, 0, ATOMSPP, ATOM, 5,
170 &atom_items, &atom_pages, &atom_name,
171 (struct heads *) CNIL, (char *)CNIL
172 },
173 strng_str =
174 {
175 (char *) CNIL, 0, STRSPP, STRNG, 128,
176 &str_items, &str_pages, &str_name,
177 (struct heads *) CNIL, (char *)CNIL
178 },
179 int_str =
180 {
181 (char *) CNIL, 0, INTSPP, INT, 1,
182 &int_items, &int_pages, &int_name,
183 (struct heads *) CNIL, (char *)CNIL
184 },
185 dtpr_str =
186 {
187 (char *) CNIL, 0, DTPRSPP, DTPR, 2,
188 &dtpr_items, &dtpr_pages, &dtpr_name,
189 (struct heads *) CNIL, (char *)CNIL
190 },
191 doub_str =
192 {
193 (char *) CNIL, 0, DOUBSPP, DOUB, 2,
194 &doub_items, &doub_pages, &doub_name,
195 (struct heads *) CNIL, (char *)CNIL
196 },
197 array_str =
198 {
199 (char *) CNIL, 0, ARRAYSPP, ARRAY, 5,
200 &array_items, &array_pages, &array_name,
201 (struct heads *) CNIL, (char *)CNIL
202 },
203 other_str =
204 {
205 (char *) CNIL, 0, STRSPP, OTHER, 128,
206 &other_items, &other_pages, &other_name,
207 (struct heads *) CNIL, (char *)CNIL
208 },
209
210 sdot_str =
211 {
212 (char *) CNIL, 0, SDOTSPP, SDOT, 2,
213 &sdot_items, &sdot_pages, &sdot_name,
214 (struct heads *) CNIL, (char *)CNIL
215 },
216 val_str =
217 {
218 (char *) CNIL, 0, VALSPP, VALUE, 1,
219 &val_items, &val_pages, &val_name,
220 (struct heads *) CNIL, (char *)CNIL
221 },
222funct_str =
223 {
224 (char *) CNIL, 0, BCDSPP, BCD, 2,
225 &funct_items, &funct_pages, &funct_name,
226 (struct heads *) CNIL, (char *)CNIL
227 },
228vect_str =
229 {
230
231 (char *) CNIL, 0, VECTORSPP, VECTOR, 1,
232 &vect_items, &vect_pages, &vect_name,
233 (struct heads *) CNIL, (char *)CNIL
234 },
235vecti_str =
236 {
237
238 (char *) CNIL, 0, VECTORSPP, VECTORI, 1,
239 &vect_items, &vecti_pages, &vecti_name,
240 (struct heads *) CNIL, (char *)CNIL
241 },
242
243hunk_str[7] =
244 {
245 {
246 (char *) CNIL, 0, HUNK2SPP, HUNK2, 2,
247 &hunk_items[0], &hunk_pages[0], &hunk_name[0],
248 (struct heads *) CNIL, (char *)CNIL
249 },
250 {
251 (char *) CNIL, 0, HUNK4SPP, HUNK4, 4,
252 &hunk_items[1], &hunk_pages[1], &hunk_name[1],
253 (struct heads *) CNIL, (char *)CNIL
254 },
255 {
256 (char *) CNIL, 0, HUNK8SPP, HUNK8, 8,
257 &hunk_items[2], &hunk_pages[2], &hunk_name[2],
258 (struct heads *) CNIL, (char *)CNIL
259 },
260 {
261 (char *) CNIL, 0, HUNK16SPP, HUNK16, 16,
262 &hunk_items[3], &hunk_pages[3], &hunk_name[3],
263 (struct heads *) CNIL, (char *)CNIL
264 },
265 {
266 (char *) CNIL, 0, HUNK32SPP, HUNK32, 32,
267 &hunk_items[4], &hunk_pages[4], &hunk_name[4],
268 (struct heads *) CNIL, (char *)CNIL
269 },
270 {
271 (char *) CNIL, 0, HUNK64SPP, HUNK64, 64,
272 &hunk_items[5], &hunk_pages[5], &hunk_name[5],
273 (struct heads *) CNIL, (char *)CNIL
274 },
275 {
276 (char *) CNIL, 0, HUNK128SPP, HUNK128, 128,
277 &hunk_items[6], &hunk_pages[6], &hunk_name[6],
278 (struct heads *) CNIL, (char *)CNIL
279 }
280 };
281extern struct readtable { unsigned char ctable[132]; } initread;
282unsigned char *ctable = initread.ctable;
283int gensymcounter = 0;
284
285int hashtop = HASHTOP;
286int xcycle = 0; /* used by xsbrk */
287struct atom *hasht[HASHTOP];
288lispval datalim; /* pointer to next location to allocate */
289
290char typetable[TTSIZE+1] = {UNBO,ATOM,PORT,INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,INT};
291
292/* this must be the last thing allocated in this file */
293char lsbrkpnt,zfreespace;