15 static long amount_used;
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]==
'=')
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);
1559 fprintf(stderr,
"- Done pass 1 ");
1565 fprintf(stderr,
"- Done compress ");
1573 fprintf(stderr,
"- Done pass 2\n");
1581 (void)times(&garbage_end_time);
1582 gc_time=(garbage_end_time.tms_utime - garbage_start_time.tms_utime)/60.0;
1586 fprintf(stderr,
"*** End ");
1589 (void)fflush(stderr);
1595 assert(end_number_cells<=start_number_cells);
1621 s /=
sizeof (*heap_pointer);
1626 Errorline(
"the heap overflowed into the stack.\n");
1651 s /=
sizeof (*stack_pointer);
1656 Errorline(
"the stack overflowed into the heap.\n");
1711 Errorline(
"Wild_life could not allocate sufficient memory to run.\n\n");
1728 if(
verbose) fprintf(stderr,
"\n");
1732 fprintf(stderr,
"*********************\n");
1733 fprintf(stderr,
"*** OUT OF MEMORY ***\n");
1734 fprintf(stderr,
"*********************\n");
GENERIC stack_pointer
used to allocate from stack - size allocated added - adj for alignment
#define WORD
Memory Word Size.
#define prove
was enum (goal) – but must be long for error.c - now typedef
static void check_type_disj(ptr_int_list *p)
check_type_disj
ptr_definition disjunction
symbol in bi module
static void check_undo_stack()
ptr_node printed_pointers
ptr_definition alist
symbol in bi module
long memory_check()
memory_check
float garbage_time
total time on garbage collections - seconds
GENERIC stack_alloc(long s)
stack_alloc
ptr_definition succeed
symbol in bi module
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
ptr_definition xf_sym
symbol in bi module
void clear_copy()
clear_copy
GENERIC heap_pointer
used to allocate from heap - size allocated subtracted - adj for alignment
ptr_definition apply
symbol in bi module
static void check_resid(ptr_residuation *r)
check_resid
ptr_definition lf_false
symbol in bi module
ptr_definition nothing
symbol in bi module
ptr_definition integer
symbol in bi module
ptr_definition eqsym
symbol in syntax module
ptr_definition functor
symbol in bi module
ptr_definition quote
symbol in syntax module
ptr_module user_module
Default module for user input.
ptr_definition final_question
symbol in syntax module
#define show_window
To backtrack on show window.
GENERIC mem_limit
starting point of heap - mem_base aligned
ptr_definition xdisplaylist
#define def_ptr
values of type_ptr
ptr_definition first_definition
All definition are stores in a linked list starting at first_definition.
static void check_goal_stack(ptr_goal *g)
check_goal_stack
int alloc_words
number of words to allocate - from either command lind or ALLOC_WORDS define
ptr_definition xbutton_event
static void check_operator_data(ptr_operator_data *op)
check_operator_data
ptr_module current_module
The current module for the tokenizer.
ptr_definition delay_checksym
symbol in bi module
ptr_definition cut
symbol in syntax module
ptr_definition iff
symbol in bi module
#define general_cut
was enum (goal) – but must be long for error.c - now typedef
ptr_definition timesym
symbol in bi module
ptr_module syntax_module
Module for minimal Prolog syntax.
static void check_string(GENERIC *s)
check_string
#define implies_cut
was enum (goal) – but must be long for error.c - now typedef
ptr_definition comment
symbol in bi module
ptr_definition listingsym
symbol in bi module
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...
ptr_definition fx_sym
symbol in bi module
#define destroy_window
To backtrack on window creation.
ptr_definition stream
symbol in bi module
ptr_definition xexpose_event
ptr_definition call_handlersym
symbol in bi module
static void check_pair_list(ptr_pair_list *p)
check_pair_list
struct wl_psi_term * ptr_psi_term
quotedStackCopy
ptr_definition dynamicsym
symbol in bi module
ptr_definition opsym
symbol in bi module
#define cut_ptr
values of type_ptr 22.9
ptr_definition add_module3
symbol in bi module for feature_values
ptr_definition add_module2
symbol in bi module for str2psi
#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 funcsym
symbol in syntax module
ptr_definition eval_argsym
symbol in bi module
GENERIC other_limit
only used for the half-space garbage collector
ptr_definition xmotion_event
static long unchecked(GENERIC *p, long len)
unchecked
ptr_definition and
symbol in syntax module
ptr_resid_list resid_vars
struct wl_list * ptr_list
ptr_definition xmisc_event
long abort_life(int nlflag)
abort_life
#define eval
was enum (goal) – but must be long for error.c - now typedef
ptr_psi_term null_psi_term
Used to represent an empty parse token.
static void check_symbol(ptr_node *n)
check_symbol
static void check_choice()
GENERIC other_pointer
NOT USED - according to comment.
ptr_definition built_in
symbol in bi module
ptr_definition sys_bytedata
symbol in sys module
ptr_psi_term old_state
used in token.c to save state to restore it later
long sub_type(ptr_definition t1, ptr_definition t2)
sub_type
void check_definition(ptr_definition *d)
check_definition
ptr_definition real
symbol in bi module
void print_gc_info(long timeflag)
print_gc_info
#define type_it
was enum (def_type) in extern.h now there is typedef ptr_definition
ptr_definition inputfilesym
symbol in bi module
ptr_definition yf_sym
symbol in bi module
#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
char * buffer
buffer used only in print.c - there is local with same name in xpred.c
static void check_def_code(ptr_definition *d)
check_def_code
ptr_definition variable
symbol in bi module
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 final_dot
symbol in syntax module
ptr_definition colonsym
symbol in syntax module
#define freeze_cut
was enum (goal) – but must be long for error.c - now typedef
ptr_definition xkeyboard_event
int arg_c
set from argc in either life.c or lib.c
#define TRUE
Standard boolean.
ptr_definition minus_symbol
symbol in syntax module
ptr_definition eof
symbol in syntax module
ptr_definition * gamma_table
#define what_next
was enum (goal) – but must be long for error.c - now typedef
#define PRINT_BUFFER
Size of print buffer.
#define match
was enum (goal) – but must be long for error.c - now typedef
GENERIC other_base
mem_size memory allocated in init_memory by malloc
ptr_definition constant
symbol in bi module
#define FALSE
Standard boolean.
ptr_definition abortsym
symbol in bi module
ptr_definition add_module1
symbol in bi module for features
static void check_triple_list(ptr_triple_list *p)
check_triple_list
ptr_definition staticsym
symbol in bi module
#define code_ptr
values of type_ptr
void print_undo_stack()
print_undo_stack
#define clause
was enum (goal) – but must be long for error.c - now typedef
struct wl_definition * ptr_definition
ptr_definition such_that
symbol in syntax module
ptr_definition typesym
symbol in syntax module
ptr_definition nil
symbol in bi module
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 xfy_sym
symbol in bi module
#define fail
was enum (goal) – but must be long for error.c - now typedef
ptr_definition disj_nil
symbol in syntax module
#define retract
was enum (goal) – but must be long for error.c - now typedef
static void check_code(ptr_int_list *c)
check_code
ptr_definition xenter_event
#define unify
was enum (goal) – but must be long for error.c - now typedef
ptr_definition commasym
symbol in syntax module
void init_memory()
init_memory ()
int GetBoolOption(char *name)
GetBoolOption.
char * arg_v[ARGNN]
set from argv in either life.c or lib.c
#define load
was enum (goal) – but must be long for error.c - now typedef
void check_definition_list()
check_definition_list
static void compress()
compress
char * GetStrOption(char *name, char *def)
GetStrOption.
ptr_module bi_module
Module for public built-ins.
ptr_psi_term saved_psi_term
ptr_psi_term error_psi_term
symbol in bi module
#define unify_noeval
was enum (goal) – but must be long for error.c - now typedef
ptr_definition top
symbol in syntax module
ptr_definition yfx_sym
symbol in bi module
#define del_clause
was enum (goal) – but must be long for error.c - now typedef
#define eval_cut
was enum (goal) – but must be long for error.c - now typedef
void check_gamma_code()
check_gamma_code
static void check_var(ptr_node *n)
check_var
ptr_node module_table
The table of modules.
ptr_definition loadsym
symbol in bi module
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 nullsym
symbol in bi module
ptr_definition xdestroy_event
static void check_module_tree(ptr_node *n)
check_module_tree
#define disj
was enum (goal) – but must be long for error.c - now typedef
#define MAX_BUILT_INS
Maximum number of built_ins.
GENERIC mem_base
mem_size memory allocated in init_memory by malloc
ptr_definition encodesym
symbol in bi module
ptr_definition fy_sym
symbol in bi module
int mem_size
number of words from memory = alloc_words * sizeof word
int GetIntOption(char *name, int def)
GetIntOption.
ptr_definition xleave_event
static void check_psi_list()
#define type_disj
was enum (goal) – but must be long for error.c - now typedef
static void check_gamma_rest()
check_gamma_rest
ptr_definition lf_true
symbol in bi module
ptr_definition aborthooksym
symbol in bi module
void check_sys_definitions()
check_sys_definitions
ptr_definition xconfigure_event
void stdin_cleareof()
stdin_cleareof
ptr_psi_term xevent_existing
ptr_definition boolpredsym
symbol in bi module
#define resid_ptr
values of type_ptr
static void check_keyword()
long bounds_undo_stack()
bounds_undo_stack
void check_attr(ptr_node *n)
check_attr
#define goal_ptr
values of type_ptr
ptr_definition xfx_sym
symbol in bi module
ptr_module x_module
'ifdef X11' unnecessary
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 quoted_string
symbol in bi module
ptr_choice_point choice_stack
ptr_psi_term old_saved_psi_term
ptr_definition predsym
symbol in syntax module
ptr_definition tracesym
symbol in bi module
ptr_definition life_or
symbol in syntax module
#define psi_term_ptr
values of type_ptr
#define int_ptr
values of type_ptr