Wild Life  2.29
 All Data Structures Files Functions Variables Typedefs Macros
memory.c
Go to the documentation of this file.
1 
6 /* Copyright 1991 Digital Equipment Corporation.
7 ** All Rights Reserved.
8 *****************************************************************/
9 
10 #include "defs.h"
11 
12 static long delta;
13 
14 #ifdef prlDEBUG
15 static long amount_used;
16 #endif
17 
18 #ifdef CLIFE
19 long pass;
20 #else
21 static long pass;
22 #endif /* CLIFE */
23 
24 #define LONELY 1
25 
26 static struct tms last_garbage_time;
27 static float gc_time, life_time;
28 
29 
30 
31 // #define ALIGNUP(X) { (X) = (GENERIC)( ((long) (X) + (ALIGN-1)) & ~(ALIGN-1) ); }
32 
41 char *GetStrOption(char *name,char *def)
42 {
43  int i;
44  char *result=def;
45  int l=strlen(name);
46 
47  for(i=1;i<arg_c;i++)
48  if(arg_v[i][0]=='-' && (int)strlen(arg_v[i])>=l+1)
49  if(!strncmp(arg_v[i]+1,name,l))
50  if(arg_v[i][l+1]=='=')
51  result=arg_v[i]+l+2;
52  else
53  result=arg_v[i]+l+1;
54 
55  return result;
56 }
57 
64 int GetBoolOption(char *name)
65 {
66  char *s;
67  s=GetStrOption(name,"off");
68  return strcmp(s,"off");
69 }
70 
78 int GetIntOption(char *name,int def)
79 {
80  char *s;
81  char buffer_loc[40];
82  (void)snprintf(buffer_loc,40,"%d",def);
83  s=GetStrOption(name,buffer_loc);
84  return atof(s);
85 }
86 
93 void pchoices() /* RM: Oct 28 1993 For debugging. */
94 {
96  printf("stack pointer is: %lx\n",(unsigned long)stack_pointer);
97  for(c=choice_stack;c;c=c->next)
98  printf("\tc=%lx\ts=%lx\tg=%lx\tu=%lx\n",(unsigned long)c,(unsigned long)c->stack_top,(unsigned long)c->goal_stack,(unsigned long)c->undo_point);
99 }
100 
101 /****************************************************************************/
102 
103 /* GC sanity checks */
104 
105 /* Keep for release versions, unless the garbage collector is very robust */
106 /* #define GCTEST */
107 
108 /* Remove for release versions */
109 /* #define GCVERBOSE */
110 
111 #ifndef GCTEST
112 #undef assert
113 #define assert(N)
114 #endif
115 
122 {
124 
125  while (u) {
126  if ((GENERIC)u->aaaa_3<mem_base || (GENERIC)u->aaaa_3>mem_limit ||
127  (GENERIC)u->next<mem_base || (GENERIC)u->next>mem_limit) {
128  printf("UNDO: type:%ld a:%lx b:%lx next:%lx\n",u->type,(unsigned long)u->aaaa_3,(unsigned long)u->bbbb_3,(unsigned long)u->next);
129  (void)fflush(stdout);
130  }
131  u=u->next;
132  }
133 }
134 
143 {
145 
146  while (u) {
147  if ( (GENERIC)u<mem_base
148  || (GENERIC)u>mem_limit
149  || (!VALID_ADDRESS(u->aaaa_3) && !(u->type & undo_action))
150  ) {
151  if ((GENERIC)u<mem_base || (GENERIC)u>mem_limit) {
152  printf("\nUNDO: u=%lx\n",(long)u);
153  }
154  else {
155  printf("\nUNDO: u:%lx type:%ld a:%lx b:%lx next:%lx\n",
156  (unsigned long)u,(unsigned long)u->type,(unsigned long)u->aaaa_3,(unsigned long)u->bbbb_3,(unsigned long)u->next);
157  }
158  (void)fflush(stdout);
159  return FALSE;
160  }
161  u=u->next;
162  }
163 
164  return TRUE;
165 }
166 
167 
168 /****************************************************************************/
169 
170 /* Forward declarations */
171 static void check_psi_list();
172 static void check_resid_list(); /* 21.9 */
173 static void check_choice();
174 static void check_undo_stack();
175 
176 
177 
178 
188 void fail_all()
189 {
190  output_stream=stdout;
194  (void)abort_life(TRUE);
195  /* printf("\n*** Abort\n"); */
196  stdin_cleareof();
197  (void)open_input_file("stdin");
198 }
199 
200 
201 
202 
203 /******************************************************************************
204 
205  GARBAGE COLLECTING.
206 
207 */
208 
209 
210 
211 /* RM: Jan 29 1993 Replaced with PVR's version of 26.1 */
212 
222 static void compress()
223 {
224  GENERIC addr, new_addr;
225  long len, i;
226 
227  /* Compressing the stack: */
228 
229  addr=new_addr=mem_base;
230  while (addr<=stack_pointer) {
231  len = *(addr+delta);
232  if (len) {
233  /* There are lots of these: */
234  /* if (len==LONELY) printf("Isolated LONELY at %lx\n",addr); */
235  if (len==LONELY) len=ALIGN;
236  else if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN;
237  /* if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN; 12.6 */
238  assert((len & (ALIGN-1))==0);
239  len /= sizeof(*addr);
240  assert(len>0);
241 
242  for (i=0; i<len; i++) {
243  *new_addr = *addr;
244  if (i>0) {
245  if (*(addr+delta)>=len)
246  assert(i>0 ? *(addr+delta)<len : TRUE);
247  }
248  assert(VALID_ADDRESS(new_addr));
249  *(addr+delta) = (long)new_addr + 1; /* Set low bit */
250 #ifdef prlDEBUG
251  if (*(addr+delta) & 1 == 0)
252  printf ("compress: could be a bug ...\n");
253 #endif
254  addr++;
255  new_addr++;
256  }
257  }
258  else
259  addr++;
260  }
261  other_pointer=stack_pointer; /* 10.6 this var. is unused */
262  stack_pointer=new_addr;
263 
264  /* Compressing the heap: */
265 
266  addr=new_addr=mem_limit;
267  addr--; /* PVR fix: adding this statement avoids accessing beyond */
268  /* the memory's edge, which causes a segmentation fault on*/
269  /* SPARC. */
270  while (addr>=heap_pointer) {
271  skip_addr:
272  len= *(addr+delta);
273  if (len) {
274  if (len!=LONELY) {
275 
276  if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN;
277  assert((len & (ALIGN-1))==0);
278  len /= sizeof (*addr);
279  assert(len>0);
280 
281  } else { /* len==LONELY */
282  GENERIC a;
283 
284  if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN;
285  assert((len & (ALIGN-1))==0);
286  len /= sizeof (*addr);
287  assert(len==1);
288 
289  /* Check if the LONELY field is actually part of a block. */
290  /* If so, skip to the beginning of the block. */
291  a=addr;
292  do {
293  a--;
294  } while (a>=heap_pointer &&
295  (*(a+delta)==0 || *(a+delta)==LONELY));
296  if (a>=heap_pointer && *(a+delta)/sizeof(*a)+a>addr) {
297  addr=a;
298  goto skip_addr;
299  }
300  }
301 
302  /* Move a block or an isolated LONELY field. */
303  addr += len;
304  for (i=0; i<len; i++) {
305  addr--;
306  new_addr--;
307  *new_addr = *addr;
308  assert(VALID_ADDRESS(new_addr));
309  *(addr+delta) = (long)new_addr + 1;
310  }
311  }
312  addr--;
313  }
314  heap_pointer=new_addr;
315 }
316 
317 #define UNCHECKED(P) (! *((GENERIC)(P)+delta))
318 
335 #ifdef CLIFE
336 long unchecked (GENERIC *p, long len)
337 #else
338 static long unchecked (GENERIC *p, long len)
339 #endif /* CLIFE */
340 {
341  GENERIC addr;
342  long result=FALSE, value;
343 
344  assert(len>0);
345  if ((unsigned long)*p>MAX_BUILT_INS) {
346 #ifdef GCTEST
347  if (!VALID_ADDRESS(*p)) {
348  printf("p=%lx,*p=%lx\n",p,*p);
349  }
350 #endif
351  assert(VALID_ADDRESS(*p));
352  addr = *p + delta;
353  value = *addr;
354  switch (pass) {
355  case 1:
356 #ifdef GCTEST
357  if (FALSE /* len>100 || value>100 13.8 */) {
358  /* This does in fact happen */
359  printf("len=%ld,value=%ld\n",len,value);
360  fflush(stdout);
361  }
362 #endif
363  /* if (!value) */
364  if (!value || value==LONELY) {
365  /* Pointer not yet explored */
366  result=TRUE;
367  *addr=len;
368 #ifdef prlDEBUG
369  amount_used+=len;
370 #endif
371  }
372  else if (value < len && len != LONELY) {
373  Errorline("in garbage collection, %d < %d.\n", value, len);
374  }
375  else if (value > len && len != LONELY) {
376  Errorline("in garbage collection, %d > %d.\n", value, len);
377  }
378  break;
379  case 2:
380  if (value & 1) { /* If low bit set */
381  value--; /* Reset low bit */
382  *addr=value;
383 #ifdef prlDEBUG
384  amount_used+=len;
385 #endif
386  result=TRUE;
387  }
388  if (!VALID_ADDRESS(value))
389  assert(VALID_ADDRESS(value));
390  *p = (GENERIC) value;
391  break;
392  }
393  }
394  return result;
395 }
396 
405 static void check_string (GENERIC *s)
406 {
407  GENERIC addr;
408  long value;
409  long bytes;
410 
411  if ((unsigned long) *s > MAX_BUILT_INS) {
412  switch (pass) {
413  case 1:
414  bytes=strlen((char *)*s)+1;
415  /* if (bytes==LONELY) {
416  fprintf(stderr,"Caught an empty string!\n");
417  fflush(stderr);
418  } */
419  /* Make sure there's no conflict with LONELY (this occurs for an */
420  /* empty string, which still needs a single byte of storage). */
421  /* This does occasionally happen. */
422  (void)unchecked((GENERIC *)s, (bytes==LONELY)?bytes+1:bytes); // added cast DJD 12/8/2016
423  break;
424  case 2:
425  addr=(*s+delta);
426  value= *addr;
427  if (value & 1) { /* If low bit set */
428  value--;
429  *s=(GENERIC)value;
430  *addr=value;
431 #ifdef prlDEBUG
432  amount_used+=strlen(*s)+1;
433 #endif
434  }
435  *s=(GENERIC)value;
436  break;
437  }
438  }
439 }
440 
441 /* DENYS: BYTEDATA */
450 static void check_bytedata(GENERIC *s)
451 {
452  GENERIC addr;
453  long value;
454  if ((unsigned long) *s > MAX_BUILT_INS) {
455  unsigned long bytes = *((unsigned long *) *s);
456  unsigned long size = bytes + sizeof(bytes);
457  switch (pass) {
458  case 1:
459  (void)unchecked((GENERIC *)s,size);
460  break;
461  case 2:
462  addr=(*s+delta);
463  value= *addr;
464  if (value & 1) {
465  value--;
466  *s=(GENERIC) value;
467  *addr=value;
468 #ifdef prlDEBUG
469  amount_used+=size;
470 #endif
471  }
472  *s=(GENERIC)value;
473  break;
474  }
475  }
476 }
477 
486 static void check_code(ptr_int_list *c)
487 {
488  while (unchecked((GENERIC *)c,sizeof(int_list))) // added cast DJD 12/8/2016
489  c= &((*c)->next);
490 }
491 
501 {
502  while (unchecked((GENERIC *)p,sizeof(pair_list))) { // added cast DJD 12/8/2016
503  check_psi_term(&((*p)->aaaa_2));
504  check_psi_term(&((*p)->bbbb_2));
505  p= &((*p)->next);
506  }
507 }
508 
518 {
519  while (unchecked((GENERIC *)p,sizeof(triple_list))) { // added cast DJD 12/8/2016
520  check_psi_term(&((*p)->aaaa_4));
521  check_psi_term(&((*p)->bbbb_4));
522  check_definition(&((*p)->cccc_4));
523  p= &((*p)->next);
524  }
525 }
526 
535 static void check_kids(ptr_int_list *c)
536 {
537  while (unchecked((GENERIC *) c,sizeof(int_list))) { // added cast DJD 12/8/2016
538  check_definition((ptr_definition *)&((*c)->value_1));
539  c= &((*c)->next);
540  }
541 }
542 
552 {
553  while (unchecked((GENERIC *) op,sizeof(operator_data))) { // added cast DJD 12/8/2016
554  op = &((*op)->next);
555  }
556 }
557 
558 static void check_module();
559 // void check_hash_table(); /* RM: Feb 3 1993 */
560 static void check_keyword(); /* RM: Jan 12 1993 */
561 
570 static void check_module_list(ptr_int_list *c) /* RM: Jan 12 1993 */
571 {
572  while (unchecked((GENERIC *)c,sizeof(int_list))) { // added cast DJD 12/8/2016
573  check_module(&((*c)->value_1));
574  c= &((*c)->next);
575  }
576 }
577 
578 
587 static void check_module_tree(ptr_node *n) /* RM: Jan 13 1993 */
588 {
589  if (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
590  check_module_tree(&((*n)->left));
591  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
592  check_module(&((*n)->data));
593  check_module_tree(&((*n)->right));
594  }
595 }
596 
605 static void check_module(ptr_module *m) /* RM: Jan 12 1993 */
606 {
607  if(unchecked((GENERIC *)m,sizeof(struct wl_module))) { // added cast DJD 12/8/2016
608  check_string((GENERIC *)&((*m)->module_name)); // added cast DJD 12/8/2016
609  check_string((GENERIC *)&((*m)->source_file)); // added cast DJD 12/8/2016
610  check_module_list(&((*m)->open_modules));
611  check_module_list(&((*m)->inherited_modules));
612  check_hash_table((*m)->symbol_table);
613  }
614 }
615 
625 void check_hash_table(ptr_hash_table table) /* RM: Feb 3 1993 */
626 {
627  long i;
628 
629  for(i=0;i<table->size;i++)
630  if(table->data[i])
631  check_keyword((ptr_keyword *)&(table->data[i]));
632 }
633 
642 static void check_keyword(ptr_keyword *k) /* RM: Jan 12 1993 */
643 {
644  if(unchecked((GENERIC *)k,sizeof(struct wl_keyword))) { // added cast DJD 12/8/2016
645  check_module(&((*k)->module));
646  check_string((GENERIC *)&((*k)->symbol)); // added cast DJD 12/8/2016
647  check_string((GENERIC *)&((*k)->combined_name)); // added cast DJD 12/8/2016
648  check_definition(&((*k)->definition));
649  }
650 }
651 
663 {
664  if(unchecked((GENERIC *)d,sizeof(definition))) { // added cast DJD 12/8/2016
665 
666  check_keyword((ptr_keyword *)&((*d)->keyword)); /* RM: Jan 12 1993 */ // added cast DJD 12/8/2016
667 
668 #ifdef prlDEBUG
669  printf("%lx %20s %ld\n",*d,(*d)->keyword->symbol,amount_used);
670 #endif
671 
672  check_code((ptr_int_list *)&((*d)->code)); // added cast DJD 12/8/2016
673  check_pair_list((ptr_pair_list *)&((*d)->rule)); // added cast DJD 12/8/2016
674  check_triple_list(&((*d)->properties));
675 
676  if ((*d)->type_def==(def_type)type_it) {
677  check_kids(&((*d)->parents));
678  check_kids(&((*d)->children));
679  }
680 
681  check_psi_term(&((*d)->global_value)); /* RM: Feb 9 1993 */
682  check_psi_term(&((*d)->init_value)); /* RM: Mar 23 1993 */
683 
684  check_operator_data(&((*d)->op_data)); /* PVR 5.6 */
685 
686 #ifdef CLIFE
687  check_block_def(&((*d)->block_def)); /* RM: Jan 27 1993 */
688 #endif /* CLIFE */
689  }
690 }
691 
699 void check_definition_list() /* RM: Feb 15 1993 */
700 {
701  ptr_definition *d;
702 
703  d= &first_definition;
704 
705  while(*d) {
706  check_definition(d);
707  d= &((*d)->next);
708  }
709 }
710 
721 {
722  if (unchecked((GENERIC *)d,sizeof(definition))) // added cast DJD 12/8/2016
723  check_code((ptr_int_list *)&((*d)->code)); // added cast DJD 12/8/2016
724  /* p = &((*d)->properties); */
725  /* check_def_prop(p); */
726 }
727 
738 {
739  if (*d) {
740  check_keyword((ptr_keyword *)&((*d)->keyword)); /* RM: Jan 12 1993 */ // added cast DJD 12/8/2016
741  check_pair_list((ptr_pair_list *)&((*d)->rule)); // added cast DJD 12/8/2016
742  check_triple_list(&((*d)->properties));
743 
744  if ((*d)->type_def==(def_type)type_it) {
745  check_kids(&((*d)->parents));
746  check_kids(&((*d)->children));
747  }
748  check_operator_data(&((*d)->op_data)); /* PVR 5.6 */
749 #ifdef CLIFE
750  check_block_def(&((*d)->block_def)); /*CB 25/01/93 */
751 #endif /* CLIFE */
752  }
753 }
754 
764 static void check_symbol(ptr_node *n)
765 {
766  if (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
767  check_symbol(&((*n)->left));
768  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
769  check_keyword((ptr_keyword *)&((*n)->data)); /* RM: Jan 12 1993 */ // added cast DJD 12/8/2016
770  check_symbol(&((*n)->right));
771  }
772 }
773 
783 {
784  while (unchecked((GENERIC *)p,sizeof(int_list))) { // added cast DJD 12/8/2016
785  check_definition((struct wl_definition **)&((*p)->value_1));
786  p= &((*p)->next);
787  }
788 }
789 
800 static void check_goal_stack(ptr_goal *g)
801 {
802  while (unchecked((GENERIC *)g,sizeof(goal))) { // added cast DJD 12/8/2016
803 
804  switch ((*g)->type) {
805 
806  case fail:
807  break;
808 
809  case unify:
810  case unify_noeval: /* PVR 5.6 */
811  check_psi_term(&((*g)->aaaa_1));
812  check_psi_term(&((*g)->bbbb_1));
813  break;
814 
815  case prove:
816  check_psi_term(&((*g)->aaaa_1));
817  if ((unsigned long)(*g)->bbbb_1!=DEFRULES) check_pair_list((ptr_pair_list *)&((*g)->bbbb_1)); // added cast DJD 12/8/2016
818  check_pair_list((ptr_pair_list *)&((*g)->cccc_1)); // added cast DJD 12/8/2016
819  break;
820 
821  case disj:
822  check_psi_term(&((*g)->aaaa_1));
823  check_psi_term(&((*g)->bbbb_1));
824  break;
825 
826  case what_next:
827  /* check_choice(&((*g)->bbbb_1)); */
828  break;
829 
830  case eval:
831  check_psi_term(&((*g)->aaaa_1));
832  check_psi_term(&((*g)->bbbb_1));
833  check_pair_list((ptr_pair_list *)&((*g)->cccc_1)); // added cast DJD 12/8/2016
834  break;
835 
836  case load:
837  check_psi_term(&((*g)->aaaa_1));
838  check_string((GENERIC *)&((*g)->cccc_1)); // added cast DJD 12/8/2016
839  break;
840 
841  case match:
842  check_psi_term(&((*g)->aaaa_1));
843  check_psi_term(&((*g)->bbbb_1));
844  check_resid_block((struct wl_resid_block **)&((*g)->cccc_1));
845  break;
846 
847  case general_cut:
848  /* assert((GENERIC)(*g)->aaaa_3 <= (GENERIC)choice_stack); 12.7 17.7 */
849  if (pass==1 && (ptr_choice_point)(*g)->aaaa_1>choice_stack)
850  (*g)->aaaa_1=(ptr_psi_term)choice_stack;
851  (void)unchecked((GENERIC *)&((*g)->aaaa_1),LONELY); // added cast DJD 12/8/2016
852  break;
853 
854  case eval_cut:
855  check_psi_term(&((*g)->aaaa_1));
856  /* assert((GENERIC)(*g)->bbbb_1 <= (GENERIC)choice_stack); 12.7 17.7 */
857  if (pass==1 && (ptr_choice_point)(*g)->bbbb_1>choice_stack)
858  (*g)->bbbb_1=(ptr_psi_term)choice_stack;
859  (void)unchecked((GENERIC *)&((*g)->bbbb_1),LONELY); // added cast DJD 12/8/2016
860  check_resid_block((struct wl_resid_block **)&((*g)->cccc_1));
861  break;
862 
863  case freeze_cut:
864  case implies_cut:
865  check_psi_term(&((*g)->aaaa_1));
866  /* assert((GENERIC)(*g)->bbbb_1 <= (GENERIC)choice_stack); 12.7 17.7 */
867  if (pass==1 && (ptr_choice_point)(*g)->bbbb_1>choice_stack)
868  (*g)->bbbb_1=(ptr_psi_term)choice_stack;
869  (void)unchecked((GENERIC *)&((*g)->bbbb_1),LONELY); // added cast DJD 12/8/2016
870  check_resid_block((struct wl_resid_block **)&((*g)->cccc_1));
871  break;
872 
873  case type_disj:
874  check_psi_term(&((*g)->aaaa_1));
875  check_type_disj((ptr_int_list *)&((*g)->bbbb_1)); // added cast DJD 12/8/2016
876  break;
877 
878  case clause:
879  check_psi_term(&((*g)->aaaa_1));
880  check_psi_term(&((*g)->bbbb_1));
881  (void)unchecked((GENERIC *)&((*g)->cccc_1),LONELY); // added cast DJD 12/8/2016
882  /* check_pair_list((*g)->cccc_1); */ /* 6.8 */
883  break;
884 
885  case del_clause:
886  check_psi_term(&((*g)->aaaa_1));
887  check_psi_term(&((*g)->bbbb_1));
888  (void)unchecked((GENERIC *)&((*g)->cccc_1),LONELY); // added cast DJD 12/8/2016
889  /* check_pair_list((*g)->cccc_1); */ /* 6.8 */
890  break;
891 
892  case retract:
893  (void)unchecked((GENERIC *)&((*g)->aaaa_1),LONELY); // added cast DJD 12/8/2016
894  /* check_pair_list((*g)->aaaa_1); */ /* 6.8 */
895  /*PVR*/ /* check_choice(&((*g)->bbbb_1)); 9.6 */
896  break;
897 
898  default:
899  Errorline("in garbage collection, bad goal on stack.\n");
900  }
901 
902  g= &((*g)->next);
903  }
904 }
905 
915 {
916  ptr_int_list code;
917  ptr_list *l;
918 
919  while (unchecked((GENERIC *)r,sizeof(residuation))) { // added cast DJD 12/8/2016
920 
921  if ((*r)->sortflag) /* 22.9 */
922  check_definition((struct wl_definition **)&((*r)->bestsort));
923  else
924  check_code((ptr_int_list *)&((*r)->bestsort)); /* 21.9 */ // added cast DJD 12/8/2016
925 
926  /* Handling of the value field (6.10) */
927  code = (*r)->sortflag ? ((ptr_definition)((*r)->bestsort))->code
928  : (ptr_int_list)(*r)->bestsort;
929  /* Copied (almost) verbatim from check_psi_term: */
930  if ((*r)->value_2) {
931  if (code==alist->code) { /* RM: Dec 15 1992 Will be removed */
932  l=(ptr_list *) &((*r)->value_2);
933  if (l)
934  printf("Found an old list!!\n");
935  }
936  else if (sub_CodeType(code,real->code))
937  (void)unchecked((GENERIC *)&((*r)->value_2),sizeof(REAL)); // added cast DJD 12/8/2016
938  else if (sub_CodeType(code,quoted_string->code))
939  check_string((GENERIC *)&((*r)->value_2)); // added cast DJD 12/8/2016
940  /* DENYS: BYTEDATA */
941  else if (sub_CodeType(code,sys_bytedata->code))
942  check_bytedata(&((*r)->value_2));
943  else if (sub_CodeType(code,cut->code)) {
944  if (pass==1 && (*r)->value_2>(GENERIC)choice_stack)
945  (*r)->value_2=(GENERIC)choice_stack;
946  (void)unchecked((GENERIC *)&((*r)->value_2),LONELY); // added cast DJD 12/8/2016
947  }
948  else if (sub_CodeType(code,variable->code)) /* 8.8 */
949  check_string((GENERIC *)&((*r)->value_2)); // added cast DJD 12/8/2016
950  }
951 
952  check_goal_stack((ptr_goal *)&((*r)->goal)); // added cast DJD 12/8/2016
953  r= &((*r)->next);
954  }
955 }
956 
966 {
967  if (*rb) {
968  if (unchecked((GENERIC *)rb,sizeof(resid_block))) { // added cast DJD 12/8/2016
969  check_goal_stack((ptr_goal *)&((*rb)->ra)); // added cast DJD 12/8/2016
970  check_resid_list(&((*rb)->rv)); /* 21.9 */
971  /* unchecked(&((*rb)->rl),LONELY); 12.6 */ /* 10.6 */
972  (void)unchecked((GENERIC *)&((*rb)->md),LONELY); /* 10.6 */ // added cast DJD 12/8/2016
973  /* check_goal_stack(&((*rb)->rl)); 10.6 */
974  /* check_psi_term(&((*rb)->md)); 10.6 */
975  }
976  }
977 }
978 
988 {
989  ptr_list *l;
990 
991  while (unchecked((GENERIC *)t,sizeof(psi_term))) { // added cast DJD 12/8/2016
992 
993  /* A psi-term on the heap has no residuation list. */
994  if (pass==1 && (GENERIC)(*t)>=heap_pointer && (GENERIC)(*t)<mem_limit) {
995  assert((*t)->resid==NULL);
996  }
997  check_definition(&((*t)->type));
998  check_attr(&((*t)->attr_list));
999 
1000  if ((*t)->value_3) {
1001 
1002  if ((*t)->type==alist) { /* RM: Dec 15 1992 Should be removed */
1003  l=(ptr_list *) &((*t)->value_3);
1004  if (l)
1005  printf("Found an old list!\n");
1006  }
1007  else
1008 
1009  if (sub_type((*t)->type,real))
1010  (void)unchecked((GENERIC *)&((*t)->value_3),sizeof(REAL)); // added cast DJD 12/8/2016
1011  else if (sub_type((*t)->type,quoted_string))
1012  check_string((GENERIC *)&((*t)->value_3)); // added cast DJD 12/8/2016
1013  /* DENYS: BYTEDATA */
1014  else if (sub_type((*t)->type,sys_bytedata))
1015  check_bytedata(&((*t)->value_3));
1016 #ifdef CLIFE
1017  else if ((*t)->type->type==block) { /* RM: Jan 27 1993 */
1018  check_block_value(&((*t)->value_3));
1019  }
1020 #endif /* CLIFE */
1021  else if ((*t)->type==cut) { /* RM: Oct 28 1993 */
1022  /* assert((*t)->value_3 <= (GENERIC)choice_stack); 12.7 17.7 */
1023  if (pass==1 && (*t)->value_3>(GENERIC)choice_stack)
1024  (*t)->value_3=(GENERIC)choice_stack;
1025  (void)unchecked((GENERIC *)&((*t)->value_3),LONELY); // added cast DJD 12/8/2016
1026  }
1027  else if (sub_type((*t)->type,variable)) /* 8.8 */
1028  check_string((GENERIC *)&((*t)->value_3)); // added cast DJD 12/8/2016
1029  else if ((*t)->type!=stream)
1030  Errorline("non-NULL value field in garbage collector, type='%s', value=%d.\n",
1031  (*t)->type->keyword->combined_name,
1032  (*t)->value_3);
1033  }
1034 
1035  /* check_psi_term(&((*t)->coref)); 9.6 */
1036  if ((*t)->resid)
1037  check_resid((ptr_residuation *)&((*t)->resid)); // added cast DJD 12/8/2016
1038 
1039  t = &((*t)->coref);
1040  }
1041 }
1042 
1055 {
1056  while (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
1057  check_attr(&((*n)->left));
1058  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
1059  check_psi_term((struct wl_psi_term **)&((*n)->data));
1060 
1061  n = &((*n)->right);
1062  /* check_attr(&((*n)->right)); 9.6 */
1063  }
1064 }
1065 
1079 {
1080  long i;
1081 
1082  if (unchecked((GENERIC *)&gamma_table,type_count*sizeof(ptr_definition))) { // added cast DJD 12/8/2016
1083  for (i=0;i<type_count;i++)
1084  check_def_code(&(gamma_table[i]));
1085  }
1086 }
1087 
1095 static void check_gamma_rest()
1096 {
1097  long i;
1098 
1099  for (i=0;i<type_count;i++)
1100  check_def_rest(&(gamma_table[i]));
1101 }
1102 
1114 {
1115  while (unchecked((GENERIC *)s,sizeof(stack))) { // added cast DJD 12/8/2016
1116 
1117  switch((*s)->type) {
1118 
1119  case psi_term_ptr:
1120  check_psi_term((struct wl_psi_term **)&((*s)->bbbb_3));
1121  break;
1122 
1123  case resid_ptr:
1124  check_resid((ptr_residuation *)&((*s)->bbbb_3)); // added cast DJD 12/8/2016
1125  break;
1126 
1127  case int_ptr:
1128  /* int_ptr's are used to trail time_stamps, so they can get large. */
1129  break;
1130 
1131  case def_ptr:
1132  check_definition((struct wl_definition **)&((*s)->bbbb_3));
1133  break;
1134 
1135  case code_ptr:
1136  check_code((ptr_int_list *)&((*s)->bbbb_3)); // added cast DJD 12/8/2016
1137  break;
1138 
1139  case goal_ptr:
1140  check_goal_stack((ptr_goal *)&((*s)->bbbb_3)); // added cast DJD 12/8/2016
1141  break;
1142 
1143  case cut_ptr: /* 22.9 */
1144  break;
1145 #ifdef CLIFE
1146  case block_ptr: /* CB: Jan 28 1993 */
1147  check_block_value(&((*s)->bbbb_3));
1148  break;
1149 
1150 #endif /* CLIFE */
1151  /* All undo actions here */
1152  case destroy_window:
1153  case show_window:
1154  case hide_window:
1155  /* No pointers to follow */
1156  break;
1157  }
1158 
1159  s= &((*s)->next);
1160  }
1161 }
1162 
1170 {
1171  while(unchecked((GENERIC *)c,sizeof(choice_point))) { // added cast DJD 12/8/2016
1172  c= &((*c)->next);
1173  }
1174 }
1175 
1185 {
1186  while(*c) {
1187  check_undo_stack(&((*c)->undo_point)); /* 17.7 */
1188  check_goal_stack((ptr_goal *)&((*c)->goal_stack)); // added cast DJD 12/8/2016
1189  c= &((*c)->next);
1190  }
1191 }
1192 
1203 {
1204  ptr_choice_point c;
1205  ptr_stack p;
1206  // ptr_goal g;
1207 
1208  c=choice_stack;
1209  while(c) {
1210  /* unchecked(&(c->undo_point),LONELY); 17.7 */
1211  (void)unchecked((GENERIC *)&(c->stack_top),LONELY); // added cast DJD 12/8/2016
1212  c=c->next;
1213  }
1214 
1215  p=undo_stack;
1216  while (p) {
1217  if (!(p->type & undo_action)) {
1218  /* Only update an address if it's within the Life data space! */
1219  if (VALID_RANGE(p->aaaa_3)) (void)unchecked((GENERIC *)&(p->aaaa_3),LONELY); // added cast DJD 12/8/2016
1220  if (p->type==cut_ptr) (void)unchecked((GENERIC *)&(p->bbbb_3),LONELY); /* 22.9 */ // added cast DJD 12/8/2016
1221  }
1222  p=p->next;
1223  }
1224 }
1225 
1236 {
1237  while(unchecked((GENERIC *)l,sizeof(int_list))) { // added cast DJD 12/8/2016
1238  check_psi_term((struct wl_psi_term **)&((*l)->value_1));
1239  l= &((*l)->next);
1240  }
1241 }
1242 
1253 {
1254  while(unchecked((GENERIC *)l,sizeof(resid_list))) { // added cast DJD 12/8/2016
1255  check_psi_term(&((*l)->var));
1256  check_psi_term(&((*l)->othervar));
1257  l= &((*l)->next);
1258  }
1259 }
1260 
1270 static void check_var(ptr_node *n)
1271 {
1272  if (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
1273  check_var(&((*n)->left));
1274  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
1275  check_psi_term((struct wl_psi_term **)&((*n)->data));
1276  check_var(&((*n)->right));
1277  }
1278 }
1279 
1299 static void check()
1300 {
1301 #ifdef prlDEBUG
1302  amount_used=0;
1303 #endif
1304 
1305  /* First of all, get all the codes right so that data type-checking remains
1306  coherent.
1307 
1308  Kids and Parents cannot be checked because the built-in types have codes
1309  which might have been moved.
1310  */
1311  /* print_undo_stack(); */
1312 
1313 
1314  check_choice_structs(&choice_stack); /* RM: Oct 28 1993 */
1315 
1317  check_gamma_code();
1318 
1319  /* Now, check the rest of the definitions and all global roots */
1320 
1321  check_gamma_rest();
1322 
1324 
1325  check_definition(&abortsym); /* 26.1 */
1326  check_definition(&aborthooksym); /* 26.1 */
1327 
1328  check_definition(&add_module1); /* RM: Mar 12 1993 */
1331 
1334  check_definition(&boolean);
1340  /* check_definition(&conjunction); 19.8 */
1344  check_definition(&disj_nil); /* RM: Feb 16 1993 */
1353  check_definition(&life_or); /* RM: Apr 6 1993 */
1354  check_definition(&minus_symbol); /* RM: Jun 21 1993 */
1355  check_definition(&nil); /* RM: Dec 9 1992 */
1367  check_definition(&tracesym); /* 26.1 */
1376  /* check_definition(&provesym); */
1389 
1390  /* RM: Jul 7 1993 */
1393 
1395 
1396 #ifdef X11
1413 #endif
1414 
1415  /* check_psi_term(&empty_list); 5.8 */
1416 
1417  check_string((GENERIC *)&one); // added cast DJD 12/8/2016
1418  check_string((GENERIC *)&two); // added cast DJD 12/8/2016
1419  check_string((GENERIC *)&three); // added cast DJD 12/8/2016
1420  check_string((GENERIC *)&year_attr); // added cast DJD 12/8/2016
1421  check_string((GENERIC *)&month_attr); // added cast DJD 12/8/2016
1422  check_string((GENERIC *)&day_attr); // added cast DJD 12/8/2016
1423  check_string((GENERIC *)&hour_attr); // added cast DJD 12/8/2016
1424  check_string((GENERIC *)&minute_attr); // added cast DJD 12/8/2016
1425  check_string((GENERIC *)&second_attr); // added cast DJD 12/8/2016
1426  check_string((GENERIC *)&weekday_attr); // added cast DJD 12/8/2016
1427 
1434  check_psi_term(&old_state); /* RM: Feb 17 1993 */
1435 
1437 #ifdef X11
1440 #endif
1441 
1443  /* check_choice(&prompt_choice_stack); 12.7 */
1444 
1445 
1446  /* RM: Feb 3 1993 */
1447  /* check_symbol(&symbol_table); */
1448  /* check_definition(&first_definition); */
1449  check_definition_list(); /* RM: Feb 15 1993 */
1450 
1451 
1452  /*** MODULES ***/
1453  /* RM: Jan 13 1993 */
1454 
1458  check_module(&user_module); /* RM: Jan 27 1993 */
1463 
1464  /*** End ***/
1465 
1466 
1467 
1468  check_var(&var_tree);
1469 
1470  check_goal_stack((ptr_goal *)&goal_stack); // added cast DJD 12/8/2016
1471  check_goal_stack((ptr_goal *)&aim); /* 7.10 */ // added cast DJD 12/8/2016
1472 
1473  if (TRUE /*resid_aim 10.6 */) check_resid_list(&resid_vars); /* 21.9 */
1474 
1475  check_goal_stack((ptr_goal *)&resid_aim); // added cast DJD 12/8/2016
1476 
1479 
1482 
1484 }
1485 
1492 void print_gc_info(long timeflag)
1493 {
1494  fprintf(stderr," [%ld%% free (%ldK), %ld%% heap, %ld%% stack",
1495  (100*((unsigned long)heap_pointer-(unsigned long)stack_pointer)+mem_size/2)/mem_size,
1496  ((unsigned long)heap_pointer-(unsigned long)stack_pointer+512)/1024,
1497  (100*((unsigned long)mem_limit-(unsigned long)heap_pointer)+mem_size/2)/mem_size,
1498  (100*((unsigned long)stack_pointer-(unsigned long)mem_base)+mem_size/2)/mem_size);
1499  if (timeflag) {
1500  fprintf(stderr,", %1.3fs cpu (%ld%%)",
1501  gc_time,
1502  (unsigned long)(0.5+100*gc_time/(life_time+gc_time)));
1503  }
1504  fprintf(stderr,"]\n");
1505 }
1506 
1507 
1529 void garbage()
1530 {
1531  GENERIC addr;
1532  struct tms garbage_start_time,garbage_end_time;
1533  long start_number_cells, end_number_cells;
1534 
1535  start_number_cells = (stack_pointer-mem_base) + (mem_limit-heap_pointer);
1536 
1537  (void)times(&garbage_start_time);
1538 
1539  /* Time elapsed since last garbage collection */
1540  life_time=(garbage_start_time.tms_utime - last_garbage_time.tms_utime)/60.0;
1541 
1542 
1543  if (verbose) {
1544  fprintf(stderr,"*** Garbage Collect "); /* RM: Jan 26 1993 */
1545  fprintf(stderr,"\n*** Begin");
1547  (void)fflush(stderr);
1548  }
1549 
1550 
1551  /* reset the other base */
1552  for (addr = other_base; addr < other_limit; addr ++)
1553  *addr = 0;
1554 
1555  pass=1;
1556 
1557  check();
1558 #ifdef GCVERBOSE
1559  fprintf(stderr,"- Done pass 1 ");
1560 #endif
1561 
1563  compress();
1564 #ifdef GCVERBOSE
1565  fprintf(stderr,"- Done compress ");
1566 #endif
1567 
1568  pass=2;
1569 
1570  check();
1572 #ifdef GCVERBOSE
1573  fprintf(stderr,"- Done pass 2\n");
1574 #endif
1575 
1576  clear_copy();
1577 
1580 
1581  (void)times(&garbage_end_time);
1582  gc_time=(garbage_end_time.tms_utime - garbage_start_time.tms_utime)/60.0;
1584 
1585  if (verbose) {
1586  fprintf(stderr,"*** End ");
1587  print_gc_info(TRUE); /* RM: Jan 26 1993 */
1588  stack_info(stderr);
1589  (void)fflush(stderr);
1590  }
1591 
1592  last_garbage_time=garbage_end_time;
1593 
1594  end_number_cells = (stack_pointer-mem_base) + (mem_limit-heap_pointer);
1595  assert(end_number_cells<=start_number_cells);
1596 
1597  ignore_eff=FALSE;
1598 
1599 }
1600 
1601 /****************************************************************************
1602  MEMORY ALLOCATION ROUTINES.
1603 */
1604 
1617 {
1618  if (s & (ALIGN-1))
1619  s = s - (s & (ALIGN-1))+ALIGN;
1620  /* assert(s % sizeof(*heap_pointer) == 0); */
1621  s /= sizeof (*heap_pointer);
1622 
1623  heap_pointer -= s;
1624 
1626  Errorline("the heap overflowed into the stack.\n");
1627 
1628  return heap_pointer;
1629 }
1630 
1643 {
1644  GENERIC r;
1645 
1646  r = stack_pointer;
1647 
1648  if (s & (ALIGN-1))
1649  s = s - (s & (ALIGN-1)) + ALIGN;
1650  /* assert(s % sizeof(*stack_pointer) == 0); */
1651  s /= sizeof (*stack_pointer);
1652 
1653  stack_pointer += s;
1654 
1656  Errorline("the stack overflowed into the heap.\n");
1657 
1658  return r;
1659 }
1660 
1672 {
1674  mem_size=alloc_words*sizeof(long);
1675 
1676  mem_base = (GENERIC) malloc(mem_size);
1677  other_base = (GENERIC) malloc(mem_size);
1678 
1679  if (mem_base && other_base) {
1680  /* Rewrote some rather poor code... RM: Mar 1 1994 */
1681  ALIGNUP(mem_base);
1683 
1684  mem_limit=mem_base+alloc_words-2;
1685  ALIGNUP(mem_limit);
1687 
1690 
1691  other_limit=other_base+alloc_words-2;
1693 
1695  buffer = (char *) malloc (PRINT_BUFFER); /* The printing buffer */
1696 
1697  /* RM: Oct 22 1993 */
1698  /* Fill the memory with rubbish data */
1699  /*
1700  {
1701  int i;
1702 
1703  for(i=0;i<alloc_words;i++) {
1704  mem_base[i]= -1234;
1705  other_base[i]= -1234;
1706  }
1707  }
1708  */
1709  }
1710  else
1711  Errorline("Wild_life could not allocate sufficient memory to run.\n\n");
1712 }
1713 
1724 {
1725  long success=TRUE;
1726 
1728  if(verbose) fprintf(stderr,"\n"); /* RM: Feb 1 1993 */
1729  garbage();
1730  /* Abort if didn't recover at least GC_THRESHOLD/10 of memory */
1732  fprintf(stderr,"*********************\n");
1733  fprintf(stderr,"*** OUT OF MEMORY ***\n");
1734  fprintf(stderr,"*********************\n");
1735  fail_all();
1736  success=FALSE;
1737  }
1738  }
1739  return success;
1740 }
1741 
1742 
1743 
#define VALID_ADDRESS(A)
Definition: def_macro.h:132
#define prove
Definition: def_const.h:273
ptr_definition encodesym
Definition: def_glob.h:116
static void check_type_disj(ptr_int_list *p)
check_type_disj
Definition: memory.c:782
ptr_definition such_that
Definition: def_glob.h:105
ptr_definition boolpredsym
Definition: def_glob.h:74
ptr_keyword * data
Definition: def_struct.h:114
static void check_undo_stack()
ptr_node printed_pointers
Definition: def_glob.h:28
ptr_definition abortsym
Definition: def_glob.h:64
long memory_check()
memory_check
Definition: memory.c:1723
ptr_definition timesym
Definition: def_glob.h:108
GENERIC stack_alloc(long s)
stack_alloc
Definition: memory.c:1642
static void check_resid_list()
static void check_bytedata(GENERIC *s)
check_bytedata
Definition: memory.c:450
#define ALLOC_WORDS
Definition: def_config.h:10
static void check()
check
Definition: memory.c:1299
ptr_definition xfy_sym
Definition: def_glob.h:127
ptr_definition staticsym
Definition: def_glob.h:115
void clear_copy()
clear_copy
Definition: copy.c:53
ptr_psi_term stdin_state
Definition: def_glob.h:200
static void check_resid(ptr_residuation *r)
check_resid
Definition: memory.c:914
ptr_definition loadsym
Definition: def_glob.h:113
ptr_goal goal_stack
Definition: def_glob.h:50
#define show_window
Definition: def_const.h:184
GENERIC mem_limit
Definition: def_glob.h:13
ptr_module current_module
Definition: def_glob.h:161
ptr_definition dynamicsym
Definition: def_glob.h:114
ptr_definition opsym
Definition: def_glob.h:112
long type_count
Definition: def_glob.h:46
ptr_definition comment
Definition: def_glob.h:80
ptr_definition xdisplaylist
Definition: def_glob.h:211
static float gc_time
Definition: memory.c:27
#define VALID_RANGE(A)
Definition: def_macro.h:122
#define def_ptr
Definition: def_const.h:173
ptr_definition stream
Definition: def_glob.h:103
void fail_all()
fail_all
Definition: memory.c:188
ptr_psi_term xevent_list
Definition: def_glob.h:208
static void check_goal_stack(ptr_goal *g)
check_goal_stack
Definition: memory.c:800
ptr_definition xbutton_event
Definition: def_glob.h:211
int alloc_words
Definition: def_glob.h:10
ptr_definition listingsym
Definition: def_glob.h:117
static void check_operator_data(ptr_operator_data *op)
check_operator_data
Definition: memory.c:551
ptr_psi_term old_state
Definition: def_glob.h:142
long verbose
Definition: def_glob.h:273
char * two
Definition: def_glob.h:251
GENERIC * bbbb_3
Definition: def_struct.h:218
ptr_definition commasym
Definition: def_glob.h:79
static long delta
Definition: memory.c:12
#define general_cut
Definition: def_const.h:282
ptr_psi_term null_psi_term
Definition: def_glob.h:140
int mem_size
Definition: def_glob.h:9
static void check_string(GENERIC *s)
check_string
Definition: memory.c:405
#define implies_cut
Definition: def_const.h:281
ptr_definition fy_sym
Definition: def_glob.h:125
static void check_special_addresses()
check_special_addresses
Definition: memory.c:1202
#define DEFRULES
Definition: def_const.h:138
static long pass
Definition: memory.c:21
#define destroy_window
Definition: def_const.h:183
ptr_definition aborthooksym
Definition: def_glob.h:65
ptr_definition xexpose_event
Definition: def_glob.h:211
ptr_definition constant
Definition: def_glob.h:82
GENERIC stack_top
Definition: def_struct.h:236
ptr_keyword keyword
Definition: def_struct.h:124
ptr_module user_module
Definition: def_glob.h:156
static void check_pair_list(ptr_pair_list *p)
check_pair_list
Definition: memory.c:500
GENERIC other_base
Definition: def_glob.h:19
ptr_definition top
Definition: def_glob.h:106
#define cut_ptr
Definition: def_const.h:176
#define NULL
Definition: def_const.h:203
ptr_node var_tree
Definition: def_glob.h:26
ptr_psi_term input_state
Definition: def_glob.h:199
GENERIC other_pointer
Definition: def_glob.h:21
ptr_definition quote
Definition: def_glob.h:100
long ignore_eff
Definition: def_glob.h:151
static void check_module()
GENERIC heap_alloc(long s)
heap_alloc
Definition: memory.c:1616
char * three
Definition: def_glob.h:252
char * symbol
Definition: def_struct.h:91
ptr_definition apply
Definition: def_glob.h:72
ptr_definition xgc
Definition: def_glob.h:211
ptr_goal resid_aim
Definition: def_glob.h:220
ptr_choice_point next
Definition: def_struct.h:235
#define REAL
Definition: def_const.h:72
ptr_definition xmotion_event
Definition: def_glob.h:211
static long unchecked(GENERIC *p, long len)
unchecked
Definition: memory.c:338
ptr_resid_list resid_vars
Definition: def_glob.h:221
struct wl_list * ptr_list
Definition: def_struct.h:38
ptr_definition xmisc_event
Definition: def_glob.h:211
long abort_life(int nlflag)
abort_life
Definition: built_ins.c:2260
#define eval
Definition: def_const.h:278
ptr_node pointer_names
Definition: def_glob.h:29
ptr_definition minus_symbol
Definition: def_glob.h:96
static void check_symbol(ptr_node *n)
check_symbol
Definition: memory.c:764
static void check_choice()
ptr_definition xfx_sym
Definition: def_glob.h:126
long sub_type(ptr_definition t1, ptr_definition t2)
sub_type
Definition: types.c:1642
void check_definition(ptr_definition *d)
check_definition
Definition: memory.c:662
void print_gc_info(long timeflag)
print_gc_info
Definition: memory.c:1492
#define type_it
Definition: def_const.h:363
ptr_definition add_module3
Definition: def_glob.h:69
#define hide_window
Definition: def_const.h:185
ptr_stack undo_stack
Definition: def_glob.h:53
static void check_kids(ptr_int_list *c)
check_kids
Definition: memory.c:535
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
ptr_definition yf_sym
Definition: def_glob.h:124
static void check_def_code(ptr_definition *d)
check_def_code
Definition: memory.c:720
ptr_definition disj_nil
Definition: def_glob.h:85
ptr_definition nullsym
Definition: def_glob.h:129
ptr_definition real
Definition: def_glob.h:102
char * buffer
Definition: def_glob.h:175
ptr_definition alist
Definition: def_glob.h:94
void check_resid_block(ptr_resid_block *rb)
check_resid_block
Definition: memory.c:965
static void check_choice_structs(ptr_choice_point *c)
check_choice_structs
Definition: memory.c:1169
type_ptr type
Definition: def_struct.h:216
ptr_definition functor
Definition: def_glob.h:91
ptr_definition eqsym
Definition: def_glob.h:87
#define freeze_cut
Definition: def_const.h:280
ptr_definition eof
Definition: def_glob.h:86
ptr_definition xkeyboard_event
Definition: def_glob.h:211
#define TRUE
Definition: def_const.h:127
ptr_definition xwindow
Definition: def_glob.h:211
char * name
Definition: def_glob.h:325
ptr_definition first_definition
Definition: def_glob.h:3
#define ALIGNUP(X)
Definition: def_macro.h:294
ptr_psi_term error_psi_term
Definition: def_glob.h:23
ptr_definition * gamma_table
Definition: def_glob.h:309
#define what_next
Definition: def_const.h:277
ptr_definition built_in
Definition: def_glob.h:75
ptr_definition integer
Definition: def_glob.h:93
#define PRINT_BUFFER
Definition: def_const.h:106
#define match
Definition: def_const.h:283
static float life_time
Definition: memory.c:27
ptr_definition lf_true
Definition: def_glob.h:107
ptr_definition iff
Definition: def_glob.h:92
ptr_definition final_dot
Definition: def_glob.h:137
#define FALSE
Definition: def_const.h:128
int arg_c
Definition: def_glob.h:5
static void check_triple_list(ptr_triple_list *p)
check_triple_list
Definition: memory.c:517
#define code_ptr
Definition: def_const.h:174
ptr_definition quoted_string
Definition: def_glob.h:101
GENERIC mem_base
Definition: def_glob.h:11
ptr_definition succeed
Definition: def_glob.h:104
void print_undo_stack()
print_undo_stack
Definition: memory.c:121
#define clause
Definition: def_const.h:285
struct wl_definition * ptr_definition
Definition: def_struct.h:31
char * arg_v[10]
Definition: def_glob.h:6
ptr_definition and
Definition: def_glob.h:71
ptr_node module_table
Definition: def_glob.h:160
void check_psi_term(ptr_psi_term *t)
check_psi_term
Definition: memory.c:987
static void check_module_list(ptr_int_list *c)
check_module_list
Definition: memory.c:570
ptr_definition lf_false
Definition: def_glob.h:89
ptr_module syntax_module
Definition: def_glob.h:159
#define fail
Definition: def_const.h:272
ptr_goal aim
Definition: def_glob.h:49
char * weekday_attr
Definition: def_glob.h:259
ptr_definition disjunction
Definition: def_glob.h:84
GENERIC heap_pointer
Definition: def_glob.h:12
ptr_definition xpixmap
Definition: def_glob.h:211
char * one
Definition: def_glob.h:250
#define retract
Definition: def_const.h:287
static void check_code(ptr_int_list *c)
check_code
Definition: memory.c:486
ptr_definition xenter_event
Definition: def_glob.h:211
ptr_definition xevent
Definition: def_glob.h:211
#define unify
Definition: def_const.h:274
void init_memory()
init_memory ()
Definition: memory.c:1671
GENERIC * aaaa_3
Definition: def_struct.h:217
ptr_definition add_module2
Definition: def_glob.h:68
int GetBoolOption(char *name)
GetBoolOption.
Definition: memory.c:64
ptr_definition life_or
Definition: def_glob.h:95
ptr_definition delay_checksym
Definition: def_glob.h:118
#define load
Definition: def_const.h:288
void check_definition_list()
check_definition_list
Definition: memory.c:699
ptr_definition yfx_sym
Definition: def_glob.h:128
static void compress()
compress
Definition: memory.c:222
ptr_definition final_question
Definition: def_glob.h:138
char * GetStrOption(char *name, char *def)
GetStrOption.
Definition: memory.c:41
ptr_psi_term saved_psi_term
Definition: def_glob.h:194
ptr_module sys_module
Definition: def_glob.h:162
#define unify_noeval
Definition: def_const.h:275
void garbage()
garbage
Definition: memory.c:1529
ptr_definition sys_bytedata
Definition: def_glob.h:336
ptr_definition add_module1
Definition: def_glob.h:67
ptr_definition tracesym
Definition: def_glob.h:109
ptr_definition xdisplay
Definition: def_glob.h:211
#define del_clause
Definition: def_const.h:286
#define eval_cut
Definition: def_const.h:279
void check_gamma_code()
check_gamma_code
Definition: memory.c:1078
static void check_var(ptr_node *n)
Definition: memory.c:1270
struct wl_psi_term * ptr_psi_term
Definition: def_struct.h:34
void stack_info(FILE *outfile)
stack_info
Definition: error.c:77
ptr_definition fx_sym
Definition: def_glob.h:123
long sub_CodeType(ptr_int_list c1, ptr_int_list c2)
sub_CodeType
Definition: types.c:1618
#define undo_action
Definition: def_const.h:188
void check_hash_table(ptr_hash_table table)
check_hash_table
Definition: memory.c:625
char * minute_attr
Definition: def_glob.h:257
ptr_definition cut
Definition: def_glob.h:83
#define GC_THRESHOLD
Definition: def_const.h:65
ptr_module x_module
Definition: def_glob.h:158
GENERIC other_limit
Definition: def_glob.h:20
ptr_definition xdestroy_event
Definition: def_glob.h:211
FILE * output_stream
Definition: def_glob.h:41
static void check_module_tree(ptr_node *n)
check_module_tree
Definition: memory.c:587
#define disj
Definition: def_const.h:276
#define MAX_BUILT_INS
Definition: def_const.h:82
ptr_definition nothing
Definition: def_glob.h:98
ptr_definition nil
Definition: def_glob.h:97
char * year_attr
Definition: def_glob.h:253
ptr_module no_module
Definition: def_glob.h:157
GENERIC stack_pointer
Definition: def_glob.h:14
int GetIntOption(char *name, int def)
GetIntOption.
Definition: memory.c:78
void pchoices()
pchoices
Definition: memory.c:93
ptr_int_list code
Definition: def_struct.h:129
char * second_attr
Definition: def_glob.h:258
ptr_definition xleave_event
Definition: def_glob.h:211
char * day_attr
Definition: def_glob.h:255
static void check_psi_list()
#define type_disj
Definition: def_const.h:284
static void check_gamma_rest()
check_gamma_rest
Definition: memory.c:1095
ptr_module bi_module
Definition: def_glob.h:155
float garbage_time
Definition: def_glob.h:16
ptr_definition predsym
Definition: def_glob.h:99
#define LONELY
Definition: memory.c:24
char * hour_attr
Definition: def_glob.h:256
void check_sys_definitions()
check_sys_definitions
Definition: sys.c:2192
ptr_definition xconfigure_event
Definition: def_glob.h:211
void stdin_cleareof()
stdin_cleareof
Definition: token.c:51
unsigned long * GENERIC
Definition: def_struct.h:17
ptr_psi_term xevent_existing
Definition: def_glob.h:208
#define resid_ptr
Definition: def_const.h:171
ptr_definition xf_sym
Definition: def_glob.h:122
static void check_keyword()
long bounds_undo_stack()
bounds_undo_stack
Definition: memory.c:142
void check_attr(ptr_node *n)
check_attr
Definition: memory.c:1054
#define ALIGN
Definition: def_const.h:31
#define goal_ptr
Definition: def_const.h:175
ptr_definition colonsym
Definition: def_glob.h:78
ptr_definition inputfilesym
Definition: def_glob.h:120
ptr_definition variable
Definition: def_glob.h:111
ptr_stack next
Definition: def_struct.h:219
long open_input_file(char *file)
open_input_file
Definition: token.c:594
static struct tms last_garbage_time
Definition: memory.c:26
static void check_def_rest(ptr_definition *d)
check_def_rest
Definition: memory.c:737
ptr_definition call_handlersym
Definition: def_glob.h:121
ptr_choice_point choice_stack
Definition: def_glob.h:51
ptr_psi_term old_saved_psi_term
Definition: def_glob.h:195
ptr_definition eval_argsym
Definition: def_glob.h:119
ptr_definition funcsym
Definition: def_glob.h:90
char * month_attr
Definition: def_glob.h:254
ptr_definition typesym
Definition: def_glob.h:110
#define assert(N)
Definition: memory.c:113
ptr_definition xdrawable
Definition: def_glob.h:211
#define psi_term_ptr
Definition: def_const.h:170
#define int_ptr
Definition: def_const.h:172