3 #define MAXMARKER MAXINTEGER /* maximum special value of mark */
4 #define MAXAPPT MAXINTEGER /* maximum appetite (easily extensible ?) */
5 #define MAXTRACNT 13 /* maximum number of trace messages in line */
6 #define MAXHDLEN 40 /* maximum length of formal procedure header */
7 #define MAXSYSSN 62 /* maximum number of a system signal */
8 #define MAXPARAM 10 /* maximum number of params to standard proc */
9 #define IOBLOCK 0x4000 /* size of I/O transfer block in bytes */
11 /* Object structure : */
13 /* Offsets from the beginning : */
14 #define PROTNUM 1 /* prototype number */
15 #define SHORTLINK 1 /* link to same size list (killed only) */
16 #define LONGLINK 2 /* link to other size list (killed only) */
20 /* prot number 1 always FILEOBJECT */
21 #define FSTAT 2 /* file status */
22 #define FTEMP 3 /* flag to tell if file is temporary */
23 #define FTYPE 4 /* file type */
24 #define FNAME 5 /* file name pointer */
25 #define FFILE (FNAME+sizeof(char *)/sizeof(word)) /*file handle */
26 #define APFILE (FFILE+sizeof(FILE *)/sizeof(word)) /*appetite of file*/
29 /* Offsets from the first address after object : */
30 #define SL -2 /* static link */
31 #define DL -4 /* dynamic link */
32 #define LSC -5 /* local control */
33 #define STATSL -6 /* number of times the object occurs in SL */
34 #define SIGNR -7 /* signal number (handlers only) */
35 #define RPCDL -8 /* remote dynamic link (procedures only) */
36 #define CL -8 /* coroutine link (coroutine only) */
37 #define CHD -10 /* coroutine head (process only) */
38 #define VIRTSC -12 /* virtual scratch (process only) */
40 /* Virtual address (also formal type) : */
43 word addr; /* address of dictionary item */
44 /* (node and process index for processes) */
45 /* (or for formal types - number of arrayof) */
46 word mark; /* address mark */
47 /* (negative for processes) */
48 /* (or for formal types - actual type) */
51 #define loadvirt(v, a) { word ta; \
53 (v).addr = M[ ta++ ]; \
55 #define storevirt(v, a) { word ta; \
57 M[ ta++ ] = (v).addr; \
60 #define MF(a) (*( (FILE **) (M+(a)) ))
61 #define MN(a) (*( (char **) (M+(a)) ))
62 #define MR(a) *( (real *) (M+(a)) )
73 #define min(x, y) ((x) < (y) ? (x) : (y))
74 #define max(x, y) ((x) > (y) ? (x) : (y))
75 #define absolute(x) ((x) >= 0 ? (x) : -(x))
77 /* LOGLAN's booleans : */
78 #define LFALSE ((word)0)
79 #define LTRUE (~LFALSE)
80 #define lbool(b) ( (b) ? LTRUE : LFALSE )
83 #define TEXTF 1 /* text file */
84 #define CHARF 2 /* file of char */
85 #define INTF 3 /* file of integer */
86 #define REALF 4 /* file of real */
87 #define DIRECT 5 /* direct access file */
90 #define READING 0 /* sequential file opened for read */
91 #define WRITING 1 /* sequential file opened for write */
92 #define UPDATING 2 /* direct access file */
93 #define UNKNOWN 3 /* file not opened */
95 /* Run time error types : */
97 #define RTESLCOF 0 /* SL chain cut off */
98 #define RTEUNSTP 1 /* unimplemented standard procedure */
99 #define RTEILLAT 2 /* illegal attach */
100 #define RTEILLDT 3 /* illegal detach */
101 #define RTECORTM 4 /* coroutine terminated */
102 #define RTECORAC 5 /* coroutine active */
103 #define RTEINVIN 6 /* array index error */
104 #define RTEILLAB 7 /* incorrect array bounds */
105 #define RTEINCQA 8 /* improper QUA */
106 #define RTEINCAS 9 /* illegal assignment */
107 #define RTEFTPMS 10 /* formal type missing */
108 #define RTEILLKL 11 /* illegal kill */
109 #define RTEILLCP 12 /* illegal copy */
110 #define RTEINCHS 13 /* incompatible headers */
111 #define RTEHNDNF 14 /* handler not found */
112 #define RTEMEMOV 15 /* memory overflow */
113 #define RTEFHTLG 16 /* formal header too long */
114 #define RTEILLRT 17 /* illegal return */
115 #define RTEREFTN 18 /* reference to NONE */
116 #define RTEDIVBZ 19 /* division by zero */
117 #define RTESYSER 20 /* system error */
118 #define RTEILLIO 21 /* illegal I/O operation */
119 #define RTEIOERR 22 /* I/O error */
120 #define RTECNTOP 23 /* Cannot open file */
121 #define RTEBADFM 24 /* Input data format bad */
122 #define RTEILLRS 25 /* illegal resume */
123 #define RTETMPRC 26 /* too many processes on one machine */
124 #define RTEINVND 27 /* invalid node number */
125 #define RTENEGST 28 /* negative step value */
126 #define RTENONGL 29 /* only process may be global */
136 #define MAXINSTANCE 255
140 extern memory M; /* main memory for code and data */
141 extern union value *param; /* pointer to standard proc. param list */
142 extern int offset[]; /* offset conversion table for compact. */
143 extern int scot[]; /* signal to number conversion table */
144 extern int primapet[]; /* appetites of primitive types */
145 extern word ic; /* instruction counter */
146 extern word lastic; /* previous ic for redecoding after comp. */
147 extern int opcode; /* opcode of L-code instruction */
148 extern word a1, a2, a3; /* arguments of L-code instruction */
150 /* kernel variables for the running system */
152 extern word memorysize; /* size of memory array for code and data */
153 extern word dispoff; /* DISPLAY offset in process object */
154 extern word disp2off; /* indirect DISPLAY offset in process object */
155 extern word display; /* DISPLAY address - physical addresses */
156 extern word display2; /* DISPLAY address - indirect addresses */
157 extern word c1, c2; /* pointers to current object */
158 extern word mainprog; /* main block object */
159 extern word mnoff; /* offset of variable main */
162 extern bool infmode; /* TRUE if compactification message printed */
163 extern bool debug; /* TRUE if trace is printed */
164 extern FILE *tracefile; /* output file for trace */
165 bool graphics; /* is graphics active ? */
167 extern jmp_buf contenv; /* for continue execution */
169 extern int internal_sock,graph_sock,net_sock;
170 extern int connected;
176 extern char ProgName[255];
177 extern ctx_struct my_ctx;
178 extern void send_to_graph(G_MESSAGE*);
179 extern int read_from_graph(G_MESSAGE*);
180 extern int read_from_net(MESSAGE*);
181 extern char mygname[80],mykname[80],mynname[80];
182 extern int DirConn[MAXINSTANCE];