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