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