Wild Life  2.30
 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 
83  (void)snprintf(buffer_loc,40,"%d",def);
84  s=GetStrOption(name,buffer_loc);
85  return atof(s);
86 }
87 
94 void pchoices() /* RM: Oct 28 1993 For debugging. */
95 {
97  printf("stack pointer is: %lx\n",(unsigned long)stack_pointer);
98  for(c=choice_stack;c;c=c->next)
99  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);
100 }
101 
102 /****************************************************************************/
103 
104 /* GC sanity checks */
105 
106 /* Keep for release versions, unless the garbage collector is very robust */
107 /* #define GCTEST */
108 
109 /* Remove for release versions */
110 /* #define GCVERBOSE */
111 
112 #ifndef GCTEST
113 #undef assert
114 #define assert(N)
115 #endif
116 
123 {
125 
126  while (u) {
127  if ((GENERIC)u->aaaa_3<mem_base || (GENERIC)u->aaaa_3>mem_limit ||
128  (GENERIC)u->next<mem_base || (GENERIC)u->next>mem_limit) {
129  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);
130  (void)fflush(stdout);
131  }
132  u=u->next;
133  }
134 }
135 
144 {
146 
147  while (u) {
148  if ( (GENERIC)u<mem_base
149  || (GENERIC)u>mem_limit
150  || (!VALID_ADDRESS(u->aaaa_3) && !(u->type & undo_action))
151  ) {
152  if ((GENERIC)u<mem_base || (GENERIC)u>mem_limit) {
153  printf("\nUNDO: u=%lx\n",(long)u);
154  }
155  else {
156  printf("\nUNDO: u:%lx type:%ld a:%lx b:%lx next:%lx\n",
157  (unsigned long)u,(unsigned long)u->type,(unsigned long)u->aaaa_3,(unsigned long)u->bbbb_3,(unsigned long)u->next);
158  }
159  (void)fflush(stdout);
160  return FALSE;
161  }
162  u=u->next;
163  }
164 
165  return TRUE;
166 }
167 
168 
169 /****************************************************************************/
170 
171 /* Forward declarations */
172 static void check_psi_list();
173 static void check_resid_list(); /* 21.9 */
174 static void check_choice();
175 static void check_undo_stack();
176 
177 
178 
179 
189 void fail_all()
190 {
191  output_stream=stdout;
195  (void)abort_life(TRUE);
196  /* printf("\n*** Abort\n"); */
197  stdin_cleareof();
198  (void)open_input_file("stdin");
199 }
200 
201 
202 
203 
204 /******************************************************************************
205 
206  GARBAGE COLLECTING.
207 
208 */
209 
210 
211 
212 /* RM: Jan 29 1993 Replaced with PVR's version of 26.1 */
213 
223 static void compress()
224 {
225  GENERIC addr, new_addr;
226  long len, i;
227 
228  /* Compressing the stack: */
229 
230  addr=new_addr=mem_base;
231  while (addr<=stack_pointer) {
232  len = *(addr+delta);
233  if (len) {
234  /* There are lots of these: */
235  /* if (len==LONELY) printf("Isolated LONELY at %lx\n",addr); */
236  if (len==LONELY) len=ALIGN;
237  else if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN;
238  /* if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN; 12.6 */
239  assert((len & (ALIGN-1))==0);
240  len /= sizeof(*addr);
241  assert(len>0);
242 
243  for (i=0; i<len; i++) {
244  *new_addr = *addr;
245  if (i>0) {
246  if (*(addr+delta)>=len)
247  assert(i>0 ? *(addr+delta)<len : TRUE);
248  }
249  assert(VALID_ADDRESS(new_addr));
250  *(addr+delta) = (long)new_addr + 1; /* Set low bit */
251 #ifdef prlDEBUG
252  if (*(addr+delta) & 1 == 0)
253  printf ("compress: could be a bug ...\n");
254 #endif
255  addr++;
256  new_addr++;
257  }
258  }
259  else
260  addr++;
261  }
262  other_pointer=stack_pointer; /* 10.6 this var. is unused */
263  stack_pointer=new_addr;
264 
265  /* Compressing the heap: */
266 
267  addr=new_addr=mem_limit;
268  addr--; /* PVR fix: adding this statement avoids accessing beyond */
269  /* the memory's edge, which causes a segmentation fault on*/
270  /* SPARC. */
271  while (addr>=heap_pointer) {
272  skip_addr:
273  len= *(addr+delta);
274  if (len) {
275  if (len!=LONELY) {
276 
277  if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN;
278  assert((len & (ALIGN-1))==0);
279  len /= sizeof (*addr);
280  assert(len>0);
281 
282  } else { /* len==LONELY */
283  GENERIC a;
284 
285  if (len & (ALIGN-1)) len=len-(len & (ALIGN-1))+ALIGN;
286  assert((len & (ALIGN-1))==0);
287  len /= sizeof (*addr);
288  assert(len==1);
289 
290  /* Check if the LONELY field is actually part of a block. */
291  /* If so, skip to the beginning of the block. */
292  a=addr;
293  do {
294  a--;
295  } while (a>=heap_pointer &&
296  (*(a+delta)==0 || *(a+delta)==LONELY));
297  if (a>=heap_pointer && *(a+delta)/sizeof(*a)+a>addr) {
298  addr=a;
299  goto skip_addr;
300  }
301  }
302 
303  /* Move a block or an isolated LONELY field. */
304  addr += len;
305  for (i=0; i<len; i++) {
306  addr--;
307  new_addr--;
308  *new_addr = *addr;
309  assert(VALID_ADDRESS(new_addr));
310  *(addr+delta) = (long)new_addr + 1;
311  }
312  }
313  addr--;
314  }
315  heap_pointer=new_addr;
316 }
317 
318 #define UNCHECKED(P) (! *((GENERIC)(P)+delta))
319 
336 #ifdef CLIFE
337 long unchecked (GENERIC *p, long len)
338 #else
339 static long unchecked (GENERIC *p, long len)
340 #endif /* CLIFE */
341 {
342  GENERIC addr;
343  long result=FALSE, value;
344 
345  assert(len>0);
346  if ((unsigned long)*p>MAX_BUILT_INS) {
347 #ifdef GCTEST
348  if (!VALID_ADDRESS(*p)) {
349  printf("p=%lx,*p=%lx\n",p,*p);
350  }
351 #endif
352  assert(VALID_ADDRESS(*p));
353  addr = *p + delta;
354  value = *addr;
355  switch (pass) {
356  case 1:
357 #ifdef GCTEST
358  if (FALSE /* len>100 || value>100 13.8 */) {
359  /* This does in fact happen */
360  printf("len=%ld,value=%ld\n",len,value);
361  fflush(stdout);
362  }
363 #endif
364  /* if (!value) */
365  if (!value || value==LONELY) {
366  /* Pointer not yet explored */
367  result=TRUE;
368  *addr=len;
369 #ifdef prlDEBUG
370  amount_used+=len;
371 #endif
372  }
373  else if (value < len && len != LONELY) {
374  Errorline("in garbage collection, %d < %d.\n", value, len);
375  }
376  else if (value > len && len != LONELY) {
377  Errorline("in garbage collection, %d > %d.\n", value, len);
378  }
379  break;
380  case 2:
381  if (value & 1) { /* If low bit set */
382  value--; /* Reset low bit */
383  *addr=value;
384 #ifdef prlDEBUG
385  amount_used+=len;
386 #endif
387  result=TRUE;
388  }
389  if (!VALID_ADDRESS(value))
390  assert(VALID_ADDRESS(value));
391  *p = (GENERIC) value;
392  break;
393  }
394  }
395  return result;
396 }
397 
406 static void check_string (GENERIC *s)
407 {
408  GENERIC addr;
409  long value;
410  long bytes;
411 
412  if ((unsigned long) *s > MAX_BUILT_INS) {
413  switch (pass) {
414  case 1:
415  bytes=strlen((char *)*s)+1;
416  /* if (bytes==LONELY) {
417  fprintf(stderr,"Caught an empty string!\n");
418  fflush(stderr);
419  } */
420  /* Make sure there's no conflict with LONELY (this occurs for an */
421  /* empty string, which still needs a single byte of storage). */
422  /* This does occasionally happen. */
423  (void)unchecked((GENERIC *)s, (bytes==LONELY)?bytes+1:bytes); // added cast DJD 12/8/2016
424  break;
425  case 2:
426  addr=(*s+delta);
427  value= *addr;
428  if (value & 1) { /* If low bit set */
429  value--;
430  *s=(GENERIC)value;
431  *addr=value;
432 #ifdef prlDEBUG
433  amount_used+=strlen(*s)+1;
434 #endif
435  }
436  *s=(GENERIC)value;
437  break;
438  }
439  }
440 }
441 
442 /* DENYS: BYTEDATA */
451 static void check_bytedata(GENERIC *s)
452 {
453  GENERIC addr;
454  long value;
455  if ((unsigned long) *s > MAX_BUILT_INS) {
456  unsigned long bytes = *((unsigned long *) *s);
457  unsigned long size = bytes + sizeof(bytes);
458  switch (pass) {
459  case 1:
460  (void)unchecked((GENERIC *)s,size);
461  break;
462  case 2:
463  addr=(*s+delta);
464  value= *addr;
465  if (value & 1) {
466  value--;
467  *s=(GENERIC) value;
468  *addr=value;
469 #ifdef prlDEBUG
470  amount_used+=size;
471 #endif
472  }
473  *s=(GENERIC)value;
474  break;
475  }
476  }
477 }
478 
487 static void check_code(ptr_int_list *c)
488 {
489  while (unchecked((GENERIC *)c,sizeof(int_list))) // added cast DJD 12/8/2016
490  c= &((*c)->next);
491 }
492 
502 {
503  while (unchecked((GENERIC *)p,sizeof(pair_list))) { // added cast DJD 12/8/2016
504  check_psi_term(&((*p)->aaaa_2));
505  check_psi_term(&((*p)->bbbb_2));
506  p= &((*p)->next);
507  }
508 }
509 
519 {
520  while (unchecked((GENERIC *)p,sizeof(triple_list))) { // added cast DJD 12/8/2016
521  check_psi_term(&((*p)->aaaa_4));
522  check_psi_term(&((*p)->bbbb_4));
523  check_definition(&((*p)->cccc_4));
524  p= &((*p)->next);
525  }
526 }
527 
536 static void check_kids(ptr_int_list *c)
537 {
538  while (unchecked((GENERIC *) c,sizeof(int_list))) { // added cast DJD 12/8/2016
539  check_definition((ptr_definition *)&((*c)->value_1));
540  c= &((*c)->next);
541  }
542 }
543 
553 {
554  while (unchecked((GENERIC *) op,sizeof(operator_data))) { // added cast DJD 12/8/2016
555  op = &((*op)->next);
556  }
557 }
558 
559 static void check_module();
560 // void check_hash_table(); /* RM: Feb 3 1993 */
561 static void check_keyword(); /* RM: Jan 12 1993 */
562 
571 static void check_module_list(ptr_int_list *c) /* RM: Jan 12 1993 */
572 {
573  while (unchecked((GENERIC *)c,sizeof(int_list))) { // added cast DJD 12/8/2016
574  check_module(&((*c)->value_1));
575  c= &((*c)->next);
576  }
577 }
578 
579 
588 static void check_module_tree(ptr_node *n) /* RM: Jan 13 1993 */
589 {
590  if (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
591  check_module_tree(&((*n)->left));
592  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
593  check_module(&((*n)->data));
594  check_module_tree(&((*n)->right));
595  }
596 }
597 
606 static void check_module(ptr_module *m) /* RM: Jan 12 1993 */
607 {
608  if(unchecked((GENERIC *)m,sizeof(struct wl_module))) { // added cast DJD 12/8/2016
609  check_string((GENERIC *)&((*m)->module_name)); // added cast DJD 12/8/2016
610  check_string((GENERIC *)&((*m)->source_file)); // added cast DJD 12/8/2016
611  check_module_list(&((*m)->open_modules));
612  check_module_list(&((*m)->inherited_modules));
613  check_hash_table((*m)->symbol_table);
614  }
615 }
616 
626 void check_hash_table(ptr_hash_table table) /* RM: Feb 3 1993 */
627 {
628  long i;
629 
630  for(i=0;i<table->size;i++)
631  if(table->data[i])
632  check_keyword((ptr_keyword *)&(table->data[i]));
633 }
634 
643 static void check_keyword(ptr_keyword *k) /* RM: Jan 12 1993 */
644 {
645  if(unchecked((GENERIC *)k,sizeof(struct wl_keyword))) { // added cast DJD 12/8/2016
646  check_module(&((*k)->module));
647  check_string((GENERIC *)&((*k)->symbol)); // added cast DJD 12/8/2016
648  check_string((GENERIC *)&((*k)->combined_name)); // added cast DJD 12/8/2016
649  check_definition(&((*k)->definition));
650  }
651 }
652 
664 {
665  if(unchecked((GENERIC *)d,sizeof(definition))) { // added cast DJD 12/8/2016
666 
667  check_keyword((ptr_keyword *)&((*d)->keyword)); /* RM: Jan 12 1993 */ // added cast DJD 12/8/2016
668 
669 #ifdef prlDEBUG
670  printf("%lx %20s %ld\n",*d,(*d)->keyword->symbol,amount_used);
671 #endif
672 
673  check_code((ptr_int_list *)&((*d)->code)); // added cast DJD 12/8/2016
674  check_pair_list((ptr_pair_list *)&((*d)->rule)); // added cast DJD 12/8/2016
675  check_triple_list(&((*d)->properties));
676 
677  if ((*d)->type_def==(def_type)type_it) {
678  check_kids(&((*d)->parents));
679  check_kids(&((*d)->children));
680  }
681 
682  check_psi_term(&((*d)->global_value)); /* RM: Feb 9 1993 */
683  check_psi_term(&((*d)->init_value)); /* RM: Mar 23 1993 */
684 
685  check_operator_data(&((*d)->op_data)); /* PVR 5.6 */
686 
687 #ifdef CLIFE
688  check_block_def(&((*d)->block_def)); /* RM: Jan 27 1993 */
689 #endif /* CLIFE */
690  }
691 }
692 
700 void check_definition_list() /* RM: Feb 15 1993 */
701 {
702  ptr_definition *d;
703 
704  d= &first_definition;
705 
706  while(*d) {
707  check_definition(d);
708  d= &((*d)->next);
709  }
710 }
711 
722 {
723  if (unchecked((GENERIC *)d,sizeof(definition))) // added cast DJD 12/8/2016
724  check_code((ptr_int_list *)&((*d)->code)); // added cast DJD 12/8/2016
725  /* p = &((*d)->properties); */
726  /* check_def_prop(p); */
727 }
728 
739 {
740  if (*d) {
741  check_keyword((ptr_keyword *)&((*d)->keyword)); /* RM: Jan 12 1993 */ // added cast DJD 12/8/2016
742  check_pair_list((ptr_pair_list *)&((*d)->rule)); // added cast DJD 12/8/2016
743  check_triple_list(&((*d)->properties));
744 
745  if ((*d)->type_def==(def_type)type_it) {
746  check_kids(&((*d)->parents));
747  check_kids(&((*d)->children));
748  }
749  check_operator_data(&((*d)->op_data)); /* PVR 5.6 */
750 #ifdef CLIFE
751  check_block_def(&((*d)->block_def)); /*CB 25/01/93 */
752 #endif /* CLIFE */
753  }
754 }
755 
765 static void check_symbol(ptr_node *n)
766 {
767  if (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
768  check_symbol(&((*n)->left));
769  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
770  check_keyword((ptr_keyword *)&((*n)->data)); /* RM: Jan 12 1993 */ // added cast DJD 12/8/2016
771  check_symbol(&((*n)->right));
772  }
773 }
774 
784 {
785  while (unchecked((GENERIC *)p,sizeof(int_list))) { // added cast DJD 12/8/2016
786  check_definition((struct wl_definition **)&((*p)->value_1));
787  p= &((*p)->next);
788  }
789 }
790 
801 static void check_goal_stack(ptr_goal *g)
802 {
803  while (unchecked((GENERIC *)g,sizeof(goal))) { // added cast DJD 12/8/2016
804 
805  switch ((*g)->type) {
806 
807  case fail:
808  break;
809 
810  case unify:
811  case unify_noeval: /* PVR 5.6 */
812  check_psi_term(&((*g)->aaaa_1));
813  check_psi_term(&((*g)->bbbb_1));
814  break;
815 
816  case prove:
817  check_psi_term(&((*g)->aaaa_1));
818  if ((unsigned long)(*g)->bbbb_1!=DEFRULES) check_pair_list((ptr_pair_list *)&((*g)->bbbb_1)); // added cast DJD 12/8/2016
819  check_pair_list((ptr_pair_list *)&((*g)->cccc_1)); // added cast DJD 12/8/2016
820  break;
821 
822  case disj:
823  check_psi_term(&((*g)->aaaa_1));
824  check_psi_term(&((*g)->bbbb_1));
825  break;
826 
827  case what_next:
828  /* check_choice(&((*g)->bbbb_1)); */
829  break;
830 
831  case eval:
832  check_psi_term(&((*g)->aaaa_1));
833  check_psi_term(&((*g)->bbbb_1));
834  check_pair_list((ptr_pair_list *)&((*g)->cccc_1)); // added cast DJD 12/8/2016
835  break;
836 
837  case load:
838  check_psi_term(&((*g)->aaaa_1));
839  check_string((GENERIC *)&((*g)->cccc_1)); // added cast DJD 12/8/2016
840  break;
841 
842  case match:
843  check_psi_term(&((*g)->aaaa_1));
844  check_psi_term(&((*g)->bbbb_1));
845  check_resid_block((struct wl_resid_block **)&((*g)->cccc_1));
846  break;
847 
848  case general_cut:
849  /* assert((GENERIC)(*g)->aaaa_3 <= (GENERIC)choice_stack); 12.7 17.7 */
850  if (pass==1 && (ptr_choice_point)(*g)->aaaa_1>choice_stack)
851  (*g)->aaaa_1=(ptr_psi_term)choice_stack;
852  (void)unchecked((GENERIC *)&((*g)->aaaa_1),LONELY); // added cast DJD 12/8/2016
853  break;
854 
855  case eval_cut:
856  check_psi_term(&((*g)->aaaa_1));
857  /* assert((GENERIC)(*g)->bbbb_1 <= (GENERIC)choice_stack); 12.7 17.7 */
858  if (pass==1 && (ptr_choice_point)(*g)->bbbb_1>choice_stack)
859  (*g)->bbbb_1=(ptr_psi_term)choice_stack;
860  (void)unchecked((GENERIC *)&((*g)->bbbb_1),LONELY); // added cast DJD 12/8/2016
861  check_resid_block((struct wl_resid_block **)&((*g)->cccc_1));
862  break;
863 
864  case freeze_cut:
865  case implies_cut:
866  check_psi_term(&((*g)->aaaa_1));
867  /* assert((GENERIC)(*g)->bbbb_1 <= (GENERIC)choice_stack); 12.7 17.7 */
868  if (pass==1 && (ptr_choice_point)(*g)->bbbb_1>choice_stack)
869  (*g)->bbbb_1=(ptr_psi_term)choice_stack;
870  (void)unchecked((GENERIC *)&((*g)->bbbb_1),LONELY); // added cast DJD 12/8/2016
871  check_resid_block((struct wl_resid_block **)&((*g)->cccc_1));
872  break;
873 
874  case type_disj:
875  check_psi_term(&((*g)->aaaa_1));
876  check_type_disj((ptr_int_list *)&((*g)->bbbb_1)); // added cast DJD 12/8/2016
877  break;
878 
879  case clause:
880  check_psi_term(&((*g)->aaaa_1));
881  check_psi_term(&((*g)->bbbb_1));
882  (void)unchecked((GENERIC *)&((*g)->cccc_1),LONELY); // added cast DJD 12/8/2016
883  /* check_pair_list((*g)->cccc_1); */ /* 6.8 */
884  break;
885 
886  case del_clause:
887  check_psi_term(&((*g)->aaaa_1));
888  check_psi_term(&((*g)->bbbb_1));
889  (void)unchecked((GENERIC *)&((*g)->cccc_1),LONELY); // added cast DJD 12/8/2016
890  /* check_pair_list((*g)->cccc_1); */ /* 6.8 */
891  break;
892 
893  case retract:
894  (void)unchecked((GENERIC *)&((*g)->aaaa_1),LONELY); // added cast DJD 12/8/2016
895  /* check_pair_list((*g)->aaaa_1); */ /* 6.8 */
896  /*PVR*/ /* check_choice(&((*g)->bbbb_1)); 9.6 */
897  break;
898 
899  default:
900  Errorline("in garbage collection, bad goal on stack.\n");
901  }
902 
903  g= &((*g)->next);
904  }
905 }
906 
916 {
917  ptr_int_list code;
918  ptr_list *l;
919 
920  while (unchecked((GENERIC *)r,sizeof(residuation))) { // added cast DJD 12/8/2016
921 
922  if ((*r)->sortflag) /* 22.9 */
923  check_definition((struct wl_definition **)&((*r)->bestsort));
924  else
925  check_code((ptr_int_list *)&((*r)->bestsort)); /* 21.9 */ // added cast DJD 12/8/2016
926 
927  /* Handling of the value field (6.10) */
928  code = (*r)->sortflag ? ((ptr_definition)((*r)->bestsort))->code
929  : (ptr_int_list)(*r)->bestsort;
930  /* Copied (almost) verbatim from check_psi_term: */
931  if ((*r)->value_2) {
932  if (code==alist->code) { /* RM: Dec 15 1992 Will be removed */
933  l=(ptr_list *) &((*r)->value_2);
934  if (l)
935  printf("Found an old list!!\n");
936  }
937  else if (sub_CodeType(code,real->code))
938  (void)unchecked((GENERIC *)&((*r)->value_2),sizeof(REAL)); // added cast DJD 12/8/2016
939  else if (sub_CodeType(code,quoted_string->code))
940  check_string((GENERIC *)&((*r)->value_2)); // added cast DJD 12/8/2016
941  /* DENYS: BYTEDATA */
942  else if (sub_CodeType(code,sys_bytedata->code))
943  check_bytedata(&((*r)->value_2));
944  else if (sub_CodeType(code,cut->code)) {
945  if (pass==1 && (*r)->value_2>(GENERIC)choice_stack)
946  (*r)->value_2=(GENERIC)choice_stack;
947  (void)unchecked((GENERIC *)&((*r)->value_2),LONELY); // added cast DJD 12/8/2016
948  }
949  else if (sub_CodeType(code,variable->code)) /* 8.8 */
950  check_string((GENERIC *)&((*r)->value_2)); // added cast DJD 12/8/2016
951  }
952 
953  check_goal_stack((ptr_goal *)&((*r)->goal)); // added cast DJD 12/8/2016
954  r= &((*r)->next);
955  }
956 }
957 
967 {
968  if (*rb) {
969  if (unchecked((GENERIC *)rb,sizeof(resid_block))) { // added cast DJD 12/8/2016
970  check_goal_stack((ptr_goal *)&((*rb)->ra)); // added cast DJD 12/8/2016
971  check_resid_list(&((*rb)->rv)); /* 21.9 */
972  /* unchecked(&((*rb)->rl),LONELY); 12.6 */ /* 10.6 */
973  (void)unchecked((GENERIC *)&((*rb)->md),LONELY); /* 10.6 */ // added cast DJD 12/8/2016
974  /* check_goal_stack(&((*rb)->rl)); 10.6 */
975  /* check_psi_term(&((*rb)->md)); 10.6 */
976  }
977  }
978 }
979 
989 {
990  ptr_list *l;
991 
992  while (unchecked((GENERIC *)t,sizeof(psi_term))) { // added cast DJD 12/8/2016
993 
994  /* A psi-term on the heap has no residuation list. */
995  if (pass==1 && (GENERIC)(*t)>=heap_pointer && (GENERIC)(*t)<mem_limit) {
996  assert((*t)->resid==NULL);
997  }
998  check_definition(&((*t)->type));
999  check_attr(&((*t)->attr_list));
1000 
1001  if ((*t)->value_3) {
1002 
1003  if ((*t)->type==alist) { /* RM: Dec 15 1992 Should be removed */
1004  l=(ptr_list *) &((*t)->value_3);
1005  if (l)
1006  printf("Found an old list!\n");
1007  }
1008  else
1009 
1010  if (sub_type((*t)->type,real))
1011  (void)unchecked((GENERIC *)&((*t)->value_3),sizeof(REAL)); // added cast DJD 12/8/2016
1012  else if (sub_type((*t)->type,quoted_string))
1013  check_string((GENERIC *)&((*t)->value_3)); // added cast DJD 12/8/2016
1014  /* DENYS: BYTEDATA */
1015  else if (sub_type((*t)->type,sys_bytedata))
1016  check_bytedata(&((*t)->value_3));
1017 #ifdef CLIFE
1018  else if ((*t)->type->type==block) { /* RM: Jan 27 1993 */
1019  check_block_value(&((*t)->value_3));
1020  }
1021 #endif /* CLIFE */
1022  else if ((*t)->type==cut) { /* RM: Oct 28 1993 */
1023  /* assert((*t)->value_3 <= (GENERIC)choice_stack); 12.7 17.7 */
1024  if (pass==1 && (*t)->value_3>(GENERIC)choice_stack)
1025  (*t)->value_3=(GENERIC)choice_stack;
1026  (void)unchecked((GENERIC *)&((*t)->value_3),LONELY); // added cast DJD 12/8/2016
1027  }
1028  else if (sub_type((*t)->type,variable)) /* 8.8 */
1029  check_string((GENERIC *)&((*t)->value_3)); // added cast DJD 12/8/2016
1030  else if ((*t)->type!=stream)
1031  Errorline("non-NULL value field in garbage collector, type='%s', value=%d.\n",
1032  (*t)->type->keyword->combined_name,
1033  (*t)->value_3);
1034  }
1035 
1036  /* check_psi_term(&((*t)->coref)); 9.6 */
1037  if ((*t)->resid)
1038  check_resid((ptr_residuation *)&((*t)->resid)); // added cast DJD 12/8/2016
1039 
1040  t = &((*t)->coref);
1041  }
1042 }
1043 
1056 {
1057  while (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
1058  check_attr(&((*n)->left));
1059  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
1060  check_psi_term((struct wl_psi_term **)&((*n)->data));
1061 
1062  n = &((*n)->right);
1063  /* check_attr(&((*n)->right)); 9.6 */
1064  }
1065 }
1066 
1080 {
1081  long i;
1082 
1083  if (unchecked((GENERIC *)&gamma_table,type_count*sizeof(ptr_definition))) { // added cast DJD 12/8/2016
1084  for (i=0;i<type_count;i++)
1085  check_def_code(&(gamma_table[i]));
1086  }
1087 }
1088 
1096 static void check_gamma_rest()
1097 {
1098  long i;
1099 
1100  for (i=0;i<type_count;i++)
1101  check_def_rest(&(gamma_table[i]));
1102 }
1103 
1115 {
1116  while (unchecked((GENERIC *)s,sizeof(stack))) { // added cast DJD 12/8/2016
1117 
1118  switch((*s)->type) {
1119 
1120  case psi_term_ptr:
1121  check_psi_term((struct wl_psi_term **)&((*s)->bbbb_3));
1122  break;
1123 
1124  case resid_ptr:
1125  check_resid((ptr_residuation *)&((*s)->bbbb_3)); // added cast DJD 12/8/2016
1126  break;
1127 
1128  case int_ptr:
1129  /* int_ptr's are used to trail time_stamps, so they can get large. */
1130  break;
1131 
1132  case def_ptr:
1133  check_definition((struct wl_definition **)&((*s)->bbbb_3));
1134  break;
1135 
1136  case code_ptr:
1137  check_code((ptr_int_list *)&((*s)->bbbb_3)); // added cast DJD 12/8/2016
1138  break;
1139 
1140  case goal_ptr:
1141  check_goal_stack((ptr_goal *)&((*s)->bbbb_3)); // added cast DJD 12/8/2016
1142  break;
1143 
1144  case cut_ptr: /* 22.9 */
1145  break;
1146 #ifdef CLIFE
1147  case block_ptr: /* CB: Jan 28 1993 */
1148  check_block_value(&((*s)->bbbb_3));
1149  break;
1150 
1151 #endif /* CLIFE */
1152  /* All undo actions here */
1153  case destroy_window:
1154  case show_window:
1155  case hide_window:
1156  /* No pointers to follow */
1157  break;
1158  }
1159 
1160  s= &((*s)->next);
1161  }
1162 }
1163 
1171 {
1172  while(unchecked((GENERIC *)c,sizeof(choice_point))) { // added cast DJD 12/8/2016
1173  c= &((*c)->next);
1174  }
1175 }
1176 
1186 {
1187  while(*c) {
1188  check_undo_stack(&((*c)->undo_point)); /* 17.7 */
1189  check_goal_stack((ptr_goal *)&((*c)->goal_stack)); // added cast DJD 12/8/2016
1190  c= &((*c)->next);
1191  }
1192 }
1193 
1204 {
1205  ptr_choice_point c;
1206  ptr_stack p;
1207  // ptr_goal g;
1208 
1209  c=choice_stack;
1210  while(c) {
1211  /* unchecked(&(c->undo_point),LONELY); 17.7 */
1212  (void)unchecked((GENERIC *)&(c->stack_top),LONELY); // added cast DJD 12/8/2016
1213  c=c->next;
1214  }
1215 
1216  p=undo_stack;
1217  while (p) {
1218  if (!(p->type & undo_action)) {
1219  /* Only update an address if it's within the Life data space! */
1220  if (VALID_RANGE(p->aaaa_3)) (void)unchecked((GENERIC *)&(p->aaaa_3),LONELY); // added cast DJD 12/8/2016
1221  if (p->type==cut_ptr) (void)unchecked((GENERIC *)&(p->bbbb_3),LONELY); /* 22.9 */ // added cast DJD 12/8/2016
1222  }
1223  p=p->next;
1224  }
1225 }
1226 
1237 {
1238  while(unchecked((GENERIC *)l,sizeof(int_list))) { // added cast DJD 12/8/2016
1239  check_psi_term((struct wl_psi_term **)&((*l)->value_1));
1240  l= &((*l)->next);
1241  }
1242 }
1243 
1254 {
1255  while(unchecked((GENERIC *)l,sizeof(resid_list))) { // added cast DJD 12/8/2016
1256  check_psi_term(&((*l)->var));
1257  check_psi_term(&((*l)->othervar));
1258  l= &((*l)->next);
1259  }
1260 }
1261 
1271 static void check_var(ptr_node *n)
1272 {
1273  if (unchecked((GENERIC *)n,sizeof(node))) { // added cast DJD 12/8/2016
1274  check_var(&((*n)->left));
1275  check_string((GENERIC *)&((*n)->key)); // added cast DJD 12/8/2016
1276  check_psi_term((struct wl_psi_term **)&((*n)->data));
1277  check_var(&((*n)->right));
1278  }
1279 }
1280 
1300 static void check()
1301 {
1302 #ifdef prlDEBUG
1303  amount_used=0;
1304 #endif
1305 
1306  /* First of all, get all the codes right so that data type-checking remains
1307  coherent.
1308 
1309  Kids and Parents cannot be checked because the built-in types have codes
1310  which might have been moved.
1311  */
1312  /* print_undo_stack(); */
1313 
1314 
1315  check_choice_structs(&choice_stack); /* RM: Oct 28 1993 */
1316 
1318  check_gamma_code();
1319 
1320  /* Now, check the rest of the definitions and all global roots */
1321 
1322  check_gamma_rest();
1323 
1325 
1326  check_definition(&abortsym); /* 26.1 */
1327  check_definition(&aborthooksym); /* 26.1 */
1328 
1329  check_definition(&add_module1); /* RM: Mar 12 1993 */
1332 
1335  check_definition(&boolean);
1341  /* check_definition(&conjunction); 19.8 */
1345  check_definition(&disj_nil); /* RM: Feb 16 1993 */
1354  check_definition(&life_or); /* RM: Apr 6 1993 */
1355  check_definition(&minus_symbol); /* RM: Jun 21 1993 */
1356  check_definition(&nil); /* RM: Dec 9 1992 */
1368  check_definition(&tracesym); /* 26.1 */
1377  /* check_definition(&provesym); */
1390 
1391  /* RM: Jul 7 1993 */
1394 
1396 
1397 #ifdef X11
1414 #endif
1415 
1416  /* check_psi_term(&empty_list); 5.8 */
1417 
1418  check_string((GENERIC *)&one); // added cast DJD 12/8/2016
1419  check_string((GENERIC *)&two); // added cast DJD 12/8/2016
1420  check_string((GENERIC *)&three); // added cast DJD 12/8/2016
1421  check_string((GENERIC *)&year_attr); // added cast DJD 12/8/2016
1422  check_string((GENERIC *)&month_attr); // added cast DJD 12/8/2016
1423  check_string((GENERIC *)&day_attr); // added cast DJD 12/8/2016
1424  check_string((GENERIC *)&hour_attr); // added cast DJD 12/8/2016
1425  check_string((GENERIC *)&minute_attr); // added cast DJD 12/8/2016
1426  check_string((GENERIC *)&second_attr); // added cast DJD 12/8/2016
1427  check_string((GENERIC *)&weekday_attr); // added cast DJD 12/8/2016
1428 
1435  check_psi_term(&old_state); /* RM: Feb 17 1993 */
1436 
1438 #ifdef X11
1441 #endif
1442 
1444  /* check_choice(&prompt_choice_stack); 12.7 */
1445 
1446 
1447  /* RM: Feb 3 1993 */
1448  /* check_symbol(&symbol_table); */
1449  /* check_definition(&first_definition); */
1450  check_definition_list(); /* RM: Feb 15 1993 */
1451 
1452 
1453  /*** MODULES ***/
1454  /* RM: Jan 13 1993 */
1455 
1459  check_module(&user_module); /* RM: Jan 27 1993 */
1464 
1465  /*** End ***/
1466 
1467 
1468 
1469  check_var(&var_tree);
1470 
1471  check_goal_stack((ptr_goal *)&goal_stack); // added cast DJD 12/8/2016
1472  check_goal_stack((ptr_goal *)&aim); /* 7.10 */ // added cast DJD 12/8/2016
1473 
1474  if (TRUE /*resid_aim 10.6 */) check_resid_list(&resid_vars); /* 21.9 */
1475 
1476  check_goal_stack((ptr_goal *)&resid_aim); // added cast DJD 12/8/2016
1477 
1480 
1483 
1485 }
1486 
1493 void print_gc_info(long timeflag)
1494 {
1495  fprintf(stderr," [%ld%% free (%ldK), %ld%% heap, %ld%% stack",
1496  (100*((unsigned long)heap_pointer-(unsigned long)stack_pointer)+mem_size/2)/mem_size,
1497  ((unsigned long)heap_pointer-(unsigned long)stack_pointer+512)/1024,
1498  (100*((unsigned long)mem_limit-(unsigned long)heap_pointer)+mem_size/2)/mem_size,
1499  (100*((unsigned long)stack_pointer-(unsigned long)mem_base)+mem_size/2)/mem_size);
1500  if (timeflag) {
1501  fprintf(stderr,", %1.3fs cpu (%ld%%)",
1502  gc_time,
1503  (unsigned long)(0.5+100*gc_time/(life_time+gc_time)));
1504  }
1505  fprintf(stderr,"]\n");
1506 }
1507 
1508 
1530 void garbage()
1531 {
1532  GENERIC addr;
1533  struct tms garbage_start_time,garbage_end_time;
1534  long start_number_cells, end_number_cells;
1535 
1536  start_number_cells = (stack_pointer-mem_base) + (mem_limit-heap_pointer);
1537 
1538  (void)times(&garbage_start_time);
1539 
1540  /* Time elapsed since last garbage collection */
1541  life_time=(garbage_start_time.tms_utime - last_garbage_time.tms_utime)/60.0;
1542 
1543 
1544  if (verbose) {
1545  fprintf(stderr,"*** Garbage Collect "); /* RM: Jan 26 1993 */
1546  fprintf(stderr,"\n*** Begin");
1548  (void)fflush(stderr);
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 {
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 
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 
GENERIC stack_pointer
used to allocate from stack - size allocated added - adj for alignment
Definition: def_glob.h:69
#define WORD
Memory Word Size.
Definition: def_const.h:63
#define VALID_ADDRESS(A)
Definition: def_macro.h:137
#define prove
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1051
static void check_type_disj(ptr_int_list *p)
check_type_disj
Definition: memory.c:783
ptr_definition disjunction
symbol in bi module
Definition: def_glob.h:249
ptr_keyword * data
Definition: def_struct.h:139
static void check_undo_stack()
ptr_node printed_pointers
Definition: def_glob.h:1007
ptr_definition alist
symbol in bi module
Definition: def_glob.h:319
long memory_check()
memory_check
Definition: memory.c:1723
float garbage_time
total time on garbage collections - seconds
Definition: def_glob.h:76
GENERIC stack_alloc(long s)
stack_alloc
Definition: memory.c:1642
ptr_definition succeed
symbol in bi module
Definition: def_glob.h:389
static void check_resid_list()
static void check_bytedata(GENERIC *s)
check_bytedata
Definition: memory.c:451
#define ALLOC_WORDS
number of words to allocate if -memory=nnnnn not on command line
Definition: def_config.h:26
static void check()
check
Definition: memory.c:1300
ptr_definition xf_sym
symbol in bi module
Definition: def_glob.h:515
void clear_copy()
clear_copy
Definition: copy.c:53
GENERIC heap_pointer
used to allocate from heap - size allocated subtracted - adj for alignment
Definition: def_glob.h:55
ptr_psi_term stdin_state
Definition: def_glob.h:857
ptr_definition apply
symbol in bi module
Definition: def_glob.h:178
static void check_resid(ptr_residuation *r)
check_resid
Definition: memory.c:915
ptr_definition lf_false
symbol in bi module
Definition: def_glob.h:284
ptr_definition nothing
symbol in bi module
Definition: def_glob.h:347
ptr_definition integer
symbol in bi module
Definition: def_glob.h:312
ptr_definition eqsym
symbol in syntax module
Definition: def_glob.h:270
ptr_definition functor
symbol in bi module
Definition: def_glob.h:298
ptr_definition quote
symbol in syntax module
Definition: def_glob.h:361
ptr_module user_module
Default module for user input.
Definition: def_glob.h:694
ptr_definition final_question
symbol in syntax module
Definition: def_glob.h:615
ptr_goal goal_stack
Definition: def_glob.h:1025
#define show_window
To backtrack on show window.
Definition: def_const.h:456
GENERIC mem_limit
starting point of heap - mem_base aligned
Definition: def_glob.h:62
long type_count
Definition: def_glob.h:1021
ptr_definition xdisplaylist
Definition: def_glob.h:1040
static float gc_time
Definition: memory.c:27
#define VALID_RANGE(A)
Definition: def_macro.h:127
#define def_ptr
values of type_ptr
Definition: def_const.h:404
void fail_all()
fail_all
Definition: memory.c:189
ptr_definition first_definition
All definition are stores in a linked list starting at first_definition.
Definition: def_glob.h:13
ptr_psi_term xevent_list
Definition: def_glob.h:1037
static void check_goal_stack(ptr_goal *g)
check_goal_stack
Definition: memory.c:801
int alloc_words
number of words to allocate - from either command lind or ALLOC_WORDS define
Definition: def_glob.h:34
ptr_definition xbutton_event
Definition: def_glob.h:1040
static void check_operator_data(ptr_operator_data *op)
check_operator_data
Definition: memory.c:552
ptr_module current_module
The current module for the tokenizer.
Definition: def_glob.h:729
ptr_definition delay_checksym
symbol in bi module
Definition: def_glob.h:487
ptr_definition cut
symbol in syntax module
Definition: def_glob.h:242
long verbose
Definition: def_glob.h:914
char * two
Definition: def_glob.h:892
ptr_definition iff
symbol in bi module
Definition: def_glob.h:305
GENERIC * bbbb_3
Definition: def_struct.h:233
static long delta
Definition: memory.c:12
#define general_cut
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1114
ptr_definition timesym
symbol in bi module
Definition: def_glob.h:417
ptr_module syntax_module
Module for minimal Prolog syntax.
Definition: def_glob.h:715
static void check_string(GENERIC *s)
check_string
Definition: memory.c:406
#define implies_cut
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1107
ptr_definition comment
symbol in bi module
Definition: def_glob.h:227
includes
ptr_definition listingsym
symbol in bi module
Definition: def_glob.h:480
static void check_special_addresses()
check_special_addresses
Definition: memory.c:1203
#define DEFRULES
Must be different from NULL, a built-in index, and a pointer Used to indicate that the rules of the d...
Definition: def_const.h:302
ptr_definition fx_sym
symbol in bi module
Definition: def_glob.h:522
static long pass
Definition: memory.c:21
#define destroy_window
To backtrack on window creation.
Definition: def_const.h:449
ptr_definition stream
symbol in bi module
Definition: def_glob.h:382
ptr_definition xexpose_event
Definition: def_glob.h:1040
GENERIC stack_top
Definition: def_struct.h:251
ptr_definition call_handlersym
symbol in bi module
Definition: def_glob.h:508
ptr_keyword keyword
Definition: def_struct.h:147
static void check_pair_list(ptr_pair_list *p)
check_pair_list
Definition: memory.c:501
struct wl_psi_term * ptr_psi_term
quotedStackCopy
Definition: def_struct.h:62
ptr_definition dynamicsym
symbol in bi module
Definition: def_glob.h:459
ptr_definition opsym
symbol in bi module
Definition: def_glob.h:445
#define cut_ptr
values of type_ptr 22.9
Definition: def_const.h:425
#define NULL
Definition: def_const.h:533
ptr_node var_tree
Definition: def_glob.h:1005
ptr_definition add_module3
symbol in bi module for feature_values
Definition: def_glob.h:157
ptr_psi_term input_state
Definition: def_glob.h:856
ptr_definition add_module2
symbol in bi module for str2psi
Definition: def_glob.h:150
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
long ignore_eff
Definition: def_glob.h:677
static void check_module()
GENERIC heap_alloc(long s)
heap_alloc
Definition: memory.c:1616
char * three
Definition: def_glob.h:893
char * symbol
Definition: def_struct.h:118
ptr_definition funcsym
symbol in syntax module
Definition: def_glob.h:291
ptr_definition xgc
Definition: def_glob.h:1040
ptr_goal resid_aim
Definition: def_glob.h:865
ptr_choice_point next
Definition: def_struct.h:250
ptr_definition eval_argsym
symbol in bi module
Definition: def_glob.h:494
GENERIC other_limit
only used for the half-space garbage collector
Definition: def_glob.h:104
ptr_definition xmotion_event
Definition: def_glob.h:1040
static long unchecked(GENERIC *p, long len)
unchecked
Definition: memory.c:339
ptr_definition and
symbol in syntax module
Definition: def_glob.h:171
ptr_resid_list resid_vars
Definition: def_glob.h:866
struct wl_list * ptr_list
Definition: def_struct.h:66
ptr_definition xmisc_event
Definition: def_glob.h:1040
long abort_life(int nlflag)
abort_life
Definition: built_ins.c:2259
#define eval
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1086
ptr_node pointer_names
Definition: def_glob.h:1008
ptr_psi_term null_psi_term
Used to represent an empty parse token.
Definition: def_glob.h:656
static void check_symbol(ptr_node *n)
check_symbol
Definition: memory.c:765
static void check_choice()
GENERIC other_pointer
NOT USED - according to comment.
Definition: def_glob.h:111
ptr_definition built_in
symbol in bi module
Definition: def_glob.h:199
ptr_definition sys_bytedata
symbol in sys module
Definition: def_glob.h:983
ptr_psi_term old_state
used in token.c to save state to restore it later
Definition: def_glob.h:663
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:663
ptr_definition real
symbol in bi module
Definition: def_glob.h:375
void print_gc_info(long timeflag)
print_gc_info
Definition: memory.c:1493
#define type_it
was enum (def_type) in extern.h now there is typedef ptr_definition
Definition: def_const.h:1415
ptr_definition inputfilesym
symbol in bi module
Definition: def_glob.h:501
ptr_definition yf_sym
symbol in bi module
Definition: def_glob.h:529
#define hide_window
To backtrack on hide window.
Definition: def_const.h:463
ptr_stack undo_stack
Definition: def_glob.h:1027
static void check_kids(ptr_int_list *c)
check_kids
Definition: memory.c:536
void Errorline(char *format,...)
Errorline.
Definition: error.c:465
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
char * buffer
buffer used only in print.c - there is local with same name in xpred.c
Definition: def_glob.h:781
static void check_def_code(ptr_definition *d)
check_def_code
Definition: memory.c:721
ptr_definition variable
symbol in bi module
Definition: def_glob.h:438
void check_resid_block(ptr_resid_block *rb)
check_resid_block
Definition: memory.c:966
static void check_choice_structs(ptr_choice_point *c)
check_choice_structs
Definition: memory.c:1170
ptr_definition final_dot
symbol in syntax module
Definition: def_glob.h:608
type_ptr type
Definition: def_struct.h:231
ptr_definition colonsym
symbol in syntax module
Definition: def_glob.h:213
#define freeze_cut
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1100
ptr_definition xkeyboard_event
Definition: def_glob.h:1040
int arg_c
set from argc in either life.c or lib.c
Definition: def_glob.h:20
#define TRUE
Standard boolean.
Definition: def_const.h:268
ptr_definition xwindow
Definition: def_glob.h:1040
char * name
Definition: def_glob.h:966
ptr_definition minus_symbol
symbol in syntax module
Definition: def_glob.h:333
#define ALIGNUP(X)
Definition: def_macro.h:299
ptr_definition eof
symbol in syntax module
Definition: def_glob.h:263
ptr_definition * gamma_table
Definition: def_glob.h:950
#define what_next
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1079
#define PRINT_BUFFER
Size of print buffer.
Definition: def_const.h:211
#define match
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1121
GENERIC other_base
mem_size memory allocated in init_memory by malloc
Definition: def_glob.h:98
static float life_time
Definition: memory.c:27
ptr_definition constant
symbol in bi module
Definition: def_glob.h:235
#define FALSE
Standard boolean.
Definition: def_const.h:275
ptr_definition abortsym
symbol in bi module
Definition: def_glob.h:126
ptr_definition add_module1
symbol in bi module for features
Definition: def_glob.h:143
static void check_triple_list(ptr_triple_list *p)
check_triple_list
Definition: memory.c:518
ptr_definition staticsym
symbol in bi module
Definition: def_glob.h:466
#define code_ptr
values of type_ptr
Definition: def_const.h:411
void print_undo_stack()
print_undo_stack
Definition: memory.c:122
#define clause
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1135
struct wl_definition * ptr_definition
Definition: def_struct.h:59
ptr_definition such_that
symbol in syntax module
Definition: def_glob.h:396
ptr_definition typesym
symbol in syntax module
Definition: def_glob.h:431
ptr_definition nil
symbol in bi module
Definition: def_glob.h:340
void check_psi_term(ptr_psi_term *t)
check_psi_term
Definition: memory.c:988
static void check_module_list(ptr_int_list *c)
check_module_list
Definition: memory.c:571
ptr_definition xfy_sym
symbol in bi module
Definition: def_glob.h:550
#define fail
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1044
ptr_goal aim
Definition: def_glob.h:1024
ptr_definition disj_nil
symbol in syntax module
Definition: def_glob.h:256
char * weekday_attr
Definition: def_glob.h:900
ptr_definition xpixmap
Definition: def_glob.h:1040
char * one
Definition: def_glob.h:891
#define retract
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1149
static void check_code(ptr_int_list *c)
check_code
Definition: memory.c:487
ptr_definition xenter_event
Definition: def_glob.h:1040
ptr_definition xevent
Definition: def_glob.h:1040
#define unify
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1058
ptr_definition commasym
symbol in syntax module
Definition: def_glob.h:220
void init_memory()
init_memory ()
Definition: memory.c:1671
GENERIC * aaaa_3
Definition: def_struct.h:232
int GetBoolOption(char *name)
GetBoolOption.
Definition: memory.c:64
char * arg_v[ARGNN]
set from argv in either life.c or lib.c
Definition: def_glob.h:27
#define load
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1156
void check_definition_list()
check_definition_list
Definition: memory.c:700
static void compress()
compress
Definition: memory.c:223
char * GetStrOption(char *name, char *def)
GetStrOption.
Definition: memory.c:41
ptr_module bi_module
Module for public built-ins.
Definition: def_glob.h:687
ptr_psi_term saved_psi_term
Definition: def_glob.h:851
ptr_module sys_module
Definition: def_glob.h:735
ptr_psi_term error_psi_term
symbol in bi module
Definition: def_glob.h:118
#define unify_noeval
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1065
ptr_definition top
symbol in syntax module
Definition: def_glob.h:403
void garbage()
garbage
Definition: memory.c:1530
ptr_definition yfx_sym
symbol in bi module
Definition: def_glob.h:557
ptr_definition xdisplay
Definition: def_glob.h:1040
#define del_clause
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1142
#define eval_cut
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1093
void check_gamma_code()
check_gamma_code
Definition: memory.c:1079
static void check_var(ptr_node *n)
check_var
Definition: memory.c:1271
ptr_node module_table
The table of modules.
Definition: def_glob.h:722
ptr_definition loadsym
symbol in bi module
Definition: def_glob.h:452
void stack_info(FILE *outfile)
stack_info
Definition: error.c:77
long sub_CodeType(ptr_int_list c1, ptr_int_list c2)
sub_CodeType
Definition: types.c:1618
#define undo_action
Fast checking for an undo action.
Definition: def_const.h:484
void check_hash_table(ptr_hash_table table)
check_hash_table
Definition: memory.c:626
char * minute_attr
Definition: def_glob.h:898
#define GC_THRESHOLD
Garbage collection threshold (1/8 of MEM_SIZE is reasonable).
Definition: def_const.h:117
ptr_definition nullsym
symbol in bi module
Definition: def_glob.h:564
ptr_definition xdestroy_event
Definition: def_glob.h:1040
ptr_module no_module
???
Definition: def_glob.h:701
FILE * output_stream
Definition: def_glob.h:1017
static void check_module_tree(ptr_node *n)
check_module_tree
Definition: memory.c:588
#define disj
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1072
#define MAX_BUILT_INS
Maximum number of built_ins.
Definition: def_const.h:154
GENERIC mem_base
mem_size memory allocated in init_memory by malloc
Definition: def_glob.h:48
char * year_attr
Definition: def_glob.h:894
ptr_definition encodesym
symbol in bi module
Definition: def_glob.h:473
ptr_definition fy_sym
symbol in bi module
Definition: def_glob.h:536
int mem_size
number of words from memory = alloc_words * sizeof word
Definition: def_glob.h:41
int GetIntOption(char *name, int def)
GetIntOption.
Definition: memory.c:78
void pchoices()
pchoices
Definition: memory.c:94
ptr_int_list code
Definition: def_struct.h:150
char * second_attr
Definition: def_glob.h:899
ptr_definition xleave_event
Definition: def_glob.h:1040
char * day_attr
Definition: def_glob.h:896
static void check_psi_list()
#define type_disj
was enum (goal) – but must be long for error.c - now typedef
Definition: def_const.h:1128
static void check_gamma_rest()
check_gamma_rest
Definition: memory.c:1096
#define LONELY
Definition: memory.c:24
ptr_definition lf_true
symbol in bi module
Definition: def_glob.h:410
char * hour_attr
Definition: def_glob.h:897
ptr_definition aborthooksym
symbol in bi module
Definition: def_glob.h:133
void check_sys_definitions()
check_sys_definitions
Definition: sys.c:2186
ptr_definition xconfigure_event
Definition: def_glob.h:1040
void stdin_cleareof()
stdin_cleareof
Definition: token.c:51
ptr_psi_term xevent_existing
Definition: def_glob.h:1037
ptr_definition boolpredsym
symbol in bi module
Definition: def_glob.h:192
#define resid_ptr
values of type_ptr
Definition: def_const.h:390
static void check_keyword()
long bounds_undo_stack()
bounds_undo_stack
Definition: memory.c:143
void check_attr(ptr_node *n)
check_attr
Definition: memory.c:1055
#define ALIGN
Definition: def_const.h:66
#define goal_ptr
values of type_ptr
Definition: def_const.h:418
ptr_definition xfx_sym
symbol in bi module
Definition: def_glob.h:543
ptr_stack next
Definition: def_struct.h:234
ptr_module x_module
'ifdef X11' unnecessary
Definition: def_glob.h:708
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:738
ptr_definition quoted_string
symbol in bi module
Definition: def_glob.h:368
ptr_choice_point choice_stack
Definition: def_glob.h:1026
ptr_psi_term old_saved_psi_term
Definition: def_glob.h:852
ptr_definition predsym
symbol in syntax module
Definition: def_glob.h:354
char * month_attr
Definition: def_glob.h:895
#define assert(N)
Definition: memory.c:114
ptr_definition xdrawable
Definition: def_glob.h:1040
ptr_definition tracesym
symbol in bi module
Definition: def_glob.h:424
ptr_definition life_or
symbol in syntax module
Definition: def_glob.h:326
#define psi_term_ptr
values of type_ptr
Definition: def_const.h:383
#define int_ptr
values of type_ptr
Definition: def_const.h:397