Built in functions. More...
Go to the source code of this file.
Functions | |
long | all_public_symbols () |
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... | |
static long | get_bool_value (ptr_psi_term t, REAL *v, long *n) |
get_bool_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... | |
static long | c_gt () |
c_gt More... | |
static long | c_equal () |
static long c_equal() More... | |
static long | c_eval_disjunction () |
c_eval_disjunction More... | |
static long | c_lt () |
c_lt C_LT Less than. More... | |
static long | c_gtoe () |
c_gtoe More... | |
static long | c_ltoe () |
c_ltoe More... | |
static long | c_boolpred () |
c_boolpred More... | |
static long | get_bool (ptr_definition typ) |
get_bool More... | |
static void | unify_bool (ptr_psi_term arg) |
unify_bool More... | |
static long | c_logical_main (long sel) |
c_logical_main More... | |
static long | c_and () |
c_and More... | |
static long | c_or () |
c_or More... | |
static long | c_not () |
c_not More... | |
static long | c_xor () |
c_xor More... | |
static long | c_apply () |
c_apply More... | |
static long | c_project () |
c_project More... | |
static long | c_diff () |
c_diff More... | |
static long | c_fail () |
c_fail More... | |
static long | c_succeed () |
c_succeed More... | |
static long | c_repeat () |
c_repeat More... | |
static long | c_var () |
static long c_var() More... | |
static long | c_nonvar () |
c_nonvar More... | |
static long | c_is_function () |
c_is_function More... | |
static long | c_is_predicate () |
c_is_predicate More... | |
static long | c_is_sort () |
c_is_sort More... | |
long | only_arg1 (ptr_psi_term t, ptr_psi_term *arg1) |
only_arg1 More... | |
static long | c_dynamic () |
c_dynamic More... | |
static long | c_static () |
c_static More... | |
static long | c_delay_check () |
static long c_delay_check() More... | |
static long | c_non_strict () |
c_non_strict More... | |
static long | c_op () |
c_op More... | |
long | file_exists (char *s) |
file_exists More... | |
static long | c_exists () |
c_exists More... | |
static long | c_load () |
c_load More... | |
static long | c_get_choice () |
c_get_choice More... | |
static long | c_set_choice () |
c_set_choice More... | |
static long | c_exists_choice () |
c_exists_choice More... | |
static long | c_print_variables () |
c_print_variables More... | |
static void | set_parse_queryflag (ptr_node thelist, long sort) |
set_parse_queryflag More... | |
static long | c_parse () |
c_parse More... | |
static long | c_read (long) |
c_read More... | |
static long | c_read_psi () |
c_read_psi More... | |
static long | c_read_token () |
c_read_token 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... | |
static long | c_not_implemented () |
c_not_implemented More... | |
static long | c_declaration () |
c_declaration More... | |
static long | c_setq () |
c_setq More... | |
static long | c_assert_first () |
c_assert_first More... | |
static long | c_assert_last () |
c_assert_last More... | |
long | pred_clause (ptr_psi_term t, long r, ptr_psi_term g) |
pred_clause More... | |
static long | c_clause () |
c_clause More... | |
static long | c_retract () |
c_retract More... | |
static long | c_global () |
c_global More... | |
void | global_error_check (ptr_node n, int *error, int *eval_2) |
global_error_check More... | |
void | global_tree (ptr_node n) |
global_tree More... | |
void | global_one (ptr_psi_term t) |
global_one More... | |
static long | c_persistent () |
c_persistent 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... | |
static long | c_open_in () |
c_open_in More... | |
static long | c_open_out () |
c_open_out More... | |
static long | c_set_input () |
c_set_input More... | |
static long | c_set_output () |
c_set_output More... | |
static long | c_close () |
c_close More... | |
static long | c_get () |
c_get More... | |
static long | c_put_main (long) |
c_put_main More... | |
static long | c_put () |
c_put More... | |
static long | c_put_err () |
c_put_err More... | |
static long | generic_write () |
generic_write More... | |
static long | c_write_err () |
c_write_err More... | |
static long | c_writeq_err () |
c_writeq_err More... | |
static long | c_write () |
c_write More... | |
static long | c_writeq () |
c_writeq More... | |
static long | c_write_canonical () |
c_write_canonical More... | |
static long | c_pwrite () |
c_pwrite More... | |
static long | c_pwriteq () |
c_pwriteq More... | |
static long | c_page_width () |
c_page_width More... | |
static long | c_print_depth () |
c_print_depth More... | |
static long | c_rootsort () |
c_rootsort More... | |
static long | c_disj () |
c_disj More... | |
static long | c_cond () |
c_cond More... | |
static long | c_exist_feature () |
c_exist_feature More... | |
static long | c_features () |
c_features More... | |
static long | c_feature_values () |
c_feature_values More... | |
long | hidden_type (ptr_definition t) |
hidden_type More... | |
ptr_psi_term | collect_symbols (long sel) |
collect_symbols More... | |
static long | c_ops () |
c_ops More... | |
static ptr_node | copy_attr_list (ptr_node n) |
copy_attr_list More... | |
static long | c_strip () |
c_strip More... | |
static long | c_same_address () |
c_same_address More... | |
static long | c_diff_address () |
c_diff_address More... | |
static long | c_eval () |
c_eval More... | |
static long | c_eval_inplace () |
c_eval_inplace More... | |
static long | c_quote () |
c_quote More... | |
static long | c_split_double () |
c_split_double More... | |
static long | c_string_address () |
c_string_address More... | |
static long | c_chdir () |
c_chdir More... | |
static long | c_call () |
c_call More... | |
static long | c_bk_assign () |
c_bk_assign More... | |
static long | c_assign () |
c_assign More... | |
static long | c_global_assign () |
c_global_assign More... | |
static long | c_unify_func () |
c_unify_func More... | |
static long | c_unify_pred () |
c_unify_pred More... | |
static long | c_copy_pointer () |
c_copy_pointer More... | |
static long | c_copy_term () |
c_copy_term More... | |
static long | c_undo () |
c_undo More... | |
static long | c_freeze_inner (long freeze_flag) |
c_freeze_inner More... | |
static long | c_freeze () |
c_freeze More... | |
static long | c_implies () |
c_implies More... | |
static long | c_char () |
c_char More... | |
static long | c_ascii () |
c_ascii More... | |
static long | c_string2psi () |
c_string2psi More... | |
static long | c_psi2string () |
c_psi2string More... | |
static long | c_int2string () |
c_int2string More... | |
static long | c_such_that () |
c_such_that 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... | |
static long | c_listing () |
c_listing More... | |
static long | c_print_codes () |
c_print_codes More... | |
static long | c_pred () |
c_pred More... | |
static long | c_funct () |
c_funct More... | |
void | new_built_in (ptr_module m, char *s, def_type t, long(*r)()) |
new_built_in More... | |
static void | op_declare (long p, operator t, char *s) |
op_declare 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... | |
static long | c_module_name () |
c_module_name More... | |
static long | c_combined_name () |
c_combined_name 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... | |
Variables | |
static long | built_in_index =0 |
Built in functions.
Definition in file built_ins.c.
long abort_life | ( | int | nlflag | ) |
abort_life
int | nlflag |
Definition at line 2260 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.
long all_public_symbols | ( | ) |
Definition at line 1349 of file modules.c.
long append_files | ( | char * | s1, |
char * | s2 | ||
) |
append_files
char | *s1 |
char | *s2 |
Definition at line 5539 of file built_ins.c.
References Errorline(), FALSE, and TRUE.
long c_abort | ( | ) |
c_abort
C_ABORT Return to the top level of the interpreter.
Definition at line 2248 of file built_ins.c.
References abort_life(), and TRUE.
|
static |
c_and
C_AND Logical and & or. These functions do all possible local propagations.
Definition at line 1001 of file built_ins.c.
References c_logical_main(), and TRUE.
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 5886 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.
|
static |
c_apply
C_APPLY This evaluates "apply(functor => F,Args)". If F is a known function, then it builds the psi-term F(Args), and evaluates it.
Definition at line 1161 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, clear_copy(), curry(), wl_node::data, delete_attr(), deref, deref_ptr, distinct_copy(), distinct_tree(), Errorline(), eval, FALSE, FEATCMP, find(), function_it, functor, wl_definition::keyword, merge_unify(), push_goal(), residuate(), wl_definition::rule, wl_keyword::symbol, top, TRUE, wl_psi_term::type, and wl_definition::type_def.
long c_args | ( | ) |
c_args
C_ARGS Return the Unix "ARGV" array as a list of strings. RM: Sep 20 1993
Definition at line 6118 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.
|
static |
c_ascii
C_ASCII Return the Ascii code of the first character of a string or of a psi-term's name.
Definition at line 4777 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), matches(), quoted_string, REAL, residuate(), set_1, TRUE, wl_psi_term::type, unify_real_result(), and wl_psi_term::value_3.
|
static |
c_assert_first
C_ASSERT_FIRST Assert a fact, inserting it as the first clause for that predicate or function.
Definition at line 2387 of file built_ins.c.
References wl_goal::aaaa_1, aim, assert_clause(), assert_first, assert_ok, wl_psi_term::attr_list, bk_mark_quote(), deref_ptr, encode_types(), Errorline(), FALSE, get_one_arg(), and TRUE.
|
static |
c_assert_last
C_ASSERT_LAST Assert a fact, inserting as the last clause for that predicate or function.
Definition at line 2417 of file built_ins.c.
References wl_goal::aaaa_1, aim, assert_clause(), assert_first, assert_ok, wl_psi_term::attr_list, bk_mark_quote(), deref_ptr, encode_types(), Errorline(), FALSE, and get_one_arg().
|
static |
c_assign
C_ASSIGN() This implements non-backtrackable assignment. It doesn't work because backtrackable unifications can have been made before this assignment was reached. It is complicated by the fact that the assigned term has to be copied into the heap as it becomes a permanent object.
Definition at line 4342 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, clear_copy(), deref_args, deref_ptr, deref_rec, Errorline(), exact_copy(), FALSE, get_two_args(), HEAP, heap_pointer, set_1_2, and TRUE.
|
static |
c_bk_assign
C_BK_ASSIGN() This implements backtrackable assignment.
Definition at line 4283 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, c_abort(), wl_psi_term::coref, deref, deref_args, deref_ptr, deref_rec, Errorline(), FALSE, get_two_args(), heap_pointer, push_psi_ptr_value(), release_resid(), release_resid_notrail(), set_1_2, trail_condition(), and TRUE.
|
static |
c_boolpred
C_BOOLPRED Internal built-in predicate that handles functions in predicate positions. This predicate should never be called directly by the user.
Definition at line 839 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, c_abort(), DEFRULES, deref, deref_args, deref_ptr, Errorline(), FALSE, get_one_arg(), lf_false, lf_true, matches(), NULL, predicate, prove, push_goal(), residuate(), set_1, sub_type(), TRUE, wl_psi_term::type, and wl_definition::type_def.
|
static |
c_call
C_CALL Prove a predicate, return true or false if it succeeds or fails. No implicit cut is performed.
Definition at line 4232 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, choice_stack, curry(), DEFRULES, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), lf_false, lf_true, NULL, prove, push_choice_point(), push_goal(), resid_aim, residuate(), set_1, stack_psi_term(), top, TRUE, wl_psi_term::type, and unify.
|
static |
c_char
C_CHAR RM: May 6 1993 Changed C_CHAR to return a string Create a 1 character string from an ASCII code.
Definition at line 4727 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), heap_alloc(), integer, NULL, overlap_type(), push_goal(), quoted_string, REAL, residuate(), set_1, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_chdir
C_CHDIR Change the current working directory
Definition at line 4148 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), expand_file_name(), FALSE, get_two_args(), matches(), quoted_string, wl_psi_term::type, and wl_psi_term::value_3.
|
static |
c_clause
C_CLAUSE Find the clauses that unify with the argument in the rules. The argument must be a predicate or a function. Use PRED_CLAUSE to perform the search.
Definition at line 2520 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, FALSE, get_two_args(), and pred_clause().
|
static |
c_close
C_CLOSE Close a stream.
Definition at line 2933 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_node::data, deref, deref_args, deref_ptr, equal_types, Errorline(), FALSE, FEATCMP, find(), get_two_args(), input_stream, inputfilesym, NULL, open_input_file(), open_output_file(), output_stream, set_1, stream, STREAM, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
|
static |
c_combined_name
C_COMBINED_NAME Return the string module::name for a term.
Definition at line 5689 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_keyword::combined_name, curry(), deref_ptr, get_two_args(), heap_copy_string(), wl_definition::keyword, NULL, push_goal(), quoted_string, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
long c_concatenate | ( | ) |
c_concatenate
C_CONCATENATE Concatenate the strings in arguments 1 and 2.
Definition at line 5573 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.
|
static |
c_cond
C_COND This implements COND(Condition,Then,Else). First Condition is evaluated. If it returns true, return the Then value. If it returns false, return the Else value. Either the Then or the Else values may be omitted, in which case they are considered to be true.
Definition at line 3419 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, calloncesym, curry(), wl_node::data, deref, deref_args, deref_ptr, Errorline(), FEATCMP, find(), get_bool_value(), get_one_arg_addr(), goal_stack, i_check_out(), wl_node::key, wl_node::left, lf_true, NULL, one, predicate, psi_term_ptr, push_goal(), push_ptr_value(), REAL, resid_aim, residuate(), wl_node::right, set_1_2_3, STACK_ALLOC, stack_psi_term(), three, TRUE, two, wl_psi_term::type, wl_definition::type_def, and unify.
|
static |
c_copy_pointer
C_COPY_POINTER Make a fresh copy of the input's sort, keeping exactly the same arguments as before (i.e., copying the sort and feature table but not the feature values).
Definition at line 4478 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, copy_attr_list(), curry(), deref, deref_args, deref_ptr, get_one_arg(), NULL, push_goal(), set_1, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_copy_term
C_COPY_TERM Make a fresh copy of the input argument, keeping its structure but with no connections to the input.
Definition at line 4510 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, clear_copy(), curry(), deref, deref_args, deref_ptr, exact_copy(), get_one_arg(), NULL, push_goal(), set_1, STACK, TRUE, and unify.
|
static |
c_declaration
C_DECLARATION This function always fails, it is in fact identical to BOTTOM.
Definition at line 2314 of file built_ins.c.
References wl_goal::aaaa_1, aim, deref_ptr, Errorline(), and FALSE.
|
static |
static long c_delay_check()
C_DELAY_CHECK() Mark that the properties of the types in the arguments are delay checked during unification (i.e. they are only checked when the psi-term is given attributes, and they are not checked as long as the psi-term has no attributes.)
Definition at line 1662 of file built_ins.c.
References wl_goal::aaaa_1, aim, assert_delay_check(), wl_psi_term::attr_list, deref_ptr, inherit_always_check(), and TRUE.
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 6083 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().
|
static |
c_diff
C_DIFF Arithmetic not-equal.
Definition at line 1309 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, FALSE, get_bool_value(), get_real_value(), get_two_args(), nonnum_warning(), REAL, residuate(), residuate2(), set_1_2, TRUE, unify_bool_result(), and unify_real_result().
|
static |
c_diff_address
C_DIFF_ADDRESS Return TRUE if two arguments have different addresses.
Definition at line 3897 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, FALSE, get_bool_value(), get_two_args(), NULL, push_goal(), REAL, resid_aim, set_1_2, TRUE, unify, and unify_bool_result().
|
static |
c_disj
C_DISJ This implements disjunctions (A;B). A nonexistent A or B is taken to mean 'fail'. Disjunctions should not be implemented in Life, because doing so results in both A and B being evaluated before the disjunction is. Disjunctions could be implemented in Life if there were a 'melt' predicate.
Definition at line 3388 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, DEFRULES, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), NULL, prove, push_choice_point(), push_goal(), resid_aim, set_1_2, traceline(), and TRUE.
|
static |
c_dynamic
C_DYNAMIC() Mark all the arguments as 'unprotected', i.e. they may be changed by assert/retract/redefinition.
Definition at line 1626 of file built_ins.c.
References wl_goal::aaaa_1, aim, assert_protected(), wl_psi_term::attr_list, deref_ptr, FALSE, and TRUE.
|
static |
static long c_equal()
C_EQUAL Arithmetic equality.
Definition at line 508 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, FALSE, get_bool_value(), get_real_value(), get_two_args(), nonnum_warning(), REAL, residuate(), residuate2(), set_1_2, TRUE, unify_bool_result(), and unify_real_result().
|
static |
c_eval
C_EVAL Evaluate an expression and return its value.
Definition at line 3941 of file built_ins.c.
References wl_goal::aaaa_1, aim, assert, wl_psi_term::attr_list, wl_goal::bbbb_1, clear_copy(), curry(), deref, deref_args, deref_ptr, eval_copy(), get_two_args(), i_check_out(), NULL, push_goal(), resid_aim, set_1, STACK, TRUE, wl_psi_term::type, and unify.
|
static |
c_eval_disjunction
C_EVAL_DISJUNCTION Evaluate a disjunction.
Definition at line 590 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, c_abort(), deref_ptr, disj_nil, Errorline(), eval, get_two_args(), i_check_out(), NULL, push_choice_point(), push_goal(), resid_aim, wl_definition::rule, TRUE, wl_psi_term::type, and unify.
|
static |
c_eval_inplace
C_EVAL_INPLACE Evaluate an expression and return its value.
Definition at line 3973 of file built_ins.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(), i_check_out(), mark_eval(), NULL, push_goal(), resid_aim, set_1, TRUE, and unify.
|
static |
c_exist_feature
C_EXIST_FEATURE Here we evaluate "has_feature(Label,Psi-term,Value)". This is a boolean function that returns true iff Psi-term has the feature Label.
Added optional 3rd argument which is unified with the feature value if it exists.
Definition at line 3496 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_keyword::combined_name, curry(), wl_node::data, deref, deref_args, deref_ptr, FEATCMP, find(), get_two_args(), heap_copy_string(), integer, wl_definition::keyword, lf_false, lf_true, NULL, wl_keyword::private_feature, push_goal(), quoted_string, REAL, set_1_2, stack_psi_term(), sub_type(), wl_keyword::symbol, three, TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_exists
C_EXISTS Succeed iff a file can be read in (i.e. if it exists).
Definition at line 1733 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, file_exists(), find(), one, psi_to_string(), set_1, and TRUE.
|
static |
c_exists_choice
C_EXISTS_CHOICE() Return true iff there exists a choice point A such that arg1 < A <= arg2, i.e. A is more recent than the choice point marked by arg1 and no more recent than the choice point marked by arg2. The two arguments to exists_choice must come from past calls to get_choice. This function allows one to check whether a choice point exists between any two arbitrary execution points of the program.
Definition at line 1911 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, choice_stack, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_real_value(), get_two_args(), lf_false, lf_true, wl_choice_point::next, NULL, push_goal(), REAL, set_1_2, set_empty, stack_psi_term(), wl_choice_point::time_stamp, TRUE, wl_psi_term::type, and unify.
|
static |
|
static |
c_feature_values
C_FEATURES Return the list of values of the features of a term.
Definition at line 3615 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, current_module, curry(), deref, deref_args, deref_ptr, get_module(), get_two_args(), make_feature_list(), NULL, push_goal(), resid_aim, set_1, stack_nil(), TRUE, and unify.
|
static |
c_features
C_FEATURES Convert the feature names of a psi_term into a list of psi-terms. This uses the MAKE_FEATURE_LIST routine.
Definition at line 3561 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, current_module, curry(), deref, deref_args, deref_ptr, get_module(), get_two_args(), make_feature_list(), NULL, push_goal(), resid_aim, set_1, stack_nil(), TRUE, and unify.
|
static |
c_freeze
C_FREEZE() See c_freeze_inner.
Definition at line 4702 of file built_ins.c.
References c_freeze_inner(), and TRUE.
|
static |
c_freeze_inner
long | freeze_flag |
C_FREEZE_INNER This implements the freeze and implies predicates. For example:
freeze(g)
The proof will use matching on the heads of g's definition rather than unification to prove Goal. An implicit cut is put at the beginning of each clause body. Body goals are executed in the same way as without freeze. Essentially, the predicate is called as if it were a function.
implies(g)
The proof will use matching as for freeze, but there is no cut at the beginning of the clause body & no residuation is done (the clause fails if its head is not implied by the caller). Essentially, the predicate is called as before except that matching is used instead of unification to decide whether to enter a clause.
Definition at line 4593 of file built_ins.c.
References wl_goal::aaaa_1, wl_pair_list::aaaa_2, aim, wl_psi_term::attr_list, wl_pair_list::bbbb_2, can_curry, wl_goal::cccc_1, choice_stack, clear_copy(), curried, DEFRULES, deref_args, deref_ptr, Errorline(), eval_copy(), FALSE, freeze_cut, get_one_arg(), implies_cut, match, MAX_BUILT_INS, wl_pair_list::next, NULL, predicate, prove, push_choice_point(), push_goal(), quote_copy(), resid_aim, resid_vars, wl_definition::rule, save_resid(), set_1, STACK, STACK_ALLOC, stack_pointer, wl_psi_term::status, traceline(), TRUE, wl_psi_term::type, and wl_definition::type_def.
|
static |
c_funct
C_FUNCT Template for C built-in functions.
Definition at line 5327 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, curry(), deref_args, deref_ptr, get_two_args(), set_1_2, and TRUE.
|
static |
c_get
C_GET Read the next character from the current input stream and return its Ascii code. This includes blank characters, so this predicate differs slightly from Edinburgh Prolog's get(X). At end of file, return the psi-term 'end_of_file'.
Definition at line 2989 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, eof, eof_flag, Errorline(), FALSE, get_two_args(), heap_alloc(), i_check_out(), integer, NULL, prompt, push_goal(), read_char(), REAL, set_1, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_get_choice
C_GET_CHOICE() Return the current state of the choice point stack (i.e., the time stamp of the current choice point).
Definition at line 1815 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, choice_stack, deref_args, deref_ptr, global_time_stamp, NULL, push_goal(), REAL, real_stack_psi_term(), set_empty, wl_choice_point::time_stamp, TRUE, and unify.
|
static |
c_global
C_GLOBAL Declare that a symbol is a global variable. Handle multiple arguments and initialization (the initialization term is evaluated). If there is an error anywhere in the declaration, then evaluate and declare nothing.
Definition at line 2562 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, global_error_check(), and global_tree().
|
static |
c_global_assign
C_GLOBAL_ASSIGN() This implements non-backtrackable assignment on global variables.
Closely modelled on 'c_assign', except that pointers to the heap are not copied again onto the heap.
Definition at line 4379 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, clear_copy(), wl_psi_term::coref, deref_args, deref_ptr, deref_rec, Errorline(), FALSE, get_two_args(), heap_pointer, inc_heap_copy(), push_psi_ptr_value(), set_1_2, and TRUE.
|
static |
c_gt
C_GT Greater than.
Definition at line 440 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_bool_value(), get_real_value(), get_two_args(), nonnum_warning(), REAL, residuate(), residuate2(), set_1_2, TRUE, and unify_bool_result().
|
static |
c_gtoe
C_GTOE Greater than or equal.
Definition at line 702 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_bool_value(), get_real_value(), get_two_args(), nonnum_warning(), REAL, residuate(), residuate2(), set_1_2, TRUE, and unify_bool_result().
long c_halt | ( | ) |
c_halt
C_HALT Exit the Wild_Life interpreter.
Definition at line 2209 of file built_ins.c.
References exit_life(), and TRUE.
|
static |
c_implies
C_IMPLIES() See c_freeze_inner.
Definition at line 4714 of file built_ins.c.
References c_freeze_inner(), and FALSE.
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 6028 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.
|
static |
c_int2string
C_INT2STRING(P) Convert an integer psi-term into a string representing its value.
Definition at line 4939 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_one_arg(), heap_copy_string(), integer, NULL, overlap_type(), push_goal(), quoted_string, REAL, residuate(), set_1, stack_psi_term(), STRLEN, TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_is_function
C_IS_FUNCTION Succeed iff argument is a function (built-in or user-defined).
Definition at line 1502 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, function_it, get_one_arg(), lf_false, lf_true, NULL, push_goal(), resid_aim, set_1, stack_psi_term(), TRUE, wl_psi_term::type, wl_definition::type_def, and unify.
|
static |
c_is_predicate
C_IS_PREDICATE Succeed iff argument is a predicate (built-in or user-defined).
Definition at line 1537 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), lf_false, lf_true, NULL, predicate, push_goal(), resid_aim, set_1, stack_psi_term(), TRUE, wl_psi_term::type, wl_definition::type_def, and unify.
|
static |
c_is_sort
C_IS_SORT Succeed iff argument is a sort (built-in or user-defined).
Definition at line 1571 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), lf_false, lf_true, NULL, push_goal(), resid_aim, set_1, stack_psi_term(), TRUE, wl_psi_term::type, wl_definition::type_def, type_it, and unify.
|
static |
c_listing
C_LISTING List the definition of a predicate or a function, and the own constraints of a type (i.e. the non-inherited constraints).
Definition at line 5168 of file built_ins.c.
References wl_goal::aaaa_1, wl_pair_list::aaaa_2, aim, wl_psi_term::attr_list, wl_pair_list::bbbb_2, wl_node::data, deref_ptr, display_psi_stream(), Errorline(), FALSE, funcsym, function_it, get_two_args(), global, wl_definition::global_value, has_rules(), is_built_in(), wl_definition::keyword, list_special(), listing_pred_write(), new_psi_term(), wl_pair_list::next, NULL, one_attr(), output_stream, outputline(), predicate, predsym, quoted_string, wl_definition::rule, such_that, wl_keyword::symbol, TRUE, wl_psi_term::type, wl_definition::type_def, type_it, typesym, and wl_psi_term::value_3.
|
static |
c_load
C_LOAD Load a file. This load accepts and executes any queries in the loaded file, including calls to user-defined predicates and other load predicates.
Definition at line 1775 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, Errorline(), FALSE, file_date, get_two_args(), input_state, load, open_input_file(), psi_to_string(), push_goal(), and set_1.
|
static |
c_logical_main
long | sel |
Main routine to handle the and & or functions. sel = TRUE (for and) or FALSE (for or)
Definition at line 929 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_bool(), get_two_args(), matches(), NULL, push_goal(), residuate(), set_1_2, TRUE, wl_psi_term::type, UNDEF, unify, unify_bool(), and unify_bool_result().
|
static |
c_lt C_LT Less than.
Definition at line 634 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_bool_value(), get_real_value(), get_two_args(), nonnum_warning(), REAL, residuate(), residuate2(), set_1_2, TRUE, and unify_bool_result().
|
static |
c_ltoe
C_LTOE Less than or equal.
Definition at line 770 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_bool_value(), get_real_value(), get_two_args(), nonnum_warning(), REAL, residuate(), residuate2(), set_1_2, TRUE, and unify_bool_result().
|
static |
c_module_name
C_MODULE_NAME Return the module in which a term resides.
Definition at line 5656 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref_ptr, get_two_args(), heap_copy_string(), wl_definition::keyword, wl_keyword::module, wl_module::module_name, NULL, push_goal(), quoted_string, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_non_strict
C_NON_STRICT() Mark that the function or predicate's arguments are not evaluated when the function or predicate is called.
Definition at line 1681 of file built_ins.c.
References wl_goal::aaaa_1, aim, assert_args_not_eval(), wl_psi_term::attr_list, deref_ptr, and TRUE.
|
static |
c_nonvar
C_NONVAR Return lf_true/false iff argument is not/is '@' (top with no attributes).
Definition at line 1468 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), lf_false, lf_true, NULL, push_goal(), resid_aim, set_1, stack_psi_term(), top, TRUE, wl_psi_term::type, and unify.
|
static |
c_not
C_NOT Logical not. This function does all possible local propagations.
Definition at line 1027 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_bool(), get_one_arg(), matches(), residuate(), set_1, TRUE, wl_psi_term::type, UNDEF, unify_bool(), and unify_bool_result().
|
static |
c_not_implemented
C_NOT_IMPLEMENTED This function always fails, it is in fact identical to BOTTOM.
Definition at line 2297 of file built_ins.c.
References wl_goal::aaaa_1, aim, deref_ptr, Errorline(), and FALSE.
|
static |
c_op
C_OP() Declare an operator.
Definition at line 1698 of file built_ins.c.
References wl_goal::aaaa_1, aim, and declare_operator().
|
static |
c_open_in
C_OPEN_IN Create a stream for input from the specified file.
Definition at line 2770 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_psi_term::coref, deref, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), input_state, is_top, open_input_file(), psi_to_string(), push_psi_ptr_value(), set_1_2, and TRUE.
|
static |
c_open_out
C_OPEN_OUT Create a stream for output from the specified file.
Definition at line 2816 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_psi_term::coref, deref, deref_ptr, Errorline(), FALSE, get_two_args(), open_output_file(), output_stream, overlap_type(), psi_to_string(), push_psi_ptr_value(), stack_psi_term(), stream, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
|
static |
c_ops
C_OPS Return a list of all operators (represented as 3-tuples op(prec,type,atom)). This function has no arguments.
Definition at line 3781 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, collect_symbols(), deref_args, NULL, op_sel, push_goal(), set_empty, TRUE, and unify.
|
static |
c_or
C_OR Logical and & or. These functions do all possible local propagations.
Definition at line 1014 of file built_ins.c.
References c_logical_main(), and FALSE.
|
static |
c_page_width
static long c_page_width() C_PAGE_WIDTH Set the page width.
Definition at line 3268 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, equal_types, Errorline(), FALSE, get_two_args(), integer, NULL, page_width, push_goal(), REAL, real_stack_psi_term(), set_1, sub_type(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_parse
C_PARSE Parse a string and return a quoted psi-term. The global variable names are recognized (see the built-in print_variables). All variables in the parsed string are added to the set of global variables.
Definition at line 2013 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, bi_module, curry(), wl_node::data, deref, deref_args, deref_ptr, FACT, FALSE, FEATCMP, find(), get_one_arg(), init_parse_state(), lf_false, lf_true, mark_quote(), matches(), NULL, parse(), push_goal(), QUERY, quoted_string, residuate(), restore_parse_state(), save_parse_state(), set_1, stack_copy_psi_term(), stack_psi_term(), stringinput, stringparse, three, TRUE, two, wl_psi_term::type, unify, update_symbol(), wl_psi_term::value_3, and var_occurred.
|
static |
c_persistent
C_PERSISTENT Declare that a symbol is a persistent variable.
Definition at line 2687 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, persistent_error_check(), and persistent_tree().
|
static |
c_pred
C_PRED Template for C built-in predicates.
Definition at line 5301 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), set_1_2, and TRUE.
|
static |
c_print_codes
C_print_codes Print the codes of all the sorts.
Definition at line 5281 of file built_ins.c.
References wl_goal::aaaa_1, aim, deref_args, outputline(), print_codes(), set_empty, TRUE, and type_count.
|
static |
c_print_depth
static long c_print_depth() C_PRINT_DEPTH Set the depth limit of printing.
Definition at line 3308 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, equal_types, Errorline(), FALSE, get_two_args(), integer, NULL, PRINT_DEPTH, print_depth, push_goal(), REAL, real_stack_psi_term(), set_1, sub_type(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_print_variables
C_PRINT_VARIABLES Print the global variables and their values, in the same way as is done in the user interface.
Definition at line 1968 of file built_ins.c.
References print_variables(), and TRUE.
|
static |
c_project
C_PROJECT RM: Jan 7 1993 Here we evaluate "project(Psi-term,Label)". This returns the psi-term associated to label Label in Psi-term. It is identical to C_PROJECT except that the order of the arguments is inversed.
Definition at line 1208 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_definition::always_check, wl_psi_term::attr_list, wl_goal::bbbb_1, bk_stack_insert(), clear_copy(), wl_keyword::combined_name, wl_psi_term::coref, curry(), wl_node::data, deref, deref_args, deref_ptr, Errorline(), FALSE, FEATCMP, fetch_def_lazy(), find(), wl_psi_term::flags, function_it, get_two_args(), heap_copy_string(), heap_insert(), heap_pointer, inc_heap_copy(), integer, wl_definition::keyword, NULL, wl_keyword::private_feature, push_goal(), push_psi_ptr_value(), quoted_string, QUOTED_TRUE, REAL, release_resid(), wl_psi_term::resid, residuate(), set_1_2, sub_type(), wl_keyword::symbol, top, TRUE, wl_psi_term::type, wl_definition::type_def, unify, and wl_psi_term::value_3.
|
static |
c_psi2string
C_PSI2STRING(P) Convert a psi-term's name into a string with the name as value.
Definition at line 4894 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), heap_copy_string(), wl_definition::keyword, NULL, push_goal(), quoted_string, real, set_1, stack_psi_term(), sub_type(), wl_keyword::symbol, TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_put
C_PUT Write the root of a psi-term to the current output stream. This routine accepts the string type (which is written without quotes), a number type (whose integer part is considered an Ascii code if it is in the range 0..255), and any other psi-term (in which case its name is written).
Definition at line 3046 of file built_ins.c.
References c_put_main(), and FALSE.
|
static |
c_put_err
C_PUT_ERR Write the root of a psi-term to stderr. This routine accepts the string type (which is written without quotes), a number type (whose integer part is considered an Ascii code if it is in the range 0..255), and any other psi-term (in which case its name is written).
Definition at line 3062 of file built_ins.c.
References c_put_main(), and TRUE.
|
static |
c_put_main
long | to_stderr if TRUE stderr otherwise current output |
Definition at line 3073 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, equal_types, Errorline(), FALSE, get_two_args(), integer, output_stream, psi_to_string(), REAL, real, set_1, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
|
static |
c_pwrite
C_PRETTY_WRITE The same as write, only indenting if output is wider than PAGEWIDTH.
Definition at line 3232 of file built_ins.c.
References const_quote, FALSE, generic_write(), indent, TRUE, write_canon, write_corefs, write_resids, and write_stderr.
|
static |
c_pwriteq
C_PRETTY_WRITEQ The same as writeq, only indenting if output is wider than PAGEWIDTH.
Definition at line 3250 of file built_ins.c.
References const_quote, FALSE, generic_write(), indent, TRUE, write_canon, write_corefs, write_resids, and write_stderr.
|
static |
c_quote
C_QUOTE Quote an expression, i.e. do not evaluate it but mark it as completely evaluated. This works if the function is declared as non_strict.
Definition at line 4005 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_ptr, get_two_args(), NULL, push_goal(), TRUE, 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 5962 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.
|
static |
c_read
long | psi_flag |
C_READ Read a psi_term or a token from the current input stream. The variables in the object read are not added to the set of global variables.
Definition at line 2123 of file built_ins.c.
References wl_goal::aaaa_1, abort_life(), aim, wl_psi_term::attr_list, bi_module, wl_node::data, deref_args, deref_ptr, eof, eof_flag, Errorline(), FACT, FALSE, FEATCMP, find(), get_one_arg(), heap_alloc(), integer, line_count, mark_quote(), NULL, parse(), prompt, push_goal(), QUERY, read_token_b(), REAL, set_1, stack_copy_psi_term(), stack_psi_term(), three, TRUE, two, wl_psi_term::type, unify, update_symbol(), wl_psi_term::value_3, and var_tree.
|
static |
|
static |
|
static |
c_repeat
C_REPEAT Succeed indefinitely on backtracking.
Definition at line 1417 of file built_ins.c.
References wl_goal::aaaa_1, aim, DEFRULES, deref_args, NULL, prove, push_choice_point(), set_empty, and TRUE.
|
static |
c_retract
C_RETRACT Retract the first clause that unifies with the argument. Use PRED_CLAUSE to perform the search.
Definition at line 2539 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, FALSE, get_two_args(), and pred_clause().
|
static |
c_rootsort
C_ROOTSORT Return the principal sort of the argument == create a copy with the attributes detached.
Definition at line 3352 of file built_ins.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(), NULL, push_goal(), resid_aim, set_1, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value_3.
|
static |
c_same_address
C_SAME_ADDRESS Return TRUE if two arguments share the same address.
Definition at line 3853 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, FALSE, get_bool_value(), get_two_args(), NULL, push_goal(), REAL, resid_aim, set_1_2, TRUE, unify, and unify_bool_result().
|
static |
c_set_choice
C_SET_CHOICE() Set the choice point stack to a state no later than (i.e. the same or earlier than) the state of the first argument (i.e., remove all choice points up to the first one whose time stamp is =< the first argument). This predicate will remove zero or more choice points, never add them. The first argument must come from a past call to get_choice. Together, get_choice and set_choice allow one to implement an "ancestor cut" that removes all choice points created between the current execution point and an execution point arbitarily remote in the past. The built-ins get_choice, set_choice, and exists_choice are implemented using the timestamping mechanism in the interpreter. The two relevant properties of the timestamping mechanism are that each choice point is identified by an integer and that the integers are in increasing order (but not necessarily consecutive) from the bottom to the top of the choice point stack.
Definition at line 1854 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, choice_stack, clean_trail(), curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_one_arg(), get_real_value(), wl_choice_point::next, REAL, set_1, wl_choice_point::time_stamp, and TRUE.
|
static |
c_set_input
C_SET_INPUT Set the current input stream to a given stream. If the given stream is closed, then do nothing.
Definition at line 2865 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, equal_types, Errorline(), FALSE, get_stream(), get_two_args(), input_state, inputfilesym, NULL, restore_state(), save_state(), set_1, TRUE, and wl_psi_term::type.
|
static |
c_set_output
C_SET_OUTPUT Set the current output stream.
Definition at line 2902 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, equal_types, Errorline(), FALSE, get_two_args(), output_stream, set_1, stream, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
|
static |
c_setq
C_SETQ
Create a function with one rule F -> X, where F and X are the arguments of setq. Setq evaluates its first argument and quotes the first. away any previous definition of F. F must be undefined or a function, there is an error if F is a sort or a predicate. This gives an error for a static function, but none for an undefined (i.e. uninterpreted) psi-term, which is made dynamic.
Definition at line 2337 of file built_ins.c.
References wl_goal::aaaa_1, wl_pair_list::aaaa_2, aim, wl_psi_term::attr_list, wl_pair_list::bbbb_2, clear_copy(), deref_ptr, deref_rec, Errorline(), FALSE, function_it, get_two_args(), HEAP, HEAP_ALLOC, heap_psi_term(), wl_pair_list::next, NULL, wl_definition::protected, quote_copy(), wl_definition::rule, TRUE, wl_psi_term::type, wl_definition::type_def, and undef.
|
static |
c_split_double
C_SPLIT_DOUBLE Split a double into two 32-bit words.
Definition at line 4030 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref_ptr, Errorline(), FALSE, get_real_value(), get_two_args(), REAL, residuate(), residuate2(), TRUE, and unify_real_result().
|
static |
c_static
C_STATIC() Mark all the arguments as 'protected', i.e. they may not be changed by assert/retract/redefinition.
Definition at line 1643 of file built_ins.c.
References wl_goal::aaaa_1, aim, assert_protected(), wl_psi_term::attr_list, deref_ptr, and TRUE.
|
static |
c_string2psi
C_STRING2PSI(P) Convert a string to a psi-term whose name is the string's value.
Definition at line 4827 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, current_module, curry(), deref, deref_args, deref_ptr, error_psi_term, Errorline(), FALSE, get_module(), get_two_args(), NULL, overlap_type(), push_goal(), quoted_string, residuate(), set_1_2, stack_psi_term(), TRUE, wl_psi_term::type, unify, update_symbol(), wl_psi_term::value_3, and warningline().
|
static |
c_string_address
C_STRING_ADDRESS Return the address of a string.
Definition at line 4095 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref_ptr, Errorline(), FALSE, get_real_value(), get_two_args(), matches(), NULL, push_goal(), quoted_string, REAL, residuate2(), stack_psi_term(), wl_psi_term::type, unify, unify_real_result(), and wl_psi_term::value_3.
long c_string_length | ( | ) |
c_string_length
C_STRING_LENGTH Return the length of the string in argument 1.
Definition at line 5722 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.
|
static |
c_strip
C_STRIP Return the attributes of a psi-term, that is, a psi-term of type @ but with all the attributes of the argument.
Definition at line 3824 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, copy_attr_list(), curry(), deref, deref_args, deref_ptr, get_two_args(), merge_unify(), NULL, resid_aim, set_1, and TRUE.
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 5777 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.
|
static |
c_succeed
C_SUCCEED Always succeed.
Definition at line 1401 of file built_ins.c.
References wl_goal::aaaa_1, aim, deref_args, set_empty, and TRUE.
|
static |
c_such_that
C_SUCH_THAT This implements 'Value | Goal'. First it unifies Value with the result, then it proves Goal.
This routine is different than the straight-forward implementation in Life which would have been: "V|G => cond(G,V,{})" because V is evaluated and unified before G is proved.
Definition at line 5007 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), DEFRULES, deref_args, deref_ptr, get_two_args(), i_check_out(), NULL, prove, push_goal(), resid_aim, set_1_2, TRUE, and unify.
|
static |
c_undo
C_UNDO This will prove a goal on backtracking. This is a completely uninteresting implmentation which is equivalent to:
undo. undo(G) :- G.
The problem is that it can be affected by CUT. A correct implementation would be very simple: stack the pair (ADDRESS=NULL, VALUE=GOAL) onto the trail and when undoing push the goal onto the goal-stack.
Definition at line 4548 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, DEFRULES, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), NULL, prove, push_choice_point(), set_1, and TRUE.
|
static |
c_unify_func
C_UNIFY_FUNC An explicit unify function that curries on its two arguments.
Definition at line 4421 of file built_ins.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(), NULL, push_goal(), set_1_2, TRUE, and unify.
|
static |
c_unify_pred
C_UNIFY_PRED() This unifies its two arguments (i.e. implements the predicate A=B).
Definition at line 4450 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), NULL, push_goal(), set_1_2, TRUE, and unify.
|
static |
static long c_var()
C_VAR Return lf_true/lf_false iff argument is/is not '@' (top with no attributes).
Definition at line 1434 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), lf_false, lf_true, NULL, push_goal(), resid_aim, set_1, stack_psi_term(), top, TRUE, wl_psi_term::type, and unify.
|
static |
c_write
C_WRITE Write a list of arguments. Print cyclical terms correctly, but don't use the pretty printer indentation.
Definition at line 3174 of file built_ins.c.
References const_quote, FALSE, generic_write(), indent, write_canon, write_corefs, write_resids, and write_stderr.
|
static |
c_write_canonical
C_WRITE_CANONICAL Write a list of arguments in a form that allows them to be read in again. Print cyclical terms correctly, but don't use the pretty printer indentation.
Definition at line 3214 of file built_ins.c.
References const_quote, FALSE, generic_write(), indent, TRUE, write_canon, write_corefs, write_resids, and write_stderr.
|
static |
c_write_err
C_WRITE_ERR Write a list of arguments to stderr. Print cyclical terms correctly, but don't use the pretty printer indentation.
Definition at line 3135 of file built_ins.c.
References const_quote, FALSE, generic_write(), indent, TRUE, write_canon, write_corefs, write_resids, and write_stderr.
|
static |
c_writeq
C_WRITEQ Write a list of arguments in a form that allows them to be read in again. Print cyclical terms correctly, but don't use the pretty printer indentation.
Definition at line 3194 of file built_ins.c.
References const_quote, FALSE, generic_write(), indent, TRUE, write_canon, write_corefs, write_resids, and write_stderr.
|
static |
c_writeq_err
C_WRITEQ_ERR Write a list of arguments to stderr in a form that allows them to be read in again. Print cyclical terms correctly, but don't use the pretty printer indentation.
Definition at line 3155 of file built_ins.c.
References const_quote, FALSE, generic_write(), indent, TRUE, write_canon, write_corefs, write_resids, and write_stderr.
|
static |
c_xor
C_XOR Logical exclusive or. This function does all possible local propagations.
Definition at line 1081 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_bool(), get_two_args(), matches(), NULL, push_goal(), residuate(), set_1_2, TRUE, wl_psi_term::type, UNDEF, unify, unify_bool(), and unify_bool_result().
long check_real | ( | ptr_psi_term | t, |
REAL * | v, | ||
long * | n | ||
) |
check_real
ptr_psi_term | t |
REAL | *v |
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 232 of file built_ins.c.
References FALSE, matches(), REAL, real, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
ptr_psi_term collect_symbols | ( | long | sel | ) |
collect_symbols
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 3696 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, xf, xf_sym, xfx, xfx_sym, xfy, xfy_sym, yf, yf_sym, yfx, and yfx_sym.
copy_attr_list
PVR 23.2.94 – Added this to fix c_strip and c_copy_pointer Make a copy of an attr_list structure, keeping the same leaf pointers
Definition at line 3802 of file built_ins.c.
References wl_node::data, wl_node::key, wl_node::left, NULL, wl_node::right, and STACK_ALLOC.
long declare_operator | ( | ptr_psi_term | t | ) |
declare_operator
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 5432 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.
void exit_life | ( | long | nl_flag | ) |
exit_life
long | nl_flag |
Definition at line 2220 of file built_ins.c.
References garbage_time, life_end, NOTQUIET, and open_input_file().
long file_exists | ( | char * | s | ) |
file_exists
char | *s |
Definition at line 1712 of file built_ins.c.
References expand_file_name(), FALSE, and TRUE.
|
static |
generic_write
GENERIC_WRITE Implements write, writeq, pretty_write, pretty_writeq.
Definition at line 3115 of file built_ins.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref_args, pred_write(), set_empty, and TRUE.
|
static |
get_bool
ptr_definition | typ |
Definition at line 899 of file built_ins.c.
References FALSE, lf_false, lf_true, sub_type(), TRUE, and UNDEF.
|
static |
get_bool_value
ptr_psi_term | t |
REAL | *v |
long | *n |
GET_BOOL_VALUE(t,v,n) This is identical in nature to GET_REAL_VALUE. The values handled here have to be booleans. Check if psi_term T is a boolean. V <- TRUE or FALSE value of T.
Definition at line 301 of file built_ins.c.
References boolean, def_ptr, FALSE, heap_pointer, i_check_out(), int_ptr, lf_false, lf_true, matches(), push_ptr_value(), wl_psi_term::status, TRUE, and wl_psi_term::type.
long get_real_value | ( | ptr_psi_term | t, |
REAL * | v, | ||
long * | n | ||
) |
get_real_value
ptr_psi_term | t |
REAL | *v |
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 262 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.
void global_error_check | ( | ptr_node | n, |
int * | error, | ||
int * | eval_2 | ||
) |
global_error_check
ptr_node | n |
int | * error |
int | * eval_2 |
Definition at line 2592 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, global_error_check(), wl_node::left, leftarrowsym, NULL, wl_node::right, TRUE, wl_psi_term::type, wl_definition::type_def, undef, and wl_psi_term::value_3.
void global_one | ( | ptr_psi_term | t | ) |
global_one
Definition at line 2651 of file built_ins.c.
References wl_psi_term::attr_list, clear_copy(), deref_ptr, get_two_args(), global, 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
ptr_node | n |
Definition at line 2632 of file built_ins.c.
References wl_node::data, deref_ptr, global_one(), global_tree(), wl_node::left, and wl_node::right.
long has_rules | ( | ptr_pair_list | r | ) |
has_rules
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 5097 of file built_ins.c.
References wl_pair_list::aaaa_2, FALSE, wl_pair_list::next, NULL, and TRUE.
long hidden_type | ( | ptr_definition | t | ) |
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 6150 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, 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.
long is_built_in | ( | ptr_pair_list | r | ) |
is_built_in
ptr_pair_list | r |
Return TRUE if rules r are for a built-in
Definition at line 5114 of file built_ins.c.
References MAX_BUILT_INS.
void list_special | ( | ptr_psi_term | t | ) |
list_special
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 5127 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.
ptr_psi_term make_feature_list | ( | ptr_node | tree, |
ptr_psi_term | tail, | ||
ptr_module | module, | ||
int | val | ||
) |
make_feature_list
ptr_node | tree |
ptr_psi_term | tail |
ptr_module | module |
int | val |
Definition at line 176 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().
void new_built_in | ( | ptr_module | m, |
char * | s, | ||
def_type | t, | ||
long(*)() | r | ||
) |
new_built_in
ptr_module | m |
char | *s |
def_type | t |
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 5371 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_psi_term new_psi_term | ( | long | numargs, |
ptr_definition | typ, | ||
ptr_psi_term ** | a1, | ||
ptr_psi_term ** | a2 | ||
) |
new_psi_term
long | numargs |
ptr_definition | typ |
ptr_psi_term | **a1 |
ptr_psi_term | **a2 |
Return a psi term with one or two args, and the addresses of the args
Definition at line 5060 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.
ptr_node one_attr | ( | ) |
one_attr
Return an attr_list with one argument
Definition at line 5038 of file built_ins.c.
References wl_node::data, wl_node::key, wl_node::left, NULL, one, wl_node::right, and STACK_ALLOC.
long only_arg1 | ( | ptr_psi_term | t, |
ptr_psi_term * | arg1 | ||
) |
only_arg1
ptr_psi_term | t |
ptr_psi_term | * arg1 |
Return TRUE iff t has only argument "1", and return the argument.
Definition at line 1606 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.
|
static |
op_declare
long | p |
operator | t |
char | *s |
OP_DECLARE(p,t,s) Declare that string S is an operator of precedence P and of type T where T=xf, fx, yf, fy, xfx etc...
Definition at line 5400 of file built_ins.c.
References Errorline(), heap_alloc(), MAX_PRECEDENCE, wl_operator_data::next, NULL, wl_definition::op_data, wl_operator_data::precedence, and update_symbol().
void persistent_error_check | ( | ptr_node | n, |
int * | error | ||
) |
persistent_error_check
Definition at line 2712 of file built_ins.c.
References wl_node::data, deref_ptr, error_psi_term, Errorline(), global, wl_node::left, persistent_error_check(), wl_node::right, TRUE, wl_psi_term::type, wl_definition::type_def, and undef.
void persistent_one | ( | ptr_psi_term | t | ) |
persistent_one
Definition at line 2756 of file built_ins.c.
References global, 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
Definition at line 2737 of file built_ins.c.
References wl_node::data, deref_ptr, wl_node::left, persistent_one(), persistent_tree(), and wl_node::right.
long pred_clause | ( | ptr_psi_term | t, |
long | r, | ||
ptr_psi_term | g | ||
) |
pred_clause
ptr_psi_term | t |
long | r |
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 2452 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, push_goal(), redefine(), wl_definition::rule, stack_psi_term(), succeed, wl_keyword::symbol, TRUE, wl_psi_term::type, wl_definition::type_def, and undef.
long psi_to_string | ( | ptr_psi_term | t, |
char ** | fn | ||
) |
psi_to_string
ptr_psi_term | t |
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.
|
static |
set_parse_queryflag
ptr_node | thelist |
long | sort |
Definition at line 1984 of file built_ins.c.
References bi_module, wl_node::data, FACT, FEATCMP, find(), NULL, push_goal(), QUERY, stack_psi_term(), two, wl_psi_term::type, unify, and update_symbol().
ptr_psi_term stack_bytes | ( | char * | s, |
int | n | ||
) |
stack_bytes
char | *s |
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
ptr_psi_term | head |
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_int | ( | long | n | ) |
stack_int
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
ptr_psi_term | left |
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_string | ( | char * | s | ) |
stack_string
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.
char * str_conc | ( | char * | s1, |
char * | s2 | ||
) |
str_conc
char | *s1 |
char | *s2 |
Definition at line 5492 of file built_ins.c.
References heap_alloc().
char * sub_str | ( | char * | s, |
long | p, | ||
long | n | ||
) |
sub_str
char | *s |
long | p |
long | n |
Definition at line 5510 of file built_ins.c.
References heap_alloc().
|
static |
unify_bool
ptr_psi_term | arg |
Definition at line 912 of file built_ins.c.
References boolean, NULL, push_goal(), stack_psi_term(), wl_psi_term::type, and unify.
void unify_bool_result | ( | ptr_psi_term | t, |
long | v | ||
) |
unify_bool_result
ptr_psi_term | t |
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 345 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
ptr_psi_term | t |
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 387 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().
|
static |
Definition at line 16 of file built_ins.c.