prototypes More...
Go to the source code of this file.
Functions | |
void | insert_math_builtins () |
insert math builtins into table More... | |
long | c_trace () |
trace More... | |
long | c_tprove () |
c_tprove More... | |
long | c_quiet () |
c_quiet More... | |
void | setUnitList (GENERIC x) |
setUnitList(GENERIC x) More... | |
ptr_psi_term | unitListValue () |
make psi term from unitListElement More... | |
GENERIC | unitListNext () |
set unitListElement to NULL & return NULL More... | |
ptr_psi_term | intListValue (ptr_int_list p) |
ptr_psi_term intListValue More... | |
GENERIC | intListNext (ptr_int_list p) |
intListNext More... | |
ptr_psi_term | quotedStackCopy (psi_term p) |
ptr_psi_term | residListGoalQuote (ptr_residuation p) |
residListGoalQuote More... | |
GENERIC | residListNext (ptr_residuation p) |
residListNext More... | |
ptr_psi_term | makePsiTerm (ptr_definition x) |
ptr_psi_term makePsiTerm More... | |
ptr_psi_term | makePsiList (GENERIC head, ptr_psi_term(*valueFunc)(), GENERIC(*nextFunc)()) |
makePsiList More... | |
ptr_goal | makeGoal (ptr_psi_term p) |
makeGoal More... | |
void | insert_system_builtins () |
insert_system_builtins More... | |
long | c_isa_subsort () |
long c_isa_subsort More... | |
long | isValue (ptr_psi_term p) |
isValue(p) More... | |
long | c_glb () |
long c_glb More... | |
long | c_lub () |
long c_lub More... | |
void | insert_type_builtins () |
void insert_type_builtins More... | |
int | isSubTypeValue (ptr_psi_term arg1, ptr_psi_term arg2) |
isSubTypeValue More... | |
ptr_psi_term | stack_nil () |
stack_nil More... | |
ptr_psi_term | stack_cons (ptr_psi_term head, ptr_psi_term tail) |
stack_cons More... | |
ptr_psi_term | stack_pair (ptr_psi_term left, ptr_psi_term right) |
stack_pair More... | |
ptr_psi_term | stack_int (long n) |
stack_int More... | |
ptr_psi_term | stack_string (char *s) |
stack_string More... | |
ptr_psi_term | stack_bytes (char *s, int n) |
stack_bytes More... | |
long | psi_to_string (ptr_psi_term t, char **fn) |
psi_to_string More... | |
ptr_psi_term | make_feature_list (ptr_node tree, ptr_psi_term tail, ptr_module module, int val) |
make_feature_list More... | |
long | check_real (ptr_psi_term t, REAL *v, long *n) |
check_real More... | |
long | get_real_value (ptr_psi_term t, REAL *v, long *n) |
get_real_value More... | |
void | unify_bool_result (ptr_psi_term t, long v) |
unify_bool_result More... | |
long | unify_real_result (ptr_psi_term t, REAL v) |
unify_real_result More... | |
long | only_arg1 (ptr_psi_term t, ptr_psi_term *arg1) |
only_arg1 More... | |
long | file_exists (char *s) |
file_exists More... | |
long | c_halt () |
c_halt More... | |
void | exit_life (long nl_flag) |
exit_life More... | |
long | c_abort () |
c_abort More... | |
long | abort_life (int nlflag) |
abort_life More... | |
long | pred_clause (ptr_psi_term t, long r, ptr_psi_term g) |
pred_clause More... | |
void | global_error_check (ptr_node n, int *error, int *eval2) |
global_error_check More... | |
void | global_tree (ptr_node n) |
global_tree More... | |
void | global_one (ptr_psi_term t) |
global_one More... | |
void | persistent_error_check (ptr_node n, int *error) |
persistent_error_check More... | |
void | persistent_tree (ptr_node n) |
persistent_tree More... | |
void | persistent_one (ptr_psi_term t) |
persistent_one More... | |
long | hidden_type (ptr_definition t) |
hidden_type More... | |
ptr_psi_term | collect_symbols (long sel) |
collect_symbols More... | |
ptr_node | one_attr () |
one_attr More... | |
ptr_psi_term | new_psi_term (long numargs, ptr_definition typ, ptr_psi_term **a1, ptr_psi_term **a2) |
new_psi_term More... | |
long | has_rules (ptr_pair_list r) |
has_rules More... | |
long | is_built_in (ptr_pair_list r) |
is_built_in More... | |
void | list_special (ptr_psi_term t) |
list_special More... | |
void | new_built_in (ptr_module m, char *s, def_type t, long(*r)()) |
new_built_in More... | |
long | declare_operator (ptr_psi_term t) |
declare_operator More... | |
char * | str_conc (char *s1, char *s2) |
str_conc More... | |
char * | sub_str (char *s, long p, long n) |
sub_str More... | |
long | append_files (char *s1, char *s2) |
append_files More... | |
long | c_concatenate () |
c_concatenate More... | |
long | c_string_length () |
c_string_length More... | |
long | c_sub_string () |
c_sub_string More... | |
long | c_append_file () |
c_append_file More... | |
long | c_random () |
c_random More... | |
long | c_initrandom () |
c_initrandom More... | |
long | c_deref_length () |
c_deref_length More... | |
long | c_args () |
c_args More... | |
void | init_built_in_types () |
init_built_in_types More... | |
void | init_copy () |
init_copy More... | |
void | clear_copy () |
clear_copy More... | |
void | insert_translation (ptr_psi_term a, ptr_psi_term b, long info) |
insert_translation More... | |
ptr_psi_term | translate (ptr_psi_term a, long **infoptr) |
translate More... | |
ptr_psi_term | exact_copy (ptr_psi_term t, long heap_flag) |
exact_copy More... | |
ptr_psi_term | quote_copy (ptr_psi_term t, long heap_flag) |
quote_copy More... | |
ptr_psi_term | eval_copy (ptr_psi_term t, long heap_flag) |
eval_copy More... | |
ptr_psi_term | inc_heap_copy (ptr_psi_term t) |
inc_heap_copy More... | |
ptr_psi_term | copy (ptr_psi_term t, long copy_flag, long heap_flag) |
copy More... | |
ptr_node | distinct_tree (ptr_node t) |
distinct_tree More... | |
ptr_psi_term | distinct_copy (ptr_psi_term t) |
distinct_copy More... | |
void | mark_quote_c (ptr_psi_term t, long heap_flag) |
mark_quote_c More... | |
void | mark_quote_tree_c (ptr_node n, long heap_flag) |
mark_quote_tree_c More... | |
void | mark_eval (ptr_psi_term t) |
mark_eval More... | |
void | mark_nonstrict (ptr_psi_term t) |
mark_nonstrict More... | |
void | mark_quote_new2 (ptr_psi_term t) |
mark_quote_new2 More... | |
void | mark_eval_new (ptr_psi_term t) |
mark_eval_new More... | |
void | mark_eval_tree_new (ptr_node n) |
mark_eval_tree_new More... | |
void | mark_quote_new (ptr_psi_term t) |
mark_quote_new More... | |
void | mark_quote_tree_new (ptr_node n) |
mark_quote_tree_new More... | |
void | mark_quote (ptr_psi_term t) |
mark_quote More... | |
void | mark_quote_tree (ptr_node t) |
mark_quote_tree More... | |
void | bk_mark_quote (ptr_psi_term t) |
bk_mark_quote More... | |
void | bk_mark_quote_tree (ptr_node t) |
bk_mark_quote_tree More... | |
void | stack_info (FILE *outfile) |
stack_info More... | |
void | outputline (char *format,...) |
void outputline(char *format,...) More... | |
void | traceline (char *format,...) |
traceline More... | |
void | infoline (char *format,...) |
infoline More... | |
void | warningline (char *format,...) |
warningline More... | |
void | Errorline (char *format,...) |
Errorline. More... | |
void | Syntaxerrorline (char *format,...) |
Syntaxerrorline. More... | |
void | vinfoline (char *format, FILE *outfile,...) |
void | init_trace () |
init_trace More... | |
void | reset_step () |
reset_step More... | |
void | tracing () |
tracing More... | |
void | new_trace (long newtrace) |
new_trace More... | |
void | new_step (long newstep) |
new_step More... | |
void | set_trace_to_prove () |
set_trace_to_prove More... | |
void | toggle_trace () |
toggle_trace More... | |
void | toggle_step () |
toggle_step More... | |
void | perr (char *str) |
perr More... | |
void | perr_s (char *s1, char *s2) |
perr_s More... | |
void | perr_s2 (char *s1, char *s2, char *s3) |
perr_s2 More... | |
void | perr_i (char *str, long i) |
perr_i More... | |
long | warning () |
warning More... | |
long | warningx () |
warningx More... | |
void | report_error_main (ptr_psi_term g, char *s, char *s2) |
report_error_main More... | |
void | report_error (ptr_psi_term g, char *s) |
report_error More... | |
long | reportAndAbort (ptr_psi_term g, char *s) |
reportAndAbort More... | |
void | report_warning (ptr_psi_term g, char *s) |
report_warning More... | |
void | report_error2_main (ptr_psi_term g, char *s, char *s2) |
report_error2_main More... | |
void | report_error2 (ptr_psi_term g, char *s) |
report_error2 More... | |
void | report_warning2 (ptr_psi_term g, char *s) |
report_warning2 More... | |
void | nonnum_warning (ptr_psi_term t, ptr_psi_term arg1, ptr_psi_term arg2) |
nonnum_warning More... | |
long | nonint_warning (ptr_psi_term arg, REAL val, char *msg) |
nonint_warning More... | |
long | bit_and_warning (ptr_psi_term arg, REAL val) |
bit_and_warning More... | |
long | bit_or_warning (ptr_psi_term arg, REAL val) |
bit_or_warning More... | |
long | bit_not_warning (ptr_psi_term arg, REAL val) |
bit_not_warning More... | |
long | int_div_warning (ptr_psi_term arg, REAL val) |
int_div_warning More... | |
long | mod_warning (ptr_psi_term arg, REAL val, int zero) |
mod_warning More... | |
long | shift_warning (long dir, ptr_psi_term arg, REAL val) |
shift_warning More... | |
ptr_hash_table | hash_create (int size) |
HASH_CREATE. More... | |
void | hash_expand (ptr_hash_table table, int new_size) |
HASH_EXPAND. More... | |
int | hash_code (ptr_hash_table table, char *symbol) |
HASH_CODE. More... | |
int | hash_find (ptr_hash_table table, char *symbol) |
hash_find More... | |
ptr_keyword | hash_lookup (ptr_hash_table table, char *symbol) |
HASH_LOOKUP. More... | |
void | hash_insert (ptr_hash_table table, char *symbol, ptr_keyword keyword) |
HASH_INSERT. More... | |
void | hash_display (ptr_hash_table table) |
HASH_DISPLAY. More... | |
void | title () |
TITLE. More... | |
void | interrupt () |
INTERRUPT() More... | |
void | init_interrupt () |
INIT_INTERRUPT. More... | |
void | handle_interrupt () |
HANDLE_INTERRUPT. More... | |
ptr_psi_term | stack_psi_term (long stat) |
stack_psi_term More... | |
ptr_psi_term | real_stack_psi_term (long stat, REAL thereal) |
real_stack_psi_term More... | |
ptr_psi_term | heap_psi_term (long stat) |
heap_psi_term More... | |
void | residuate_double (ptr_psi_term t, ptr_psi_term u) |
residuate_double More... | |
void | residuate (ptr_psi_term t) |
residuate More... | |
void | residuate2 (ptr_psi_term u, ptr_psi_term v) |
residuate2 More... | |
void | residuate3 (ptr_psi_term u, ptr_psi_term v, ptr_psi_term w) |
residuate3 More... | |
void | curry () |
curry More... | |
long | residuateGoalOnVar (ptr_goal g, ptr_psi_term var, ptr_psi_term othervar) |
residuateGoalOnVar More... | |
long | do_residuation_user () |
do_residuation_user() More... | |
long | do_residuation () |
do_residuation More... | |
void | do_currying () |
do_currying More... | |
void | release_resid_main (ptr_psi_term t, long trailflag) |
release_resid_main More... | |
void | release_resid (ptr_psi_term t) |
release_resid More... | |
void | release_resid_notrail (ptr_psi_term t) |
release_resid_notrail More... | |
void | append_resid (ptr_psi_term u, ptr_psi_term v) |
append_resid More... | |
long | eval_aim () |
eval_aim More... | |
void | match_attr1 (ptr_node *u, ptr_node v, ptr_resid_block rb) |
void match_attr1 More... | |
void | match_attr2 (ptr_node *u, ptr_node v, ptr_resid_block rb) |
match_attr2 More... | |
void | match_attr3 (ptr_node *u, ptr_node v, ptr_resid_block rb) |
match_attr3 More... | |
void | match_attr (ptr_node *u, ptr_node v, ptr_resid_block rb) |
match_attr More... | |
long | match_aim () |
match_aim More... | |
long | i_eval_args (ptr_node n) |
i_eval_args More... | |
long | eval_args (ptr_node n) |
eval_args More... | |
void | check_disj (ptr_psi_term t) |
check_disj More... | |
void | check_func (ptr_psi_term t) |
check_func More... | |
long | check_type (ptr_psi_term t) |
check_type More... | |
long | i_check_out (ptr_psi_term t) |
i_check_out More... | |
long | f_check_out (ptr_psi_term t) |
f_check_out More... | |
long | check_out (ptr_psi_term t) |
long | deref_eval (ptr_psi_term t) |
deref_eval More... | |
long | deref_rec_eval (ptr_psi_term t) |
deref_rec_eval More... | |
void | deref_rec_body (ptr_psi_term t) |
deref_rec_body More... | |
void | deref_rec_args (ptr_node n) |
deref_rec_args More... | |
long | deref_args_eval (ptr_psi_term t, long set) |
deref_args_eval More... | |
long | in_set (char *str, long set) |
in_set More... | |
void | deref_rec_args_exc (ptr_node n, long set) |
deref_rec_args_exc More... | |
void | deref2_eval (ptr_psi_term t) |
deref2_eval More... | |
void | deref2_rec_eval (ptr_psi_term t) |
deref2_rec_eval More... | |
void | save_resid (ptr_resid_block rb, ptr_psi_term match_date) |
save_resid More... | |
void | restore_resid (ptr_resid_block rb, ptr_psi_term *match_date) |
restore_resid More... | |
void | eval_global_var (ptr_psi_term t) |
eval_global_var More... | |
void | init_global_vars () |
init_global_vars More... | |
char ** | group_features (char **f, ptr_node n) |
group_features More... | |
void | exit_if_true (long exitflag) |
exit_if_true More... | |
void | init_io () |
void init_io More... | |
void | init_system () |
init_system More... | |
void | WFInit (long argc, char **argv) |
int | WFInput (char *query) |
WFInput. More... | |
PsiTerm | WFGetVar (char *name) |
WFGetVar. More... | |
int | WFfeature_count_loop (ptr_node n) |
WFfeature_count_loop. More... | |
int | WFFeatureCount (ptr_psi_term psi) |
WFFeatureCount. More... | |
char * | WFType (ptr_psi_term psi) |
WFType. More... | |
char ** | WFFeatures (ptr_psi_term psi) |
WFFeatures. More... | |
double | WFGetDouble (ptr_psi_term psi, int *ok) |
WFGetDouble. More... | |
char * | WFGetString (ptr_psi_term psi, int *ok) |
WFGetString. More... | |
PsiTerm | WFGetFeature (ptr_psi_term ps, char *feature) |
WFGetFeature. More... | |
int | main (int argc, char *argv[]) |
main More... | |
void | List_SetLinkProc (RefListHeader header, RefListGetLinksProc getLinks) |
List_SetLinkProc. More... | |
void | List_InsertAhead (RefListHeader header, Ref atom) |
List_InsertAhead. More... | |
void | List_Append (RefListHeader header, Ref atom) |
void List_Append More... | |
void | List_InsertBefore (RefListHeader header, Ref atom, Ref mark) |
List_InsertBefore. More... | |
void | List_InsertAfter (RefListHeader header, Ref atom, Ref mark) |
List_InsertAfter. More... | |
void | List_Swap (RefListHeader header, Ref first, Ref second) |
List_Swap. More... | |
void | List_Reverse (RefListHeader header) |
List_Reverse. More... | |
void | List_Remove (RefListHeader header, Ref atom) |
List_Remove. More... | |
void | List_Concat (RefListHeader header1, RefListHeader header2) |
List_Concat. More... | |
long | List_EnumFrom (RefListHeader header, Ref atom, RefListEnumProc proc, Ref closure) |
List_EnumFrom. More... | |
long | List_Enum (RefListHeader header, RefListEnumProc proc, Ref closure) |
List_Enum. More... | |
long | List_EnumBackFrom (RefListHeader header, Ref atom, RefListEnumProc proc, Ref closure) |
List_EnumBackFrom. More... | |
long | List_EnumBack (RefListHeader header, RefListEnumProc proc, Ref closure) |
List_EnumBack. More... | |
long | List_Card (RefListHeader header) |
List_Card. More... | |
long | List_IsUnlink (RefListLinks links) |
List_IsUnlink. More... | |
void | List_Cut (RefListHeader header, Ref atom, RefListHeader newHeader) |
List_Cut. More... | |
void | get_two_args (ptr_node t, ptr_psi_term *a, ptr_psi_term *b) |
get_two_args More... | |
void | get_one_arg (ptr_node t, ptr_psi_term *a) |
get_one_arg More... | |
void | get_one_arg_addr (ptr_node t, ptr_psi_term **a) |
get_one_arg_addr More... | |
void | add_rule (ptr_psi_term head, ptr_psi_term body, def_type typ) |
add_rule More... | |
void | assert_rule (psi_term t, def_type typ) |
assert_rule More... | |
void | assert_clause (ptr_psi_term t) |
assert_clause More... | |
void | start_chrono () |
start_chrono More... | |
void | push_ptr_value (type_ptr t, GENERIC *p) |
push_ptr_value More... | |
void | push_def_ptr_value (ptr_psi_term q, GENERIC *p) |
push_def_ptr_value More... | |
void | push_psi_ptr_value (ptr_psi_term q, GENERIC *p) |
push_psi_ptr_value More... | |
void | push_ptr_value_global (type_ptr t, GENERIC *p) |
push_ptr_value_global More... | |
void | push_window (long type, long disp, long wind) |
push_window More... | |
void | push2_ptr_value (type_ptr t, GENERIC *p, GENERIC v) |
push2_ptr_value More... | |
void | push_goal (goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c) |
push_goal More... | |
void | push_choice_point (goals t, ptr_psi_term a, ptr_psi_term b, GENERIC c) |
push_choice_point More... | |
void | undo (ptr_stack limit) |
undo More... | |
void | undo_actions () |
undo_actions More... | |
void | backtrack () |
backtrack More... | |
void | clean_undo_window (long disp, long wind) |
clean_undo_window More... | |
void | merge1 (ptr_node *u, ptr_node v) |
merge1 More... | |
void | merge2 (ptr_node *u, ptr_node v) |
merge2 More... | |
void | merge3 (ptr_node *u, ptr_node v) |
merge3 More... | |
void | merge (ptr_node *u, ptr_node v) |
merge More... | |
void | merge_unify (ptr_node *u, ptr_node v) |
merge_unify More... | |
void | show_count () |
show_count More... | |
void | fetch_def (ptr_psi_term u, long allflag) |
fetch_def More... | |
void | fetch_def_lazy (ptr_psi_term u, ptr_definition old1, ptr_definition old2, ptr_node old1attr, ptr_node old2attr, long old1stat, long old2stat) |
fetch_def_lazy More... | |
long | unify_aim_noeval () |
unify_aim_noeval More... | |
long | unify_aim () |
unify_aim More... | |
long | unify_body (long eval_flag) |
unify_body More... | |
long | disjunct_aim () |
disjunct_aim More... | |
long | prove_aim () |
prove_aim More... | |
void | type_disj_aim () |
type_disj_aim More... | |
long | clause_aim (long r) |
clause_aim More... | |
long | no_choices () |
no_choices More... | |
long | num_choices () |
num_choices More... | |
long | num_vars (ptr_node vt) |
num_vars More... | |
long | what_next_cut () |
what_next_cut More... | |
ptr_choice_point | topmost_what_next () |
topmost_what_next More... | |
void | reset_stacks () |
reset_stacks More... | |
long | what_next_aim () |
what_next_aim More... | |
long | load_aim () |
load_aim More... | |
void | main_prove () |
main_prove More... | |
int | dummy_printf (char *f, char *s, char *t) |
dummy_printf More... | |
long | trail_condition (psi_term *Q) |
trail_condition More... | |
ptr_int_list | appendIntList (ptr_int_list tail, ptr_int_list more) |
appendIntList More... | |
void | mark_ancestors (ptr_definition def, long *flags) |
mark_ancestors More... | |
ptr_int_list | lub (ptr_psi_term a, ptr_psi_term b, ptr_psi_term *pp) |
char * | GetStrOption (char *name, char *def) |
GetStrOption. More... | |
int | GetBoolOption (char *name) |
GetBoolOption. More... | |
int | GetIntOption (char *name, int def) |
GetIntOption. More... | |
void | pchoices () |
pchoices More... | |
void | print_undo_stack () |
print_undo_stack More... | |
long | bounds_undo_stack () |
bounds_undo_stack More... | |
void | fail_all () |
fail_all More... | |
void | check_hash_table (ptr_hash_table table) |
check_hash_table More... | |
void | check_definition (ptr_definition *d) |
check_definition More... | |
void | check_definition_list () |
check_definition_list More... | |
void | check_resid_block (ptr_resid_block *rb) |
check_resid_block More... | |
void | check_psi_term (ptr_psi_term *t) |
check_psi_term More... | |
void | check_attr (ptr_node *n) |
check_attr More... | |
void | check_gamma_code () |
check_gamma_code More... | |
void | print_gc_info (long timeflag) |
print_gc_info More... | |
void | garbage () |
garbage More... | |
GENERIC | heap_alloc (long s) |
heap_alloc More... | |
GENERIC | stack_alloc (long s) |
stack_alloc More... | |
void | init_memory () |
init_memory () More... | |
long | memory_check () |
memory_check More... | |
void | init_modules () |
init_modules More... | |
ptr_module | find_module (char *module) |
find_module More... | |
ptr_module | create_module (char *module) |
ptr_module create_module(char *module) More... | |
ptr_module | set_current_module (ptr_module module) |
set_current_module More... | |
ptr_module | extract_module_from_name (char *str) |
extract_module_from_name More... | |
char * | strip_module_name (char *str) |
strip_module_name More... | |
char * | string_val (ptr_psi_term term) |
string_val More... | |
char * | make_module_token (ptr_module module, char *str) |
make_module_token More... | |
ptr_definition | new_definition (ptr_keyword key) |
new_definition More... | |
ptr_definition | update_symbol (ptr_module module, char *symbol) |
update_symbol More... | |
char * | print_symbol (ptr_keyword k) |
print_symbol More... | |
void | pretty_symbol (ptr_keyword k) |
pretty_symbol More... | |
void | pretty_quote_symbol (ptr_keyword k) |
pretty_quote_symbol More... | |
long | c_set_module () |
c_set_module More... | |
long | c_open_module () |
c_open_module More... | |
void | open_module_tree (ptr_node n, int *onefailed) |
open_module_tree More... | |
void | open_module_one (ptr_psi_term t, int *onefailed) |
open_module_one More... | |
long | make_public (ptr_psi_term term, long bool) |
make_public More... | |
void | traverse_tree (ptr_node n, int flag) |
traverse_tree More... | |
long | c_public () |
c_public More... | |
long | c_private () |
c_private More... | |
long | c_display_modules () |
c_display_modules More... | |
long | c_display_persistent () |
c_display_persistent More... | |
long | c_trace_input () |
c_trace_input More... | |
void | replace (ptr_definition old, ptr_definition new, ptr_psi_term term) |
replace More... | |
void | rec_replace (ptr_definition old, ptr_definition new, ptr_psi_term term) |
rec_replace More... | |
void | replace_attr (ptr_node old_attr, ptr_psi_term term, ptr_definition old, ptr_definition new) |
replace_attr More... | |
long | c_replace () |
c_replace More... | |
long | c_current_module () |
c_current_module More... | |
long | c_module_access () |
c_module_access More... | |
int | global_unify (ptr_psi_term u, ptr_psi_term v) |
global_unify More... | |
int | global_unify_attr (ptr_node u, ptr_node v) |
global_unify_attr More... | |
long | c_alias () |
c_alias More... | |
int | get_module (ptr_psi_term psi, ptr_module *module) |
get_module More... | |
int | make_feature_private (ptr_psi_term term) |
make_feature_private More... | |
long | c_private_feature () |
c_private_feature More... | |
ptr_definition | update_feature (ptr_module module, char *feature) |
update_feature More... | |
long | all_public_symbols () |
all_public_symbols More... | |
int | bad_psi_term (ptr_psi_term t) |
bad_psi_term More... | |
void | show (long limit) |
show More... | |
void | push (psi_term tok, long prec, long op) |
push More... | |
long | pop (ptr_psi_term tok, long *op) |
pop More... | |
long | look () |
look More... | |
long | precedence (psi_term tok, long typ) |
precedence More... | |
ptr_psi_term | stack_copy_psi_term (psi_term t) |
stack_copy_psi_term More... | |
ptr_psi_term | heap_copy_psi_term (psi_term t) |
heap_copy_psi_term More... | |
void | feature_insert (char *keystr, ptr_node *tree, ptr_psi_term psi) |
feature_insert More... | |
psi_term | list_nil (ptr_definition type) |
list_nil More... | |
psi_term | parse_list (ptr_definition typ, char e, char s) |
parse_list More... | |
psi_term | read_psi_term () |
read_psi_term More... | |
psi_term | make_life_form (ptr_psi_term tok, ptr_psi_term arg1, ptr_psi_term arg2) |
make_life_form More... | |
void | crunch (long prec, long limit) |
crunch More... | |
psi_term | read_life_form (char ch1, char ch2) |
read_life_form More... | |
psi_term | parse (long *q) |
parse More... | |
void | init_print () |
init_print More... | |
char * | heap_nice_name () |
heap_nice_name More... | |
GENERIC | unique_name () |
unique_name More... | |
long | str_to_int (char *s) |
str_to_int More... | |
void | print_bin (long b) |
print_bin More... | |
void | print_code (FILE *s, ptr_int_list c) |
print_code More... | |
void | print_operator_kind (FILE *s, long kind) |
print_operator_kind More... | |
void | check_pointer (ptr_psi_term p) |
check_pointer More... | |
void | go_through_tree (ptr_node t) |
go_through_tree More... | |
void | go_through (ptr_psi_term t) |
go_through More... | |
void | insert_variables (ptr_node vars, long force) |
insert_variables More... | |
void | forbid_variables (ptr_node n) |
void | prettyf_inner (char *s, long q, char c) |
prettyf_inner More... | |
long | starts_nonlower (char *s) |
starts_nonlower More... | |
long | has_non_alpha (char *s) |
has_non_alpha More... | |
long | all_symbol (char *s) |
all_symbol More... | |
long | is_integer (char *s) |
is_integer More... | |
long | no_quote (char *s) |
no_quote More... | |
void | prettyf (char *s) |
prettyf More... | |
void | prettyf_quoted_string (char *s) |
prettyf_quoted_string More... | |
void | prettyf_quote (char *s) |
prettyf_quote More... | |
void | end_tab () |
end_tab More... | |
void | mark_tab (ptr_tab_brk t) |
mark_tab More... | |
void | new_tab (ptr_tab_brk *t) |
new_tab More... | |
long | strpos (long pos, char *str) |
strpos More... | |
void | work_out_length () |
work_out_length More... | |
long | count_features (ptr_node t) |
count_features More... | |
long | check_legal_cons (ptr_psi_term t, ptr_definition t_type) |
check_legal_cons More... | |
void | pretty_list (ptr_psi_term t, long depth) |
pretty_list More... | |
void | pretty_tag_or_psi_term (ptr_psi_term p, long sprec, long depth) |
pretty_tag_or_psi_term More... | |
long | check_opargs (ptr_node n) |
check_opargs More... | |
long | opcheck (ptr_psi_term t, long *prec, long *type) |
opcheck More... | |
long | pretty_psi_with_ops (ptr_psi_term t, long sprec, long depth) |
pretty_psi_with_ops More... | |
void | pretty_psi_term (ptr_psi_term t, long sprec, long depth) |
pretty_psi_term More... | |
void | do_pretty_attr (ptr_node t, ptr_tab_brk tab, long *cnt, long two, long depth) |
do_pretty_attr More... | |
long | two_or_more (ptr_node t) |
two_or_more More... | |
void | pretty_attr (ptr_node t, long depth) |
pretty_attr More... | |
void | pretty_output () |
pretty_output More... | |
void | pretty_variables (ptr_node n, ptr_tab_brk tab) |
pretty_variables More... | |
long | print_variables (long printflag) |
print_variables More... | |
void | write_attributes (ptr_node n, ptr_tab_brk tab) |
write_attributes More... | |
void | listing_pred_write (ptr_node n, long fflag) |
listing_pred_write More... | |
void | pred_write (ptr_node n) |
pred_write More... | |
void | main_pred_write (ptr_node n) |
main_pred_write More... | |
void | display_psi_stdout (ptr_psi_term t) |
display_psi_stdout More... | |
void | display_psi_stderr (ptr_psi_term t) |
display_psi_stderr More... | |
void | display_psi_stream (ptr_psi_term t) |
display_psi_stream More... | |
void | display_psi (FILE *s, ptr_psi_term t) |
display_psi More... | |
void | main_display_psi_term (ptr_psi_term t) |
main_display_psi_term More... | |
void | display_couple (ptr_psi_term u, char *s, ptr_psi_term v) |
display_couple More... | |
void | print_resid_message (ptr_psi_term t, ptr_resid_list r) |
print_resid_message More... | |
long | c_begin_raw () |
long | c_get_raw () |
long | c_put_raw () |
long | c_end_raw () |
long | c_in_raw () |
long | c_window_flag () |
long | c_reset_window_flag () |
void | raw_setup_builtins () |
raw_setup_builtins More... | |
long | call_primitive (long(*fun)(), int num, psi_arg argi[], GENERIC info) |
call_primitive More... | |
ptr_psi_term | fileptr2stream (FILE *fp, ptr_definition typ) |
fileptr2stream More... | |
int | text_buffer_next (struct text_buffer *buf, int idx, char c, struct text_buffer **rbuf, int *ridx) |
text_buffer_next More... | |
char * | text_buffer_cmp (struct text_buffer *buf, int idx, char *str) |
text_buffer_cmp More... | |
void | text_buffer_push (struct text_buffer **buf, char c) |
text_buffer_push More... | |
void | text_buffer_free (struct text_buffer *buf) |
text_buffer_free More... | |
int | is_ipaddr (char *s) |
is_ipaddr More... | |
void | make_sys_type_links () |
make_sys_type_links More... | |
void | check_sys_definitions () |
check_sys_definitions More... | |
void | insert_sys_builtins () |
insert_sys_builtins More... | |
void | insert_dbm_builtins () |
long | get_arg (ptr_psi_term g, ptr_psi_term *arg, char *number) |
get_arg More... | |
void | TOKEN_ERROR (ptr_psi_term p) |
TOKEN_ERROR. More... | |
void | stdin_cleareof () |
stdin_cleareof More... | |
void | heap_add_int_attr (ptr_psi_term t, char *attrname, long value) |
heap_add_int_attr More... | |
void | stack_add_int_attr (ptr_psi_term t, char *attrname, long value) |
stack_add_int_attr More... | |
void | heap_mod_int_attr (ptr_psi_term t, char *attrname, long value) |
heap_mod_int_attr More... | |
void | heap_add_str_attr (ptr_psi_term t, char *attrname, char *str) |
heap_add_str_attr More... | |
void | stack_add_str_attr (ptr_psi_term t, char *attrname, char *str) |
stack_add_str_attr More... | |
void | heap_mod_str_attr (ptr_psi_term t, char *attrname, char *str) |
heap_mod_str_attr More... | |
void | heap_add_psi_attr (ptr_psi_term t, char *attrname, ptr_psi_term g) |
heap_add_psi_attr More... | |
void | stack_add_psi_attr (ptr_psi_term t, char *attrname, ptr_psi_term g) |
stack_add_psi_attr More... | |
void | bk_stack_add_psi_attr (ptr_psi_term t, char *attrname, ptr_psi_term g) |
bk_stack_add_psi_attr More... | |
GENERIC | get_attr (ptr_psi_term t, char *attrname) |
get_attr More... | |
FILE * | get_stream (ptr_psi_term t) |
get_stream More... | |
void | save_state (ptr_psi_term t) |
save_state More... | |
void | restore_state (ptr_psi_term t) |
restore_state More... | |
void | new_state (ptr_psi_term *t) |
new_state More... | |
void | save_parse_state (ptr_parse_block pb) |
save_parse_state More... | |
void | restore_parse_state (ptr_parse_block pb) |
restore_parse_state More... | |
void | init_parse_state () |
init_parse_state More... | |
void | begin_terminal_io () |
begin_terminal_io More... | |
void | end_terminal_io () |
end_terminal_io More... | |
char * | expand_file_name (char *s) |
expand_file_name More... | |
long | open_input_file (char *file) |
open_input_file More... | |
long | open_output_file (char *file) |
long | read_char () |
read_char More... | |
void | put_back_char (long c) |
put_back_char More... | |
void | put_back_token (psi_term t) |
put_back_token More... | |
void | psi_term_error () |
psi_term_error More... | |
void | read_comment (ptr_psi_term tok) |
read_comment More... | |
void | read_string_error (int n) |
read_string_error More... | |
int | base2int (int n) |
base2int More... | |
void | read_string (ptr_psi_term tok, long e) |
read_string More... | |
long | symbolic (long c) |
symbolic More... | |
long | legal_in_name (long c) |
legal_in_name More... | |
void | read_name (ptr_psi_term tok, long ch, long(*f)(), ptr_definition typ) |
void | read_number (ptr_psi_term tok, long c) |
read_number More... | |
void | read_token (ptr_psi_term tok) |
read_token More... | |
void | read_token_b (ptr_psi_term tok) |
read_token_b More... | |
void | read_token_main (ptr_psi_term tok, long for_parser) |
read_token_main More... | |
long | intcmp (long a, long b) |
intcmp More... | |
long | is_int (char **s, long *len, long *sgn) |
is_int More... | |
long | featcmp (char *str1, char *str2) |
featcmp More... | |
char * | heap_ncopy_string (char *s, int n) |
heap_ncopy_string More... | |
char * | heap_copy_string (char *s) |
heap_copy_string More... | |
char * | stack_copy_string (char *s) |
stack_copy_string More... | |
ptr_node | general_insert (long comp, char *keystr, ptr_node *tree, GENERIC info, long heapflag, long copystr, long bkflag) |
ptr_node general_insert More... | |
void | heap_insert_copystr (char *keystr, ptr_node *tree, GENERIC info) |
heap_insert_copystr More... | |
void | stack_insert_copystr (char *keystr, ptr_node *tree, GENERIC info) |
stack_insert_copystr More... | |
ptr_node | heap_insert (long comp, char *keystr, ptr_node *tree, GENERIC info) |
heap_insert More... | |
ptr_node | stack_insert (long comp, char *keystr, ptr_node *tree, GENERIC info) |
stack_insert More... | |
ptr_node | bk_stack_insert (long comp, char *keystr, ptr_node *tree, GENERIC info) |
bk_stack_insert More... | |
ptr_node | bk2_stack_insert (long comp, char *keystr, ptr_node *tree, GENERIC info) |
bk2_stack_insert More... | |
ptr_node | find (long comp, char *keystr, ptr_node tree) |
find More... | |
ptr_node | find_data (GENERIC p, ptr_node t) |
find_data More... | |
void | delete_attr (char *s, ptr_node *n) |
delete_attr More... | |
void | print_def_type (def_type t) |
print_def_type More... | |
long | yes_or_no () |
yes_or_no More... | |
void | remove_cycles (ptr_definition d, ptr_int_list *dl) |
remove_cycles More... | |
long | redefine (ptr_psi_term t) |
redefine More... | |
ptr_int_list | cons (GENERIC v, ptr_int_list l) |
cons More... | |
long | assert_less (ptr_psi_term t1, ptr_psi_term t2) |
assert_less More... | |
void | assert_protected (ptr_node n, long prot) |
assert_protected More... | |
void | assert_args_not_eval (ptr_node n) |
assert_args_not_eval More... | |
void | assert_delay_check (ptr_node n) |
assert_delay_check More... | |
void | clear_already_loaded (ptr_node n) |
clear_already_loaded More... | |
void | assert_type (ptr_psi_term t) |
assert_type More... | |
void | assert_complicated_type (ptr_psi_term t) |
assert_complicated_type More... | |
void | assert_attributes (ptr_psi_term t) |
assert_attributes More... | |
void | find_adults () |
find_adults More... | |
void | insert_own_prop (ptr_definition d) |
insert_own_prop More... | |
void | insert_prop (ptr_definition d, ptr_triple_list prop) |
insert_prop More... | |
void | propagate_definitions () |
propagate_definitions More... | |
long | count_sorts (long c0) |
count_sorts More... | |
void | clear_coding () |
clear_coding More... | |
void | least_sorts () |
void least_sorts() More... | |
void | all_sorts () |
all_sorts More... | |
ptr_int_list | two_to_the (long p) |
two_to_the More... | |
ptr_int_list | copyTypeCode (ptr_int_list u) |
copyTypeCode More... | |
void | or_codes (ptr_int_list u, ptr_int_list v) |
or_codes More... | |
void | equalize_codes (int len) |
equalize_codes More... | |
void | make_type_link (ptr_definition t1, ptr_definition t2) |
make_type_link More... | |
long | type_member (ptr_definition t, ptr_int_list tlst) |
type_member More... | |
void | perr_sort (ptr_definition d) |
perr_sort More... | |
void | perr_sort_list (ptr_int_list anc) |
perr_sort_list More... | |
void | perr_sort_cycle (ptr_int_list anc) |
perr_sort_cycle More... | |
long | type_cyclicity (ptr_definition d, ptr_int_list anc) |
type_cyclicity More... | |
void | propagate_always_check (ptr_definition d, long *ch) |
propagate_always_check More... | |
void | one_pass_always_check (long *ch) |
one_pass_always_check More... | |
void | inherit_always_check () |
inherit_always_check More... | |
void | encode_types () |
encode_types More... | |
void | print_codes () |
print_codes More... | |
long | glb_value (long result, long f, GENERIC c, GENERIC value1, GENERIC value2, GENERIC *value) |
glb_value More... | |
long | glb_code (long f1, GENERIC c1, long f2, GENERIC c2, long *f3, GENERIC *c3) |
glb_code More... | |
long | glb (ptr_definition t1, ptr_definition t2, ptr_definition *t3, ptr_int_list *c3) |
glb More... | |
long | overlap_type (ptr_definition t1, ptr_definition t2) |
overlap_type More... | |
long | sub_CodeType (ptr_int_list c1, ptr_int_list c2) |
sub_CodeType More... | |
long | sub_type (ptr_definition t1, ptr_definition t2) |
sub_type More... | |
long | matches (ptr_definition t1, ptr_definition t2, long *smaller) |
matches More... | |
long | strict_matches (ptr_psi_term t1, ptr_psi_term t2, long *smaller) |
strict_matches More... | |
long | bit_length (ptr_int_list c) |
bit_length More... | |
ptr_int_list | decode (ptr_int_list c) |
decode More... | |
ptr_goal | GoalFromPsiTerm (ptr_psi_term psiTerm) |
GoalFromPsiTerm. More... | |
prototypes
Definition in file def_proto.h.
long abort_life | ( | int | nlflag | ) |
abort_life
nlflag | - int nlflag |
Definition at line 2259 of file built_ins.c.
References aborthooksym, abortsym, wl_pair_list::bbbb_2, DEFRULES, FALSE, function_it, init_system(), main_loop_ok, NOTQUIET, NULL, prove, push_goal(), wl_definition::rule, stack_psi_term(), stdin_cleareof(), TRUE, wl_psi_term::type, wl_definition::type_def, undo(), and var_occurred.
void add_rule | ( | ptr_psi_term | head, |
ptr_psi_term | body, | ||
def_type | typ | ||
) |
add_rule
head | - ptr_psi_term head |
body | - ptr_psi_term body |
typ | - def_type typ |
ADD_RULE(head,body,typ) The TYP argument is either 'predicate', 'function', or 'type'. For predicates or functions, insert the clause 'HEAD :- BODY' or the rule 'HEAD -> BODY' into the definition of HEAD. For types, insert HEAD as a term of type attributes and BODY as a type constraint. The global flag ASSERT_FIRST indicates whether to do the insertion at the head or the tail of the existing list.
Definition at line 167 of file login.c.
References wl_pair_list::aaaa_2, assert_first, assert_ok, wl_psi_term::attr_list, wl_pair_list::bbbb_2, clear_copy(), wl_keyword::combined_name, wl_psi_term::coref, current_module, deref_ptr, Errorline(), HEAP, HEAP_ALLOC, wl_definition::keyword, MAX_BUILT_INS, wl_module::module_name, wl_pair_list::next, NULL, predicate_it, quote_copy(), redefine(), wl_psi_term::resid, wl_definition::rule, succeed, wl_keyword::symbol, TRUE, wl_psi_term::type, wl_definition::type_def, undef_it, and wl_psi_term::value_3.
long all_public_symbols | ( | ) |
all_public_symbols
ALL_PUBLIC_SYMBOLS Returns all public symbols from all modules or a specific module.
Definition at line 1363 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, deref_ptr, first_definition, get_module(), get_two_args(), wl_definition::keyword, wl_keyword::module, wl_definition::next, NULL, wl_keyword::public, push_goal(), stack_cons(), stack_nil(), stack_psi_term(), TRUE, wl_psi_term::type, and unify.
all_sorts | ( | ) |
all_sorts
ALL_SORTS() Build a list of all sorts (except nothing) in nothing->parents.
Definition at line 759 of file types.c.
References cons(), first_definition, wl_definition::next, nothing, wl_definition::parents, wl_definition::type_def, and type_it.
long all_symbol | ( | char * | s | ) |
long append_files | ( | char * | s1, |
char * | s2 | ||
) |
append_files
s1 | - char *s1 |
s2 | - char *s2 |
Definition at line 5543 of file built_ins.c.
References Errorline(), FALSE, and TRUE.
void append_resid | ( | ptr_psi_term | u, |
ptr_psi_term | v | ||
) |
append_resid
u | - ptr_psi_term u |
v | - ptr_psi_term v |
APPEND_RESID(u,v) Append the residuations pending on V to U. This routine does not check that the same constraint is not present twice in the end on U. This doesn't matter since RELEASE_RESID ensures that the same constraint is not released more than once.
Definition at line 474 of file lefun.c.
References push_ptr_value(), wl_psi_term::resid, and resid_ptr.
ptr_int_list appendIntList | ( | ptr_int_list | tail, |
ptr_int_list | more | ||
) |
appendIntList
tail | - ptr_int_list tail |
more | - ptr_int_list more |
attach copies of more to tail
Definition at line 40 of file lub.c.
References wl_int_list::next, NULL, STACK_ALLOC, and wl_int_list::value_1.
void assert_args_not_eval | ( | ptr_node | n | ) |
assert_args_not_eval
n | - ptr_node n |
ASSERT_ARGS_NOT_EVAL(n) Mark all the nodes in the attribute tree N as having unevaluated arguments, if they are functions or predicates.
Definition at line 294 of file types.c.
References wl_node::data, deref_ptr, wl_definition::evaluate_args, FALSE, wl_definition::keyword, wl_node::left, wl_node::right, wl_keyword::symbol, wl_psi_term::type, wl_definition::type_def, type_it, and warningline().
void assert_attributes | ( | ptr_psi_term | t | ) |
assert_attributes
t | - ptr_psi_term t |
ASSERT_ATTRIBUTES(t) T is of the form ':: type(attributes) | pred', the attributes must be appended to T's definition, and will be propagated after ENCODING to T's subtypes.
Definition at line 500 of file types.c.
References add_rule(), wl_psi_term::attr_list, deref_ptr, Errorline(), function_it, get_two_args(), wl_definition::keyword, NULL, predicate_it, wl_keyword::symbol, TRUE, wl_psi_term::type, wl_definition::type_def, type_it, types_modified, and wl_const_3.
void assert_clause | ( | ptr_psi_term | t | ) |
assert_clause
t | - ptr_psi_term t |
ASSERT_CLAUSE(t) Assert the clause T. Cope with various syntaxes for predicates.
ASSERT_FIRST is a flag indicating the position: 1= insert before existing rules (asserta), 0= insert after existing rules (assert),
Definition at line 287 of file login.c.
References add_rule(), assert_attributes(), assert_complicated_type(), assert_ok, assert_rule(), deref_ptr, equ_tok, FALSE, function_it, NULL, and predicate_it.
void assert_complicated_type | ( | ptr_psi_term | t | ) |
assert_complicated_type
t | - ptr_psi_term t |
ASSERT_COMPLICATED_TYPE This deals with all the type declarations of the form:
a(attr) <| b. % (a<|b) a(attr) <| b | pred.
a(attr) <| {b;c;d}. % (a<|b, a<|c, a<|d) a(attr) <| {b;c;d} | pred.
a := b(attr). % (a<|b) a := b(attr) | pred.
a := {b(attr1);c(attr2);d(attr3)}. % (b<|a,c<|a,d<|a) a := {b(attr1);c(attr2);d(attr3)} | pred.
Definition at line 405 of file types.c.
References add_rule(), assert_less(), assert_ok, wl_psi_term::attr_list, deref_ptr, disjunction, equ_tok, Errorline(), FALSE, get_two_args(), wl_definition::keyword, nil, NULL, wl_keyword::symbol, TRUE, wl_psi_term::type, type_it, and warningline().
void assert_delay_check | ( | ptr_node | n | ) |
assert_delay_check
n | - ptr_node n |
ASSERT_DELAY_CHECK(n) Assert that the types in the attribute tree N will have their properties checked only when they have attributes. If they have no attributes, then no properties are checked.
Definition at line 326 of file types.c.
References wl_definition::always_check, wl_node::data, deref_ptr, FALSE, wl_node::left, wl_node::right, and wl_psi_term::type.
long assert_less | ( | ptr_psi_term | t1, |
ptr_psi_term | t2 | ||
) |
assert_less
t1 | - ptr_psi_term t1 |
t2 | - ptr_psi_term t2 |
ASSERT_LESS(t1,t2) Assert that T1 <| T2. Return false if some sort of error occurred.
Definition at line 200 of file types.c.
References deref_ptr, Errorline(), FALSE, function_it, wl_definition::keyword, make_type_link(), predicate_it, redefine(), wl_keyword::symbol, top, TRUE, wl_psi_term::type, wl_definition::type_def, type_it, types_modified, and wl_psi_term::value_3.
void assert_protected | ( | ptr_node | n, |
long | prot | ||
) |
assert_protected
n | - ptr_node n |
prot | - long prot |
ASSERT_PROTECTED(n,prot) Mark all the nodes in the attribute tree N with protect flag prot.
Definition at line 255 of file types.c.
References wl_node::data, wl_definition::date, deref_ptr, wl_definition::keyword, wl_node::left, MAX_BUILT_INS, wl_definition::protected, wl_node::right, wl_definition::rule, wl_keyword::symbol, wl_psi_term::type, wl_definition::type_def, type_it, and warningline().
assert_rule
t | - psi_term t |
typ | - def_type typ |
ASSERT_RULE(t,typ) Add a rule to the rule tree. It may be either a predicate or a function. The psi_term T is of the form 'H :- B' or 'H -> B', but it may be incorrect (report errors). TYP is the type, function or predicate.
Definition at line 257 of file login.c.
References add_rule(), wl_psi_term::attr_list, get_two_args(), and Syntaxerrorline().
void assert_type | ( | ptr_psi_term | t | ) |
assert_type
t | - ptr_psi_term t |
ASSERT_TYPE(t) T is the psi_term <|(type1,type2). Add that to the type-definitions.
Definition at line 372 of file types.c.
References assert_less(), assert_ok, wl_psi_term::attr_list, Errorline(), get_two_args(), and NULL.
void backtrack | ( | ) |
backtrack
BACKTRACK() Undo everything back to the previous choice-point and take the alternative decision. This routine would have to be modified, along with UNDO to cope with goals to be proved on backtracking.
Definition at line 772 of file login.c.
References choice_stack, wl_choice_point::goal_stack, goal_stack, wl_choice_point::next, NULL, resid_aim, stack_pointer, wl_choice_point::stack_top, undo(), and wl_choice_point::undo_point.
int bad_psi_term | ( | ptr_psi_term | t | ) |
bad_psi_term
t | - ptr_psi_term t |
BAD_PSI_TERM(t) This returns true if T is a psi_term which is not allowed to be considered as a constant by the parser.
Example: "A=)+6." would otherwise be parsed as: "=(A,+(')',6))", this was going a bit far.
Definition at line 31 of file parser.c.
References final_dot, final_question, wl_definition::keyword, wl_keyword::symbol, TRUE, and wl_psi_term::type.
void begin_terminal_io | ( | ) |
begin_terminal_io
BEGIN_TERMINAL_IO() These two routines must bracket any I/O directed to the terminal. This is to avoid mix-ups between terminal and file I/O since the program's input and output streams may be different from stdin stdout. See the routine what_next_aim(), which uses them to isolate the user interface I/O from the program's own I/O.
Definition at line 493 of file token.c.
References inchange, input_state, input_stream, open_input_file(), out, outchange, and output_stream.
long bit_and_warning | ( | ptr_psi_term | arg, |
REAL | val | ||
) |
bit_and_warning
arg | - ptr_psi_term arg |
val | - REAL val |
Definition at line 992 of file error.c.
References nonint_warning().
long bit_length | ( | ptr_int_list | c | ) |
bit_length
c | - ptr_int_list c |
BIT_LENGTH(c) Returns the number of bits needed to code C. That is the rank of the first non NULL bit of C.
Examples: C= 1001001000 result=7 C= 10000 result=1 C= 0000000 result=0
Definition at line 1753 of file types.c.
References INT_SIZE, wl_int_list::next, and wl_int_list::value_1.
long bit_not_warning | ( | ptr_psi_term | arg, |
REAL | val | ||
) |
bit_not_warning
arg | - ptr_psi_term arg |
val | - REAL val |
Definition at line 1016 of file error.c.
References nonint_warning().
long bit_or_warning | ( | ptr_psi_term | arg, |
REAL | val | ||
) |
bit_or_warning
arg | - ptr_psi_term arg |
val | - REAL val |
Definition at line 1004 of file error.c.
References nonint_warning().
bk2_stack_insert
comp | - long comp |
keystr | - char *keystr |
tree | - ptr_node *tree |
info | - GENERIC info |
BK2_STACK_INSERT(comp,keystr,tree,info) Insert the pointer INFO under the reference string KEYSTR of length len in the binary tree TREE. Return the pointer to the permanent storage place of KEY. This is used by C_APPLY_LABEL Always trail the change.
Definition at line 377 of file trees.c.
References FALSE, general_insert(), and STACK.
void bk_mark_quote | ( | ptr_psi_term | t | ) |
bk_mark_quote
t | - ptr_psi_term t |
Back-trackably mark a psi-term as completely evaluated.
Definition at line 708 of file copy.c.
References wl_psi_term::attr_list, bk_mark_quote(), bk_mark_quote_tree(), wl_psi_term::coref, wl_psi_term::flags, heap_pointer, int_ptr, push_ptr_value(), QUOTED_TRUE, RMASK, and wl_psi_term::status.
void bk_mark_quote_tree | ( | ptr_node | t | ) |
bk_mark_quote_tree
t | - ptr_node t |
Definition at line 728 of file copy.c.
References bk_mark_quote(), bk_mark_quote_tree(), wl_node::data, wl_node::left, and wl_node::right.
void bk_stack_add_psi_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
ptr_psi_term | g | ||
) |
bk_stack_add_psi_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
g | - ptr_psi_term g |
Definition at line 252 of file token.c.
References wl_psi_term::attr_list, bk_stack_insert(), FEATCMP, and heap_copy_string().
bk_stack_insert
comp | - long comp |
keystr | - char *keystr |
tree | - ptr_node *tree |
info | - GENERIC info |
BK_STACK_INSERT(comp,keystr,tree,info) Insert the pointer INFO under the reference string KEYSTR of length len in the binary tree TREE. Return the pointer to the permanent storage place of KEY. This is used by C_APPLY_LABEL Trail the change with a trail check.
Definition at line 357 of file trees.c.
References FALSE, general_insert(), and STACK.
long bounds_undo_stack | ( | ) |
bounds_undo_stack
Address field in undo_stack is within range The only valid address outside this range is that of xevent_state
Definition at line 143 of file memory.c.
References wl_stack::aaaa_3, FALSE, mem_base, mem_limit, wl_stack::next, TRUE, wl_stack::type, undo_action, undo_stack, and VALID_ADDRESS.
long c_abort | ( | ) |
c_abort
C_ABORT Return to the top level of the interpreter.
Definition at line 2247 of file built_ins.c.
References abort_life(), and TRUE.
long c_alias | ( | ) |
c_alias
C_ALIAS Alias one keyword to another.
Definition at line 1180 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_keyword::combined_name, wl_keyword::definition, deref_ptr, Errorline(), FALSE, get_two_args(), hash_lookup(), wl_definition::keyword, wl_module::module_name, wl_keyword::symbol, wl_module::symbol_table, TRUE, wl_psi_term::type, and warningline().
long c_append_file | ( | ) |
c_append_file
C_APPEND_FILE Append the file named by argument 2 to the file named by argument 1. This predicate will not residuate; it requires string arguments.
Definition at line 5890 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_node::data, deref, deref_args, deref_ptr, Errorline(), FALSE, FEATCMP, find(), one, overlap_type(), quoted_string, set_1_2, TRUE, two, wl_psi_term::type, and wl_psi_term::value_3.
long c_args | ( | ) |
c_args
C_ARGS Return the Unix "ARGV" array as a list of strings. RM: Sep 20 1993
Definition at line 6123 of file built_ins.c.
References aim, arg_c, arg_v, wl_goal::bbbb_1, heap_copy_string(), NULL, push_goal(), quoted_string, stack_cons(), stack_nil(), stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
long c_begin_raw | ( | ) |
long c_concatenate | ( | ) |
c_concatenate
C_CONCATENATE Concatenate the strings in arguments 1 and 2.
Definition at line 5577 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), wl_node::data, deref, deref_args, deref_ptr, FALSE, FEATCMP, find(), one, overlap_type(), quoted_string, residuate(), set_1_2, TRUE, two, wl_psi_term::type, and wl_psi_term::value_3.
long c_current_module | ( | ) |
c_current_module
C_CURRENT_MODULE Return the current module.
Definition at line 974 of file modules.c.
References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, deref_ptr, heap_copy_string(), wl_module::module_name, NULL, push_goal(), quoted_string, resid_aim, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
long c_deref_length | ( | ) |
c_deref_length
C_DEREF_LENGTH Return the length of the dereference chain for argument 1. RM: Jul 15 1993
Definition at line 6087 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_psi_term::coref, curry(), wl_node::data, deref_ptr, FEATCMP, find(), one, REAL, TRUE, and unify_real_result().
long c_display_modules | ( | ) |
c_display_modules
C_DISPLAY_MODULES(); Set the display modules switch.
Definition at line 739 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, display_modules, Errorline(), FALSE, get_two_args(), lf_false, lf_true, TRUE, and wl_psi_term::type.
long c_display_persistent | ( | ) |
c_display_persistent
C_DISPLAY_PERSISTENT(); Set the display persistent switch.
Definition at line 775 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, display_persistent, Errorline(), FALSE, get_two_args(), lf_false, lf_true, TRUE, and wl_psi_term::type.
long c_end_raw | ( | ) |
long c_get_raw | ( | ) |
long c_glb | ( | ) |
long c_glb
greatest lower bound (djd)
C_GLB(A,B) Return glb(A,B). Continued calls will return each following type in the disjunction of the glb of A,B.
Definition at line 709 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), decode(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), glb(), isSubTypeValue(), isValue(), makePsiTerm(), wl_int_list::next, NULL, push_choice_point(), push_goal(), resid_aim, set_1_2, TRUE, wl_psi_term::type, type_disj, unify, wl_int_list::value_1, and wl_psi_term::value_3.
long c_halt | ( | ) |
c_halt
C_HALT Exit the Wild_Life interpreter.
Definition at line 2208 of file built_ins.c.
References exit_life(), and TRUE.
long c_in_raw | ( | ) |
long c_initrandom | ( | ) |
c_initrandom
C_INITRANDOM Uses its integer argument to initialize the random number generator, which is the Unix random() function.
Definition at line 6032 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_node::data, deref, deref_args, deref_ptr, FALSE, FEATCMP, find(), integer, one, overlap_type(), residuate(), set_1, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
long c_isa_subsort | ( | ) |
long c_isa_subsort
C_ISA_SUBSORT(A,B) if A is a subsort of B => succeed and residuate on B else => fail
Definition at line 664 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, FALSE, get_two_args(), isa(), reportAndAbort(), residuate(), set_1_2, and TRUE.
long c_lub | ( | ) |
long c_lub
least upper bound (djd) C_LUB(A,B) Return lub(A,B). Continued calls will return each following type in the disjunction of the lub of A,B.
Definition at line 773 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), lub(), makePsiTerm(), wl_int_list::next, NULL, push_choice_point(), push_goal(), resid_aim, set_1_2, TRUE, type_disj, unify, and wl_int_list::value_1.
long c_module_access | ( | ) |
c_module_access
C_MODULE_ACCESS Return the psi-term Module::Symbol
Definition at line 1008 of file modules.c.
References wl_goal::aaaa_1, aim, deref_ptr, FALSE, and warningline().
long c_open_module | ( | ) |
c_open_module
C_OPEN_MODULE() Open one or more modules, that is, alias all the public words in the current module to the definitions in the argument. An error message is printed for each module that is not successfully opened. If at least one module was not successfully opened, the routine fails.
Definition at line 519 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, and open_module_tree().
long c_private | ( | ) |
c_private
C_PRIVATE() The argument is a single symbol or a list of symbols. Make them private in the current module if they belong to it.
Definition at line 714 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, MAKE_PRIVATE, traverse_tree(), and TRUE.
long c_private_feature | ( | ) |
c_private_feature
C_PRIVATE_FEATURE() The argument is a single symbol or a list of symbols. Make this feature private to the current module.
Definition at line 1302 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, MAKE_FEATURE_PRIVATE, traverse_tree(), and TRUE.
long c_public | ( | ) |
c_public
C_PUBLIC() The argument(s) are symbols. Make them public in the current module if they belong to it.
Definition at line 687 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, MAKE_PUBLIC, traverse_tree(), and TRUE.
long c_put_raw | ( | ) |
long c_quiet | ( | ) |
c_quiet
Return the value of not(NOTQUIET).
Definition at line 186 of file bi_sys.c.
References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, deref_args, deref_ptr, lf_false, lf_true, NOTQUIET, NULL, push_goal(), set_empty, stack_psi_term(), TRUE, wl_psi_term::type, and unify.
long c_random | ( | ) |
c_random
C_RANDOM Return an integer random number between 0 and abs(argument1). Uses the Unix random() function (rand_r(&seed) for Solaris).
Definition at line 5966 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), wl_node::data, deref, deref_args, deref_ptr, FALSE, FEATCMP, find(), integer, NULL, one, overlap_type(), push_goal(), REAL, real_stack_psi_term(), residuate(), set_1, TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
long c_replace | ( | ) |
c_replace
C_REPLACE() Replace all occurrences of type ARG1 with ARG2 in ARG3.
Definition at line 936 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_node::data, deref_ptr, Errorline(), FALSE, FEATCMP, find(), get_two_args(), NULL, replace(), three, TRUE, and wl_psi_term::type.
long c_reset_window_flag | ( | ) |
long c_set_module | ( | ) |
c_set_module
C_SET_MODULE() This routine retrieves the necessary psi-term to determine the current state of the module mechanism from the heap.
Definition at line 488 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, create_module(), deref_ptr, Errorline(), FALSE, get_two_args(), set_current_module(), string_val(), and TRUE.
long c_string_length | ( | ) |
c_string_length
C_STRING_LENGTH Return the length of the string in argument 1.
Definition at line 5726 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), wl_node::data, deref, deref_args, deref_ptr, FALSE, FEATCMP, find(), one, overlap_type(), quoted_string, residuate(), set_1, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
long c_sub_string | ( | ) |
c_sub_string
C_SUB_STRING Return the substring of argument 1 from position argument 2 for a length of argument 3 characters.
Definition at line 5781 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), wl_node::data, deref, deref_args, deref_ptr, FALSE, FEATCMP, find(), one, overlap_type(), quoted_string, residuate(), set_1_2_3, three, TRUE, two, wl_psi_term::type, and wl_psi_term::value_3.
long c_tprove | ( | ) |
c_tprove
UNSURE
Definition at line 81 of file bi_sys.c.
References wl_goal::aaaa_1, aim, deref_args, set_empty, set_trace_to_prove(), and TRUE.
long c_trace | ( | ) |
trace
long c_trace() turn tracing on or off
Definition at line 30 of file bi_sys.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), is_top, lf_false, lf_true, set_empty, stepflag, toggle_trace(), trace, TRUE, wl_psi_term::type, and unify_bool_result().
long c_trace_input | ( | ) |
c_trace_input
C_TRACE_INPUT(); Set the trace_input switch.
Definition at line 810 of file modules.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, get_two_args(), lf_false, lf_true, trace_input, TRUE, and wl_psi_term::type.
long c_window_flag | ( | ) |
call_primitive
fun | - (long (*fun)(), |
num | - int num |
argi | - psi_arg argi[] |
info | - GENERIC info |
Definition at line 24 of file sys.c.
References wl_goal::aaaa_1, aim, ARGNN, wl_psi_term::attr_list, wl_goal::bbbb_1, c_abort(), curry(), wl_node::data, deref, deref_ptr, Errorline(), FALSE, FEATCMP, find(), JUSTFAIL, MANDATORY, NOVALUE, NULL, overlap_type(), POLYTYPE, REQUIRED, residuate(), sub_type(), TRUE, wl_psi_term::type, psi_arg::type, UNEVALED, and wl_psi_term::value_3.
void check_attr | ( | ptr_node * | n | ) |
check_attr
n | - ptr_node *n |
CHECK_ATTR(attribute-tree) Check an attribute tree. (Could improve this by randomly picking left or right subtree for last call optimization. This would never overflow, even on very skewed attribute trees.)
Definition at line 1055 of file memory.c.
References check_psi_term(), check_string(), and unchecked().
void check_definition | ( | ptr_definition * | d | ) |
check_definition
d | - ptr_definition *d |
CHECK_DEFINITION This goes through the type tree which contains the parents and children lists for all types, and the attributed code. The code field is not checked as this has been done separately by CHECK_GAMMA.
Definition at line 663 of file memory.c.
References check_code(), check_keyword(), check_kids(), check_operator_data(), check_pair_list(), check_psi_term(), check_triple_list(), wl_definition::keyword, wl_keyword::symbol, type_it, and unchecked().
void check_definition_list | ( | ) |
check_definition_list
CHECK_DEFINITION_LIST This checks the entire list of definitions.
Definition at line 700 of file memory.c.
References check_definition(), and first_definition.
void check_disj | ( | ptr_psi_term | t | ) |
check_disj
t | - ptr_psi_term t |
CHECK_DISJ(t) Deal with disjunctions.
Definition at line 910 of file lefun.c.
References disj, fail, NULL, push_goal(), traceline(), TRUE, and wl_psi_term::value_3.
void check_func | ( | ptr_psi_term | t | ) |
check_func
t | - ptr_psi_term t |
CHECK_FUNC(t) Deal with an unevaluated function: push an 'eval' goal for it, which will cause it to be evaluated.
Definition at line 928 of file lefun.c.
References wl_psi_term::attr_list, check_func_flag, check_out(), copy(), wl_psi_term::coref, disjunction, eval, eval_args(), wl_definition::evaluate_args, get_one_arg(), iff, push_goal(), push_psi_ptr_value(), RMASK, wl_definition::rule, stack_copy_psi_term(), stack_psi_term(), wl_psi_term::status, such_that, traceline(), TRUE, and wl_psi_term::type.
void check_gamma_code | ( | ) |
check_gamma_code
CHECK_GAMMA_CODE() Check and update the code reversing table. In this part, only the codes are checked in the definitions, this is vital because these codes are used later to distinguish between the various data types and to determine the type of the VALUE field in psi_terms. Misunderstanding this caused a lot of bugs in the GC.
Definition at line 1079 of file memory.c.
References check_def_code(), gamma_table, type_count, and unchecked().
void check_hash_table | ( | ptr_hash_table | table | ) |
check_hash_table
table | - ptr_hash_table table |
CHECK_HASH_TABLE(table) Check a hash table of keywords. The actual table is not stored within LIFE memory.
Definition at line 626 of file memory.c.
References check_keyword(), wl_hash_table::data, and wl_hash_table::size.
long check_legal_cons | ( | ptr_psi_term | t, |
ptr_definition | t_type | ||
) |
check_legal_cons
t | - ptr_psi_term t |
t_type | - ptr_definition t_type |
CHECK_LEGAL_CONS(t,t_type) Check that T is of type T_TYPE, that it has exactly the attributes '1' and '2' and that the 2nd is either nil or also long check_legal_cons(t,t_type)
Definition at line 713 of file print.c.
References wl_psi_term::attr_list, count_features(), FEATCMP, find(), one, two, and wl_psi_term::type.
long check_opargs | ( | ptr_node | n | ) |
check_opargs
n | - ptr_node n |
Routines to handle printing of operators. The main routine is pretty_psi_with_ops, which is called in pretty_psi_term.
Check arguments of a potential operator. Returns existence of arguments 1 and 2 in low two bits of result. If only argument "1" exists, returns 1. If only arguments "1" and "2" exist, returns 3. Existence of any other arguments causes third bit to be set as well.
Definition at line 887 of file print.c.
References featcmp(), wl_node::key, wl_node::left, and wl_node::right.
long check_out | ( | ptr_psi_term | t | ) |
Definition at line 1083 of file lefun.c.
References wl_psi_term::attr_list, check_func(), check_func_flag, check_type(), deref_ptr, eval_args(), eval_global_var(), FALSE, function_it, global_it, heap_pointer, RMASK, wl_psi_term::status, traceline(), TRUE, wl_psi_term::type, wl_definition::type_def, and type_it.
void check_pointer | ( | ptr_psi_term | p | ) |
check_pointer
p | - ptr_psi_term p |
CHECK_POINTER(p) Count the number of times address P has been encountered in the current psi-term being printed. If it is more than once then a tag will have to be used. If P has not already been seen, then explore the psi_term it points to.
Definition at line 233 of file print.c.
References wl_node::data, deref_ptr, find(), go_through(), heap_insert(), INTCMP, no_name, NULL, and pointer_names.
void check_psi_term | ( | ptr_psi_term * | t | ) |
check_psi_term
t | - ptr_psi_term *t |
CHECK_PSI_TERM(t) Explore a psi_term.
Definition at line 988 of file memory.c.
References alist, assert, check_attr(), check_bytedata(), check_definition(), check_resid(), check_string(), choice_stack, cut, Errorline(), heap_pointer, LONELY, mem_limit, NULL, pass, quoted_string, REAL, real, stream, sub_type(), sys_bytedata, unchecked(), and variable.
long check_real | ( | ptr_psi_term | t, |
REAL * | v, | ||
long * | n | ||
) |
check_real
t | - ptr_psi_term t |
v | - REAL *v |
n | - long *n |
CHECK_REAL(t,v,n) Like get_real_value, but does not force the type of T to be real.
Definition at line 231 of file built_ins.c.
References FALSE, matches(), REAL, real, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
void check_resid_block | ( | ptr_resid_block * | rb | ) |
check_resid_block
rb | - ptr_resid_block *rb |
CHECK_RESID_BLOCK(rb) Explore a residuation block.
Definition at line 966 of file memory.c.
References check_goal_stack(), check_resid_list(), LONELY, and unchecked().
void check_sys_definitions | ( | ) |
check_sys_definitions
Definition at line 2186 of file sys.c.
References check_definition(), sys_bitvector, sys_bytedata, sys_file_stream, sys_process_continued, sys_process_exited, sys_process_no_children, sys_process_signaled, sys_process_stopped, sys_regexp, sys_socket_stream, and sys_stream.
long check_type | ( | ptr_psi_term | t | ) |
check_type
t | - ptr_psi_term t |
CHECK_TYPE(t) Here we deal with a type which may need checking. This routine will have to be modified to deal with the infinite loops currently caused by definitions such as:
:: H:husband(spouse => wife(spouse => H)). :: W:wife(spouse => husband(spouse => W)).
Definition at line 990 of file lefun.c.
References wl_definition::always_check, wl_psi_term::attr_list, eval_args(), FALSE, fetch_def(), int_ptr, wl_definition::properties, push2_ptr_value(), RMASK, SMASK, wl_psi_term::status, TRUE, and wl_psi_term::type.
long clause_aim | ( | long | r | ) |
clause_aim
r | - long r |
CLAUSE_AIM(r) Prove a CLAUSE or RETRACT goal. That is try to unify the calling argument with the current rule. If this succeeds and R=TRUE then delete the rule (RETRACT).
Definition at line 1879 of file login.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_goal::cccc_1, clause, clear_copy(), del_clause, Errorline(), FALSE, i_eval_args(), wl_definition::keyword, MAX_BUILT_INS, NULL, push_choice_point(), push_goal(), quote_copy(), retract, STACK, wl_psi_term::status, wl_keyword::symbol, traceline(), TRUE, wl_psi_term::type, and unify.
void clean_undo_window | ( | long | disp, |
long | wind | ||
) |
clean_undo_window
disp | - long disp |
wind | - long wind |
CLEAN_UNDO_WINDOW(disp,wind) Remove all trail entries that reference a given window. This is called when the window is destroyed.
Definition at line 848 of file login.c.
References wl_stack::aaaa_3, wl_stack::bbbb_3, choice_stack, wl_stack::next, wl_choice_point::next, wl_stack::type, undo_action, wl_choice_point::undo_point, and undo_stack.
void clear_already_loaded | ( | ptr_node | n | ) |
clear_already_loaded
n | - ptr_node n |
CLEAR_ALREADY_LOADED() Clear the 'already_loaded' flags in all symbol table entries. Done at each top level prompt.
Definition at line 351 of file types.c.
References wl_definition::already_loaded, wl_node::data, FALSE, wl_node::left, and wl_node::right.
void clear_coding | ( | ) |
clear_coding
CLEAR_CODING() Clear the bit-vector coding of the sorts.
Definition at line 727 of file types.c.
References wl_definition::code, first_definition, wl_definition::next, NOT_CODED, wl_definition::type_def, and type_it.
void clear_copy | ( | ) |
ptr_psi_term collect_symbols | ( | long | sel | ) |
collect_symbols
sel | - long sel |
Collect properties of the symbols in the symbol table, and make a psi-term list of them. This routine is parameterized (by sel) to collect three properties:
Note the similarity between this routine and a tree-to-list routine in Prolog. The pointer manipulations are simpler in Prolog, though.
If the number of symbols is very large, this routine may run out of space before garbage collection.
Definition at line 3699 of file built_ins.c.
References wl_definition::children, first_definition, fx, fx_sym, fy, fy_sym, greatest_sel, hidden_type(), least_sel, wl_operator_data::next, wl_definition::next, nothing, NULL, one, wl_definition::op_data, op_sel, opsym, wl_definition::parents, wl_operator_data::precedence, stack_add_int_attr(), stack_add_psi_attr(), stack_cons(), stack_nil(), stack_psi_term(), three, top, two, wl_psi_term::type, wl_definition::type_def, type_it, undef_it, xf, xf_sym, xfx, xfx_sym, xfy, xfy_sym, yf, yf_sym, yfx, and yfx_sym.
ptr_int_list cons | ( | GENERIC | v, |
ptr_int_list | l | ||
) |
cons
v | - GENERIC v |
l | - ptr_int_list l |
CONS(value,list) Returns the list [VALUE|LIST]
Definition at line 179 of file types.c.
References HEAP_ALLOC, wl_int_list::next, and wl_int_list::value_1.
ptr_psi_term copy | ( | ptr_psi_term | t, |
long | copy_flag, | ||
long | heap_flag | ||
) |
copy
t | - ptr_psi_term t |
copy_flag | - long copy_flag |
heap_flag | - long heap_flag |
COPY(t) This is the workhorse of the interpreter (alas!). All copy-related routines are non-interruptible by the garbage collector.
Make a copy in the STACK or in the HEAP of psi_term t, which is located in the HEAP. A copy is done whenever invoking a rule, so it had better be fast. This routine uses hash tables with buckets and partial inlining for speed.
The following three versions of copy all rename their variables and return a completely dereferenced object:
u=exact_copy(t,hf) u is an exact copy of t. u=quote_copy(t,hf) u is a copy of t that is recursively marked evaluated. u=eval_copy(t,hf) u is a copy of t that is recursively marked unevaluated.
This version of copy is an incremental copy to the heap. It copies only those parts of a psi_term that are on the stack, leaving the others unchanged:
u=inc_heap_copy(t) u is an exact copy of t, on the heap. This is like hf==HEAP, except that objects already on the heap are untouched. Relies on no pointers from heap to stack.
hf = heap_flag. hf = HEAP or STACK means allocate in the HEAP or STACK. Marking eval/uneval is done by modifying the STATUS field of the copied psi_term. In eval_copy, a term's status is set to 0 if the term or any subterm needs evaluation. Terms are dereferenced when copying them to the heap.
Definition at line 248 of file copy.c.
References abort_life(), wl_psi_term::attr_list, choice_stack, COPY_THRESHOLD, copy_tree(), curr_status, cut, deref_ptr, env, Errorline(), EVAL_FLAG, wl_definition::evaluate_args, FALSE, wl_psi_term::flags, function_it, global_it, global_time_stamp, HEAP, heap_pointer, HEAPDONE, insert_translation(), mark_quote_c(), NEW, NULL, wl_definition::properties, QUOTE_FLAG, QUOTE_STUB, QUOTED_TRUE, wl_psi_term::resid, stack_pointer, wl_psi_term::status, traceline(), translate(), TRUE, wl_psi_term::type, wl_definition::type_def, type_it, and wl_psi_term::value_3.
ptr_int_list copyTypeCode | ( | ptr_int_list | u | ) |
copyTypeCode
u | - ptr_int_list u |
copyTypeCode(code) returns copy of code on the heap
Definition at line 808 of file types.c.
References HEAP_ALLOC, wl_int_list::next, NULL, or_codes(), and wl_int_list::value_1.
long count_features | ( | ptr_node | t | ) |
count_features
t | - ptr_node t |
COUNT_FEATURES(t) Return the number of features of a tree.
Definition at line 690 of file print.c.
References wl_node::left, and wl_node::right.
long count_sorts | ( | long | c0 | ) |
count_sorts
c0 | - long c0 |
COUNT_SORTS(c) Count the number of sorts in the symbol table T. Overestimates in the module version. RM: Jan 21 1993 No longer !! RM: Feb 3 1993
Definition at line 710 of file types.c.
References first_definition, wl_definition::next, wl_definition::type_def, and type_it.
ptr_module create_module | ( | char * | module | ) |
ptr_module create_module(char *module)
CREATE_MODULE(module) Create a new module.
Definition at line 72 of file modules.c.
References find_module(), hash_create(), HEAP_ALLOC, heap_copy_string(), heap_insert(), input_file_name, NULL, and STRCMP.
void crunch | ( | long | prec, |
long | limit | ||
) |
crunch
prec | - long prec |
limit | - long limit |
CRUNCH(prec,limit) Crunch up = work out the arguments of anything on the stack whose precedence is <= PREC, and replace it with the corresponding psi-term. Do not go any further than LIMIT which is the end of the current expression.
Definition at line 662 of file parser.c.
References error_psi_term, FALSE, fx, look(), make_life_form(), nop, NULL, parse_ok, parser_stack_index, pop(), push(), xf, and xfx.
void curry | ( | ) |
long declare_operator | ( | ptr_psi_term | t | ) |
declare_operator
t | - ptr_psi_term t |
DECLARE_OPERATOR(t) Declare a new operator or change a pre-existing one.
For example: 'op'(3,xfx,+)? T is the OP declaration.
Definition at line 5436 of file built_ins.c.
References wl_psi_term::attr_list, wl_node::data, deref_ptr, Errorline(), FALSE, FEATCMP, find(), fx, fx_sym, fy, fy_sym, get_two_args(), integer, wl_definition::keyword, MAX_PRECEDENCE, nop, op_declare(), REAL, sub_type(), wl_keyword::symbol, three, TRUE, wl_psi_term::type, wl_psi_term::value_3, xf, xf_sym, xfx, xfx_sym, xfy, xfy_sym, yf, yf_sym, yfx, and yfx_sym.
ptr_int_list decode | ( | ptr_int_list | c | ) |
decode
c | - ptr_int_list c |
DECODE(c) Returns a list of the symbol names which make up the disjunction whose code is C.
Definition at line 1784 of file types.c.
References bit_length(), wl_definition::code, cons(), wl_int_list::next, NULL, STACK_ALLOC, and wl_int_list::value_1.
void delete_attr | ( | char * | s, |
ptr_node * | n | ||
) |
delete_attr
s | - char *s |
n | - ptr_node *n |
DELETE_ATTR(key,tree) Remove the node addressed by KEY from TREE.
Definition at line 522 of file trees.c.
References wl_node::data, featcmp(), FEATCMP, heap_insert(), wl_node::key, wl_node::left, and wl_node::right.
void deref2_eval | ( | ptr_psi_term | t | ) |
deref2_eval
t | - ptr_psi_term t |
Definition at line 1356 of file lefun.c.
References check_func(), deref_ptr, eval_global_var(), function_it, global_it, wl_psi_term::status, wl_psi_term::type, and wl_definition::type_def.
void deref2_rec_eval | ( | ptr_psi_term | t | ) |
deref2_rec_eval
t | - ptr_psi_term t |
Same as deref_rec_eval, but assumes goal_stack already restored.
Definition at line 1382 of file lefun.c.
References deref_ptr, and deref_rec_body().
long deref_args_eval | ( | ptr_psi_term | t, |
long | set | ||
) |
deref_args_eval
t | - ptr_psi_term t |
set | - long set |
Same as deref_rec_eval, but doesn't look at either the top level or the arguments in the set.
Definition at line 1294 of file lefun.c.
References aim, wl_psi_term::attr_list, deref_flag, deref_rec_args_exc(), FALSE, and goal_stack.
long deref_eval | ( | ptr_psi_term | t | ) |
deref_eval
t | - ptr_psi_term t |
deref_eval(P) If the psi-term P is a function, call check_func to push eval goals so that the function will be evaluated. Then return TRUE so that the caller can itself return. This only looks at the top level.
Definition at line 1180 of file lefun.c.
References aim, check_func(), deref_flag, deref_ptr, eval_global_var(), FALSE, function_it, global_it, goal_stack, heap_pointer, int_ptr, push_ptr_value(), wl_psi_term::status, TRUE, wl_psi_term::type, and wl_definition::type_def.
void deref_rec_args | ( | ptr_node | n | ) |
deref_rec_args
n | - ptr_node n |
Definition at line 1272 of file lefun.c.
References wl_node::data, deref_ptr, deref_rec_body(), wl_node::left, and wl_node::right.
void deref_rec_args_exc | ( | ptr_node | n, |
long | set | ||
) |
deref_rec_args_exc
n | - ptr_node n |
set | - long set |
Definition at line 1332 of file lefun.c.
References wl_node::data, deref_ptr, deref_rec_body(), in_set(), wl_node::key, wl_node::left, and wl_node::right.
void deref_rec_body | ( | ptr_psi_term | t | ) |
deref_rec_body
t | - ptr_psi_term t |
Definition at line 1243 of file lefun.c.
References wl_psi_term::attr_list, check_func(), deref_flag, deref_ptr, deref_rec_args(), eval_global_var(), function_it, global_it, heap_pointer, int_ptr, push_ptr_value(), wl_psi_term::status, TRUE, wl_psi_term::type, and wl_definition::type_def.
long deref_rec_eval | ( | ptr_psi_term | t | ) |
deref_rec_eval
t | - ptr_psi_term t |
deref_rec(P) If the psi-term P recursively contains any functions, then push eval goals to evaluate all of them. Set a global variable deref_flag if this is the case.
Definition at line 1226 of file lefun.c.
References aim, deref_flag, deref_rec_body(), FALSE, and goal_stack.
long disjunct_aim | ( | ) |
disjunct_aim
DISJUNCT_AIM() This is the disjunction enumeration routine. If U is the disjunction {H|T} then first bind U to H, then on backtracking enumerate the disjunction T. U is always passed along so that every choice of the disjunction can be bound to U.
Definition at line 1621 of file login.c.
References TRUE.
void display_couple | ( | ptr_psi_term | u, |
char * | s, | ||
ptr_psi_term | v | ||
) |
display_couple
u | - ptr_psi_term u |
s | - char *s |
v | - ptr_psi_term v |
DISPLAY_COUPLE(u,s,v) Print a couple of psi-terms (u,v) with the correct co-referencing. Print string S in between.
Definition at line 1643 of file print.c.
References buffer, check_pointer(), const_quote, end_tab(), FALSE, gen_sym_counter, heap_pointer, indent, indx, insert_variables(), listing_flag, mark_tab(), MAX_PRECEDENCE, new_tab(), NULL, output_stream, pointer_names, pretty_output(), pretty_tag_or_psi_term(), pretty_things, prettyf(), printed_pointers, TRUE, var_tree, work_out_length(), write_canon, and write_resids.
void display_psi | ( | FILE * | s, |
ptr_psi_term | t | ||
) |
display_psi
s | - FILE *s |
t | - ptr_psi_term t |
DISPLAY_PSI(stream,t) Print the psi_term T to the given stream.
Definition at line 1579 of file print.c.
References main_display_psi_term(), and outfile.
void display_psi_stderr | ( | ptr_psi_term | t | ) |
display_psi_stderr
t | - ptr_psi_term t |
DISPLAY_PSI_STDERR(t) Print the psi_term T to stderr as simply as possible (no indenting).
Definition at line 1550 of file print.c.
References main_display_psi_term(), and outfile.
void display_psi_stdout | ( | ptr_psi_term | t | ) |
display_psi_stdout
t | - ptr_psi_term t |
DISPLAY_PSI_STDOUT(t) Print the psi_term T to stdout as simply as possible (no indenting).
Definition at line 1536 of file print.c.
References main_display_psi_term(), and outfile.
void display_psi_stream | ( | ptr_psi_term | t | ) |
display_psi_stream
t | - ptr_psi_term t |
DISPLAY_PSI_STREAM(t) Print the psi_term T to output_stream as simply as possible (no indenting).
Definition at line 1564 of file print.c.
References main_display_psi_term(), outfile, and output_stream.
ptr_psi_term distinct_copy | ( | ptr_psi_term | t | ) |
distinct_copy
t | - ptr_psi_term t |
DISTINCT_COPY(t) Make a distinct copy of T and T's attribute tree, which are identical to T, only located elsewhere in memory. This is used by apply to build the calling psi-term which is used for matching. Note that this routine is not recursive, i.e. it only copies the main functor & the attribute tree.
Definition at line 393 of file copy.c.
References wl_psi_term::attr_list, distinct_tree(), global_time_stamp, and STACK_ALLOC.
distinct_tree
t | - ptr_node t |
DISTINCT_TREE(t) Return an exact copy of an attribute tree. This is used by APPLY in order to build the calling psi-term which is used for matching.
Definition at line 366 of file copy.c.
References wl_node::data, distinct_tree(), wl_node::key, wl_node::left, NULL, wl_node::right, and STACK_ALLOC.
void do_currying | ( | ) |
do_currying
This performs CURRYing: all that needs to be done is to yield the calling term as the result after having given up on evaluation. In effect the calling psi-term is left intact.
Definition at line 383 of file lefun.c.
References wl_goal::aaaa_1, wl_goal::bbbb_1, goal_stack, wl_goal::next, NULL, push_goal(), resid_aim, traceline(), and unify_noeval.
void do_pretty_attr | ( | ptr_node | t, |
ptr_tab_brk | tab, | ||
long * | cnt, | ||
long | two, | ||
long | depth | ||
) |
do_pretty_attr
t | - ptr_node t |
tab | - ptr_tab_brk tab |
cnt | - long *cnt |
two | - long two |
depth | - long depth |
DO_PRETTY_ATTR(t,tab,cnt,two,depth) Pretty print the attribute tree T at position TAB.
CNT is what the value of the first integer label should be, so that "p(1=>a,2=>b)" is printed "p(a,b)" but "p(2=>a,3=>b)" is printed as "p(2 => a,3 => b)".
Definition at line 1199 of file print.c.
References COMMA_PREC, wl_node::data, display_modules, extract_module_from_name(), wl_node::key, wl_node::left, mark_tab(), wl_module::module_name, pretty_tag_or_psi_term(), prettyf(), prettyf_quote(), wl_node::right, str_to_int(), and strip_module_name().
long do_residuation | ( | ) |
do_residuation
C-defined routines do all stack manipulation themselves
Definition at line 336 of file lefun.c.
References wl_goal::aaaa_1, deref_ptr, FALSE, wl_resid_list::next, wl_resid_list::othervar, print_resid_message(), resid_aim, resid_vars, residuateGoalOnVar(), trace, traceline(), tracing(), TRUE, and wl_resid_list::var.
long do_residuation_user | ( | ) |
Undo anything that matching may have done, then create a residuated expression. Check that the same constraint does not hang several times on the same variable.
This routine takes time proportional to the square of the number of residuations. This is too slow; eventually it should be sped up, especially if equality constraints are often used.
Definition at line 324 of file lefun.c.
References do_residuation(), goal_stack, wl_goal::next, and resid_aim.
int dummy_printf | ( | char * | f, |
char * | s, | ||
char * | t | ||
) |
void encode_types | ( | ) |
encode_types
ENCODE_TYPES() This routine performs type-coding using transitive closure. First any previous coding is undone. Then a new encryption is performed.
Some of these routines loop indefinitely if there is a circular type definition (an error should be reported but it isn't implemented (but it's quite easy to do)).
Definition at line 1091 of file types.c.
References all_sorts(), built_in, wl_definition::children, clear_coding(), wl_definition::code, cons(), count_sorts(), equalize_codes(), Errorline(), FALSE, heap_alloc(), inherit_always_check(), integer, wl_definition::keyword, least_sorts(), lf_false, lf_true, make_sys_type_links(), make_type_link(), wl_int_list::next, NOT_CODED, nothing, NULL, or_codes(), overlap_type(), wl_definition::parents, perr(), propagate_definitions(), quoted_string, real, wl_keyword::symbol, top, traceline(), TRUE, two_to_the(), type_count, type_cyclicity(), types_done, types_modified, and wl_int_list::value_1.
void end_tab | ( | ) |
end_tab
END_TAB() Mark the end of an item. Copy the item's string into global space and point to the next item.
Definition at line 554 of file print.c.
References buffer, heap_alloc(), indent, indx, and wl_item::str.
void end_terminal_io | ( | ) |
end_terminal_io
END_TERMINAL_IO() End of terminal I/O bracketing.
Definition at line 516 of file token.c.
References inchange, input_state, NULL, old_state, out, outchange, output_stream, and restore_state().
void equalize_codes | ( | int | len | ) |
equalize_codes
len | - int len |
EQUALIZE_CODES(w) Make sure all codes are w words long, by increasing the length of the shorter ones. This simplifies greatly the bitvector manipulation routines. This operation should be done after encoding. For correct operation, w>=maximum number of words used for a code.
Definition at line 859 of file types.c.
References assert, wl_definition::code, first_definition, HEAP_ALLOC, wl_int_list::next, wl_definition::next, NULL, wl_definition::type_def, and type_it.
void Errorline | ( | char * | format, |
... | |||
) |
Errorline.
format | - char *format |
... | New error printing routine |
Definition at line 465 of file error.c.
References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.
long eval_aim | ( | ) |
eval_aim
EVAL_AIM() Evaluate a function. This copies the current definition of the function and stacking the various goals that are necessary to evaluate the function correctly. It creates an extra psi-term (with value top) in which to write the result.
Definition at line 497 of file lefun.c.
References wl_goal::aaaa_1, wl_pair_list::aaaa_2, aim, wl_goal::bbbb_1, wl_pair_list::bbbb_2, c_rule, can_curry, wl_goal::cccc_1, choice_stack, clear_copy(), curried, deref_ptr, do_currying(), do_residuation(), eval, eval_copy(), eval_cut, FALSE, int_ptr, match, MAX_BUILT_INS, wl_pair_list::next, NULL, push2_ptr_value(), push_choice_point(), push_goal(), quote_copy(), resid_aim, resid_vars, save_resid(), SMASK, STACK, STACK_ALLOC, stack_pointer, wl_psi_term::status, traceline(), TRUE, and unify.
long eval_args | ( | ptr_node | n | ) |
eval_args
n | - ptr_node n |
EVAL_ARGS(n) N is an attribute tree, the attributes must be examined, if any reveal themselves to need evaluating then return FALSE.
Definition at line 889 of file lefun.c.
References check_out(), wl_node::data, wl_node::left, wl_node::right, and TRUE.
ptr_psi_term eval_copy | ( | ptr_psi_term | t, |
long | heap_flag | ||
) |
void eval_global_var | ( | ptr_psi_term | t | ) |
eval_global_var
t | - ptr_psi_term t |
EVAL_GLOBAL_VAR(t) Dereference a global variable.
Definition at line 1440 of file lefun.c.
References wl_stack::aaaa_3, wl_stack::bbbb_3, clear_copy(), wl_psi_term::coref, deref_ptr, eval_copy(), global_it, wl_definition::global_value, wl_definition::init_value, wl_stack::next, NULL, psi_term_ptr, push_psi_ptr_value(), STACK, STACK_ALLOC, traceline(), wl_psi_term::type, wl_stack::type, wl_definition::type_def, and undo_stack.
ptr_psi_term exact_copy | ( | ptr_psi_term | t, |
long | heap_flag | ||
) |
exact_copy
t | - ptr_psi_term t |
heap_flag | - long heap_flag |
Definition at line 176 of file copy.c.
References copy(), EXACT_FLAG, FALSE, and to_heap.
void exit_if_true | ( | long | exitflag | ) |
void exit_life | ( | long | nl_flag | ) |
exit_life
nl_flag | - long nl_flag |
Definition at line 2219 of file built_ins.c.
References garbage_time, life_end, life_start, NOTQUIET, and open_input_file().
char * expand_file_name | ( | char * | s | ) |
expand_file_name
s | - char *s |
EXPAND_FILE_NAME(str) Return the expansion of file name STR. For the time being all this does is replace '~' by the HOME directory if no user is given, or tries to find the user.
Definition at line 537 of file token.c.
References STRLEN.
ptr_module extract_module_from_name | ( | char * | str | ) |
extract_module_from_name
str | - char *str |
EXTRACT_MODULE_FROM_NAME Return the module corresponding to "module#symbol". Return NULL if only "#symbol".
Definition at line 116 of file modules.c.
References create_module(), legal_in_name(), and NULL.
long f_check_out | ( | ptr_psi_term | t | ) |
f_check_out
t | - ptr_psi_term t |
Definition at line 1046 of file lefun.c.
References check_func_flag, check_out(), and TRUE.
void fail_all | ( | ) |
fail_all
FAIL_ALL() This routines provokes a total failure, in case of a bad error (out of memory, abort, etc...). All goals are abandoned.
Definition at line 189 of file memory.c.
References abort_life(), choice_stack, goal_stack, NULL, open_input_file(), output_stream, stdin_cleareof(), TRUE, and undo_stack.
long featcmp | ( | char * | str1, |
char * | str2 | ||
) |
featcmp
str1 | - char *str1 |
str2 | - char *str2 |
FEATCMP(s1,s2) Compares two strings which represent features, for use in FIND or INSERT. This differs from strcmp for those strings that represent integers. These are compared as integers. In addition, all integers are considered to be less than all strings that do not represent integers.
Definition at line 106 of file trees.c.
References is_int().
void feature_insert | ( | char * | keystr, |
ptr_node * | tree, | ||
ptr_psi_term | psi | ||
) |
feature_insert
keystr | - char *keystr |
tree | - ptr_node *tree |
psi | - ptr_psi_term psi |
FEATURE_INSERT(keystr,tree,psi) Insert the psi_term psi into the attribute tree. If the feature already exists, create a call to the unification function.
Definition at line 251 of file parser.c.
References FEATCMP, find(), stack_copy_psi_term(), stack_insert_copystr(), and Syntaxerrorline().
void fetch_def | ( | ptr_psi_term | u, |
long | allflag | ||
) |
fetch_def
u | - ptr_psi_term u |
allflag | - long allflag |
FETCH_DEF(psi_term) Fetch the type definition of a psi_term and execute it. That is, get the list of (term,predicate) pairs that define the type. Unify the psi_term with the term, then prove the predicate.
This routine only gets the pairs that are defined in the type itself, not those defined in any types above it. This is the correct behavior for enumerating type disjunctions–all higher constraints have already been checked.
The above is true if allflag==FALSE. If allflag==TRUE then all constraints are executed, not just those defined in the type itself.
Definition at line 1208 of file login.c.
References wl_triple_list::aaaa_4, wl_psi_term::attr_list, wl_triple_list::bbbb_4, wl_triple_list::cccc_4, clear_copy(), DEFRULES, deref_ptr, eval_copy(), i_eval_args(), int_ptr, wl_triple_list::next, NULL, wl_definition::properties, prove, push2_ptr_value(), push_goal(), RMASK, SMASK, STACK, wl_psi_term::status, traceline(), wl_psi_term::type, and unify.
void fetch_def_lazy | ( | ptr_psi_term | u, |
ptr_definition | old1, | ||
ptr_definition | old2, | ||
ptr_node | old1attr, | ||
ptr_node | old2attr, | ||
long | old1stat, | ||
long | old2stat | ||
) |
fetch_def_lazy
u | -ptr_psi_term u |
old1 | - ptr_definition old1 |
old2 | - ptr_definition old2 |
old1attr | - ptr_node old1attr |
old2attr | - ptr_node old2attr |
old1stat | - long old1stat |
old2stat | - long old2stat |
FETCH_DEF_LAZY(psi_term,type1,type2,attr_list1,attr_list2) Fetch the type definition of a psi_term and execute it. That is, get the list of (term,pred) pairs that define the type. 'Term' is one of the type's attributes and 'pred' is a constraint. Unify the psi_term with the term, then prove pred.
Only those (term,pred) pairs are executed whose original type is below both type1 and type2, the types of the two psi-terms whose unification created psi_term. This avoids doing much superfluous work.
The above behavior is correct for a psi_term when always_check==TRUE for that psi_term. If always_check==FALSE for a psi_term, then if it does not have attributes it is not checked, and the addition of an attribute will force checking to occur.
Example:
:: t(a=>one,b=>two,c=> X) | thing(X).
psi_term = A:t (it can be any psi_term of type t) term = t(a=>one,b=>two,c=> X) pred = thing(X)
Definition at line 1276 of file login.c.
References wl_triple_list::aaaa_4, wl_definition::always_check, wl_psi_term::attr_list, wl_triple_list::bbbb_4, wl_triple_list::cccc_4, clear_copy(), DEFRULES, deref_ptr, eval_copy(), FALSE, i_eval_args(), int_ptr, matches(), wl_triple_list::next, NULL, wl_definition::properties, prove, push_goal(), push_ptr_value(), STACK, wl_psi_term::status, traceline(), wl_psi_term::type, and unify.
long file_exists | ( | char * | s | ) |
file_exists
s | - char *s |
Definition at line 1711 of file built_ins.c.
References expand_file_name(), FALSE, and TRUE.
ptr_psi_term fileptr2stream | ( | FILE * | fp, |
ptr_definition | typ | ||
) |
fileptr2stream
fp | - FILE *fp |
typ | - ptr_definition typ removed * DJD = prior to 2.29 |
Definition at line 688 of file sys.c.
References BYTEDATA_DATA, FP_NONE, and make_bytedata().
find
comp | - long comp |
keystr | - char *keystr |
tree | - ptr_node tree |
FIND(comp,keystr,tree) Return the NODE address corresponding to key KEYSTR in TREE using function COMP to compare keys.
Definition at line 394 of file trees.c.
References Errorline(), FALSE, featcmp(), FEATCMP, intcmp(), INTCMP, wl_node::left, NULL, wl_node::right, STRCMP, and TRUE.
void find_adults | ( | ) |
find_adults
FIND_ADULTS() Returns the list of all the maximal types (apart from top) in the symbol table. That is, types which have no parents. This routine modifies the global variable 'adults'.
Definition at line 549 of file types.c.
References adults, first_definition, HEAP_ALLOC, wl_int_list::next, wl_definition::next, NULL, wl_definition::parents, wl_definition::type_def, type_it, and wl_int_list::value_1.
find_data
p | - GENERIC p |
t | - ptr_node t |
FIND_DATA(p,t) Return the node containing the data P in tree T. This is a linear search and can be used to find the key to some data if it is unkown. Return NULL if no key corresponds to data P.
Definition at line 452 of file trees.c.
References wl_node::data, wl_node::left, NULL, and wl_node::right.
ptr_module find_module | ( | char * | module | ) |
find_module
module | char *module |
FIND_MODULE(module) Return a module if it exists.
Definition at line 54 of file modules.c.
References wl_node::data, FEATCMP, find(), and NULL.
void forbid_variables | ( | ptr_node | n | ) |
FORBID_VARIABLES This inserts the value of the dereferenced variables into the PRINTED_POINTERS tree, so that they will never be printed as NAME:value inside a psi-term. Each variable is printed as NAME = VALUE by the PRINT_VARIABLES routine.
Definition at line 334 of file print.c.
References wl_node::data, deref_ptr, heap_insert(), INTCMP, wl_node::key, wl_node::left, printed_pointers, and wl_node::right.
void garbage | ( | ) |
garbage
GARBAGE() The garbage collector. This routine is called whenever memory is getting low. It returns TRUE if insufficient memory was freed to allow the interpreter to carry on working.
This is a half-space GC, it first explores all known structures, then compresses the heap and the stack, then during the second pass assigns all the new addresses.
Bugs will appear if the collector is called during parsing or other such routines which are 'unsafe'. In order to avoid this problem, before one of these routines is invoked the program will check to see whether there is enough memory available to work, and will call the GC if not (this is a fix, because it is not possible to determine in advance what the size of a psi_term read by the parser will be).
Definition at line 1530 of file memory.c.
References assert, bounds_undo_stack(), check(), clear_copy(), compress(), FALSE, garbage_time, gc_time, heap_pointer, ignore_eff, last_garbage_time, life_time, mem_base, mem_limit, NULL, other_base, other_limit, pass, pointer_names, print_gc_info(), printed_pointers, stack_info(), stack_pointer, TRUE, and verbose.
ptr_node general_insert | ( | long | comp, |
char * | keystr, | ||
ptr_node * | tree, | ||
GENERIC | info, | ||
long | heapflag, | ||
long | copystr, | ||
long | bkflag | ||
) |
ptr_node general_insert
comp | - long comp |
keystr | - char *keystr |
tree | - ptr_node *tree |
info | - GENERIC info |
heapflag | - long heapflag |
copystr | - long copystr |
bkflag | - long bkflag |
GENERAL_INSERT(comp,keystr,tree,info,heapflag,copystr,bkflag) General tree insertion routine. comp = comparison routine for insertion. keystr = the insertion key. tree = the tree to insert in. info = the information to insert. heapflag = HEAP or STACK for heap or stack allocation of insertion node. copystr = TRUE iff copy the keystr to the heap on insertion. bkflag = 1 iff the insertion is backtrackable (trailed with trail check). 2 iff the insertion must always be trailed. Returns a pointer to the node containing the pair (keystr,info).
Here KEYSTR can be either a pointer to a string, an integer, or a feature. COMP is the function to call to compare 2 keys so it has three possible values: COMP==strcmp(), COMP==intcmp(), or COMP==featcmp(). COMP(a,b) should return n where: n=0 if a=b; n>0 if a>b; n<0 if a<b.
Definition at line 224 of file trees.c.
References Errorline(), FALSE, featcmp(), FEATCMP, HEAP, HEAP_ALLOC, heap_copy_string(), int_ptr, intcmp(), INTCMP, wl_node::key, NULL, push_ptr_value(), push_ptr_value_global(), STACK_ALLOC, STRCMP, and TRUE.
long get_arg | ( | ptr_psi_term | g, |
ptr_psi_term * | arg, | ||
char * | number | ||
) |
get_arg
g | - ptr_psi_term g |
arg | - ptr_psi_term *arg |
number | - char *number |
GET_ARG assign the argument "number" of the goal "g" in "arg". return FALSE if bad argument.
Definition at line 25 of file templates.c.
References wl_psi_term::attr_list, wl_node::data, FALSE, FEATCMP, find(), and TRUE.
GENERIC get_attr | ( | ptr_psi_term | t, |
char * | attrname | ||
) |
get_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
Get the GENERIC value of a psi-term's attribute
Definition at line 265 of file token.c.
References wl_psi_term::attr_list, wl_node::data, FEATCMP, and find().
int get_module | ( | ptr_psi_term | psi, |
ptr_module * | module | ||
) |
get_module
psi | - ptr_psi_term psi |
module | - ptr_module *module |
GET_MODULE(psi,module,resid) Convert a psi-term to a module. The psi-term must be a string.
Definition at line 1226 of file modules.c.
References deref_ptr, Errorline(), FALSE, find_module(), wl_definition::keyword, NULL, overlap_type(), quoted_string, wl_keyword::symbol, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
void get_one_arg | ( | ptr_node | t, |
ptr_psi_term * | a | ||
) |
get_one_arg
t | - ptr_node t |
a | - ptr_psi_term *a |
GET_ONE_ARG(attr_list,arg1) Get the argument labelled '1' as quickly as possible from the binary tree ATTR_LIST, place it in ARG1. This routine nearly always makes a direct hit.
Definition at line 99 of file login.c.
References wl_node::data, FEATCMP, find(), wl_node::key, NULL, and one.
void get_one_arg_addr | ( | ptr_node | t, |
ptr_psi_term ** | a | ||
) |
get_one_arg_addr
t | - ptr_node t |
a | - ptr_psi_term **a |
GET_ONE_ARG_ADDR(attr_list,arg1addr) Get address of slot in the attr_list that points to the argument labelled '1' as quickly as possible from the binary tree ATTR_LIST. This routine nearly always makes a direct hit.
Definition at line 132 of file login.c.
References wl_node::data, FEATCMP, find(), wl_node::key, NULL, and one.
long get_real_value | ( | ptr_psi_term | t, |
REAL * | v, | ||
long * | n | ||
) |
get_real_value
t | - ptr_psi_term t |
v | - REAL *v |
n | - long *n |
GET_REAL_VALUE(t,v,n) Check if psi_term T is a real number. Return N=TRUE iff T <| REAL. If T has a real value then set V to that value. Also force the type of T to REAL if REAL <| T. This is used in all the arithmetic built-in functions to get their arguments.
Definition at line 261 of file built_ins.c.
References def_ptr, FALSE, heap_pointer, i_check_out(), int_ptr, matches(), push_ptr_value(), REAL, real, wl_psi_term::status, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
FILE * get_stream | ( | ptr_psi_term | t | ) |
get_stream
t | - ptr_psi_term t |
Get the psi-term's STREAM attribute
Definition at line 278 of file token.c.
References get_attr(), and STREAM.
void get_two_args | ( | ptr_node | t, |
ptr_psi_term * | a, | ||
ptr_psi_term * | b | ||
) |
get_two_args
t | - ptr_node t, |
a | - ptr_psi_term *a |
b | - ptr_psi_term *b |
GET_TWO_ARGS(attr_list,arg1,arg2) Get the arguments labelled '1' and '2' as quickly as possible from the binary tree ATTR_LIST, place them in ARG1 and ARG2. This routine nearly always makes a direct hit.
Definition at line 47 of file login.c.
References wl_node::data, FEATCMP, find(), wl_node::key, NULL, one, wl_node::right, and two.
int GetBoolOption | ( | char * | name | ) |
GetBoolOption.
name | - char *name |
Definition at line 64 of file memory.c.
References GetStrOption().
int GetIntOption | ( | char * | name, |
int | def | ||
) |
GetIntOption.
name | - char *name |
def | - int def |
Definition at line 78 of file memory.c.
References GetStrOption().
char * GetStrOption | ( | char * | name, |
char * | def | ||
) |
long glb | ( | ptr_definition | t1, |
ptr_definition | t2, | ||
ptr_definition * | t3, | ||
ptr_int_list * | c3 | ||
) |
glb
t1 | - ptr_definition t1 |
t2 | - ptr_definition t2 |
t3 | - ptr_definition *t3 |
c3 | - ptr_int_list *c3 |
GLB(t1,t2,t3) This function returns the Greatest Lower Bound of two types T1 and T2 in T3.
T3 = T1 /\ T2
If T3 is not a simple type then C3 is its code, and T3=NULL.
It also does some type comparing, and returns
0 if T3 = bottom 1 if T1 = T2 2 if T1 <| T2 ( T3 = T1 ) 3 if T1 |> T2 ( T3 = T2 ) 4 otherwise ( T3 strictly <| T1 and T3 strictly <| T2 )
These results are used for knowing when to inherit properties or release residuations. The t3 field is NULL iff a new type is needed to represent the result.
RM: May 7 1993 Fixed bug in when multiple word code
Definition at line 1481 of file types.c.
References wl_definition::code, FALSE, wl_int_list::next, NOT_CODED, nothing, NULL, STACK_ALLOC, top, TRUE, and wl_int_list::value_1.
glb_code
f1 | - long f1 |
c1 | - GENERIC c1 |
f2 | - long f2 |
c2 | - GENERIC c2 |
f3 | - long *f3 |
c3 | - GENERIC *c3 |
GLB_CODE(f1,c1,f2,c2,f3,c3) (21.9) Calculate glb of two type codes C1 and C2, put result in C3. Return a result value (see comments of glb(..)).
Sorts are stored as a 'Variant Record': f1==TRUE: c1 is a ptr_definition (an interned symbol). f1==FALSE: c1 is a ptr_int_list (a sort code). The result (f3,c3) is also in this format. This is needed to correctly handle psi-terms that don't have a sort code (for example, functions, predicates, and singleton sorts). The routine handles a bunch of special cases that keep f3==TRUE. Other than that, it is almost a replica of the inner loop of glb(..).
Definition at line 1351 of file types.c.
References wl_definition::code, FALSE, wl_int_list::next, NOT_CODED, NULL, STACK_ALLOC, top, TRUE, and wl_int_list::value_1.
glb_value
result | - long result |
f | - long f |
c | - GENERIC c |
value1 | - GENERIC value1 |
value2 | - GENERIC value2 |
value | - GENERIC *value |
GLB_VALUE(result,f,c,value1,value2,value) Do the comparison of the value fields of two psi-terms. This is used in conjunction with glb_code to correctly implement completeness for disequality for psi-terms with non-NULL value fields. This must be preceded by a call to glb_code, since it uses the outputs of that call.
result result of preceding glb_code call (non-NULL iff non-empty intersec.) f,c sort intersection (sortflag & code) of preceding glb_code call. value1 value field of first psi-term. value2 value field of second psi-term. value output value field (if any).
Definition at line 1290 of file types.c.
References wl_definition::code, FALSE, NULL, quoted_string, REAL, real, sub_CodeType(), and TRUE.
void global_error_check | ( | ptr_node | n, |
int * | error, | ||
int * | eval_2 | ||
) |
global_error_check
n | - ptr_node n |
error | - int *error |
eval_2 | - int *eval_2 |
Definition at line 2591 of file built_ins.c.
References wl_psi_term::attr_list, wl_node::data, deref_eval(), deref_ptr, error_psi_term, Errorline(), FALSE, get_two_args(), global_error_check(), global_it, wl_node::left, leftarrowsym, NULL, wl_node::right, TRUE, wl_psi_term::type, wl_definition::type_def, undef_it, and wl_psi_term::value_3.
void global_one | ( | ptr_psi_term | t | ) |
global_one
t | - ptr_psi_term t |
Definition at line 2651 of file built_ins.c.
References wl_psi_term::attr_list, clear_copy(), deref_ptr, get_two_args(), global_it, HEAP, wl_definition::init_value, leftarrowsym, quote_copy(), stack_psi_term(), wl_psi_term::type, and wl_definition::type_def.
void global_tree | ( | ptr_node | n | ) |
global_tree
n | - ptr_node n |
Definition at line 2631 of file built_ins.c.
References wl_node::data, deref_ptr, global_one(), global_tree(), wl_node::left, and wl_node::right.
int global_unify | ( | ptr_psi_term | u, |
ptr_psi_term | v | ||
) |
global_unify
u | - ptr_psi_term u |
v | - ptr_psi_term v |
GLOBAL_UNIFY(u,v) Unify two psi-terms, where it is known that V is on the heap (a persistent variable).
This routine really matches U and V, it will only succeed if V is more general than U. U will then be bound to V.
Definition at line 1053 of file modules.c.
References wl_psi_term::attr_list, c_abort(), wl_psi_term::coref, deref_ptr, Errorline(), FALSE, glb(), global_unify_attr(), heap_pointer, overlap_type(), push_psi_ptr_value(), quoted_string, REAL, real, release_resid(), wl_psi_term::resid, traceline(), TRUE, wl_psi_term::type, and wl_psi_term::value_3.
global_unify_attr
u | - ptr_node u |
v | - ptr_node v |
GLOBAL_UNIFY_ATTR(u,v) Unify the attributes of two terms, one on the heap, one on the stack. This is really matching, so all features of U must appear in V.
Definition at line 1135 of file modules.c.
References wl_node::data, dummy_printf(), FALSE, featcmp(), global_unify(), wl_node::key, wl_node::left, NULL, wl_node::right, and TRUE.
void go_through | ( | ptr_psi_term | t | ) |
go_through
t | - ptr_psi_term t |
GO_THROUGH(t) This routine goes through all the sub_terms of psi_term T to determine which pointers need to have names given to them for printing because they are referred to elsewhere. T is a dereferenced psi_term.
Definition at line 282 of file print.c.
References wl_psi_term::attr_list, and go_through_tree().
void go_through_tree | ( | ptr_node | t | ) |
go_through_tree
t | - ptr_node t |
GO_THROUGH_TREE(t) Explore all the pointers in the attribute tree T. Pointers that occur more than once will need a tag.
Definition at line 258 of file print.c.
References check_pointer(), wl_node::data, wl_node::left, and wl_node::right.
ptr_goal GoalFromPsiTerm | ( | ptr_psi_term | psiTerm | ) |
GoalFromPsiTerm.
psiTerm | - ptr_psi_term psiTerm |
not used anymore, but interesting
Definition at line 3992 of file xpred.c.
References aim, Errorline(), FALSE, wl_residuation::goal, wl_residuation::next, NULL, and wl_psi_term::resid.
char ** group_features | ( | char ** | f, |
ptr_node | n | ||
) |
group_features
f | - char **f |
n | - ptr_node n |
Definition at line 34 of file lib.c.
References wl_node::key, wl_node::left, NULL, and wl_node::right.
void handle_interrupt | ( | ) |
HANDLE_INTERRUPT.
This deals with an eventual interrupt. Return TRUE if execution continues normally, otherwise abort query, toggle trace on or off, or quit Wild_Life (suicide).
Definition at line 52 of file interrupt.c.
References abort_life(), DIGIT, EOLN, exit_life(), FALSE, input_state, interrupted, open_input_file(), prompt, quietflag, read_char(), restore_state(), show_count(), stdin_cleareof(), stepcount, stepflag, steptrace, trace, TRUE, and verbose.
long has_non_alpha | ( | char * | s | ) |
long has_rules | ( | ptr_pair_list | r | ) |
has_rules
r | - ptr_pair_list r |
Return TRUE iff there are some rules r This is true for a user-defined function or predicate with a definition, and for a type with constraints.
Definition at line 5101 of file built_ins.c.
References wl_pair_list::aaaa_2, FALSE, wl_pair_list::next, NULL, and TRUE.
int hash_code | ( | ptr_hash_table | table, |
char * | symbol | ||
) |
HASH_CODE.
table | - ptr_hash_table table |
symbol | - char *symbol |
Return the hash code for a symbol
Definition at line 79 of file hash_table.c.
References rand_array, and wl_hash_table::size.
ptr_hash_table hash_create | ( | int | size | ) |
HASH_CREATE.
size | - int size |
Create a hash-table for max size keywords.
Definition at line 25 of file hash_table.c.
References NULL, and wl_hash_table::size.
void hash_display | ( | ptr_hash_table | table | ) |
HASH_DISPLAY.
table | - ptr_hash_table table |
Display a symbol table (for debugging).
Definition at line 174 of file hash_table.c.
References hash_code().
void hash_expand | ( | ptr_hash_table | table, |
int | new_size | ||
) |
HASH_EXPAND.
table | - ptr_hash_table table |
new_size | - int new_size |
Allocate a bigger hash table.
Definition at line 47 of file hash_table.c.
References wl_hash_table::data, hash_insert(), NULL, wl_hash_table::size, and wl_hash_table::used.
int hash_find | ( | ptr_hash_table | table, |
char * | symbol | ||
) |
hash_find
table | - ptr_hash_table table |
symbol | - char *symbol |
Definition at line 106 of file hash_table.c.
References wl_hash_table::data, hash_code(), wl_hash_table::size, and wl_keyword::symbol.
void hash_insert | ( | ptr_hash_table | table, |
char * | symbol, | ||
ptr_keyword | keyword | ||
) |
HASH_INSERT.
table | - ptr_hash_table table |
symbol | - char *symbol |
keyword | - ptr_keyword keyword |
Add a symbol and data to a table. Overwrite previous data.
Definition at line 151 of file hash_table.c.
References wl_hash_table::data, hash_expand(), hash_find(), wl_hash_table::size, and wl_hash_table::used.
ptr_keyword hash_lookup | ( | ptr_hash_table | table, |
char * | symbol | ||
) |
HASH_LOOKUP.
table | - ptr_hash_table table |
symbol | - char *symbol |
Look up a symbol in the symbol table.
Definition at line 131 of file hash_table.c.
References wl_hash_table::data, and hash_find().
void heap_add_int_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
long | value | ||
) |
heap_add_int_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
value | - long value |
Add an attribute whose value is an integer to a psi-term that does not yet contains this attribute.
Definition at line 74 of file token.c.
References wl_psi_term::attr_list, FEATCMP, heap_alloc(), heap_copy_string(), heap_insert(), heap_psi_term(), integer, REAL, wl_psi_term::type, and wl_psi_term::value_3.
void heap_add_psi_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
ptr_psi_term | g | ||
) |
heap_add_psi_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
g | - ptr_psi_term g |
Attach a psi-term to another as an attribute.
Definition at line 226 of file token.c.
References wl_psi_term::attr_list, FEATCMP, heap_copy_string(), and heap_insert().
void heap_add_str_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
char * | str | ||
) |
heap_add_str_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
str | - char *str |
Add an attribute whose value is a string to a psi-term that does not yet contains this attribute.
Definition at line 151 of file token.c.
References wl_psi_term::attr_list, FEATCMP, heap_copy_string(), heap_insert(), heap_psi_term(), quoted_string, wl_psi_term::type, and wl_psi_term::value_3.
GENERIC heap_alloc | ( | long | s | ) |
heap_alloc
s | - long s |
HEAP_ALLOC(s) This returns a pointer to S bytes of memory in the heap. Alignment is taken into account in the following manner: the macro ALIGN is supposed to be a power of 2 and the pointer returned is a multiple of ALIGN.
Definition at line 1616 of file memory.c.
References ALIGN, Errorline(), heap_pointer, and stack_pointer.
ptr_psi_term heap_copy_psi_term | ( | psi_term | t | ) |
heap_copy_psi_term
t | - psi_term t |
HEAP_COPY_PSI_TERM(tok) Return the address of a copy of TOK on the HEAP.
Definition at line 226 of file parser.c.
References global_time_stamp, and HEAP_ALLOC.
char * heap_copy_string | ( | char * | s | ) |
heap_copy_string
s | - char *s |
HEAP_COPY_STRING(string) Make a copy of the string in the heap, and return a pointer to that. Exceptions: "1" and "2" are unique (and in the heap).
Definition at line 172 of file trees.c.
References heap_ncopy_string().
heap_insert
comp | - long comp |
keystr | - char *keystr |
tree | - ptr_node *tree |
info | - GENERIC info |
HEAP_INSERT(comp,keystr,tree,info) Insert the pointer INFO under the reference KEYSTR in the binary tree TREE stored in the heap. Return the pointer to the node of KEYSTR.
Definition at line 320 of file trees.c.
References FALSE, general_insert(), and HEAP.
heap_insert_copystr
keystr | - char *keystr |
tree | - ptr_node *tree |
info | - GENERIC info |
HEAP_INSERT_COPYSTR(keystr,tree,info) Insert the pointer INFO under the reference string KEYSTR (which is a feature name) in the binary tree TREE. KEYSTR is copied to the heap. A potential additional node allocated to TREE is put on the heap.
Definition at line 284 of file trees.c.
References FEATCMP, general_insert(), HEAP, and TRUE.
void heap_mod_int_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
long | value | ||
) |
heap_mod_int_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
value | - long value |
Modify an attribute whose value is an integer to a psi-term that already contains this attribute with another integer value.
Definition at line 116 of file token.c.
References wl_psi_term::attr_list, wl_node::data, FEATCMP, find(), REAL, and wl_psi_term::value_3.
void heap_mod_str_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
char * | str | ||
) |
heap_mod_str_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
str | - char *str |
Modify an attribute whose value is a string to a psi-term that already contains this attribute with another integer value.
Definition at line 191 of file token.c.
References wl_psi_term::attr_list, wl_node::data, FEATCMP, find(), heap_copy_string(), and wl_psi_term::value_3.
char * heap_ncopy_string | ( | char * | s, |
int | n | ||
) |
heap_ncopy_string
s | - char *s |
n | - int n |
HEAP_NCOPY_STRING(string,length) Make a copy of the string in the heap, and return a pointer to that. Exceptions: "1" and "2" are unique (and in the heap).
Definition at line 150 of file trees.c.
References heap_alloc(), one, and two.
char * heap_nice_name | ( | ) |
heap_nice_name
Generate a nice-looking new variable name.
Definition at line 63 of file print.c.
References gen_sym_counter, heap_copy_string(), perr(), and STRLEN.
ptr_psi_term heap_psi_term | ( | long | stat | ) |
heap_psi_term
stat | - long stat |
Create a new psi_term on the heap with value '@' (top) and no attributes.
Definition at line 75 of file lefun.c.
References wl_psi_term::attr_list, wl_psi_term::coref, FALSE, wl_psi_term::flags, global_time_stamp, HEAP_ALLOC, NULL, QUOTED_TRUE, wl_psi_term::resid, wl_psi_term::status, top, wl_psi_term::type, and wl_psi_term::value_3.
long hidden_type | ( | ptr_definition | t | ) |
long i_check_out | ( | ptr_psi_term | t | ) |
i_check_out
t | - ptr_psi_term t |
Definition at line 1033 of file lefun.c.
References check_func_flag, check_out(), and FALSE.
long i_eval_args | ( | ptr_node | n | ) |
i_eval_args
n | - ptr_node n |
I_EVAL_ARGS(n) N is an attribute tree, the attributes must be examined, if any reveal themselves to need evaluating then return FALSE.
Definition at line 874 of file lefun.c.
References check_func_flag, eval_args(), and FALSE.
long in_set | ( | char * | str, |
long | set | ||
) |
ptr_psi_term inc_heap_copy | ( | ptr_psi_term | t | ) |
inc_heap_copy
t | - ptr_psi_term t |
There is a bug in inc_heap_copy
Definition at line 206 of file copy.c.
References copy(), EXACT_FLAG, to_heap, and TRUE.
void infoline | ( | char * | format, |
... | |||
) |
infoline
format | - char *format |
... |
Definition at line 281 of file error.c.
References assert, display_psi(), FALSE, input_file_name, NOTQUIET, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.
void inherit_always_check | ( | ) |
inherit_always_check
INHERIT_ALWAYS_CHECK() The 'always_check' flag, if false, should be propagated to a sort's children. This routine does a closure on this propagation operation for all declared sorts.
Definition at line 1068 of file types.c.
References FALSE, and one_pass_always_check().
void init_built_in_types | ( | ) |
init_built_in_types
INIT_BUILT_IN_TYPES Initialise the symbol tree with the built-in types. Declare all built-in predicates and functions. Initialise system type variables. Declare all standard operators.
Called by life.c
Definition at line 6155 of file built_ins.c.
References aborthooksym, abortsym, add_module1, add_module2, add_module3, alist, all_public_symbols(), and, apply, bi_module, boolpredsym, built_in, c_abort(), c_alias(), c_and(), c_append_file(), c_apply(), c_args(), c_ascii(), c_assert_first(), c_assert_last(), c_bk_assign(), c_boolpred(), c_char(), c_chdir(), c_clause(), c_close(), c_combined_name(), c_concatenate(), c_cond(), c_copy_pointer(), c_copy_term(), c_current_module(), c_declaration(), c_delay_check(), c_deref_length(), c_diff(), c_diff_address(), c_disj(), c_display_modules(), c_display_persistent(), c_dynamic(), c_equal(), c_eval(), c_eval_disjunction(), c_eval_inplace(), c_exist_feature(), c_exists(), c_exists_choice(), c_fail(), c_feature_values(), c_features(), c_get(), c_get_choice(), c_global(), c_global_assign(), c_gt(), c_gtoe(), c_halt(), c_implies(), c_initrandom(), c_int2string(), c_is_function(), c_is_predicate(), c_is_sort(), c_listing(), c_load(), c_lt(), c_ltoe(), c_module_name(), c_non_strict(), c_nonvar(), c_not(), c_not_implemented(), c_op(), c_open_in(), c_open_module(), c_open_out(), c_ops(), c_or(), c_page_width(), c_parse(), c_persistent(), c_print_codes(), c_print_depth(), c_print_variables(), c_private(), c_private_feature(), c_project(), c_psi2string(), c_public(), c_put(), c_put_err(), c_pwrite(), c_pwriteq(), c_random(), c_read_psi(), c_read_token(), c_repeat(), c_replace(), c_retract(), c_rootsort(), c_same_address(), c_set_choice(), c_set_input(), c_set_module(), c_set_output(), c_setq(), c_split_double(), c_static(), c_string2psi(), c_string_address(), c_string_length(), c_strip(), c_sub_string(), c_succeed(), c_such_that(), c_trace_input(), c_undo(), c_unify_func(), c_unify_pred(), c_var(), c_write(), c_write_canonical(), c_write_err(), c_writeq(), c_writeq_err(), c_xor(), call_handlersym, calloncesym, wl_definition::code, colonsym, commasym, comment, constant, cut, day_attr, delay_checksym, disj_nil, disjunction, dynamicsym, encodesym, eof, eqsym, error_psi_term, eval_argsym, final_dot, final_question, funcsym, function_it, functor, fx_sym, fy_sym, hash_lookup(), heap_psi_term(), hour_attr, iff, inputfilesym, insert_math_builtins(), insert_sys_builtins(), insert_system_builtins(), insert_type_builtins(), integer, wl_definition::keyword, leftarrowsym, lf_false, lf_true, life_or, listingsym, loadsym, minus_symbol, minute_attr, month_attr, new_built_in(), nil, no_module, NOT_CODED, nothing, null_psi_term, nullsym, one, opsym, predicate_it, predsym, wl_keyword::public, quote, quoted_string, real, second_attr, set_current_module(), staticsym, stream, succeed, such_that, wl_keyword::symbol, wl_module::symbol_table, syntax_module, three, timesym, top, tracesym, TRUE, two, wl_psi_term::type, wl_definition::type_def, type_it, typesym, update_symbol(), variable, weekday_attr, xf_sym, xfx_sym, xfy_sym, year_attr, yf_sym, and yfx_sym.
void init_copy | ( | ) |
init_copy
INIT_COPY() Execute once upon startup of Wild_Life.
Definition at line 32 of file copy.c.
References HASHSIZE, hashtable, hashtime, numbuckets, and NUMBUCKETS.
void init_global_vars | ( | ) |
init_global_vars
INIT_GLOBAL_VARS() Initialize all non-persistent global variables.
Definition at line 1484 of file lefun.c.
References first_definition, wl_definition::global_value, heap_pointer, wl_definition::next, and NULL.
void init_interrupt | ( | ) |
INIT_INTERRUPT.
This initialises interrupts by trapping the interrupt signal and sending it to INTERRUPT.
Definition at line 36 of file interrupt.c.
References interrupt().
void init_io | ( | ) |
void init_io
I/O initialization
Definition at line 69 of file lib.c.
References input_state, NULL, output_stream, stdin_state, stdin_terminal, and TRUE.
void init_memory | ( | ) |
init_memory ()
INIT_MEMORY() Get two big blocks of memory to work in. The second is only used for the half-space garbage collector. The start and end addresses of the blocks are re-aligned correctly. to allocate.
Definition at line 1671 of file memory.c.
References ALIGNUP, ALLOC_WORDS, alloc_words, buffer, delta, Errorline(), GetIntOption(), heap_pointer, mem_base, mem_limit, mem_size, other_base, other_limit, other_pointer, PRINT_BUFFER, stack_pointer, and WORD.
void init_modules | ( | ) |
init_modules
INIT_MODULES() Initialize the module system.
Definition at line 34 of file modules.c.
References create_module(), and set_current_module().
void init_parse_state | ( | ) |
init_parse_state
Initialize the parser/tokenizer state variables.
Definition at line 464 of file token.c.
References eof_flag, FALSE, line_count, NULL, old_saved_char, old_saved_psi_term, saved_char, saved_psi_term, start_of_line, stringparse, and TRUE.
void init_print | ( | ) |
init_print
Initialize size of single segment of split printing. Wild_Life integers are represented as REALS, and therefore can have higher precision than the machine integers. They will be printed in segments.
Definition at line 52 of file print.c.
References PRINT_POWER, and seg_format.
void init_system | ( | ) |
init_system
Initial state of system to begin a query
Definition at line 83 of file lib.c.
References choice_stack, current_module, exit_if_true(), FALSE, goal_stack, init_global_vars(), mem_base, memory_check(), wl_module::module_name, NULL, PROMPT, prompt, PROMPT_BUFFER, prompt_buffer, resid_aim, stack_nil(), stack_pointer, undo_stack, user_module, var_tree, x_window_creation, and xevent_list.
void init_trace | ( | ) |
void insert_dbm_builtins | ( | ) |
void insert_math_builtins | ( | ) |
insert math builtins into table
insert functions into table
Definition at line 1346 of file bi_math.c.
References bi_module, c_add(), c_bit_and(), c_bit_not(), c_bit_or(), c_ceiling(), c_cos(), c_div(), c_exp(), c_floor(), c_intdiv(), c_log(), c_mod(), c_mult(), c_shift_left(), c_shift_right(), c_sin(), c_sqrt(), c_sub(), c_tan(), function_it, new_built_in(), and syntax_module.
void insert_own_prop | ( | ptr_definition | d | ) |
insert_own_prop
d | - ptr_definition d |
INSERT_OWN_PROP(definition) Append a type's "rules" (i.e. its own attr. & constr.) to its property list. The property list also contains the type's code. A type's attributes and constraints are stored in the 'rule' field of the definition.
Definition at line 575 of file types.c.
References wl_pair_list::aaaa_2, wl_pair_list::bbbb_2, children, FALSE, HEAP_ALLOC, wl_int_list::next, wl_definition::next, wl_pair_list::next, NULL, wl_definition::properties, wl_definition::rule, TRUE, and wl_int_list::value_1.
void insert_prop | ( | ptr_definition | d, |
ptr_triple_list | prop | ||
) |
insert_prop
d | - ptr_definition d |
prop | - ptr_triple_list prop |
INSERT_PROP(definition,prop) Append the properties to the definition if they aren't already present.
Definition at line 620 of file types.c.
References wl_triple_list::aaaa_4, wl_triple_list::bbbb_4, wl_triple_list::cccc_4, children, FALSE, HEAP_ALLOC, wl_int_list::next, wl_definition::next, wl_triple_list::next, NULL, wl_definition::properties, TRUE, and wl_int_list::value_1.
void insert_sys_builtins | ( | ) |
insert_sys_builtins
Definition at line 2209 of file sys.c.
References bi_module, c_accept(), c_apply1(), c_bind(), c_bitvector_and(), c_bitvector_clear(), c_bitvector_count(), c_bitvector_get(), c_bitvector_not(), c_bitvector_or(), c_bitvector_set(), c_bitvector_xor(), c_call_once(), c_connect(), c_cuserid(), c_errmsg(), c_errno(), c_fclose(), c_fflush(), c_fopen(), c_fork(), c_fseek(), c_ftell(), c_fwrite(), c_get_buffer(), c_get_code(), c_get_record(), c_gethostname(), c_getpid(), c_import_symbol(), c_int2stream(), c_kill(), c_lazy_project(), c_listen(), c_make_bitvector(), c_my_wait_on_feature(), c_regexp_compile(), c_regexp_execute(), c_socket(), c_stream2sys_stream(), c_sys_stream2stream(), c_wait(), c_wait_on_feature(), c_waitpid(), current_module, function_it, insert_dbm_builtins(), new_built_in(), predicate_it, set_current_module(), sys_bitvector, sys_bytedata, sys_file_stream, sys_module, sys_process_continued, sys_process_exited, sys_process_no_children, sys_process_signaled, sys_process_stopped, sys_regexp, sys_socket_stream, sys_stream, and update_symbol().
void insert_system_builtins | ( | ) |
insert_system_builtins
Definition at line 746 of file bi_sys.c.
References bi_module, c_cputime(), c_encode(), c_garbage(), c_getenv(), c_localtime(), c_maxint(), c_mresiduate(), c_quiet(), c_realtime(), c_residList(), c_residuate(), c_statistics(), c_step(), c_system(), c_tprove(), c_trace(), c_verbose(), c_warning(), function_it, new_built_in(), and predicate_it.
void insert_translation | ( | ptr_psi_term | a, |
ptr_psi_term | b, | ||
long | info | ||
) |
insert_translation
void insert_translation(ptr_psi_term a,ptr_psi_term b,long info) INSERT_TRANSLATION(a,b,info) Add the translation of address A to address B in the translation table. Also add an info field.
Definition at line 67 of file copy.c.
References hashentry::bucketindex, HASH, hashbuckets, HASHEND, hashfree, hashtable, hashtime, hashbucket::info, hashbucket::new_value, hashbucket::next, numbuckets, hashbucket::old_value, hashentry::timestamp, and traceline().
void insert_type_builtins | ( | ) |
void insert_type_builtins
Definition at line 817 of file bi_type.c.
References bi_module, c_children(), c_glb(), c_is_function(), c_is_number(), c_is_persistent(), c_is_predicate(), c_is_sort(), c_is_value(), c_isa_cmp(), c_isa_eq(), c_isa_ge(), c_isa_gt(), c_isa_le(), c_isa_lt(), c_isa_ncmp(), c_isa_neq(), c_isa_nge(), c_isa_ngt(), c_isa_nle(), c_isa_nlt(), c_isa_subsort(), c_lub(), c_parents(), c_smallest(), function_it, new_built_in(), predicate_it, and syntax_module.
void insert_variables | ( | ptr_node | vars, |
long | force | ||
) |
insert_variables
vars | - ptr_node vars |
force | - long force |
INSERT_VARIABLES(vars,force) This routine gives the name of the query variable to the corresponding pointer in the POINTER_NAMES. If FORCE is TRUE then variables will be printed as TAGS, even if not referred to elsewhere.
Definition at line 308 of file print.c.
References wl_node::data, deref_ptr, find(), INTCMP, wl_node::key, wl_node::left, pointer_names, and wl_node::right.
long int_div_warning | ( | ptr_psi_term | arg, |
REAL | val | ||
) |
int_div_warning
arg | - ptr_psi_term arg |
val | - REAL val |
Definition at line 1028 of file error.c.
References nonint_warning().
long intcmp | ( | long | a, |
long | b | ||
) |
void interrupt | ( | ) |
INTERRUPT()
This routine is called whenever the user types CONTROL C which generates an interrupt. The interrupt is dealt with later, when convenient, or ignored.
Definition at line 21 of file interrupt.c.
References interrupted, and TRUE.
GENERIC intListNext | ( | ptr_int_list | p | ) |
intListNext
p | - ptr_int_list p |
not sure purpose (DJD ???)
Definition at line 515 of file bi_sys.c.
References wl_int_list::next.
ptr_psi_term intListValue | ( | ptr_int_list | p | ) |
ptr_psi_term intListValue
p | - ptr_int_list p |
not sure purpose (DJD ???)
Definition at line 503 of file bi_sys.c.
References makePsiTerm(), and wl_int_list::value_1.
long is_built_in | ( | ptr_pair_list | r | ) |
is_built_in
r | - ptr_pair_list r |
Return TRUE if rules r are for a built-in
Definition at line 5118 of file built_ins.c.
References MAX_BUILT_INS.
long is_int | ( | char ** | s, |
long * | len, | ||
long * | sgn | ||
) |
long is_integer | ( | char * | s | ) |
int is_ipaddr | ( | char * | s | ) |
int isSubTypeValue | ( | ptr_psi_term | arg1, |
ptr_psi_term | arg2 | ||
) |
isSubTypeValue
arg1 | - ptr_psi_term arg1 |
arg2 | - ptr_psi_term arg2 |
Definition at line 180 of file bi_type.c.
References FALSE, integer, quoted_string, REAL, real, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
long isValue | ( | ptr_psi_term | p | ) |
isValue(p)
p | - ptr_psi_term p |
Definition at line 694 of file bi_type.c.
References NULL, and wl_psi_term::value_3.
void least_sorts | ( | ) |
void least_sorts()
LEAST_SORTS() Build the list of terminals (i.e. sorts with no children) in nothing->parents.
Definition at line 743 of file types.c.
References wl_definition::children, cons(), first_definition, wl_definition::next, nothing, NULL, wl_definition::parents, wl_definition::type_def, and type_it.
long legal_in_name | ( | long | c | ) |
void List_Append | ( | RefListHeader | header, |
Ref | atom | ||
) |
void List_Append
header | - RefListHeader header |
atom | - Ref atom |
Definition at line 71 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, wl_ListHeader::Last, and NULL.
long List_Card | ( | RefListHeader | header | ) |
List_Card.
header | - RefListHeader header |
Definition at line 461 of file list.c.
References List_CountAtom(), and List_Enum().
void List_Concat | ( | RefListHeader | header1, |
RefListHeader | header2 | ||
) |
List_Concat.
header1 | - RefListHeader header1 |
header2 | - RefListHeader header2 |
Definition at line 308 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, wl_ListHeader::Last, and NULL.
void List_Cut | ( | RefListHeader | header, |
Ref | atom, | ||
RefListHeader | newHeader | ||
) |
List_Cut.
header | - RefListHeader header |
atom | - Ref atom |
newHeader | - RefListHeader newHeader |
Definition at line 488 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, wl_ListHeader::Last, List_Last, List_Next, and NULL.
long List_Enum | ( | RefListHeader | header, |
RefListEnumProc | proc, | ||
Ref | closure | ||
) |
List_Enum.
header | - RefListHeader header |
proc | - RefListEnumProc proc |
closure | - Ref closure |
Definition at line 379 of file list.c.
References wl_ListHeader::First, and List_EnumFrom().
long List_EnumBack | ( | RefListHeader | header, |
RefListEnumProc | proc, | ||
Ref | closure | ||
) |
List_EnumBack.
header | - RefListHeader header |
proc | - RefListEnumProc proc |
closure | - Ref closure |
Definition at line 433 of file list.c.
References wl_ListHeader::Last, and List_EnumBackFrom().
long List_EnumBackFrom | ( | RefListHeader | header, |
Ref | atom, | ||
RefListEnumProc | proc, | ||
Ref | closure | ||
) |
long List_EnumFrom | ( | RefListHeader | header, |
Ref | atom, | ||
RefListEnumProc | proc, | ||
Ref | closure | ||
) |
void List_InsertAfter | ( | RefListHeader | header, |
Ref | atom, | ||
Ref | mark | ||
) |
List_InsertAfter.
header | - RefListHeader header |
atom | - Ref atom |
mark | - Ref mark) |
Definition at line 134 of file list.c.
References wl_ListHeader::GetLinks, wl_ListHeader::Last, List_InsertAhead(), and NULL.
void List_InsertAhead | ( | RefListHeader | header, |
Ref | atom | ||
) |
List_InsertAhead.
header | - RefListHeader header |
atom | - Ref atom |
List functions
Definition at line 44 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, wl_ListHeader::Last, and NULL.
void List_InsertBefore | ( | RefListHeader | header, |
Ref | atom, | ||
Ref | mark | ||
) |
List_InsertBefore.
header | - RefListHeader header |
atom | - Ref atom |
mark | - Ref mark |
Definition at line 101 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, List_Append(), and NULL.
long List_IsUnlink | ( | RefListLinks | links | ) |
List_IsUnlink.
links | - RefListLinks links |
Definition at line 475 of file list.c.
References wl_ListLinks::Next, NULL, and wl_ListLinks::Prev.
psi_term list_nil | ( | ptr_definition | type | ) |
list_nil
type | - ptr_definition type |
LIST_NIL(type) Returns the atom NIL to mark the end of a list.
Definition at line 278 of file parser.c.
References wl_psi_term::attr_list, wl_psi_term::coref, disj_nil, disjunction, FALSE, wl_psi_term::flags, nil, NULL, wl_psi_term::resid, wl_psi_term::status, wl_psi_term::type, and wl_psi_term::value_3.
void List_Remove | ( | RefListHeader | header, |
Ref | atom | ||
) |
List_Remove.
header | - RefListHeader header |
atom | - Ref atom) |
Definition at line 258 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, wl_ListHeader::Last, and NULL.
void List_Reverse | ( | RefListHeader | header | ) |
List_Reverse.
header | - RefListHeader header |
Definition at line 230 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, wl_ListHeader::Last, List_SwapLinks(), text_buffer::next, and NULL.
void List_SetLinkProc | ( | RefListHeader | header, |
RefListGetLinksProc | getLinks | ||
) |
List_SetLinkProc.
header | - RefListHeader header |
getLinks | - RefListGetLinksProc getLinks |
Set functions
Definition at line 24 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, wl_ListHeader::Last, and NULL.
void list_special | ( | ptr_psi_term | t | ) |
list_special
t | - ptr_psi_term t |
List the characteristics (delay_check, dynamic/static, non_strict) in such a way that they can be immediately read in.
Definition at line 5131 of file built_ins.c.
References wl_definition::always_check, display_psi_stream(), wl_definition::evaluate_args, FALSE, is_built_in(), output_stream, wl_definition::protected, wl_definition::rule, TRUE, wl_psi_term::type, wl_definition::type_def, and type_it.
void List_Swap | ( | RefListHeader | header, |
Ref | first, | ||
Ref | second | ||
) |
List_Swap.
header | - RefListHeader header |
first | - Ref first |
second | - Ref second) |
Definition at line 172 of file list.c.
References wl_ListHeader::First, wl_ListHeader::GetLinks, and wl_ListHeader::Last.
void listing_pred_write | ( | ptr_node | n, |
long | fflag | ||
) |
listing_pred_write
n | - ptr_node n |
fflag | - long fflag |
For the listing built-in
Definition at line 1438 of file print.c.
References const_quote, FALSE, func_flag, indent, listing_flag, main_pred_write(), outfile, output_stream, print_depth, PRINT_DEPTH, TRUE, write_canon, write_corefs, write_resids, and write_stderr.
long load_aim | ( | ) |
load_aim
LOAD_AIM() Continue loading a file from the current psi-term up to the next query. Files are loaded in blocks of assertions that end with a query. Such a chunk is loaded by a 'load' goal on the goal_stack. This goal contains the input file state information. This guarantees that all queries in the input file are executed in the order they are encountered (which includes load operations).
Definition at line 2232 of file login.c.
References wl_goal::aaaa_1, abort_life(), aim, assert_clause(), assert_first, wl_goal::bbbb_1, wl_goal::cccc_1, choice_stack, CURRENT_MODULE, DEFRULES, encode_types(), eof, FACT, FALSE, file_date, find_module(), general_cut, get_attr(), input_state, input_stream, load, noisy, NULL, open_input_file(), parse(), prove, push_choice_point(), push_goal(), QUERY, restore_state(), save_state(), set_current_module(), stack_copy_psi_term(), TRUE, wl_psi_term::type, var_occurred, and var_tree.
long look | ( | ) |
look
LOOK() This function returns the precedence of the stack top.
Definition at line 163 of file parser.c.
References int_stack, and parser_stack_index.
ptr_int_list lub | ( | ptr_psi_term | a, |
ptr_psi_term | b, | ||
ptr_psi_term * | pp | ||
) |
Definition at line 173 of file lub.c.
References bfs(), wl_definition::code, copyTypeCode(), decode(), isSubTypeValue(), isValue(), makeUnitList(), NULL, or_codes(), stack_alloc(), sub_type(), top, wl_psi_term::type, and type_count.
int main | ( | int | argc, |
char * | argv[] | ||
) |
main
int main(int argc,char *argv[])
argc | - int argc |
argv | - char *argv[] |
MAIN(argc,argv) This routine contains the Read-Solve-Print loop.
Definition at line 34 of file life.c.
References arg_c, arg_v, assert, assert_clause(), assert_first, assert_ok, begin_terminal_io(), DEFRULES, encode_types(), end_terminal_io(), env, eof, Errorline(), exit_if_true(), exit_life(), FACT, FALSE, file_date, GetBoolOption(), goal_count, heap_copy_string(), ignore_eff, infoline(), init_built_in_types(), init_copy(), init_interrupt(), init_io(), init_memory(), init_modules(), init_print(), init_system(), init_trace(), input_state, life_start, load, main_prove(), mem_base, noisy, NULL, open_input_file(), other_base, parse(), prove, push_goal(), put_back_char(), QUERY, quietflag, rand_array, read_char(), reset_step(), set_current_module(), stack_copy_psi_term(), stack_pointer, start_chrono(), stdin_cleareof(), title(), TRUE, wl_psi_term::type, undo(), undo_stack, user_module, var_occurred, what_next, and x_setup_builtins().
void main_display_psi_term | ( | ptr_psi_term | t | ) |
main_display_psi_term
t | - ptr_psi_term t |
Main loop for previous two entry points
Definition at line 1593 of file print.c.
References buffer, const_quote, deref_ptr, end_tab(), FALSE, gen_sym_counter, go_through(), heap_pointer, indent, indx, insert_variables(), listing_flag, mark_tab(), MAX_PRECEDENCE, new_tab(), NULL, pointer_names, pretty_output(), pretty_tag_or_psi_term(), pretty_things, printed_pointers, TRUE, var_tree, work_out_length(), write_canon, and write_resids.
void main_pred_write | ( | ptr_node | n | ) |
main_pred_write
n | - ptr_node n |
Definition at line 1484 of file print.c.
References buffer, check_pointer(), wl_node::data, end_tab(), FALSE, gen_sym_counter, go_through_tree(), heap_pointer, indent, indx, insert_variables(), wl_node::left, mark_tab(), MAX_PRECEDENCE, new_tab(), NULL, pointer_names, pretty_output(), pretty_tag_or_psi_term(), pretty_things, printed_pointers, wl_node::right, var_tree, work_out_length(), write_attributes(), and write_corefs.
void main_prove | ( | ) |
main_prove
MAIN_PROVE() This is the inference engine. It distributes sub-goals to the appropriate routines. It deals with backtracking. It fails if there is not enough memory available or if there is an interrupt that causes the current query to be aborted.
Definition at line 2333 of file login.c.
References wl_goal::aaaa_1, aim, backtrack(), wl_goal::bbbb_1, c_what_next, wl_goal::cccc_1, choice_stack, clause, clause_aim(), clean_trail(), curried, cut_to, del_clause, disj, disjunct_aim(), do_currying(), do_residuation_user(), Errorline(), eval, eval_aim(), eval_cut, fail, FALSE, freeze_cut, function_it, GC_THRESHOLD, general_cut, goal_count, goal_stack, handle_interrupt(), heap_pointer, i_check_out(), implies_cut, infoline(), interrupted, load, load_aim(), main_loop_ok, match, match_aim(), memory_check(), wl_goal::next, NULL, prove, prove_aim(), release_resid(), resid_aim, resid_vars, restore_resid(), retract, show_count(), stack_pointer, stepcount, stepflag, steptrace, traceline(), TRUE, wl_goal::type, type_disj, type_disj_aim(), undo(), unify, unify_aim(), unify_aim_noeval(), unify_noeval, warningline(), what_next, what_next_aim(), x_exist_event(), xcount, xevent_existing, XEVENTDELAY, and xeventdelay.
ptr_psi_term make_feature_list | ( | ptr_node | tree, |
ptr_psi_term | tail, | ||
ptr_module | module, | ||
int | val | ||
) |
make_feature_list
tree | - ptr_node tree |
tail | - ptr_psi_term tail |
module | - ptr_module module |
val | - int val |
Definition at line 175 of file built_ins.c.
References wl_node::data, heap_alloc(), integer, wl_node::key, wl_node::left, make_feature_list(), REAL, real, wl_node::right, stack_cons(), stack_psi_term(), str_to_int(), and update_feature().
int make_feature_private | ( | ptr_psi_term | term | ) |
make_feature_private
term | - ptr_psi_term term |
MAKE_FEATURE_PRIVATE(feature) Make a feature private.
Definition at line 1256 of file modules.c.
References wl_keyword::combined_name, wl_keyword::definition, deref_ptr, hash_lookup(), wl_definition::keyword, wl_keyword::private_feature, wl_keyword::public, wl_keyword::symbol, wl_module::symbol_table, TRUE, wl_psi_term::type, update_symbol(), and warningline().
psi_term make_life_form | ( | ptr_psi_term | tok, |
ptr_psi_term | arg1, | ||
ptr_psi_term | arg2 | ||
) |
make_life_form
tok | - ptr_psi_term tok |
arg1 | - ptr_psi_term arg1 |
arg2 | - ptr_psi_term arg2 |
MAKE_LIFE_FORM(tok,arg1,arg2) This routine inserts ARG1 and ARG2 as the first and second attributes of psi_term TOK, thus creating the term TOK(1=>arg1,2=>arg2).
If TOK is ':' then a conjunction is created if necessary. Example: a:V:b:5:long => V: <a,b,5,int> (= conjunction list).
Definition at line 571 of file parser.c.
References wl_psi_term::attr_list, wl_psi_term::coref, deref_ptr, equ_tokch, error_psi_term, FEATCMP, heap_alloc(), integer, minus_symbol, NULL, one, push_psi_ptr_value(), REAL, real, wl_psi_term::resid, stack_copy_psi_term(), stack_insert(), Syntaxerrorline(), top, two, wl_psi_term::type, and wl_psi_term::value_3.
char * make_module_token | ( | ptr_module | module, |
char * | str | ||
) |
make_module_token
module | - ptr_module module |
str | - char *str |
MAKE_MODULE_TOKEN(module,string) Write 'module::string' in module_buffer. If string is a qualified reference to a given module, then modify the calling module variable to reflect this.
The result must be immediately stored in a newly allocated string.
Definition at line 191 of file modules.c.
References extract_module_from_name(), module_buffer, and wl_module::module_name.
long make_public | ( | ptr_psi_term | term, |
long | bool | ||
) |
make_public
term | - ptr_psi_term term |
bool | - long bool |
MAKE_PUBLIC(term,bool) Make a term public.
Definition at line 613 of file modules.c.
References wl_keyword::combined_name, wl_keyword::definition, deref_ptr, hash_lookup(), wl_definition::keyword, wl_keyword::module, new_definition(), wl_keyword::public, wl_keyword::symbol, wl_module::symbol_table, TRUE, wl_psi_term::type, update_symbol(), and warningline().
void make_sys_type_links | ( | ) |
make_sys_type_links
INITIALIZATION FUNCTIONS
Definition at line 2168 of file sys.c.
References built_in, make_type_link(), sys_bitvector, sys_bytedata, sys_file_stream, sys_regexp, sys_socket_stream, and sys_stream.
void make_type_link | ( | ptr_definition | t1, |
ptr_definition | t2 | ||
) |
make_type_link
t1 | - ptr_definition t1 |
t2 | - ptr_definition t2 |
MAKE_TYPE_LINK(t1,t2) Assert that T1 <| T2, this is used to initialise the built_in type relations so that nothing really horrible happens if the user modifies built-in types such as INT or LIST. This routine also makes sure that top has no links.
Definition at line 901 of file types.c.
References wl_definition::children, cons(), wl_definition::parents, top, and type_member().
ptr_goal makeGoal | ( | ptr_psi_term | p | ) |
makeGoal
p | - ptr_psi_term p |
Definition at line 646 of file bi_sys.c.
References DEFRULES, goal_stack, wl_goal::next, NULL, prove, and push_goal().
ptr_psi_term makePsiList | ( | GENERIC | head, |
ptr_psi_term(*)() | valueFunc, | ||
GENERIC(*)() | nextFunc | ||
) |
makePsiList
head | - GENERIC head |
*valueFunc | - ptr_psi_term (*valueFunc)() |
nextFunc | - GENERIC (*nextFunc)() |
Definition at line 590 of file bi_sys.c.
References stack_cons(), and stack_nil().
ptr_psi_term makePsiTerm | ( | ptr_definition | x | ) |
ptr_psi_term makePsiTerm
x | - ptr_definition x |
Definition at line 573 of file bi_sys.c.
References stack_psi_term(), and wl_psi_term::type.
void mark_ancestors | ( | ptr_definition | def, |
long * | flags | ||
) |
mark_ancestors
def | - ptr_definition def |
flags | - long *flags |
Set flags bit for all ancestors (i.e., higher up) of head
Definition at line 60 of file lub.c.
References bit_length(), wl_definition::code, wl_int_list::next, wl_definition::parents, and wl_int_list::value_1.
void mark_eval | ( | ptr_psi_term | t | ) |
mark_eval
t | - ptr_psi_term t |
A (possibly) correct mark_eval and its companion mark_quote.
The translation table is used to record whether a subgraph has already been quoted or not. Mark a psi-term as to be evaluated (i.e. strict), except for arguments of a nonstrict term, which are marked quoted. Set status correctly and propagate zero status upwards. Avoid doing superfluous work: non-shared terms are traversed once; shared terms are traversed at most twice (this only occurs if the first occurrence encountered is strict and a later occurrence is nonstrict). The translation table is used to indicate (1) whether a term has already been traversed, and if so, (2) whether there was a nonstrict traversal (in that case, the info field is FALSE).
Definition at line 498 of file copy.c.
References clear_copy(), FALSE, mark_eval_new(), and mark_nonstrict_flag.
void mark_eval_new | ( | ptr_psi_term | t | ) |
mark_eval_new
t | - ptr_psi_term t |
Definition at line 540 of file copy.c.
References wl_psi_term::attr_list, curr_status, deref_ptr, wl_definition::evaluate_args, FALSE, wl_psi_term::flags, function_it, global_it, insert_translation(), mark_eval_tree_new(), mark_nonstrict_flag, mark_quote_new(), mark_quote_tree_new(), wl_definition::properties, QUOTED_TRUE, wl_psi_term::status, translate(), TRUE, wl_psi_term::type, wl_definition::type_def, and type_it.
void mark_eval_tree_new | ( | ptr_node | n | ) |
mark_eval_tree_new
n | - ptr_node n |
Definition at line 611 of file copy.c.
References wl_node::data, wl_node::left, mark_eval_new(), mark_eval_tree_new(), and wl_node::right.
void mark_nonstrict | ( | ptr_psi_term | t | ) |
mark_nonstrict
t | - ptr_psi_term t |
Same as above, except that the status is only changed from 0 to 4 when needed; it is never changed from 4 to 0.
Definition at line 513 of file copy.c.
References clear_copy(), mark_eval_new(), mark_nonstrict_flag, and TRUE.
void mark_quote | ( | ptr_psi_term | t | ) |
mark_quote
t | - ptr_psi_term t |
A more efficient version of mark_quote This version avoids using the translation table by setting a 'visited' in the status field. Mark a psi-term as completely evaluated.
Definition at line 674 of file copy.c.
References wl_psi_term::attr_list, wl_psi_term::coref, wl_psi_term::flags, mark_quote(), mark_quote_tree(), QUOTED_TRUE, RMASK, and wl_psi_term::status.
void mark_quote_c | ( | ptr_psi_term | t, |
long | heap_flag | ||
) |
mark_quote_c
t | - ptr_psi_term t |
heap_flag | - long heap_flag |
The new mark_quote to be used from copy.
Meaning of the info field in the translation table: With u=translate(t,&infoptr): If infoptr==QUOTE_FLAG then the whole subgraph from u is quoted. If infoptr==EVAL_FLAG then anything is possible. If infoptr==QUOTE_STUB then the term does not exist yet, e.g., there is a cycle in the term & copy(...) has not created it yet, for example X:s(L,t(X),R), where non_strict(t), in which R does not exist when the call to mark_quote_c is done. When the term is later created, it must be created as quoted.
Mark a psi-term u (which is a copy of t) as completely evaluated. Only t is given as the argument. Assumes the psi-term is a copy of another psi-term t, which is made through eval_copy. Therefore the copy is accessible through the translation table. Assumes all translation table entries already exist. The infoptr field is updated so that each subgraph is only traversed once. This routine is called only from the main copy routine.
Definition at line 434 of file copy.c.
References wl_psi_term::attr_list, deref_ptr, EVAL_FLAG, wl_psi_term::flags, insert_translation(), mark_quote_tree_c(), NEW, QUOTE_FLAG, QUOTE_STUB, QUOTED_TRUE, wl_psi_term::status, and translate().
void mark_quote_new | ( | ptr_psi_term | t | ) |
mark_quote_new
t | - ptr_psi_term t |
Definition at line 626 of file copy.c.
References wl_psi_term::attr_list, deref_ptr, FALSE, wl_psi_term::flags, insert_translation(), mark_quote_tree_new(), QUOTED_TRUE, wl_psi_term::status, translate(), and TRUE.
void mark_quote_new2 | ( | ptr_psi_term | t | ) |
mark_quote_new2
t | - ptr_psi_term t |
Mark a term as quoted.
Definition at line 527 of file copy.c.
References clear_copy(), FALSE, mark_nonstrict_flag, and mark_quote_new().
void mark_quote_tree | ( | ptr_node | t | ) |
mark_quote_tree
t | - ptr_node t |
Definition at line 692 of file copy.c.
References wl_node::data, wl_node::left, mark_quote(), mark_quote_tree(), and wl_node::right.
void mark_quote_tree_c | ( | ptr_node | n, |
long | heap_flag | ||
) |
mark_quote_tree_c
n | - ptr_node n |
heap_flag | - long heap_flag |
Definition at line 467 of file copy.c.
References wl_node::data, wl_node::left, mark_quote_c(), mark_quote_tree_c(), and wl_node::right.
void mark_quote_tree_new | ( | ptr_node | n | ) |
mark_quote_tree_new
void mark_quote_tree_new(ptr_node n)
n | - ptr_node n |
Definition at line 653 of file copy.c.
References wl_node::data, wl_node::left, mark_quote_new(), mark_quote_tree_new(), and wl_node::right.
void mark_tab | ( | ptr_tab_brk | t | ) |
mark_tab
t | - ptr_tab_brk t |
MARK_TAB(t) Mark a tabbing position T. Make the current item point to tabbing position T.
Definition at line 573 of file print.c.
References end_tab(), indx, and wl_item::tab.
long match_aim | ( | ) |
match_aim
long match_aim() MATCH_AIM() This is very similar to UNIFY_AIM, only matching cannot modify the calling psi_term. The first argument is the calling term (which may not be changed) and the second argument is the function definition (which may be changed). Residuate the expression if the calling term is more general than the function definition.
Definition at line 770 of file lefun.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, attr_missing, wl_goal::bbbb_1, can_curry, wl_goal::cccc_1, wl_psi_term::coref, curried, cut, deref_ptr, FALSE, FUNC_ARG, integer, match_attr(), matches(), NULL, overlap_type(), quoted_string, REAL, real, resid_aim, residuate_double(), restore_resid(), save_resid(), sys_bytedata, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
void match_attr | ( | ptr_node * | u, |
ptr_node | v, | ||
ptr_resid_block | rb | ||
) |
match_attr
u | - ptr_node *u |
v | - ptr_node v |
rb | - ptr_resid_block rb |
MATCH_ATTR(u,v) Match the attribute trees of psi_terms U and V. If V has an attribute that U doesn't then curry. U is the calling term, V is the definition. This routine is careful to push nested eval and match goals in descending order of feature names.
Definition at line 752 of file lefun.c.
References match_attr1(), match_attr2(), and match_attr3().
void match_attr1 | ( | ptr_node * | u, |
ptr_node | v, | ||
ptr_resid_block | rb | ||
) |
void match_attr1
u | - ptr_node *u |
v | - ptr_node v |
rb | - ptr_resid_block rb |
Match the corresponding arguments
Definition at line 599 of file lefun.c.
References attr_missing, wl_node::data, featcmp(), wl_node::key, wl_node::left, match, NULL, push_goal(), wl_node::right, and TRUE.
void match_attr2 | ( | ptr_node * | u, |
ptr_node | v, | ||
ptr_resid_block | rb | ||
) |
match_attr2
u | - ptr_node *u |
v | - ptr_node v |
rb | - ptr_resid_block rb |
Evaluate the lone arguments (for lazy failure + eager success)
Definition at line 644 of file lefun.c.
References wl_node::data, deref2_rec_eval(), featcmp(), wl_node::key, wl_node::left, match_attr1(), NULL, and wl_node::right.
void match_attr3 | ( | ptr_node * | u, |
ptr_node | v, | ||
ptr_resid_block | rb | ||
) |
match_attr3
u | - ptr_node *u |
v | - ptr_node v |
rb | - ptr_resid_block rb |
Evaluate the corresponding arguments
Definition at line 700 of file lefun.c.
References attr_missing, wl_node::data, deref2_eval(), featcmp(), wl_node::key, wl_node::left, NULL, wl_node::right, and TRUE.
long matches | ( | ptr_definition | t1, |
ptr_definition | t2, | ||
long * | smaller | ||
) |
matches
t1 | - ptr_definition t1 |
t2 | - ptr_definition t2 |
smaller | - long *smaller |
MATCHES(t1,t2,s) Returns TRUE if GLB(t1,t2)!=bottom. Sets S to TRUE if type T1 is <| than type T2, that is if T1 matches T2.
Definition at line 1666 of file types.c.
References wl_definition::code, FALSE, wl_int_list::next, NOT_CODED, top, TRUE, and wl_int_list::value_1.
long memory_check | ( | ) |
memory_check
MEMORY_CHECK() This function tests to see whether enough memory is available to allow execution to continue. It causes a garbage collection if not, and if that fails to release enough memory it returns FALSE.
Definition at line 1723 of file memory.c.
References fail_all(), FALSE, garbage(), GC_THRESHOLD, heap_pointer, stack_pointer, TRUE, and verbose.
merge
u | - ptr_node *u |
v | - ptr_node v |
MERGE(u,v) U and V are two binary trees containing the attributes fields of psi-terms. U and V are merged together, that is U becomes the union of U and V: For each label L in V and L->Vpsi_term: If L is in U Then With L->Upsi_term Do unify(Upsi_term,Vpsi_term) Else merge L->Vpsi_term in U. Unification is simply done by appending the 2 psi_terms to the unification stack. All effects must be recorded in the trail so that they can be undone on backtracking.
Definition at line 1131 of file login.c.
References merge1(), merge2(), and merge3().
merge1
u | - ptr_node *u |
v | - ptr_node v |
Unify the corresponding arguments
Definition at line 893 of file login.c.
References wl_node::data, featcmp(), wl_node::key, wl_node::left, NULL, push_goal(), wl_node::right, and unify.
merge2
u | - ptr_node *u |
v | - ptr_node v |
Evaluate the lone arguments (For LAZY failure + EAGER success) Evaluate low numbered lone arguments first. For each lone argument in either u or v, create a new psi-term to put the (useless) result: This is needed so that all arguments of a uni- unified psi-term are evaluated, which avoids incorrect 'Yes' answers.
Definition at line 949 of file login.c.
References wl_node::data, deref2_rec_eval(), featcmp(), wl_node::key, wl_node::left, NULL, and wl_node::right.
merge3
u | - ptr_node *u |
v | - ptr_node v |
Merge v's loners into u and evaluate the corresponding arguments
Definition at line 1004 of file login.c.
References deref2_eval(), featcmp(), int_ptr, wl_node::key, wl_node::left, more_u_attr, more_v_attr, NULL, push_ptr_value(), wl_node::right, STACK_ALLOC, and TRUE.
long mod_warning | ( | ptr_psi_term | arg, |
REAL | val, | ||
int | zero | ||
) |
mod_warning
arg | - ptr_psi_term arg |
val | - REAL val |
zero | - int zero |
Definition at line 1041 of file error.c.
References Errorline(), nonint_warning(), and TRUE.
void new_built_in | ( | ptr_module | m, |
char * | s, | ||
def_type | t, | ||
long(*)() | r | ||
) |
new_built_in
m | - ptr_module m |
s | - char *s |
t | - def_type t |
r | - long (*r)() |
NEW_BUILT_IN(m,s,t,r) Add a new built-in predicate or function. Used also in x_pred.c
M=module. S=string. T=type (function or predicate). R=address of C routine to call.
Definition at line 5375 of file built_ins.c.
References built_in_index, c_rule, current_module, MAX_BUILT_INS, wl_definition::rule, set_current_module(), wl_definition::type_def, and update_symbol().
ptr_definition new_definition | ( | ptr_keyword | key | ) |
new_definition
key | - ptr_keyword key |
NEW_DEFINITION(key) Create a definition for a key.
Definition at line 220 of file modules.c.
References wl_definition::already_loaded, wl_definition::always_check, wl_definition::children, wl_definition::code, wl_definition::date, wl_keyword::definition, wl_definition::evaluate_args, FALSE, first_definition, wl_definition::global_value, HEAP_ALLOC, wl_definition::init_value, wl_definition::keyword, wl_definition::next, NOT_CODED, NULL, wl_definition::op_data, wl_definition::parents, wl_definition::properties, wl_definition::protected, wl_definition::rule, TRUE, wl_definition::type_def, and undef_it.
ptr_psi_term new_psi_term | ( | long | numargs, |
ptr_definition | typ, | ||
ptr_psi_term ** | a1, | ||
ptr_psi_term ** | a2 | ||
) |
new_psi_term
numargs | - long numargs |
typ | - ptr_definition typ |
a1 | - ptr_psi_term **a1 |
a2 | - ptr_psi_term **a2 |
Return a psi term with one or two args, and the addresses of the args
Definition at line 5064 of file built_ins.c.
References wl_psi_term::attr_list, wl_node::data, wl_node::key, wl_node::left, NULL, one, wl_node::right, STACK_ALLOC, stack_psi_term(), two, and wl_psi_term::type.
void new_state | ( | ptr_psi_term * | t | ) |
new_state
t | - ptr_psi_term *t |
Create a new file state psi-term that reflects the current global state
Definition at line 372 of file token.c.
References current_module, CURRENT_MODULE, eof_flag, EOF_FLAG, heap_add_int_attr(), heap_add_psi_attr(), heap_add_str_attr(), heap_psi_term(), INPUT_FILE_NAME, input_file_name, input_stream, inputfilesym, lf_false, lf_true, LINE_COUNT, line_count, wl_module::module_name, null_psi_term, old_saved_char, OLD_SAVED_CHAR, old_saved_psi_term, OLD_SAVED_PSI_TERM, saved_char, SAVED_CHAR, saved_psi_term, SAVED_PSI_TERM, start_of_line, START_OF_LINE, stream, STREAM, wl_psi_term::type, and wl_psi_term::value_3.
void new_step | ( | long | newstep | ) |
void new_tab | ( | ptr_tab_brk * | t | ) |
new_tab
t | - ptr_tab_brk *t |
NEW_TAB(t) Create a new tabulation mark T.
Definition at line 587 of file print.c.
References FALSE, and HEAP_ALLOC.
void new_trace | ( | long | newtrace | ) |
long no_choices | ( | ) |
no_choices
Return TRUE iff the top choice point is a what_next choice point or if there are no choice points.
Definition at line 1945 of file login.c.
References choice_stack, wl_choice_point::goal_stack, NULL, wl_goal::type, and what_next.
long no_quote | ( | char * | s | ) |
long nonint_warning | ( | ptr_psi_term | arg, |
REAL | val, | ||
char * | msg | ||
) |
nonint_warning
arg | - ptr_psi_term arg |
val | - REAL val |
msg | - char *msg |
Definition at line 974 of file error.c.
References FALSE, report_warning2(), and TRUE.
void nonnum_warning | ( | ptr_psi_term | t, |
ptr_psi_term | arg1, | ||
ptr_psi_term | arg2 | ||
) |
nonnum_warning
t | - ptr_psi_term t |
arg1 | - ptr_psi_term arg1 |
arg2 | - ptr_psi_term arg2 |
Give error message if there is an argument which cannot unify with/ a real number.
Definition at line 953 of file error.c.
References curried, overlap_type(), real, report_warning(), and wl_psi_term::type.
long num_choices | ( | ) |
num_choices
Return the number of choice points on the choice point stack
Definition at line 1956 of file login.c.
References choice_stack, and wl_choice_point::next.
long num_vars | ( | ptr_node | vt | ) |
num_vars
vt | - ptr_node vt |
Return the number of variables in the variable tree.
Definition at line 1976 of file login.c.
References wl_node::left, and wl_node::right.
ptr_node one_attr | ( | ) |
one_attr
Return an attr_list with one argument
Definition at line 5042 of file built_ins.c.
References wl_node::data, wl_node::key, wl_node::left, NULL, one, wl_node::right, and STACK_ALLOC.
void one_pass_always_check | ( | long * | ch | ) |
one_pass_always_check
ch | - long *ch ONE_PASS_ALWAYS_CHECK(ch)Go through the symbol table & propagate all FALSE always_check flags of all sorts to their children. Return a TRUE flag if a change was made somewhere (for the closure calculation). |
Definition at line 1049 of file types.c.
References wl_definition::always_check, first_definition, wl_definition::next, propagate_always_check(), wl_definition::type_def, and type_it.
long only_arg1 | ( | ptr_psi_term | t, |
ptr_psi_term * | arg1 | ||
) |
only_arg1
t | - ptr_psi_term t |
arg1 | - ptr_psi_term * arg1 |
Return TRUE iff t has only argument "1", and return the argument.
Definition at line 1605 of file built_ins.c.
References wl_psi_term::attr_list, wl_node::data, FALSE, featcmp(), wl_node::key, wl_node::left, NULL, one, wl_node::right, and TRUE.
long opcheck | ( | ptr_psi_term | t, |
long * | prec, | ||
long * | type | ||
) |
opcheck
t | - ptr_psi_term t |
prec | - long *prec |
type | - long *type) |
Get information about an operator. If t is an operator with the correct arguments, return one of {INFIX, PREFIX, POSTFIX} and also its precedence and type. If t is not an operator, or it has wrong arguments, return NOTOP and prec=0.
Definition at line 913 of file print.c.
References wl_psi_term::attr_list, check_opargs(), fx, fy, INFIX, wl_operator_data::next, NOTOP, NULL, wl_definition::op_data, POSTFIX, wl_operator_data::precedence, PREFIX, wl_psi_term::type, xf, xfx, xfy, yf, and yfx.
long open_input_file | ( | char * | file | ) |
open_input_file
file | - char *file |
OPEN_INPUT_FILE(file) Open the input file specified by the string FILE. If the file is "stdin", restore the stdin state. Otherwise, open the file and create a new global state for it. If the file can't be opened, print an error and open "stdin" instead.
Definition at line 594 of file token.c.
References Errorline(), expand_file_name(), FALSE, init_parse_state(), input_file_name, input_state, input_stream, new_state(), noisy, NULL, restore_state(), save_state(), stdin_state, and TRUE.
void open_module_one | ( | ptr_psi_term | t, |
int * | onefailed | ||
) |
open_module_one
t | = ptr_psi_term t |
onefailed | - int *onefailed |
Definition at line 562 of file modules.c.
References wl_keyword::combined_name, wl_keyword::definition, Errorline(), FALSE, find_module(), hash_lookup(), HEAP_ALLOC, wl_int_list::next, wl_module::open_modules, wl_keyword::public, string_val(), wl_keyword::symbol, wl_module::symbol_table, TRUE, and wl_int_list::value_1.
void open_module_tree | ( | ptr_node | n, |
int * | onefailed | ||
) |
open_module_tree
n | - ptr_node n |
onefailed | - int *onefailed |
Definition at line 542 of file modules.c.
References wl_node::data, wl_node::left, open_module_one(), and wl_node::right.
long open_output_file | ( | char * | file | ) |
void or_codes | ( | ptr_int_list | u, |
ptr_int_list | v | ||
) |
or_codes
u | - ptr_int_list u |
v | - ptr_int_list v |
OR_CODES(code1,code2) Performs CODE1 := CODE1 or CODE2, 'or' being the binary logical operator on bits.
Definition at line 831 of file types.c.
References HEAP_ALLOC, wl_int_list::next, NULL, and wl_int_list::value_1.
void outputline | ( | char * | format, |
... | |||
) |
void outputline(char *format,...)
outputline
format | - char *format |
... |
Definition at line 101 of file error.c.
References assert, display_psi(), FALSE, input_file_name, output_stream, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.
long overlap_type | ( | ptr_definition | t1, |
ptr_definition | t2 | ||
) |
overlap_type
t1 | - ptr_definition t1 |
t2 | - ptr_definition t2 |
OVERLAP_TYPE(t1,t2) This function returns TRUE if GLB(t1,t2)!=bottom. This is essentially the same thing as GLB, only it's faster 'cause we don't care about the resulting code.
Definition at line 1579 of file types.c.
References wl_definition::code, FALSE, wl_int_list::next, NOT_CODED, top, TRUE, and wl_int_list::value_1.
psi_term parse | ( | long * | q | ) |
parse
q | - long *q |
PARSE(is_it_a_clause) This returns one clause or query from the input stream. It also indicates the type psi-term read, that is whether it was a clause or a query in the IS_IT_A_CLAUSE variable. This is the top level of the parser.
The whole parser is, rather like the psi_termiser, not too well written. It handles psi_terms rather than pointers which causes a lot of messy code and is somewhat slower.
Definition at line 907 of file parser.c.
References eof, EOLN, ERROR, FACT, FALSE, final_dot, final_question, mark_nonstrict(), NULL, parse_ok, parser_stack_index, prompt, put_back_char(), QUERY, read_char(), read_life_form(), read_token(), saved_char, saved_psi_term, stringparse, Syntaxerrorline(), TRUE, and wl_psi_term::type.
psi_term parse_list | ( | ptr_definition | typ, |
char | e, | ||
char | s | ||
) |
parse_list
typ | - ptr_definition typ |
e | - char e |
s | - char s |
PARSE_LIST(type,end,separator)
This function provides a replacement for the function 'read_list'. It does not create the old (slightly more compact and a lot more complicated) list structure, but instead creates a generic psi-term with 2 features. The list is terminated by the atom 'nil'.
Example:
[a,b,c|d] -> cons(a,cons(b,cons(c,d))). [] -> nil {a;b;c} -> disj(a,disj(b,disj(c,{}))). {} -> {} = bottom
Example: TYP=disjunction, END="}", SEPARATOR=";" will read in disjunctions.
Example: TYP=list, END="]", SEPARATOR="," will read lists such as [1,2,a,b,c|d]
Definition at line 329 of file parser.c.
References wl_psi_term::attr_list, display_psi_stderr(), equ_tokc, equ_tokch, FALSE, FEATCMP, list_nil(), NULL, one, parse_ok, perr(), psi_term_error(), put_back_token(), read_life_form(), read_token(), stack_copy_psi_term(), stack_insert(), stringparse, two, and wl_psi_term::type.
void pchoices | ( | ) |
pchoices
for debugging
Definition at line 94 of file memory.c.
References choice_stack, wl_choice_point::next, stack_pointer, and wl_choice_point::stack_top.
void perr | ( | char * | str | ) |
void perr_i | ( | char * | str, |
long | i | ||
) |
void perr_s | ( | char * | s1, |
char * | s2 | ||
) |
void perr_s2 | ( | char * | s1, |
char * | s2, | ||
char * | s3 | ||
) |
void perr_sort | ( | ptr_definition | d | ) |
perr_sort
d | - ptr_definition d |
Definition at line 933 of file types.c.
References wl_definition::keyword, perr_s(), and wl_keyword::symbol.
void perr_sort_cycle | ( | ptr_int_list | anc | ) |
perr_sort_cycle
anc | - ptr_int_list anc |
Definition at line 959 of file types.c.
References perr(), perr_sort(), perr_sort_list(), and wl_int_list::value_1.
void perr_sort_list | ( | ptr_int_list | anc | ) |
perr_sort_list
anc | - ptr_int_list anc |
Definition at line 944 of file types.c.
References wl_int_list::next, perr(), perr_sort(), and wl_int_list::value_1.
void persistent_error_check | ( | ptr_node | n, |
int * | error | ||
) |
persistent_error_check
n | - ptr_node n |
error | - int *error |
Definition at line 2714 of file built_ins.c.
References wl_node::data, deref_ptr, error_psi_term, Errorline(), global_it, wl_node::left, persistent_error_check(), wl_node::right, TRUE, wl_psi_term::type, wl_definition::type_def, and undef_it.
void persistent_one | ( | ptr_psi_term | t | ) |
persistent_one
t | - ptr_psi_term t |
Definition at line 2759 of file built_ins.c.
References global_it, wl_definition::global_value, heap_pointer, heap_psi_term(), wl_psi_term::type, and wl_definition::type_def.
void persistent_tree | ( | ptr_node | n | ) |
persistent_tree
n | - ptr_node n |
Definition at line 2739 of file built_ins.c.
References wl_node::data, deref_ptr, wl_node::left, persistent_one(), persistent_tree(), and wl_node::right.
long pop | ( | ptr_psi_term | tok, |
long * | op | ||
) |
pop
tok | - ptr_psi_term tok |
op | - long *op |
POP(psi_term,op); This function pops PSI_TERM and OP off the parser stack and returns its precedence.
Definition at line 132 of file parser.c.
References error_psi_term, FALSE, int_stack, parse_ok, parser_stack_index, and psi_term_stack.
long precedence | ( | psi_term | tok, |
long | typ | ||
) |
precedence
tok | - psi_term tok |
typ | - long typ |
PRECEDENCE(tok,typ) This function returns the precedence of TOK if it is an operator of type TYP where TYP is FX XFX XF etc... Note that this allows both a binary and unary minus. The result is NOP if tok is not an operator.
Definition at line 180 of file parser.c.
References wl_operator_data::next, NOP, wl_definition::op_data, wl_operator_data::precedence, and wl_psi_term::type.
long pred_clause | ( | ptr_psi_term | t, |
long | r, | ||
ptr_psi_term | g | ||
) |
pred_clause
t | - ptr_psi_term t |
r | - long r |
g | - ptr_psi_term g |
PRED_CLAUSE(ptr_psi_term t,long r,ptr_psi_term g) Set about finding a clause that unifies with psi_term T. This routine is used both for CLAUSE and RETRACT. If R==TRUE then delete the first clause which unifies with T.
Definition at line 2451 of file built_ins.c.
References wl_psi_term::attr_list, bk_mark_quote(), clause, del_clause, deref_ptr, Errorline(), FALSE, function_it, get_two_args(), wl_definition::keyword, predicate_it, push_goal(), redefine(), wl_definition::rule, stack_psi_term(), succeed, wl_keyword::symbol, TRUE, wl_psi_term::type, wl_definition::type_def, and undef_it.
void pred_write | ( | ptr_node | n | ) |
pred_write
n | - ptr_node n |
PRED_WRITE(n) N is an attribute tree to be printed in one lump. This is called by WRITE.
For all write builtins I.e: write, writeq, pretty_write, pretty_writeq, write_err, writeq_err.
Definition at line 1469 of file print.c.
References FALSE, listing_flag, main_pred_write(), outfile, output_stream, and write_stderr.
void pretty_attr | ( | ptr_node | t, |
long | depth | ||
) |
pretty_attr
t | - ptr_node t |
depth | - long depth |
PRETTY_ATTR(t,depth) Pretty print the attributes. This calls DO_PRETTY_ATTR which does the real work.
Definition at line 1273 of file print.c.
References do_pretty_attr(), new_tab(), prettyf(), and two_or_more().
void pretty_list | ( | ptr_psi_term | t, |
long | depth | ||
) |
pretty_list
t | - ptr_psi_term t |
depth | - long depth |
PRETTY_LIST(t,depth) Pretty print a list. On entry we know that T is a legal CONS pair, so we can immediately print the opening bracket etc...
Definition at line 734 of file print.c.
References alist, wl_psi_term::attr_list, check_legal_cons(), COMMA_PREC, wl_node::data, deref_ptr, disj_nil, disjunction, DOTDOT, equal_types, FALSE, find(), get_two_args(), INTCMP, wl_definition::keyword, mark_tab(), MAX_PRECEDENCE, new_tab(), nil, overlap_type(), pointer_names, pretty_symbol(), pretty_tag_or_psi_term(), prettyf(), print_depth, TRUE, and wl_psi_term::type.
void pretty_output | ( | ) |
pretty_output
PRETTY_OUTPUT() Final output of all these pretty things which have been built up.
Definition at line 1293 of file print.c.
References wl_tab_brk::broken, wl_tab_brk::column, indx, outfile, wl_tab_brk::printed, wl_item::str, wl_item::tab, and TRUE.
void pretty_psi_term | ( | ptr_psi_term | t, |
long | sprec, | ||
long | depth | ||
) |
pretty_psi_term
t | - ptr_psi_term t |
sprec | - long sprec |
depth | - long depth |
PRETTY_PSI_TERM(t,sprec,depth) Pretty print a psi_term T with sugar for lists.
Definition at line 1058 of file print.c.
References wl_goal::aaaa_1, alist, wl_psi_term::attr_list, check_legal_cons(), cut, deref_ptr, disj_nil, disjunction, display_persistent, DOTDOT, eof, equal_types, FALSE, wl_residuation::goal, heap_pointer, integer, wl_definition::keyword, wl_residuation::next, nil, wl_goal::pending, pretty_attr(), pretty_list(), pretty_psi_with_ops(), pretty_quote_symbol(), pretty_symbol(), prettyf(), prettyf_quoted_string(), print_depth, PRINT_POWER, PRINT_SPLIT, quoted_string, REAL, real, wl_psi_term::resid, seg_format, stream, STRLEN, sub_type(), sys_bytedata, wl_psi_term::type, wl_psi_term::value_3, WL_MAXINT, and write_canon.
long pretty_psi_with_ops | ( | ptr_psi_term | t, |
long | sprec, | ||
long | depth | ||
) |
pretty_psi_with_ops
t | - ptr_psi_term t |
sprec | - long sprec |
depth | - long depth |
Write an expression with its operators. Return TRUE iff the arguments of t are written here (i.e. t was indeed a valid operator, and is therefore taken care of here).
Definition at line 949 of file print.c.
References wl_psi_term::attr_list, deref_ptr, FALSE, func_flag, fx, fy, get_two_args(), INFIX, wl_definition::keyword, listing_flag, MAX_PRECEDENCE, opcheck(), POSTFIX, PREFIX, pretty_quote_symbol(), pretty_tag_or_psi_term(), prettyf(), wl_keyword::symbol, TRUE, wl_psi_term::type, write_canon, xf, xfx, xfy, yf, and yfx.
void pretty_quote_symbol | ( | ptr_keyword | k | ) |
pretty_quote_symbol
k | - ptr_keyword k |
PRETTY_QUOTE_SYMBOL(k) Prints the string to be used to display keyword K, with quotes if required.
Definition at line 470 of file modules.c.
References wl_keyword::definition, display_modules, wl_definition::keyword, wl_keyword::module, wl_module::module_name, prettyf(), prettyf_quote(), and wl_keyword::symbol.
void pretty_symbol | ( | ptr_keyword | k | ) |
pretty_symbol
k | - ptr_keyword k |
PRETTY_SYMBOL(k) Prints the string to be used to display keyword K.
Definition at line 452 of file modules.c.
References wl_keyword::definition, display_modules, wl_definition::keyword, wl_keyword::module, wl_module::module_name, prettyf(), and wl_keyword::symbol.
void pretty_tag_or_psi_term | ( | ptr_psi_term | p, |
long | sprec, | ||
long | depth | ||
) |
pretty_tag_or_psi_term
p | - ptr_psi_term p |
sprec | - long sprec |
depth | - long depth |
PRETTY_TAG_OR_PSI_TERM(p,depth) Print a psi-term, but first precede it with the appropriate TAG. Don't reprint the same psi-term twice.
Definition at line 834 of file print.c.
References COLON_PREC, wl_node::data, deref_ptr, DOTDOT, FALSE, find(), heap_insert(), INTCMP, is_top, no_name, NULL, pointer_names, pretty_psi_term(), prettyf(), printed_pointers, and unique_name().
void pretty_variables | ( | ptr_node | n, |
ptr_tab_brk | tab | ||
) |
pretty_variables
n | - ptr_node n |
tab | - ptr_tab_brk tab |
PRETTY_VARIABLES(n,tab) Pretty print the variables at position TAB.
Definition at line 1318 of file print.c.
References wl_node::data, deref_ptr, eqsym, find(), INTCMP, wl_node::key, wl_node::left, mark_tab(), MAX_PRECEDENCE, wl_definition::op_data, opcheck(), wl_operator_data::precedence, pretty_psi_term(), prettyf(), printed_pointers, and wl_node::right.
void prettyf | ( | char * | s | ) |
prettyf
s | - char *s |
PRETTYF(s) This prints the string S into the BUFFER.
Definition at line 496 of file print.c.
References FALSE, and prettyf_inner().
void prettyf_inner | ( | char * | s, |
long | q, | ||
char | c | ||
) |
prettyf_inner
s | - char *s |
q | - long q |
c | - char c the quote character |
PRINTING ROUTINES.
These routines allow the correct printing in minimal form of a set of possibly cyclic psi-terms with coreferences from one to another.
First the term to be printed is explored to locate any cyclic terms or coreferences. Then is printed into memory where is it formatted to fit within PAGE_WIDTH of the output page. Then it is effectively printed to the output stream.
Printing into memory involves the use of an array containing a TAB position on which to align things then a string to print. The routine WORK_OUT_LENGTH tries (by trial and error) to print the psi_term into PAGE_WIDTH columns by inserting line feeds whereever possible
Does the work of prettyf and prettyf_quote The q argument is a flag telling whether to quote or not.
Definition at line 374 of file print.c.
References buffer, indent, and outfile.
void prettyf_quote | ( | char * | s | ) |
prettyf_quote
s | - char *s |
PRETTYF_QUOTE(s) This prints the string S into the buffer. S is surrounded by quotes if: (1) const_quote==TRUE, and (2) S does not represent an integer, and (2) S contains a non-alphanumeric character or starts with a non-lowercase character, and (3) if S is longer than one character, it is not true that S has only non-SINGLE SYMBOL characters (in that case, S does not need quotes),and (4) if S has only one character, it is a single space or underscore. When S is surrounded by quotes, a quote inside S is printed as two quotes.
Definition at line 529 of file print.c.
References const_quote, no_quote(), and prettyf_inner().
void prettyf_quoted_string | ( | char * | s | ) |
prettyf_quoted_string
s | - char *s |
Definition at line 507 of file print.c.
References const_quote, and prettyf_inner().
void print_bin | ( | long | b | ) |
print_bin
b | - long b |
PRINT_BIN(b) Print the integer B under binary format (currently 26 is printed **-*-). This is used to print the binary codes used in type encryption.
Definition at line 147 of file print.c.
References INT_SIZE, and outfile.
void print_code | ( | FILE * | s, |
ptr_int_list | c | ||
) |
print_code
s | - FILE *s |
c | - ptr_int_list c |
PRINT_CODE(s,c) Print a binary code C to a stream s (as used in type encoding).
Definition at line 167 of file print.c.
References wl_int_list::next, NOT_CODED, outfile, print_bin(), and wl_int_list::value_1.
void print_codes | ( | ) |
print_codes
PRINT_CODES() Print all the codes.
Definition at line 1256 of file types.c.
References outputline(), and type_count.
void print_def_type | ( | def_type | t | ) |
print_def_type
t | - def_type t |
PRINT_DEF_TYPE(t) This prints type T to stderr, where T=predicate, function or type.
Definition at line 24 of file types.c.
References function_it, global_it, perr(), predicate_it, and type_it.
void print_gc_info | ( | long | timeflag | ) |
print_gc_info
timeflag | - long timeflag |
Definition at line 1493 of file memory.c.
References gc_time, heap_pointer, life_time, mem_base, mem_limit, mem_size, and stack_pointer.
void print_operator_kind | ( | FILE * | s, |
long | kind | ||
) |
print_operator_kind
s | - FILE *s |
kind | - long kind |
PRINT_OPERATOR_KIND(s,kind) Print the kind of an operator.
Definition at line 192 of file print.c.
References fx, fy, xf, xfx, xfy, yf, and yfx.
void print_resid_message | ( | ptr_psi_term | t, |
ptr_resid_list | r | ||
) |
print_resid_message
t | - ptr_psi_term t |
r | - ptr_resid_list r |
PRINT_RESID_MESSAGE This is called in trace mode to print the residuated goal along with the RV set.
Definition at line 1690 of file print.c.
References buffer, check_pointer(), const_quote, end_tab(), FALSE, gen_sym_counter, heap_pointer, indent, indx, insert_variables(), listing_flag, mark_tab(), MAX_PRECEDENCE, new_tab(), wl_resid_list::next, NULL, outfile, pointer_names, pretty_tag_or_psi_term(), pretty_things, prettyf(), printed_pointers, TRUE, wl_resid_list::var, var_tree, write_canon, and write_resids.
char * print_symbol | ( | ptr_keyword | k | ) |
print_symbol
OBSOLETE ptr_psi_term get_function_value(module,symbol)
ptr_module module; char *symbol;
{ ptr_node n; ptr_definition def; ptr_psi_term result=NULL; ptr_pair_list rule;
n=find(STRCMP,make_module_token(module,symbol),symbol_table); if(n) def=(ptr_definition)n->data; if(def && def->type==function) { rule=def->rule; while (rule && (!rule->aaaa_1 || !rule->bbbb_1)) rule=rule->next; if(rule) { result=(ptr_psi_term)rule->bbbb_1; deref_ptr(result); } } }
if(!result) Errorline("error in definition of '%s'\n",module_buffer);
return result; }
k | - ptr_keyword k |
PRINT_SYMBOL(k) Returns the string to be used to display keyword K.
Definition at line 435 of file modules.c.
References wl_keyword::combined_name, wl_keyword::definition, display_modules, wl_definition::keyword, and wl_keyword::symbol.
void print_undo_stack | ( | ) |
print_undo_stack
Definition at line 122 of file memory.c.
References wl_stack::aaaa_3, wl_stack::bbbb_3, mem_base, mem_limit, wl_stack::next, wl_stack::type, and undo_stack.
long print_variables | ( | long | printflag | ) |
print_variables
printflag | - long printflag |
PRINT_VARIABLES This prints all the query variables. Symbols generated to print one variable are coherent with those used in other variables. Returns TRUE iff the set of query variables is nonempty.
Definition at line 1368 of file print.c.
References buffer, const_quote, end_tab(), FALSE, forbid_variables(), gen_sym_counter, go_through_tree(), heap_pointer, indent, indx, insert_variables(), listing_flag, mark_tab(), new_tab(), NULL, outfile, output_stream, pointer_names, pretty_output(), pretty_things, pretty_variables(), prettyf(), printed_pointers, TRUE, var_tree, work_out_length(), write_canon, and write_resids.
void propagate_always_check | ( | ptr_definition | d, |
long * | ch | ||
) |
propagate_always_check
d | - ptr_definition d |
ch | - long *ch |
PROPAGATE_ALWAYS_CHECK(d,ch) Recursively set the always_check flag to 'FALSE' for all d's children. Continue until encountering only 'FALSE' values. Return a TRUE flag if a change was made somewhere (for the closure calculation).
Definition at line 1022 of file types.c.
References wl_definition::always_check, wl_definition::children, FALSE, wl_int_list::next, TRUE, and wl_int_list::value_1.
void propagate_definitions | ( | ) |
propagate_definitions
PROPAGATE_DEFINITIONS() This routine propagates the definition (attributes,predicates) of a type to all its sons.
Definition at line 662 of file types.c.
References adults, wl_definition::children, children, find_adults(), insert_own_prop(), insert_prop(), wl_int_list::next, NULL, wl_definition::properties, and wl_int_list::value_1.
long prove_aim | ( | ) |
prove_aim
PROVE_AIM() This is the proving routine. It performs one proof step, that is: finding the definition to use to prove AIM, and unifying the HEAD with the GOAL before proving. It all works by pushing sub-goals onto the goal_stack. Special cases are CUT and AND (","). Built-in predicates written in C are called.
Definition at line 1645 of file login.c.
References wl_goal::aaaa_1, wl_pair_list::aaaa_2, aim, and, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_pair_list::bbbb_2, boolpredsym, c_rule, call_handlersym, can_curry, choice_stack, clean_trail(), clear_copy(), wl_psi_term::coref, curried, cut, cut_to, wl_node::data, DEFRULES, deref_args, deref_ptr, do_currying(), do_residuation_user(), eval_copy(), FALSE, function_it, get_two_args(), goal_count, goal_stack, i_check_out(), i_eval_args(), wl_node::key, wl_node::left, lf_false, lf_true, life_or, MAX_BUILT_INS, merge(), wl_pair_list::next, wl_goal::next, NULL, one, predicate_it, wl_definition::protected, prove, push_choice_point(), push_goal(), push_psi_ptr_value(), quote_copy(), resid_aim, resid_vars, wl_node::right, wl_definition::rule, set_empty, STACK, stack_add_psi_attr(), STACK_ALLOC, stack_psi_term(), wl_psi_term::status, sub_type(), succeed, traceline(), tracesym, TRUE, wl_psi_term::type, wl_definition::type_def, type_it, undef_it, and wl_psi_term::value_3.
void psi_term_error | ( | ) |
psi_term_error
PSI_TERM_ERROR Print the line number at which the current psi_term started.
Definition at line 761 of file token.c.
References FALSE, input_file_name, parse_ok, perr_i(), perr_s(), and psi_term_line_number.
long psi_to_string | ( | ptr_psi_term | t, |
char ** | fn | ||
) |
psi_to_string
t | - ptr_psi_term t |
fn | - char ** fn |
PSI_TO_STRING(t,fn) Get the value of a Life string, or the name of a non-string psi-term. Return TRUE iff a valid string is found.
Definition at line 146 of file built_ins.c.
References equal_types, wl_definition::keyword, quoted_string, wl_keyword::symbol, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
void push | ( | psi_term | tok, |
long | prec, | ||
long | op | ||
) |
push
tok | - psi_term tok |
prec | - long prec |
op | - long op |
PUSH(tok,prec,op) Push psi_term and precedence and operator onto parser stack.
Definition at line 107 of file parser.c.
References int_stack, parser_stack_index, PARSER_STACK_SIZE, perr(), psi_term_error(), and psi_term_stack.
push2_ptr_value
t | - type_ptr t |
p | - GENERIC *p |
v | - GENERIC v |
PUSH2_PTR_VALUE(t,*p,v) Push the pair (P,V) onto the stack of things to be undone (trail). It needn't be done if P is greater than the latest choice point because in that case memory is reclaimed.
Definition at line 573 of file login.c.
References wl_stack::aaaa_3, wl_stack::bbbb_3, choice_stack, wl_stack::next, STACK_ALLOC, stack_pointer, wl_stack::type, and undo_stack.
void push_choice_point | ( | goals | t, |
ptr_psi_term | aaaa_6, | ||
ptr_psi_term | bbbb_6, | ||
GENERIC | cccc_6 | ||
) |
push_choice_point
t | - goals t |
aaaa_6 | ptr_psi_term aaaa_6 |
bbbb_6 | ptr_psi_term bbbb_6 |
cccc_6 | GENERIC cccc_6 |
PUSH_CHOICE_POINT(t,a,b,c) T,A,B,C is an alternative goal to try. T is the type of the goal: unify or prove.
If T=prove then a=goal to prove b=definition to use if b=DEFRULES then that means it's a first call.
If T=unify then a and b are the terms to unify.
etc...
Definition at line 638 of file login.c.
References wl_goal::aaaa_1, wl_goal::bbbb_1, wl_goal::cccc_1, choice_stack, FALSE, global_time_stamp, wl_choice_point::goal_stack, goal_stack, wl_goal::next, wl_choice_point::next, wl_goal::pending, STACK_ALLOC, stack_pointer, wl_choice_point::stack_top, wl_choice_point::time_stamp, wl_goal::type, wl_choice_point::undo_point, and undo_stack.
void push_def_ptr_value | ( | ptr_psi_term | q, |
GENERIC * | p | ||
) |
push_def_ptr_value
q | - ptr_psi_term q |
p | - GENERIC *p |
PUSH_DEF_PTR_VALUE(q,p) (9.6) Same as push_ptr_value, but only for psi-terms whose definition field is being modified. (If another field is modified, use push_ptr_value.) This routine implements the time-stamp technique of only trailing once between choice point creations, even on multiple bindings. q is address of psi-term, p is address of field inside psi-term that is modified. Both the definition and the time_stamp must be trailed.
Definition at line 416 of file login.c.
References wl_stack::aaaa_3, assert, wl_stack::bbbb_3, choice_stack, def_ptr, global_time_stamp, heap_pointer, int_ptr, wl_stack::next, push_ptr_value(), STACK_ALLOC, stack_pointer, trail_condition(), wl_stack::type, undo_stack, and VALID_ADDRESS.
void push_goal | ( | goals | t, |
ptr_psi_term | aaaa_5, | ||
ptr_psi_term | bbbb_5, | ||
GENERIC | cccc_5 | ||
) |
push_goal
t | - goals t |
aaaa_5 | ptr_psi_term aaaa_5 |
bbbb_5 | ptr_psi_term bbbb_5 |
cccc_5 | GENERIC cccc_5 |
PUSH_GOAL(t,a,b,c) Push a goal onto the goal stack. T is the type of the goal, A,B and C are various parameters. See PUSH_CHOICE_POINT(t,a,b,c).
Definition at line 600 of file login.c.
References wl_goal::aaaa_1, wl_goal::bbbb_1, wl_goal::cccc_1, FALSE, goal_stack, wl_goal::next, wl_goal::pending, STACK_ALLOC, and wl_goal::type.
void push_psi_ptr_value | ( | ptr_psi_term | q, |
GENERIC * | p | ||
) |
push_psi_ptr_value
q | - ptr_psi_term q |
p | - GENERIC *p |
PUSH_PSI_PTR_VALUE(q,p) (9.6) Same as push_ptr_value, but only for psi-terms whose coref field is being modified. (If another field is modified, use push_ptr_value.) This routine implements the time-stamp technique of only trailing once between choice point creations, even on multiple bindings. q is address of psi-term, p is address of field inside psi-term that is modified. Both the coref and the time_stamp must be trailed.
Definition at line 474 of file login.c.
References wl_stack::aaaa_3, assert, wl_stack::bbbb_3, choice_stack, global_time_stamp, int_ptr, wl_stack::next, psi_term_ptr, push_ptr_value(), STACK_ALLOC, stack_pointer, trail_condition(), wl_stack::type, undo_stack, and VALID_ADDRESS.
push_ptr_value
t | - type_ptr t |
p | - GENERIC *p |
PUSH_PTR_VALUE(t,*p) Push the pair (P,*P) onto the stack of things to be undone (trail). It needn't be done if P is greater than the latest choice point because in that case memory is reclaimed.
Definition at line 383 of file login.c.
References wl_stack::aaaa_3, assert, wl_stack::bbbb_3, choice_stack, heap_pointer, wl_stack::next, STACK_ALLOC, stack_pointer, wl_stack::type, undo_stack, and VALID_ADDRESS.
push_ptr_value_global
t | - type_ptr t |
p | - GENERIC *p |
Same as push_ptr_value, but for objects that must always be trailed. This includes objects outside of the Life data space and entries in the var_tree.
Definition at line 523 of file login.c.
References wl_stack::aaaa_3, assert, wl_stack::bbbb_3, wl_stack::next, STACK_ALLOC, wl_stack::type, undo_stack, and VALID_ADDRESS.
void push_window | ( | long | type, |
long | disp, | ||
long | wind | ||
) |
push_window
type | - long type |
disp | - long disp |
wind | - long wind |
PUSH_WINDOW(type,disp,wind) Push the window information (operation, display and window identifiers) on the undo_stack (trail) so that the window can be destroyed, redrawn, or hidden on backtracking.
Definition at line 548 of file login.c.
References wl_stack::aaaa_3, assert, wl_stack::bbbb_3, wl_stack::next, STACK_ALLOC, wl_stack::type, undo_action, and undo_stack.
void put_back_char | ( | long | c | ) |
put_back_char
c | - long c |
PUT_BACK_CHAR Put back one character, if there already are 2 saved characters then report an error (= bug).
Definition at line 729 of file token.c.
References Errorline(), old_saved_char, and saved_char.
void put_back_token | ( | psi_term | t | ) |
put_back_token
t | - psi_term t |
PUT_BACK_TOKEN Put back a psi_term, if there already are two saved then report an error (= bug).
Definition at line 746 of file token.c.
References Errorline(), NULL, old_saved_psi_term, saved_psi_term, and stack_copy_psi_term().
ptr_psi_term quote_copy | ( | ptr_psi_term | t, |
long | heap_flag | ||
) |
quote_copy
t | - ptr_psi_term t |
heap_flag | - long heap_flag |
Definition at line 186 of file copy.c.
References copy(), FALSE, QUOTE_FLAG, and to_heap.
ptr_psi_term quotedStackCopy | ( | psi_term | p | ) |
Definition at line 528 of file bi_sys.c.
References mark_quote(), and stack_copy_psi_term().
void raw_setup_builtins | ( | ) |
raw_setup_builtins
set up the built-ins for the mode raw
Definition at line 303 of file raw.c.
References bi_module, c_begin_raw(), c_end_raw(), c_get_raw(), c_in_raw(), c_put_raw(), c_reset_window_flag(), c_window_flag(), function_it, and new_built_in().
long read_char | ( | ) |
read_char
READ_CHAR Return the char read from the input stream, if end of file reached then return EOF. If stringparse==TRUE then read characters from the input string instead of from a file.
Definition at line 680 of file token.c.
References EOLN, FALSE, infoline(), input_stream, line_count, NULL, old_saved_char, prompt, saved_char, start_of_line, stringinput, stringparse, trace_input, and TRUE.
void read_comment | ( | ptr_psi_term | tok | ) |
read_comment
tok | - ptr_psi_term tok |
READ_COMMENT Read a comment starting with '' to the end of the line.
Definition at line 779 of file token.c.
References comment, EOLN, read_char(), and wl_psi_term::type.
psi_term read_life_form | ( | char | ch1, |
char | ch2 | ||
) |
read_life_form
ch1 | - char ch1 |
ch2 | - char ch2 |
READ_LIFE_FORM(str1,str2) This reads in one life-form from the input stream which finishes with the psi_term whose name is STR1 or STR2, typically if we're reading a list [A,4*5,b-4!] then STR1="," and STR2="|" . It would be incorrect if "," were taken as an operator.
This routine implements the two state expression parser as described in the implementation guide. It deals with all the various types of operators, precedence is dealt with by the CRUNCH function. Each time an opening parenthesis is encountered a new expression is started.
Definition at line 728 of file parser.c.
References wl_psi_term::attr_list, bad_psi_term(), crunch(), equ_tokc, equ_tokch, error_psi_term, FALSE, fx, fy, line_count, MAX_PRECEDENCE, nop, NOP, parse_ok, parser_stack_index, pop(), precedence(), push(), put_back_token(), read_psi_term(), read_token(), stringparse, Syntaxerrorline(), TRUE, xf, xfx, xfy, yf, and yfx.
void read_name | ( | ptr_psi_term | tok, |
long | ch, | ||
long(*)() | f, | ||
ptr_definition | typ | ||
) |
void read_number | ( | ptr_psi_term | tok, |
long | c | ||
) |
read_number
tok | - ptr_psi_term tok |
c | - long c |
READ_NUMBER(c) Read in the number whose first character is c. Accepted syntax: digit+ [ . digit+ ] [ {e|E} {+|-|empty} digit* ] Negative numbers are dealt with in the parser.
Definition at line 1110 of file token.c.
References DIGIT, heap_alloc(), integer, put_back_char(), read_char(), REAL, real, wl_psi_term::type, and wl_psi_term::value_3.
psi_term read_psi_term | ( | ) |
read_psi_term
READ_PSI_TERM() This reads in a complex object from the input stream, that is, a whole psi-term.
Examples:
[A,B,C]
{0;1;2+A}
<a,b,c> death(victim => V,murderer => M)
which(x,y,z)
A:g(f)
I have allowed mixing labelled with unlabelled attributes.
Example:
f(x=>A,B,y=>K,"hklk",D) is parsed as f(1=>B,2=>"hklk",3=>D,x=>A,y=>K).
Definition at line 421 of file parser.c.
References add_module1, add_module2, add_module3, alist, apply, wl_psi_term::attr_list, bad_psi_term(), wl_keyword::combined_name, wl_psi_term::coref, current_module, disjunction, eof, equ_tok, equ_tokch, equal_types, error_psi_term, FALSE, FEATCMP, feature_insert(), find(), functor, heap_copy_string(), integer, wl_definition::keyword, wl_module::module_name, NULL, parse_list(), parse_ok, wl_keyword::private_feature, put_back_token(), quoted_string, read_life_form(), read_token(), REAL, wl_psi_term::resid, stack_copy_psi_term(), stack_insert(), stack_psi_term(), stringparse, wl_keyword::symbol, Syntaxerrorline(), TRUE, two, wl_psi_term::type, wl_psi_term::value_3, variable, and wl_const_3.
void read_string | ( | ptr_psi_term | tok, |
long | e | ||
) |
read_string
tok | - ptr_psi_term tok |
e | - long e |
READ_STRING(e) Read a string ending with character E, where E=" or '. Transform a double occurrence into a single one so that 'ab""cd' is the string 'ab"cd'.
Definition at line 859 of file token.c.
References base2int(), FALSE, heap_copy_string(), isoctal, NULL, put_back_char(), read_char(), read_string_error(), STRLEN, TOKEN_ERROR(), TRUE, wl_psi_term::type, update_symbol(), wl_psi_term::value_3, and warningline().
void read_string_error | ( | int | n | ) |
read_string_error
n | - int n |
Definition at line 796 of file token.c.
References FALSE, parse_ok, stringparse, and Syntaxerrorline().
void read_token | ( | ptr_psi_term | tok | ) |
read_token
tok | - ptr_psi_term tok |
READ_TOKEN Read in one token from the input stream, represented as a psi_term. Return the psi_term 'end_of_file' if that is the case.
Used in the parser Set prompt to the 'partial input' prompt
Definition at line 1186 of file token.c.
References read_token_main(), and TRUE.
void read_token_b | ( | ptr_psi_term | tok | ) |
read_token_b
tok | - ptr_psi_term tok |
Used as a built-in Prompt is unchanged
Definition at line 1197 of file token.c.
References FALSE, and read_token_main().
void read_token_main | ( | ptr_psi_term | tok, |
long | for_parser | ||
) |
read_token_main
tok | - ptr_psi_term tok |
for_parser | - long for_parser |
Definition at line 1207 of file token.c.
References wl_psi_term::attr_list, bk2_stack_insert(), choice_stack, comment, constant, wl_psi_term::coref, current_module, cut, wl_node::data, DIGIT, eof, EOLN, Errorline(), FALSE, final_dot, final_question, find(), wl_psi_term::flags, legal_in_name(), line_count, LOWER, nothing, NULL, old_saved_psi_term, prompt, psi_term_line_number, put_back_char(), quoted_string, read_char(), read_comment(), read_name(), read_number(), read_string(), read_token(), wl_psi_term::resid, saved_psi_term, SINGLE, stack_psi_term(), wl_psi_term::status, STRCMP, SYMBOL, symbolic(), TOKEN_ERROR(), TRUE, wl_psi_term::type, update_symbol(), UPPER, wl_psi_term::value_3, var_occurred, var_tree, and variable.
ptr_psi_term real_stack_psi_term | ( | long | stat, |
REAL | thereal | ||
) |
real_stack_psi_term
stat | - long stat |
thereal | - REAL thereal |
Create a new psi_term on the stack with a real number value.
Definition at line 48 of file lefun.c.
References wl_psi_term::attr_list, wl_psi_term::coref, FALSE, wl_psi_term::flags, global_time_stamp, heap_alloc(), integer, NULL, QUOTED_TRUE, REAL, real, wl_psi_term::resid, STACK_ALLOC, wl_psi_term::status, wl_psi_term::type, and wl_psi_term::value_3.
void rec_replace | ( | ptr_definition | old, |
ptr_definition | new, | ||
ptr_psi_term | term | ||
) |
rec_replace
old | - ptr_definition old |
new | - ptr_definition new |
term | - ptr_psi_term term |
Definition at line 865 of file modules.c.
References wl_psi_term::attr_list, def_ptr, deref_ptr, insert_translation(), int_ptr, NULL, push_ptr_value(), replace_attr(), translate(), wl_psi_term::type, and wl_psi_term::value_3.
long redefine | ( | ptr_psi_term | t | ) |
redefine
t | - ptr_psi_term t |
REDEFINE(t) This decides whether a definition (a sort, function, or predicate) may be extended or not.
Definition at line 104 of file types.c.
References wl_definition::children, wl_keyword::combined_name, wl_definition::date, deref_ptr, Errorline(), FALSE, file_date, wl_definition::keyword, MAX_BUILT_INS, wl_definition::parents, wl_definition::protected, remove_cycles(), wl_definition::rule, wl_keyword::symbol, TRUE, wl_psi_term::type, wl_definition::type_def, type_it, undef_it, warningflag, warningline(), and yes_or_no().
void release_resid | ( | ptr_psi_term | t | ) |
release_resid
t | - ptr_psi_term t |
Definition at line 445 of file lefun.c.
References release_resid_main(), and TRUE.
void release_resid_main | ( | ptr_psi_term | t, |
long | trailflag | ||
) |
release_resid_main
t | - ptr_psi_term t |
trailflag | - long trailflag |
Release the residuations pending on the Residuation Variable T. This is done by simply pushing the residuated goals onto the goal-stack. A goal is not added if already present on the stack. Two versions of this routine exist: one which trails t and one which never trails t.
Definition at line 411 of file lefun.c.
References wl_goal::aaaa_1, FALSE, wl_residuation::goal, goal_ptr, goal_stack, int_ptr, wl_residuation::next, wl_goal::next, NULL, wl_goal::pending, push_ptr_value(), wl_psi_term::resid, resid_ptr, and traceline().
void release_resid_notrail | ( | ptr_psi_term | t | ) |
release_resid_notrail
t | - ptr_psi_term t |
Definition at line 456 of file lefun.c.
References FALSE, and release_resid_main().
void remove_cycles | ( | ptr_definition | d, |
ptr_int_list * | dl | ||
) |
remove_cycles
d | - ptr_definition d |
dl | - ptr_int_list *dl |
Remove references to d in d's children or parents
Definition at line 85 of file types.c.
References wl_int_list::next.
void replace | ( | ptr_definition | old, |
ptr_definition | new, | ||
ptr_psi_term | term | ||
) |
replace
old | - ptr_definition old |
new | - ptr_definition new |
term | - ptr_psi_term term) |
REPLACE(old,new,term) Replace all occurrences of type OLD with NEW in TERM.
Definition at line 851 of file modules.c.
References clear_copy(), and rec_replace().
void replace_attr | ( | ptr_node | old_attr, |
ptr_psi_term | term, | ||
ptr_definition | old, | ||
ptr_definition | new | ||
) |
replace_attr
old_attr | - ptr_node old_attr |
term | - ptr_psi_term term |
old | - ptr_definition old |
new | - ptr_definition new |
Definition at line 898 of file modules.c.
References wl_psi_term::attr_list, wl_keyword::combined_name, wl_node::data, FEATCMP, wl_node::key, wl_definition::keyword, wl_node::left, wl_keyword::private_feature, rec_replace(), wl_node::right, stack_insert(), and wl_keyword::symbol.
void report_error | ( | ptr_psi_term | g, |
char * | s | ||
) |
report_error
g | - ptr_psi_term g |
s | - char *s |
REPORT_ERROR(g,s) Print an appropriate error message. G is the psi-term which caused the error, S a message to print. Format: '*** Error: s in 'g'.'
Definition at line 856 of file error.c.
References report_error_main().
void report_error2 | ( | ptr_psi_term | g, |
char * | s | ||
) |
report_error2
g | - ptr_psi_term g |
s | - char *s |
REPORT_ERROR2(g,s) Like report_error, with a slightly different format. Format: '*** Error: argument 'g' s.'
Definition at line 923 of file error.c.
References report_error2_main().
void report_error2_main | ( | ptr_psi_term | g, |
char * | s, | ||
char * | s2 | ||
) |
report_error2_main
g | - ptr_psi_term g |
s | - char *s |
s2 | - char *s2 |
Main routine for report_error2 and report_warning2
Definition at line 904 of file error.c.
References display_psi_stderr(), and perr_s().
void report_error_main | ( | ptr_psi_term | g, |
char * | s, | ||
char * | s2 | ||
) |
report_error_main
g | - ptr_psi_term g |
s | - char *s |
s2 | - char *s2 |
Main routine for report_error and report_warning
Definition at line 836 of file error.c.
References display_psi_stderr(), perr(), and perr_s2().
void report_warning | ( | ptr_psi_term | g, |
char * | s | ||
) |
report_warning
g | - ptr_psi_term g |
s | - char *s |
REPORT_WARNING(g,s) Print an appropriate error message. G is the psi-term which caused the error, S a message to print. Format: '*** Warning: s in 'g'.'
Definition at line 890 of file error.c.
References report_error_main(), and warningflag.
void report_warning2 | ( | ptr_psi_term | g, |
char * | s | ||
) |
report_warning2
g | - ptr_psi_term g |
s | - char *s |
REPORT_WARNING2(g,s) Like report_warning, with a slightly different format. Format: '*** Warning: argument 'g' s.'
Definition at line 938 of file error.c.
References report_error2_main(), and warningflag.
long reportAndAbort | ( | ptr_psi_term | g, |
char * | s | ||
) |
reportAndAbort
g | - ptr_psi_term g |
s | - char *s |
REPORTANDABORT(g,s) Print an appropriate error message. G is the psi-term which caused the error, S a message to print. Format: '*** Error: s in 'g'.'
Definition at line 872 of file error.c.
References abort_life(), report_error_main(), and TRUE.
void reset_stacks | ( | ) |
reset_stacks
Called when level jumps back to zero. Setting these two pointers to NULL causes an exit from main_prove and will then reset all other global information.
Definition at line 2047 of file login.c.
References choice_stack, goal_stack, NULL, and undo().
void reset_step | ( | ) |
ptr_psi_term residListGoalQuote | ( | ptr_residuation | p | ) |
residListGoalQuote
p | - ptr_residuation p |
Return a ptr to a psi-term marked as evaluated. The psi-term is a copy at the top level of the goal residuated on p, with the rest of the psi-term shared.
Definition at line 546 of file bi_sys.c.
References wl_goal::aaaa_1, copyPsiTerm, wl_residuation::goal, stack_psi_term(), and wl_psi_term::status.
GENERIC residListNext | ( | ptr_residuation | p | ) |
residListNext
p | - ptr_residuation p |
Definition at line 562 of file bi_sys.c.
References wl_residuation::next.
void residuate | ( | ptr_psi_term | t | ) |
residuate
t | - ptr_psi_term t |
Residuate the current expression with T in the Residuation Variable set.
Definition at line 125 of file lefun.c.
References wl_resid_list::next, NULL, wl_resid_list::othervar, resid_vars, STACK_ALLOC, and wl_resid_list::var.
void residuate2 | ( | ptr_psi_term | u, |
ptr_psi_term | v | ||
) |
residuate2
u | - ptr_psi_term u |
v | - ptr_psi_term v |
Residuate the current function on the two variables U and V.
Definition at line 144 of file lefun.c.
References residuate().
void residuate3 | ( | ptr_psi_term | u, |
ptr_psi_term | v, | ||
ptr_psi_term | w | ||
) |
residuate3
u | - ptr_psi_term u |
v | - ptr_psi_term v |
w | - ptr_psi_term w |
Residuate the current function on the three variables U, V, and W.
Definition at line 159 of file lefun.c.
References residuate().
void residuate_double | ( | ptr_psi_term | t, |
ptr_psi_term | u | ||
) |
residuate_double
t | - ptr_psi_term t |
u | - ptr_psi_term u |
Residuate the current expression with T in the Residuation Variable set. Also store the other variable, so that its sort can be used in the 'bestsort' calculation needed to implement disequality constraints.
Definition at line 107 of file lefun.c.
References wl_resid_list::next, wl_resid_list::othervar, resid_vars, STACK_ALLOC, and wl_resid_list::var.
long residuateGoalOnVar | ( | ptr_goal | g, |
ptr_psi_term | var, | ||
ptr_psi_term | othervar | ||
) |
residuateGoalOnVar
g | - ptr_goal g |
var | - ptr_psi_term var |
othervar | - ptr_psi_term othervar |
Add the goal to the variable's residuation list. Also update the residuation's 'bestsort' field if it exists (needed to implement complete disequality semantics). The 'othervar' parameter is needed for this.
Definition at line 192 of file lefun.c.
References code_ptr, def_ptr, Errorline(), FALSE, glb_code(), glb_value(), heap_pointer, int_ptr, wl_goal::next, NULL, wl_goal::pending, push_ptr_value(), wl_psi_term::resid, resid_ptr, STACK_ALLOC, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
void restore_parse_state | ( | ptr_parse_block | pb | ) |
restore_parse_state
pb | - ptr_parse_block pb |
Definition at line 444 of file token.c.
References wl_parse_block::ef, eof_flag, wl_parse_block::lc, line_count, old_saved_char, old_saved_psi_term, wl_parse_block::osc, wl_parse_block::ospt, saved_char, saved_psi_term, wl_parse_block::sc, wl_parse_block::sol, wl_parse_block::spt, and start_of_line.
void restore_resid | ( | ptr_resid_block | rb, |
ptr_psi_term * | match_date | ||
) |
restore_resid
rb | - ptr_resid_block rb |
match_date | - ptr_psi_term *match_date |
Definition at line 1417 of file lefun.c.
References can_curry, wl_resid_block::cc_cr, curried, FALSE, wl_resid_block::md, wl_resid_block::ra, resid_aim, resid_vars, wl_resid_block::rv, and TRUE.
void restore_state | ( | ptr_psi_term | t | ) |
restore_state
t | - ptr_psi_term t |
Restore global state from an existing file state psi-term t
Definition at line 334 of file token.c.
References eof_flag, EOF_FLAG, get_attr(), INPUT_FILE_NAME, input_file_name, input_stream, lf_true, LINE_COUNT, line_count, NULL, null_psi_term, old_saved_char, OLD_SAVED_CHAR, old_saved_psi_term, OLD_SAVED_PSI_TERM, REAL, saved_char, SAVED_CHAR, saved_psi_term, SAVED_PSI_TERM, start_of_line, START_OF_LINE, and STREAM.
void save_parse_state | ( | ptr_parse_block | pb | ) |
save_parse_state
pb | - ptr_parse_block pb |
Definition at line 425 of file token.c.
References wl_parse_block::ef, eof_flag, wl_parse_block::lc, line_count, old_saved_char, old_saved_psi_term, wl_parse_block::osc, wl_parse_block::ospt, saved_char, saved_psi_term, wl_parse_block::sc, wl_parse_block::sol, wl_parse_block::spt, and start_of_line.
void save_resid | ( | ptr_resid_block | rb, |
ptr_psi_term | match_date | ||
) |
save_resid
rb | - ptr_resid_block rb |
match_date | - ptr_psi_term match_date |
Saving & restoring residuation information
Definition at line 1398 of file lefun.c.
References can_curry, wl_resid_block::cc_cr, curried, wl_resid_block::md, wl_resid_block::ra, resid_aim, resid_vars, and wl_resid_block::rv.
void save_state | ( | ptr_psi_term | t | ) |
save_state
t | - ptr_psi_term t |
Save global state into an existing file state psi-term t
Definition at line 293 of file token.c.
References wl_psi_term::attr_list, wl_node::data, eof_flag, EOF_FLAG, FEATCMP, find(), heap_add_psi_attr(), heap_mod_int_attr(), heap_mod_str_attr(), heap_psi_term(), INPUT_FILE_NAME, input_file_name, input_stream, lf_false, lf_true, LINE_COUNT, line_count, null_psi_term, old_saved_char, OLD_SAVED_CHAR, old_saved_psi_term, OLD_SAVED_PSI_TERM, saved_char, SAVED_CHAR, saved_psi_term, SAVED_PSI_TERM, start_of_line, START_OF_LINE, STREAM, wl_psi_term::type, and wl_psi_term::value_3.
ptr_module set_current_module | ( | ptr_module | module | ) |
set_current_module
module | - ptr_module module |
SET_CURRENT_MODULE(module) Set the current module to a given string.
Definition at line 100 of file modules.c.
References current_module.
void set_trace_to_prove | ( | ) |
set_trace_to_prove
void set_trace_to_prove()
Definition at line 727 of file error.c.
References new_trace().
void setUnitList | ( | GENERIC | x | ) |
x | - GENERIC x what to set static unitListElement to (GENERIC) |
not sure purpose (DJD ???)
Definition at line 468 of file bi_sys.c.
References unitListElement.
long shift_warning | ( | long | dir, |
ptr_psi_term | arg, | ||
REAL | val | ||
) |
shift_warning
dir | - long dir |
arg | - ptr_psi_term arg |
val | - REAL val |
Definition at line 1061 of file error.c.
References nonint_warning().
void show | ( | long | limit | ) |
show
limit | - long limit |
SHOW(limit) This prints the parser's stack, for debugging purposes only, LIMIT marks the bottom of the current stack.
Definition at line 64 of file parser.c.
References display_psi_stdout(), fx, int_stack, nop, parser_stack_index, psi_term_stack, xf, and xfx.
void show_count | ( | ) |
show_count
SHOW_COUNT() This routine doesn't do anything if not in verbose mode. It prints the number of of sub-goals attempted, along with cpu-time spent during the proof etc...
Definition at line 1161 of file login.c.
References end_time, goal_count, heap_pointer, mem_base, mem_limit, NOTQUIET, stack_info(), stack_pointer, and verbose.
void stack_add_int_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
long | value | ||
) |
stack_add_int_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
value | - long value |
Definition at line 94 of file token.c.
References wl_psi_term::attr_list, FEATCMP, heap_alloc(), heap_copy_string(), integer, REAL, stack_insert(), stack_psi_term(), wl_psi_term::type, and wl_psi_term::value_3.
void stack_add_psi_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
ptr_psi_term | g | ||
) |
stack_add_psi_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
g | - ptr_psi_term g |
Definition at line 239 of file token.c.
References wl_psi_term::attr_list, FEATCMP, heap_copy_string(), and stack_insert().
void stack_add_str_attr | ( | ptr_psi_term | t, |
char * | attrname, | ||
char * | str | ||
) |
stack_add_str_attr
t | - ptr_psi_term t |
attrname | - char *attrname |
str | - char *str |
Definition at line 170 of file token.c.
References wl_psi_term::attr_list, FEATCMP, heap_copy_string(), quoted_string, stack_copy_string(), stack_insert(), stack_psi_term(), wl_psi_term::type, and wl_psi_term::value_3.
GENERIC stack_alloc | ( | long | s | ) |
stack_alloc
s | - long s |
STACK_ALLOC(s) This returns a pointer to S bytes of memory in the stack. Alignment is taken into account in the following manner: the macro ALIGN is supposed to be a power of 2 and the pointer returned is a multiple of ALIGN.
Definition at line 1642 of file memory.c.
References ALIGN, Errorline(), heap_pointer, and stack_pointer.
ptr_psi_term stack_bytes | ( | char * | s, |
int | n | ||
) |
stack_bytes
s | - char *s |
n | - int n |
STACK_BYTES(s,n) create a STRING object given a sequence of bytes
Definition at line 128 of file built_ins.c.
References heap_ncopy_string(), quoted_string, stack_psi_term(), wl_psi_term::type, and wl_psi_term::value_3.
ptr_psi_term stack_cons | ( | ptr_psi_term | head, |
ptr_psi_term | tail | ||
) |
stack_cons
head | - ptr_psi_term head |
tail | - ptr_psi_term tail |
STACK_CONS(head,tail) Create a CONS object.
Definition at line 46 of file built_ins.c.
References alist, wl_psi_term::attr_list, cons(), FEATCMP, one, stack_insert(), stack_psi_term(), two, and wl_psi_term::type.
ptr_psi_term stack_copy_psi_term | ( | psi_term | t | ) |
stack_copy_psi_term
t | - psi_term t |
STACK_COPY_PSI_TERM(tok) Return the address of a copy of TOK on the STACK. All psi_terms read in by the parser are read into the stack.
Definition at line 205 of file parser.c.
References global_time_stamp, and STACK_ALLOC.
char * stack_copy_string | ( | char * | s | ) |
stack_copy_string
s | - char *s |
STACK_COPY_STRING(string) Make a copy of the string in the stack, and return a pointer to that. Exceptions: "1" and "2" are unique (and in the heap).
Definition at line 184 of file trees.c.
References one, stack_alloc(), and two.
void stack_info | ( | FILE * | outfile | ) |
stack_info
outfile | - FILE *outfile |
Definition at line 77 of file error.c.
References depth_cs(), depth_gs(), depth_ts(), and verbose.
stack_insert
comp | - long comp |
keystr | - char *keystr |
tree | - ptr_node *tree |
info | - GENERIC info |
STACK_INSERT(comp,keystr,tree,info) Exactly the same as heap_insert, only the new node is in the stack.
Definition at line 337 of file trees.c.
References FALSE, general_insert(), and STACK.
stack_insert_copystr
keystr | - char *keystr |
tree | - ptr_node *tree |
info | - GENERIC info |
STACK_INSERT_COPYSTR(keystr,tree,info) Insert the pointer INFO under the reference string KEYSTR (which is a feature name) in the binary tree TREE. KEYSTR is copied to the heap. A potential additional node allocated to TREE is put on the stack.
Definition at line 301 of file trees.c.
References FEATCMP, general_insert(), STACK, and TRUE.
ptr_psi_term stack_int | ( | long | n | ) |
stack_int
n | - long n |
STACK_INT(n) create an INT object
Definition at line 91 of file built_ins.c.
References heap_alloc(), integer, REAL, stack_psi_term(), wl_psi_term::type, and wl_psi_term::value_3.
ptr_psi_term stack_nil | ( | ) |
stack_nil
Create the NIL object on the stack.
Definition at line 26 of file built_ins.c.
References nil, stack_psi_term(), and wl_psi_term::type.
ptr_psi_term stack_pair | ( | ptr_psi_term | left, |
ptr_psi_term | right | ||
) |
stack_pair
left | - ptr_psi_term left |
right | - ptr_psi_term right |
STACK_PAIR(left,right) create a PAIR object.
Definition at line 69 of file built_ins.c.
References and, wl_psi_term::attr_list, FEATCMP, one, stack_insert(), stack_psi_term(), two, and wl_psi_term::type.
ptr_psi_term stack_psi_term | ( | long | stat | ) |
stack_psi_term
Create a new psi_term on the stack with value '@' (top) and no attributes.
Definition at line 21 of file lefun.c.
References wl_psi_term::attr_list, wl_psi_term::coref, FALSE, wl_psi_term::flags, global_time_stamp, NULL, QUOTED_TRUE, wl_psi_term::resid, STACK_ALLOC, wl_psi_term::status, top, wl_psi_term::type, and wl_psi_term::value_3.
ptr_psi_term stack_string | ( | char * | s | ) |
stack_string
s | - char *s |
STACK_STRING(s) create a STRING object
Definition at line 109 of file built_ins.c.
References heap_copy_string(), quoted_string, stack_psi_term(), wl_psi_term::type, and wl_psi_term::value_3.
void start_chrono | ( | ) |
long starts_nonlower | ( | char * | s | ) |
void stdin_cleareof | ( | ) |
stdin_cleareof
Clear EOF if necessary for stdin
Definition at line 51 of file token.c.
References eof_flag, FALSE, NULL, old_saved_char, old_saved_psi_term, saved_char, saved_psi_term, start_of_line, stdin_terminal, and TRUE.
char* str_conc | ( | char * | s1, |
char * | s2 | ||
) |
str_conc
s1 | - char *s1 |
s2 | - char *s2 |
Definition at line 5496 of file built_ins.c.
References heap_alloc().
long str_to_int | ( | char * | s | ) |
long strict_matches | ( | ptr_psi_term | t1, |
ptr_psi_term | t2, | ||
long * | smaller | ||
) |
strict_matches
t1 | - ptr_psi_term t1 |
t2 | - ptr_psi_term t2 |
smaller | - long *smaller |
STRICT_MATCHES(t1,t2,s) Almost the same as matches, except that S is set to TRUE only if the type of t1 is strictly less than the type of t2. Because of the implementation of ints, reals, strings, and lists, this has to take the value field into account, and thus must be passed the whole psi-term.
Definition at line 1713 of file types.c.
References FALSE, matches(), NULL, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
char * string_val | ( | ptr_psi_term | term | ) |
string_val
term | - ptr_psi_term term |
STRING_VAL(term) Return a string defined by a term, that is: if term is a string, return the value, otherwise return the symbol for that term.
Definition at line 169 of file modules.c.
References deref_ptr, wl_definition::keyword, quoted_string, wl_keyword::symbol, wl_psi_term::type, and wl_psi_term::value_3.
char * strip_module_name | ( | char * | str | ) |
strip_module_name
str | - char *str |
STRIP_MODULE_NAME(symbol) Return the sub-string of symbol without the module prefix.
Definition at line 144 of file modules.c.
References legal_in_name().
long strpos | ( | long | pos, |
char * | str | ||
) |
strpos
pos | - long pos |
str | - char *str |
Utility to correctly handle '
' inside strings being printed: What is the column after printing str, when the starting position is pos? Same as strlen, except that the length count starts with pos and
resets it.
long sub_CodeType | ( | ptr_int_list | c1, |
ptr_int_list | c2 | ||
) |
sub_CodeType
c1 | - ptr_int_list c1 |
c2 | - ptr_int_list c2 |
SUB_CodeType(c1,c2) Return TRUE if code C1 is <| than type C2, that is if type represented by code C1 matches type represented by C2.
We already know that t1 and t2 are not top.
Definition at line 1618 of file types.c.
References FALSE, wl_int_list::next, NOT_CODED, TRUE, and wl_int_list::value_1.
char* sub_str | ( | char * | s, |
long | p, | ||
long | n | ||
) |
sub_str
s | - char *s |
p | - long p |
n | - long n |
Definition at line 5514 of file built_ins.c.
References heap_alloc().
long sub_type | ( | ptr_definition | t1, |
ptr_definition | t2 | ||
) |
sub_type
t1 | - ptr_definition t1 |
t2 | - ptr_definition t2 |
SUB_TYPE(t1,t2) Return TRUE if type T1 is <| than type T2, that is if T1 matches T2.
Definition at line 1642 of file types.c.
References wl_definition::code, FALSE, sub_CodeType(), top, and TRUE.
long symbolic | ( | long | c | ) |
void Syntaxerrorline | ( | char * | format, |
... | |||
) |
Syntaxerrorline.
format | - char *format |
... |
Definition at line 557 of file error.c.
References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), and psi_term_line_number.
char * text_buffer_cmp | ( | struct text_buffer * | buf, |
int | idx, | ||
char * | str | ||
) |
text_buffer_cmp
buf | - struct text_buffer *buf |
idx | - int idx |
str | - char *str |
compare string str with text in buffer buf starting at index idx. if the text to the end matches a prefix of the string, return pointer to remaining suffix of str to be matched, else return 0.
Definition at line 934 of file sys.c.
References text_buffer::data, text_buffer::next, and top.
void text_buffer_free | ( | struct text_buffer * | buf | ) |
text_buffer_free
buf | - struct text_buffer *buf |
free a linked list of buffers
Definition at line 986 of file sys.c.
References text_buffer::next.
int text_buffer_next | ( | struct text_buffer * | buf, |
int | idx, | ||
char | c, | ||
struct text_buffer ** | rbuf, | ||
int * | ridx | ||
) |
text_buffer_next
buf | - struct text_buffer *buf |
idx | - int idx |
c | - char c |
rbuf | - struct text_buffer **rbuf |
ridx | - int *ridx |
find the first match for character c starting from index idx in buffer buf. if found place new buffer and index in rbuf and ridx and return 1, else return 0
Definition at line 907 of file sys.c.
References text_buffer::data, text_buffer::next, and top.
void text_buffer_push | ( | struct text_buffer ** | buf, |
char | c | ||
) |
text_buffer_push
buf | - struct text_buffer **buf |
c | - char c |
add a character at the end of a buffer. if the buffer is full, allocate a new buffer and link it to the current one, then overwrite the variable holding the pointer to the current buffer with the pointer to the new buffer.
Definition at line 961 of file sys.c.
References text_buffer::next, TEXTBUFSIZE, and text_buffer::top.
void title | ( | ) |
TITLE.
This routine marks the start of Life. It prints info about the compile DATE, some blurb about the author etc... Who cares anyway?? [I do! -hak]
Definition at line 39 of file info.c.
References PARSER_STACK_SIZE, pnf(), quietflag, REAL, and STRLEN.
void toggle_step | ( | ) |
void toggle_trace | ( | ) |
void TOKEN_ERROR | ( | ptr_psi_term | p | ) |
TOKEN_ERROR.
p | - ptr_psi_term p |
Definition at line 38 of file token.c.
References error_psi_term, Syntaxerrorline(), and wl_psi_term::type.
ptr_choice_point topmost_what_next | ( | ) |
topmost_what_next
UNUSED 12.7 Return the choice point corresponding to the first 'what_next' choice point in the choice point stack. Return NULL if there is none. This is used to ensure that cuts don't go below the most recent 'what_next' choice point.
Definition at line 2026 of file login.c.
References choice_stack, wl_choice_point::goal_stack, wl_choice_point::next, NULL, wl_goal::type, and what_next.
void traceline | ( | char * | format, |
... | |||
) |
traceline
format | - char *format |
... |
Definition at line 186 of file error.c.
References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), psi_term_line_number, trace, and tracing().
void tracing | ( | ) |
tracing
Definition at line 678 of file error.c.
References depth_cs(), depth_gs(), goal_count, MAX_TRACE_INDENT, steptrace, and TRUE.
long trail_condition | ( | psi_term * | Q | ) |
trail_condition
Q | - psi_term *Q |
Definition at line 2630 of file login.c.
References choice_stack, and wl_choice_point::time_stamp.
ptr_psi_term translate | ( | ptr_psi_term | a, |
long ** | infoptr | ||
) |
translate
a | - ptr_psi_term a |
infoptr | - long **infoptr |
TRANSLATE(a,info) Get the translation of address A and the info field stored with it. Return NULL if none is found.
Definition at line 108 of file copy.c.
References hashentry::bucketindex, HASH, HASHEND, hashtable, hashtime, hashbucket::info, hashbucket::new_value, hashbucket::next, NULL, and hashbucket::old_value.
void traverse_tree | ( | ptr_node | n, |
int | flag | ||
) |
traverse_tree
n | - ptr_node n |
flag | - int flag |
Do for all arguments, for the built-ins c_public, c_private, and c_private_feature.
Definition at line 656 of file modules.c.
References wl_node::data, deref_ptr, FALSE, wl_node::left, MAKE_FEATURE_PRIVATE, make_feature_private(), MAKE_PRIVATE, make_public(), MAKE_PUBLIC, wl_node::right, and TRUE.
long two_or_more | ( | ptr_node | t | ) |
two_or_more
t | - ptr_node t |
Return true if number of attributes is greater than 1
Definition at line 1254 of file print.c.
References FALSE, wl_node::left, wl_node::right, and TRUE.
ptr_int_list two_to_the | ( | long | p | ) |
two_to_the
p | - long p |
TWO_TO_THE(p) Return the code worth 2^p.
Definition at line 776 of file types.c.
References HEAP_ALLOC, INT_SIZE, wl_int_list::next, NULL, and wl_int_list::value_1.
long type_cyclicity | ( | ptr_definition | d, |
ptr_int_list | anc | ||
) |
type_cyclicity
d | - ptr_definition d |
anc | - ptr_int_list anc |
TYPE_CYCLICITY(d,anc) Check cyclicity of type hierarchy. If cyclic, return a TRUE error condition and print an error message with a cycle.
Definition at line 977 of file types.c.
References wl_definition::code, Errorline(), exit_life(), FALSE, wl_int_list::next, NOT_CODED, wl_definition::parents, perr(), perr_sort_cycle(), TRUE, type_member(), and wl_int_list::value_1.
void type_disj_aim | ( | ) |
type_disj_aim
TYPE_DISJ_AIM() This routine implements type disjunctions, that is, when a type has been decoded and found to be a disjunction of types, enumerates the different values one by one.
Definition at line 1845 of file login.c.
References wl_goal::aaaa_1, aim, wl_definition::always_check, wl_psi_term::attr_list, wl_goal::bbbb_1, def_ptr, FALSE, fetch_def(), wl_definition::keyword, wl_int_list::next, NULL, push_choice_point(), push_ptr_value(), wl_psi_term::status, wl_keyword::symbol, traceline(), wl_psi_term::type, type_disj, and wl_int_list::value_1.
long type_member | ( | ptr_definition | t, |
ptr_int_list | tlst | ||
) |
type_member
t | - ptr_definition t |
tlst | - ptr_int_list tlst |
TYPE_MEMBER(t,tlst) Return TRUE iff type t is in the list tlst.
Definition at line 918 of file types.c.
References FALSE, wl_int_list::next, TRUE, and wl_int_list::value_1.
void undo | ( | ptr_stack | limit | ) |
undo
limit | - ptr_stack limit |
UNDO(limit) Undoes any side-effects up to LIMIT. Limit being the adress of the stack of side-effects you wish to return to.
Possible improvement: LIMIT is a useless parameter because GOAL_STACK is equivalent if one takes care when stacking UNDO actions. Namely, anything to be undone must be stacked LATER (=after) the goal which caused these things to be done, so that when the goal fails, everything done after it can be undone and the memory used can be reclaimed. This routine could be modified in order to cope with goals to be proved on backtracking: undo(goal).
Definition at line 691 of file login.c.
References wl_stack::aaaa_3, wl_stack::bbbb_3, destroy_window, hide_subwindow, hide_window, wl_stack::next, show_subwindow, show_window, wl_stack::type, undo_action, undo_stack, x_destroy_window(), x_hide_subwindow(), x_hide_window(), x_show_subwindow(), and x_show_window().
void undo_actions | ( | ) |
undo_actions
UNDO_ACTIONS() A subset of undo(limit) (the detrailing routine) that does all undo actions on the undo_stack, but does not undo any variable bindings, nor does it change the value of undo_stack.
Definition at line 736 of file login.c.
References Errorline(), NULL, and undo().
long unify_aim | ( | ) |
unify_aim
UNIFY_AIM() This routine performs one unification step. AIM is the current unification goal.
U and V are the two psi-terms to unify.
It swaps the two psi-terms into chronological order. U is the oldest (smallest stack address). Calculates their GLB, check their values are unifiable. It deals with all the messy things like: curried functions gaining missing arguments, types which need checking, residuation variables whose constraints must be released, disjunctions appearing in the GLB etc...
It's a rather lengthy routine, only its speed is fairly crucial in the overall performance of Wild_Life, and the code is not duplicated elsewhere.
Definition at line 1344 of file login.c.
References TRUE, and unify_body().
long unify_aim_noeval | ( | ) |
long unify_body | ( | long | eval_flag | ) |
unify_body
eval_flag | - long eval_flag |
Definition at line 1365 of file login.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_psi_term::coref, cut, cut_ptr, decode(), def_ptr, deref, deref_ptr, equal_types, Errorline(), FALSE, fetch_def_lazy(), wl_psi_term::flags, function_it, glb(), global_unify(), heap_pointer, int_ptr, integer, wl_definition::keyword, merge(), more_u_attr, more_v_attr, new_stat, wl_int_list::next, NULL, overlap_type(), push_choice_point(), push_psi_ptr_value(), push_ptr_value(), quoted_string, QUOTED_TRUE, REAL, real, release_resid(), wl_psi_term::resid, wl_psi_term::status, sub_type(), wl_keyword::symbol, sys_bytedata, traceline(), TRUE, wl_psi_term::type, wl_definition::type_def, type_disj, type_it, u_func, v_func, wl_int_list::value_1, wl_psi_term::value_3, and warningline().
void unify_bool_result | ( | ptr_psi_term | t, |
long | v | ||
) |
unify_bool_result
t | - ptr_psi_term t |
v | - long v |
UNIFY_BOOL_RESULT(t,v) Unify psi_term T to the boolean value V = TRUE or FALSE. This is used by built-in logical functions to return their result.
Definition at line 344 of file built_ins.c.
References lf_false, lf_true, NULL, push_goal(), stack_psi_term(), wl_psi_term::type, and unify.
long unify_real_result | ( | ptr_psi_term | t, |
REAL | v | ||
) |
unify_real_result
t | - ptr_psi_term t |
v | - REAL v |
UNIFY_REAL_RESULT(t,v) Unify psi_term T to the real value V. This is used by built-in arithmetic functions to return their result.
Definition at line 386 of file built_ins.c.
References assert, def_ptr, deref_ptr, FALSE, heap_alloc(), heap_pointer, i_check_out(), int_ptr, integer, matches(), NULL, push_ptr_value(), REAL, release_resid(), wl_psi_term::resid, wl_psi_term::status, TRUE, wl_psi_term::type, wl_psi_term::value_3, and warningline().
GENERIC unique_name | ( | ) |
unique_name
Make sure that the new variable name does not exist in the var_tree. (This situation should be rare.) Time to print a term is proportional to product of var_tree size and number of tags in the term. This may become large in pathological cases.
Definition at line 99 of file print.c.
References find(), heap_nice_name(), STRCMP, and var_tree.
GENERIC unitListNext | ( | ) |
set unitListElement to NULL & return NULL
not sure purpose (DJD ???)
Definition at line 490 of file bi_sys.c.
References NULL, and unitListElement.
ptr_psi_term unitListValue | ( | ) |
make psi term from unitListElement
not sure purpose (DJD ???)
Definition at line 479 of file bi_sys.c.
References makePsiTerm(), and unitListElement.
ptr_definition update_feature | ( | ptr_module | module, |
char * | feature | ||
) |
update_feature
module | - ptr_module module |
feature | - char *feature |
UPDATE_FEATURE(module,feature) Look up a FEATURE. May return NULL if the FEATURE is not visible from MODULE.
Definition at line 1331 of file modules.c.
References current_module, wl_keyword::definition, extract_module_from_name(), hash_lookup(), NULL, wl_keyword::private_feature, wl_module::symbol_table, and update_symbol().
ptr_definition update_symbol | ( | ptr_module | module, |
char * | symbol | ||
) |
update_symbol
module | - ptr_module module |
symbol | - char *symbol |
UPDATE_SYMBOL(m,s) S is a string of characters encountered during parsing, M is the module it belongs too.
if M is NULL then extract the module name from S. If that fails then use the current module.
Then, retrieve the keyword for 'module::symbol'. Then find the correct definition by scanning the opened modules.
Definition at line 270 of file modules.c.
References wl_keyword::combined_name, current_module, wl_keyword::definition, error_psi_term, Errorline(), extract_module_from_name(), FALSE, hash_insert(), hash_lookup(), HEAP_ALLOC, heap_copy_string(), make_module_token(), wl_keyword::module, wl_module::module_name, new_definition(), wl_int_list::next, NULL, wl_module::open_modules, wl_keyword::private_feature, wl_keyword::public, strip_module_name(), wl_keyword::symbol, wl_module::symbol_table, wl_psi_term::type, wl_int_list::value_1, and warningline().
void vinfoline | ( | char * | format, |
FILE * | outfile, | ||
... | |||
) |
long warning | ( | ) |
void warningline | ( | char * | format, |
... | |||
) |
warningline
format | - char *format |
... |
Definition at line 371 of file error.c.
References assert, display_psi(), FALSE, input_file_name, parse_ok, perr_i(), perr_s(), print_code(), print_def_type(), print_operator_kind(), psi_term_line_number, quietflag, and warningflag.
long warningx | ( | ) |
int WFfeature_count_loop | ( | ptr_node | n | ) |
WFfeature_count_loop.
n | - ptr_node n |
Definition at line 325 of file lib.c.
References wl_node::left, and wl_node::right.
int WFFeatureCount | ( | ptr_psi_term | psi | ) |
WFFeatureCount.
psi | - ptr_psi_term psi |
Definition at line 346 of file lib.c.
References wl_psi_term::attr_list, deref_ptr, and WFfeature_count_loop().
char ** WFFeatures | ( | ptr_psi_term | psi | ) |
WFFeatures.
psi | - ptr_psi_term psi |
Definition at line 380 of file lib.c.
References wl_psi_term::attr_list, deref_ptr, group_features(), NULL, and WFfeature_count_loop().
double WFGetDouble | ( | ptr_psi_term | psi, |
int * | ok | ||
) |
WFGetDouble.
psi | - ptr_psi_term psi |
ok | - int *ok |
Definition at line 405 of file lib.c.
References deref_ptr, FALSE, real, sub_type(), TRUE, wl_psi_term::type, and wl_psi_term::value_3.
PsiTerm WFGetFeature | ( | ptr_psi_term | psi, |
char * | feature | ||
) |
WFGetFeature.
psi | - ptr_psi_term psi |
feature | - char *feature |
Definition at line 457 of file lib.c.
References wl_psi_term::attr_list, wl_node::data, deref_ptr, FEATCMP, find(), and NULL.
char * WFGetString | ( | ptr_psi_term | psi, |
int * | ok | ||
) |
WFGetString.
psi | - ptr_psi_term psi |
ok | - int *ok |
Definition at line 431 of file lib.c.
References deref_ptr, FALSE, NULL, quoted_string, sub_type(), TRUE, wl_psi_term::type, and wl_psi_term::value_3.
PsiTerm WFGetVar | ( | char * | name | ) |
WFGetVar.
name | - char *name |
Definition at line 304 of file lib.c.
References wl_node::data, deref_ptr, find(), NULL, STRCMP, and var_tree.
void WFInit | ( | long | argc, |
char ** | argv | ||
) |
int WFInput | ( | char * | query | ) |
WFInput.
query | - char *query |
Definition at line 215 of file lib.c.
References wl_goal::aaaa_1, assert_clause(), assert_first, assert_ok, c_query_level, c_what_next, choice_stack, DEFRULES, encode_types(), FACT, fail, FALSE, goal_count, goal_stack, ignore_eff, init_parse_state(), main_prove(), wl_goal::next, NULL, parse(), prove, push_choice_point(), push_goal(), QUERY, reset_stacks(), save_parse_state(), stack_copy_psi_term(), start_chrono(), stringinput, stringparse, TRUE, wl_goal::type, undo(), undo_stack, var_occurred, WFmore, WFno, and WFyes.
char * WFType | ( | ptr_psi_term | psi | ) |
WFType.
psi | - ptr_psi_term psi |
Definition at line 364 of file lib.c.
References wl_keyword::combined_name, deref_ptr, wl_definition::keyword, NULL, and wl_psi_term::type.
long what_next_aim | ( | ) |
what_next_aim
WHAT_NEXT_AIM() Find out what the user wants to do: a) retry current goal -> ';' b) quit current goal -> RETURN c) add current goal -> 'new goal ?' d) return to top level -> '.'
Definition at line 2068 of file login.c.
References wl_goal::aaaa_1, aborthooksym, aim, assert_clause(), assert_first, wl_goal::bbbb_1, begin_terminal_io(), wl_goal::cccc_1, current_module, DEFRULES, encode_types(), end_terminal_io(), eof, EOLN, FACT, FALSE, function_it, infoline(), MAX_LEVEL, wl_module::module_name, no_choices(), NOTQUIET, NULL, parse(), print_variables(), PROMPT, prompt, prompt_buffer, prove, push_choice_point(), push_goal(), put_back_char(), QUERY, read_char(), release_resid(), reset_stacks(), reset_step(), show_count(), stack_copy_psi_term(), start_chrono(), stdin_cleareof(), TRUE, TRUEMASK, wl_psi_term::type, wl_definition::type_def, undo(), undo_stack, user_module, var_occurred, what_next, what_next_cut(), x_read_stdin_or_event(), x_window_creation, and xevent_existing.
long what_next_cut | ( | ) |
what_next_cut
Cut away up to and including the first 'what_next' choice point.
Definition at line 1987 of file login.c.
References backtrack(), choice_stack, FALSE, goal_stack, NULL, TRUE, wl_goal::type, undo(), and what_next.
void work_out_length | ( | ) |
work_out_length
WORK_OUT_LENGTH() Calculate the number of blanks before each tabulation. Insert line feeds until it all fits into PAGE_WIDTH columns. This is done by a trial and error mechanism.
Definition at line 626 of file print.c.
References wl_tab_brk::broken, wl_tab_brk::column, FALSE, indx, NULL, page_width, wl_tab_brk::printed, wl_item::str, strpos(), wl_item::tab, and TRUE.
void write_attributes | ( | ptr_node | n, |
ptr_tab_brk | tab | ||
) |
write_attributes
n | - ptr_node n |
tab | - ptr_tab_brk tab |
WRITE_ATTRIBUTES(n) Used by all versions of the built-in predicate write, and by the built-in predicate listing.
Definition at line 1419 of file print.c.
References wl_node::data, wl_node::left, mark_tab(), MAX_PRECEDENCE, pretty_tag_or_psi_term(), and wl_node::right.
long yes_or_no | ( | ) |
yes_or_no
Confirm an important change
Definition at line 50 of file types.c.
References EOLN, input_state, open_input_file(), perr(), prompt, read_char(), and restore_state().