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