Wild Life  2.29
 All Data Structures Files Functions Variables Typedefs Macros
def_struct.h
Go to the documentation of this file.
1 
6 // from c_life.h
7 
8 /* Type for psi-terms, hidden from users */
9 typedef void *PsiTerm;
10 
11 
12 // from extern.h
13 
14 
15 /******************************* TYPES ************************************/
16 
17 /* GENERIC is the type of a pointer to any type. This might not work on */
18 /* some machines, but it should be possible as MALLOC() uses something of */
19 /* that kind. ANSI uses "void *" instead. */
20 
21 
22  typedef unsigned long* GENERIC;
23 // typedef unsigned long* GENERIC;
24 // typedef void * GENERIC;
25 typedef int operator;
26 typedef long goals;
27 
28 #ifdef X11
29 typedef long Action;
30 #endif
31 
32 typedef char string[STRLEN];
34 typedef struct wl_int_list * ptr_int_list;
35 typedef struct wl_resid_list * ptr_resid_list; /* 21.9 */
36 typedef struct wl_definition * ptr_definition;
37 typedef struct wl_definition * def_type;
39 typedef struct wl_psi_term * ptr_psi_term;
40 typedef struct wl_node * ptr_node;
41 typedef struct wl_pair_list * ptr_pair_list;
43 typedef struct wl_list * ptr_list;
44 typedef struct wl_stack * ptr_stack;
45 typedef struct wl_goal * ptr_goal;
47 
48 /****************************** DATA STRUCTURES **************************/
49 
50 
51 typedef struct wl_operator_data {
52  operator type;
53  long precedence;
54  ptr_operator_data next;
56 
57 /* List of integers or pointers */
58 typedef struct wl_int_list {
60  ptr_int_list next;
61 } int_list;
62 
63 /* List of residuation variables */ /* 21.9 */
64 typedef struct wl_resid_list {
65  ptr_psi_term var;
66  ptr_psi_term othervar; /* needed for its sort only */
67  ptr_resid_list next;
68 } resid_list;
69 
70 
71 
72 
73 typedef struct wl_hash_table * ptr_hash_table;
74 
75 
76 /************ MODULES **************/
77 /* RM: Jan 7 1993 */
78 
79 struct wl_module {
80  char *module_name;
81  char *source_file;
82  ptr_int_list open_modules;
83  ptr_int_list inherited_modules;
84  ptr_hash_table symbol_table;
85 };
86 
87 
88 typedef struct wl_module * ptr_module;
89 
90 extern ptr_node module_table; /* The table of modules */
91 extern ptr_module current_module; /* The current module for the tokenizer */
92 
93 
94 struct wl_keyword {
95  ptr_module module;
96  char *symbol;
97  char *combined_name; /* module#symbol */
98  // next 2 were int in 2.20 DJD
99  int public;
100  int private_feature; /* RM: Mar 11 1993 */
101  ptr_definition definition;
102 };
103 
104 typedef struct wl_keyword * ptr_keyword;
105 
106 /********* END MODULES *************/
107 
108 
109 
110 /************ HASH CODED SYMBOL TABLE **************/
111 /* RM: Feb 3 1993 */
112 
113 
114 /* Hash tables for keywords */
115 
117  int size;
118  int used;
119  ptr_keyword *data;
120 };
121 
122 
123 /****************************/
124 /* Definition of a keyword. */
125 /* This includes the rules associated to the symbol and how old they are. */
126 typedef struct wl_definition {
127  long date;
128 
129  ptr_keyword keyword; /* RM: Jan 11 1993 */
130 
131  ptr_pair_list rule;
132  ptr_triple_list properties;
133 
134  ptr_int_list code;
135  ptr_int_list parents;
136  ptr_int_list children;
137 
138  def_type type_def;
139  char always_check; /* TRUE by default */
140  char protected; /* TRUE by default */
141  char evaluate_args; /* TRUE by default */
142  char already_loaded; /* Cleared at the prompt, set upon loading */
143 
144  ptr_operator_data op_data;
145 
146  ptr_psi_term global_value; /* RM: Feb 8 1993 */
147  ptr_psi_term init_value; /* RM: Mar 23 1993 */
148 
149 #ifdef CLIFE
150  ptr_block_definition block_def; /* AA: Mar 10 1993 */
151 #endif /* CLIFE */
152 
153  ptr_definition next;
154 } definition;
155 
156 /* 22.9 */
157 typedef struct wl_residuation {
158  long sortflag; /* bestsort == if TRUE ptr_definition else ptr_int_list */
159  GENERIC bestsort; /* 21.9 */
160  GENERIC value_2; /* to handle psi-terms with a value field 6.10 */
161  ptr_goal goal;
162  ptr_residuation next;
163 } residuation;
164 
165 /* PSI_TERM */
166 typedef struct wl_psi_term {
167 #ifdef TS
168  unsigned long time_stamp; /* Avoid multiple trailing on a choice point. 9.6 */
169 #endif
170  ptr_definition type;
171  long status; /* Indicates whether the properties of the type have been */
172  /* checked or the function evaluated */
173  /* long curried; Distinguish between quoted and curried object 20.5 */
174  long flags; /* 14.9 */
176  ptr_node attr_list;
177  ptr_psi_term coref;
178  ptr_residuation resid; /* List of goals to prove if type is narrowed. */
179 } psi_term;
180 
181 /* Binary tree node. */
182 /* KEY can be either an integer (a pointer) or a pointer to a string. */
183 /* DATA is the information accessed under the KEY, in most cases a pointer */
184 /* to a PSI-TERM. */
185 
186 typedef struct wl_node {
187  char *key;
188  ptr_node left;
189  ptr_node right;
191 } node;
192 
193 typedef struct wl_pair_list {
194  ptr_psi_term aaaa_2;
195  ptr_psi_term bbbb_2;
196  ptr_pair_list next;
197 } pair_list;
198 
199 /* Used for type properties */
200 typedef struct wl_triple_list {
201  ptr_psi_term aaaa_4; /* Attributes */
202  ptr_psi_term bbbb_4; /* Constralong */
203  ptr_definition cccc_4; /* Original type of attribute & constralong */
204  ptr_triple_list next;
205 } triple_list;
206 
207 /* RM: Dec 15 1992 Away goes the old list structure!!
208  typedef struct wl_list {
209  ptr_psi_term car;
210  ptr_psi_term cdr;
211  } list;
212  */
213 
214 
215 #ifdef CLIFE
216 #include "blockstruct.h"
217 #endif /* CLIFE */
218 
219 
220 typedef struct wl_stack {
222  GENERIC *aaaa_3; // was GENERIC
223  GENERIC *bbbb_3; // was GENERIC
224  ptr_stack next;
225 } stack;
226 
227 typedef struct wl_goal {
229  ptr_psi_term aaaa_1;
230  ptr_psi_term bbbb_1;
232  ptr_goal next;
233  ptr_definition pending;
234 } goal;
235 
236 typedef struct wl_choice_point {
237  unsigned long time_stamp;
238  ptr_stack undo_point;
239  ptr_goal goal_stack;
240  ptr_choice_point next;
242 } choice_point;
243 
244 // from lefun.h
245 
246 
247 /* Residuation block state handling */
248 
250 
251 typedef struct wl_resid_block {
252  long cc_cr; /* 11.9 */
253  ptr_goal ra;
254  /* long cc; 11.9 */
255  /* long cr; 11.9 */
256  ptr_resid_list rv; /* 21.9 */
257  ptr_psi_term md;
258 } resid_block;
259 
260 // from list.h
261 
262 
263 typedef void * Ref;
264 typedef struct wl_ListLinks * RefListLinks;
265 typedef struct wl_ListHeader * RefListHeader;
267 typedef int (*RefListEnumProc) ( );
268 
269 
270 
271 /*
272  "First", "Last" are pointers to the first and last element of the list
273  respectively.
274 
275  "Current" points to the current processed element of the list. Used when
276  applying a function to each element of the list.
277 
278  "GetLinks" is a function to get the list links on the object.
279 
280  "Lock" is the number of recursive enum calls on the list. Used only in
281  debugging mode.
282  */
283 
284 
285 typedef struct wl_ListHeader
286 {
288 
289 #ifdef prlDEBUG
290  Int32 Lock;
291 #endif
292 
294 } ListHeader;
295 
296 
297 
298 typedef struct wl_ListLinks
299 {
301 } ListLinks;
302 
303 
304 // from print.h
305 
306 typedef struct wl_tab_brk * ptr_tab_brk;
307 typedef struct wl_item * ptr_item;
308 
309 typedef struct wl_tab_brk {
310  long column;
311  long broken;
312  long printed;
313 } tab_brk;
314 
315 typedef struct wl_item {
316  char *str;
317  ptr_tab_brk tab;
318 } item;
319 
320 
321 // from sys.h
322 
323 /********************************************************************
324  When calling a primitive, you always need to process the arguments
325  according to the same protocol. The call_primitive procedure does
326  all this work for you. It should be called as follows:
327 
328  call_primitive(f,n,args,info)
329 
330  where f is the primitive implementing the actual functionality, n
331  is the number of arguments described in args, and args is an array
332  of argument descriptions, and info is a pointer to extra info to be
333  passed to f. Each argument is described by a psi_arg structure
334  whose 1st field is a string naming the feature, 2nd field is a type
335  restriction, and 3rd field describes processing options, e.g.:
336 
337  { "1" , quoted_string , REQUIRED }
338 
339  describes a required argument on feature 1, that must be a string.
340  The 3rd field is a mask of boolean flags and is constructed by
341  ORing some constants chosen from the set:
342 
343  OPTIONAL for an optional argument
344  REQUIRED for a required argument (i.e. residuate on it if not
345  present
346  UNEVALED if the argument should not be evaluated
347  JUSTFAIL to just fail is the argument does not meet its type
348  restriction
349  POLYTYPE sometimes you want to permit several particular sorts
350  in that case the 2nd psi_arg field is interpreted as
351  a pointer to a NULL terminated array of ptr_definitions
352  MANDATORY like REQUIRED, but it is an error for it not to be
353  present; don't residuate. This is useful for
354  predicates since it doesn't make sense for them to
355  residuate.
356  NOVALUE no value required for this argument.
357 
358  The primitive must be defined to take the following arguments
359  f(argl,result,funct[,info])
360  where argl is an array containing the arguments obtained by call_
361  primitive, result is the result in case we are implementing a
362  function, and info (optional) is extra information, typically a
363  pointer to a structure.
364  *******************************************************************/
365 
366 
367 typedef struct {
368  char *feature;
369  ptr_definition type;
370  unsigned int options;
371 } psi_arg;
372 
373 // from token.h
374 
375 
376 typedef struct wl_parse_block {
377  long lc;
378  long sol;
379  long sc;
380  long osc;
381  ptr_psi_term spt;
382  ptr_psi_term ospt;
383  long ef;
384 } parse_block;
385 
387 
388 // from copy.c
389 struct hashbucket {
390  ptr_psi_term old_value;
391  ptr_psi_term new_value;
392  long info;
393  long next;
394 };
395 
396 struct hashentry {
397  long timestamp;
399 };
400 
401 #define TEXTBUFSIZE 5000
402 
403 struct text_buffer {
404  struct text_buffer *next;
405  int top;
407 };
struct wl_tab_brk tab_brk
ptr_keyword * data
Definition: def_struct.h:119
ptr_psi_term aaaa_1
Definition: def_struct.h:229
ptr_psi_term aaaa_2
Definition: def_struct.h:194
ptr_residuation resid
Definition: def_struct.h:178
struct wl_node * ptr_node
Definition: def_struct.h:40
struct wl_choice_point choice_point
char already_loaded
Definition: def_struct.h:142
struct wl_resid_block * ptr_resid_block
Definition: def_struct.h:249
ptr_psi_term init_value
Definition: def_struct.h:147
ptr_psi_term ospt
Definition: def_struct.h:382
struct wl_definition * def_type
Definition: def_struct.h:37
char evaluate_args
Definition: def_struct.h:141
long printed
Definition: def_struct.h:312
char * combined_name
Definition: def_struct.h:97
struct wl_int_list int_list
char data[TEXTBUFSIZE]
Definition: def_struct.h:406
struct wl_resid_list * ptr_resid_list
Definition: def_struct.h:35
struct wl_operator_data operator_data
ptr_goal goal
Definition: def_struct.h:161
struct wl_item item
struct wl_resid_block resid_block
struct wl_ListHeader ListHeader
ptr_residuation next
Definition: def_struct.h:162
ptr_pair_list next
Definition: def_struct.h:196
unsigned int options
Definition: def_struct.h:370
GENERIC * bbbb_3
Definition: def_struct.h:223
GENERIC cccc_1
Definition: def_struct.h:231
ptr_int_list inherited_modules
Definition: def_struct.h:83
ptr_operator_data next
Definition: def_struct.h:54
long column
Definition: def_struct.h:310
ptr_definition definition
Definition: def_struct.h:101
ptr_stack undo_point
Definition: def_struct.h:238
def_type type_def
Definition: def_struct.h:138
ptr_resid_list next
Definition: def_struct.h:67
ptr_tab_brk tab
Definition: def_struct.h:317
RefListGetLinksProc GetLinks
Definition: def_struct.h:293
GENERIC stack_top
Definition: def_struct.h:241
ptr_goal ra
Definition: def_struct.h:253
ptr_hash_table symbol_table
Definition: def_struct.h:84
ptr_keyword keyword
Definition: def_struct.h:129
char * str
Definition: def_struct.h:316
struct wl_tab_brk * ptr_tab_brk
Definition: def_struct.h:306
struct wl_psi_term psi_term
struct wl_psi_term * ptr_psi_term
quotedStackCopy
Definition: def_struct.h:39
GENERIC data
Definition: def_struct.h:190
struct wl_goal goal
ptr_psi_term old_value
Definition: def_struct.h:390
char * symbol
Definition: def_struct.h:96
struct wl_hash_table * ptr_hash_table
Definition: def_struct.h:73
unsigned long time_stamp
Definition: def_struct.h:237
ptr_choice_point next
Definition: def_struct.h:240
ptr_triple_list next
Definition: def_struct.h:204
ptr_definition cccc_4
Definition: def_struct.h:203
struct wl_list * ptr_list
Definition: def_struct.h:43
char always_check
Definition: def_struct.h:139
ptr_node left
Definition: def_struct.h:188
ptr_psi_term new_value
Definition: def_struct.h:391
struct wl_module * ptr_module
Definition: def_struct.h:88
void * PsiTerm
Definition: def_struct.h:9
ptr_definition next
Definition: def_struct.h:153
RefListLinks(* RefListGetLinksProc)()
Definition: def_struct.h:266
struct wl_triple_list * ptr_triple_list
Definition: def_struct.h:42
goals type
Definition: def_struct.h:228
type_ptr type
Definition: def_struct.h:221
#define TEXTBUFSIZE
Definition: def_struct.h:401
ptr_definition type
Definition: def_struct.h:369
char * key
Definition: def_struct.h:187
long broken
Definition: def_struct.h:311
ptr_psi_term md
Definition: def_struct.h:257
struct wl_choice_point * ptr_choice_point
Definition: def_struct.h:46
struct wl_goal * ptr_goal
Definition: def_struct.h:45
struct wl_ListLinks ListLinks
GENERIC value_2
Definition: def_struct.h:160
ptr_pair_list rule
Definition: def_struct.h:131
ptr_psi_term global_value
Definition: def_struct.h:146
struct wl_ListLinks * RefListLinks
Definition: def_struct.h:264
char * source_file
Definition: def_struct.h:81
struct wl_definition * ptr_definition
Definition: def_struct.h:36
GENERIC value_3
Definition: def_struct.h:175
struct wl_operator_data * ptr_operator_data
Definition: def_struct.h:33
struct wl_pair_list * ptr_pair_list
Definition: def_struct.h:41
ptr_psi_term bbbb_2
Definition: def_struct.h:195
ptr_psi_term var
Definition: def_struct.h:65
ptr_psi_term bbbb_4
Definition: def_struct.h:202
long timestamp
Definition: def_struct.h:397
struct wl_ListHeader * RefListHeader
Definition: def_struct.h:265
char * module_name
Definition: def_struct.h:80
ptr_psi_term coref
Definition: def_struct.h:177
long goals
Definition: def_struct.h:26
long bucketindex
Definition: def_struct.h:398
GENERIC * aaaa_3
Definition: def_struct.h:222
GENERIC bestsort
Definition: def_struct.h:159
ptr_int_list open_modules
Definition: def_struct.h:82
char * feature
Definition: def_struct.h:368
struct wl_stack stack
struct wl_parse_block * ptr_parse_block
Definition: def_struct.h:386
struct wl_keyword * ptr_keyword
Definition: def_struct.h:104
ptr_module module
Definition: def_struct.h:95
ptr_goal goal_stack
Definition: def_struct.h:239
ptr_psi_term othervar
Definition: def_struct.h:66
struct wl_parse_block parse_block
int private_feature
Definition: def_struct.h:100
int(* RefListEnumProc)()
Definition: def_struct.h:267
struct wl_residuation * ptr_residuation
Definition: def_struct.h:38
#define STRLEN
Definition: def_const.h:92
ptr_psi_term spt
Definition: def_struct.h:381
ptr_resid_list rv
Definition: def_struct.h:256
ptr_int_list code
Definition: def_struct.h:134
struct wl_definition definition
ptr_definition type
Definition: def_struct.h:170
GENERIC value_1
Definition: def_struct.h:59
ptr_psi_term bbbb_1
Definition: def_struct.h:230
unsigned long * GENERIC
Definition: def_struct.h:22
ptr_triple_list properties
Definition: def_struct.h:132
struct wl_triple_list triple_list
struct wl_resid_list resid_list
long type_ptr
Definition: def_const.h:175
struct wl_int_list * ptr_int_list
Definition: def_struct.h:34
struct wl_pair_list pair_list
struct text_buffer * next
Definition: def_struct.h:404
ptr_int_list children
Definition: def_struct.h:136
ptr_node module_table
Definition: def_glob.h:165
struct wl_item * ptr_item
Definition: def_struct.h:307
ptr_stack next
Definition: def_struct.h:224
struct wl_stack * ptr_stack
Definition: def_struct.h:44
ptr_node attr_list
Definition: def_struct.h:176
struct wl_node node
ptr_definition pending
Definition: def_struct.h:233
ptr_module current_module
Definition: def_glob.h:166
ptr_psi_term aaaa_4
Definition: def_struct.h:201
ptr_operator_data op_data
Definition: def_struct.h:144
void * Ref
Definition: def_struct.h:263
ptr_node right
Definition: def_struct.h:189
struct wl_residuation residuation
ptr_goal next
Definition: def_struct.h:232
ptr_int_list next
Definition: def_struct.h:60
ptr_int_list parents
Definition: def_struct.h:135