15 static long amount_used;
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]==
'=')
68 return strcmp(s,
"off");
83 (void)snprintf(buffer_loc,40,
"%d",def);
97 printf(
"stack pointer is: %lx\n",(
unsigned long)
stack_pointer);
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);
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);
153 printf(
"\nUNDO: u=%lx\n",(
long)u);
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);
159 (void)fflush(stdout);
240 len /=
sizeof(*addr);
243 for (i=0; i<len; i++) {
246 if (*(addr+
delta)>=len)
250 *(addr+
delta) = (
long)new_addr + 1;
252 if (*(addr+
delta) & 1 == 0)
253 printf (
"compress: could be a bug ...\n");
279 len /=
sizeof (*addr);
287 len /=
sizeof (*addr);
305 for (i=0; i<len; i++) {
310 *(addr+
delta) = (
long)new_addr + 1;
318 #define UNCHECKED(P) (! *((GENERIC)(P)+delta))
343 long result=
FALSE, value;
349 printf(
"p=%lx,*p=%lx\n",p,*p);
360 printf(
"len=%ld,value=%ld\n",len,value);
365 if (!value || value==
LONELY) {
373 else if (value < len && len !=
LONELY) {
374 Errorline(
"in garbage collection, %d < %d.\n", value, len);
376 else if (value > len && len !=
LONELY) {
377 Errorline(
"in garbage collection, %d > %d.\n", value, len);
415 bytes=strlen((
char *)*s)+1;
433 amount_used+=strlen(*s)+1;
456 unsigned long bytes = *((
unsigned long *) *s);
457 unsigned long size = bytes +
sizeof(bytes);
630 for(i=0;i<table->
size;i++)
670 printf(
"%lx %20s %ld\n",*d,(*d)->
keyword->
symbol,amount_used);
688 check_block_def(&((*d)->block_def));
751 check_block_def(&((*d)->block_def));
805 switch ((*g)->type) {
900 Errorline(
"in garbage collection, bad goal on stack.\n");
935 printf(
"Found an old list!!\n");
1001 if ((*t)->value_3) {
1003 if ((*t)->type==
alist) {
1006 printf(
"Found an old list!\n");
1018 else if ((*t)->type->type==block) {
1019 check_block_value(&((*t)->value_3));
1022 else if ((*t)->type==
cut) {
1025 (*t)->value_3=(
GENERIC)choice_stack;
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,
1118 switch((*s)->type) {
1148 check_block_value(&((*s)->bbbb_3));
1495 fprintf(stderr,
" [%ld%% free (%ldK), %ld%% heap, %ld%% stack",
1497 ((
unsigned long)
heap_pointer-(
unsigned long)stack_pointer+512)/1024,
1501 fprintf(stderr,
", %1.3fs cpu (%ld%%)",
1505 fprintf(stderr,
"]\n");
1533 struct tms garbage_start_time,garbage_end_time;
1534 long start_number_cells, end_number_cells;
1538 (void)times(&garbage_start_time);
1545 fprintf(stderr,
"*** Garbage Collect ");
1546 fprintf(stderr,
"\n*** Begin");
1548 (void)fflush(stderr);
1560 fprintf(stderr,
"- Done pass 1 ");
1566 fprintf(stderr,
"- Done compress ");
1574 fprintf(stderr,
"- Done pass 2\n");
1582 (void)times(&garbage_end_time);
1583 gc_time=(garbage_end_time.tms_utime - garbage_start_time.tms_utime)/60.0;
1587 fprintf(stderr,
"*** End ");
1590 (void)fflush(stderr);
1596 assert(end_number_cells<=start_number_cells);
1622 s /=
sizeof (*heap_pointer);
1627 Errorline(
"the heap overflowed into the stack.\n");
1652 s /=
sizeof (*stack_pointer);
1657 Errorline(
"the stack overflowed into the heap.\n");
1712 Errorline(
"Wild_life could not allocate sufficient memory to run.\n\n");
1729 if(
verbose) fprintf(stderr,
"\n");
1733 fprintf(stderr,
"*********************\n");
1734 fprintf(stderr,
"*** OUT OF MEMORY ***\n");
1735 fprintf(stderr,
"*********************\n");
static void check_type_disj(ptr_int_list *p)
check_type_disj
ptr_definition boolpredsym
static void check_undo_stack()
ptr_node printed_pointers
long memory_check()
memory_check
GENERIC stack_alloc(long s)
stack_alloc
static void check_resid_list()
static void check_bytedata(GENERIC *s)
check_bytedata
#define ALLOC_WORDS
number of words to allocate if -memory=nnnnn not on command line
void clear_copy()
clear_copy
static void check_resid(ptr_residuation *r)
check_resid
#define show_window
To backtrack on show window.
ptr_module current_module
ptr_definition dynamicsym
ptr_definition xdisplaylist
static void check_goal_stack(ptr_goal *g)
check_goal_stack
ptr_definition xbutton_event
ptr_definition listingsym
static void check_operator_data(ptr_operator_data *op)
check_operator_data
ptr_psi_term null_psi_term
static void check_string(GENERIC *s)
check_string
static void check_special_addresses()
check_special_addresses
#define DEFRULES
Must be different from NULL, a built-in index, and a pointer Used to indicate that the rules of the d...
#define destroy_window
To backtrack on window creation.
ptr_definition aborthooksym
ptr_definition xexpose_event
static void check_pair_list(ptr_pair_list *p)
check_pair_list
struct wl_psi_term * ptr_psi_term
quotedStackCopy
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
static void check_module()
GENERIC heap_alloc(long s)
heap_alloc
ptr_definition xmotion_event
static long unchecked(GENERIC *p, long len)
unchecked
ptr_resid_list resid_vars
struct wl_list * ptr_list
ptr_definition xmisc_event
long abort_life(int nlflag)
abort_life
ptr_definition minus_symbol
static void check_symbol(ptr_node *n)
check_symbol
static void check_choice()
long sub_type(ptr_definition t1, ptr_definition t2)
sub_type
void check_definition(ptr_definition *d)
check_definition
void print_gc_info(long timeflag)
print_gc_info
ptr_definition add_module3
#define hide_window
To backtrack on hide window.
static void check_kids(ptr_int_list *c)
check_kids
void Errorline(char *format,...)
Errorline.
unsigned long * GENERIC
unsigned long *GENERIC
static void check_def_code(ptr_definition *d)
check_def_code
void check_resid_block(ptr_resid_block *rb)
check_resid_block
static void check_choice_structs(ptr_choice_point *c)
check_choice_structs
ptr_definition xkeyboard_event
#define TRUE
Standard boolean.
ptr_definition first_definition
ptr_psi_term error_psi_term
ptr_definition * gamma_table
#define PRINT_BUFFER
Size of print buffer.
#define FALSE
Standard boolean.
static void check_triple_list(ptr_triple_list *p)
check_triple_list
ptr_definition quoted_string
void print_undo_stack()
print_undo_stack
struct wl_definition * ptr_definition
void check_psi_term(ptr_psi_term *t)
check_psi_term
static void check_module_list(ptr_int_list *c)
check_module_list
ptr_definition disjunction
static void check_code(ptr_int_list *c)
check_code
ptr_definition xenter_event
void init_memory()
init_memory ()
ptr_definition add_module2
int GetBoolOption(char *name)
GetBoolOption.
ptr_definition delay_checksym
void check_definition_list()
check_definition_list
static void compress()
compress
ptr_definition final_question
char * GetStrOption(char *name, char *def)
GetStrOption.
ptr_psi_term saved_psi_term
ptr_definition sys_bytedata
ptr_definition add_module1
void check_gamma_code()
check_gamma_code
static void check_var(ptr_node *n)
check_var
void stack_info(FILE *outfile)
stack_info
long sub_CodeType(ptr_int_list c1, ptr_int_list c2)
sub_CodeType
#define undo_action
Fast checking for an undo action.
void check_hash_table(ptr_hash_table table)
check_hash_table
#define GC_THRESHOLD
Garbage collection threshold (1/8 of MEM_SIZE is reasonable).
ptr_definition xdestroy_event
static void check_module_tree(ptr_node *n)
check_module_tree
#define MAX_BUILT_INS
Maximum number of built_ins.
int GetIntOption(char *name, int def)
GetIntOption.
ptr_definition xleave_event
static void check_psi_list()
static void check_gamma_rest()
check_gamma_rest
void check_sys_definitions()
check_sys_definitions
ptr_definition xconfigure_event
void stdin_cleareof()
stdin_cleareof
ptr_psi_term xevent_existing
static void check_keyword()
long bounds_undo_stack()
bounds_undo_stack
void check_attr(ptr_node *n)
check_attr
ptr_definition inputfilesym
long open_input_file(char *file)
open_input_file
static struct tms last_garbage_time
static void check_def_rest(ptr_definition *d)
check_def_rest
ptr_definition call_handlersym
ptr_choice_point choice_stack
ptr_psi_term old_saved_psi_term
ptr_definition eval_argsym