login More...
Go to the source code of this file.
Macros | |
#define | CLEAN_TRAIL |
#define | TRAIL_TS |
#define | TRAIL_TS |
#define | RESTORE_TIME_STAMP |
Functions | |
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 aaaa_5, ptr_psi_term bbbb_5, GENERIC cccc_5) |
push_goal More... | |
void | push_choice_point (goals t, ptr_psi_term aaaa_6, ptr_psi_term bbbb_6, GENERIC cccc_6) |
push_choice_point More... | |
void | undo (ptr_stack limit) |
undo More... | |
void | undo_actions () |
undo_actions More... | |
void | backtrack () |
backtrack More... | |
static void | clean_trail (ptr_choice_point cutpt) |
clean_trail 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 () |
unify_aim More... | |
long | unify_aim_noeval () |
unify_aim_noeval 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... | |
Variables | |
long | clean_iter = 0 |
long | clean_succ = 0 |
unsigned long | global_time_stamp =INIT_TIME_STAMP |
login
What follows are the functions which assert facts in their correct places: function definitions, rule definitions or type definitions.
Definition in file login.c.
#define RESTORE_TIME_STAMP |
#define TRAIL_TS |
#define TRAIL_TS |
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.
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.
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 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.
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.
|
static |
clean_trail
cutpt | - ptr_choice_point cutpt |
CLEAN_TRAIL(cutpt) This routine removes all trail entries between the top of the undo_stack and the cutpt, whose addresses are between the cutpt and stack_pointer. (The cutpt is the choice point that will become the most recent one after the cut.) This routine should be called when a cut built-in is done. This routine is careful not to remove any trailed entries that are on the heap or outside of Life space.
Definition at line 810 of file login.c.
References wl_stack::aaaa_3, clean_iter, clean_succ, mem_base, wl_stack::next, NULL, stack_pointer, wl_choice_point::stack_top, wl_stack::type, undo_action, wl_choice_point::undo_point, undo_stack, and VALID_RANGE.
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.
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.
int dummy_printf | ( | char * | f, |
char * | s, | ||
char * | t | ||
) |
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.
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.
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.
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.
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.
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 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 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.
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.
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 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 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 start_chrono | ( | ) |
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.
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.
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.
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().
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.
unsigned long global_time_stamp =INIT_TIME_STAMP |