Builtins for doing type heierachy stuff. More...
Go to the source code of this file.
Functions | |
static long | c_children () |
Return a list of roots of the children types of T (except bottom). More... | |
static long | c_parents () |
Return a list of roots of the parent types of T. More... | |
static long | c_smallest () |
c_smallest More... | |
int | isSubTypeValue (ptr_psi_term arg1, ptr_psi_term arg2) |
isSubTypeValue More... | |
static long | isa (ptr_psi_term arg1, ptr_psi_term arg2) |
static long | isa_select (ptr_psi_term arg1, ptr_psi_term arg2, long sel) |
isa_select More... | |
static long | c_isa_main (long sel) |
c_isa_main More... | |
static long | c_isa_le () |
c_isa_le More... | |
static long | c_isa_lt () |
c_isa_lt More... | |
static long | c_isa_ge () |
c_isa_ge More... | |
static long | c_isa_gt () |
c_isa_gt More... | |
static long | c_isa_eq () |
c_isa_eq More... | |
static long | c_isa_nle () |
c_isa_nle More... | |
static long | c_isa_nlt () |
c_isa_nlt More... | |
static long | c_isa_nge () |
c_isa_nge More... | |
static long | c_isa_ngt () |
c_isa_ngt More... | |
static long | c_isa_neq () |
c_isa_neq More... | |
static long | c_isa_cmp () |
c_isa_cmp More... | |
static long | c_isa_ncmp () |
c_isa_ncmp More... | |
static long | c_is_function () |
c_is_function More... | |
static long | c_is_persistent () |
c_is_persistent More... | |
static long | c_is_predicate () |
c_is_predicate More... | |
static long | c_is_sort () |
c_is_sort More... | |
static long | c_is_value () |
c_is_value More... | |
static long | c_is_number () |
static long c_is_number More... | |
long | c_isa_subsort () |
long c_isa_subsort More... | |
long | isValue (ptr_psi_term p) |
isValue(p) More... | |
long | c_glb () |
long c_glb More... | |
long | c_lub () |
long c_lub More... | |
void | insert_type_builtins () |
void insert_type_builtins More... | |
Builtins for doing type heierachy stuff.
Definition in file bi_type.c.
|
static |
Return a list of roots of the children types of T (except bottom).
Return a list of roots of the children types of T (except bottom).
Definition at line 30 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, wl_definition::children, collect_symbols(), curry(), deref, deref_args, deref_ptr, get_two_args(), greatest_sel, hidden_type(), wl_int_list::next, NULL, push_goal(), real, resid_aim, set_1, stack_cons(), stack_nil(), stack_psi_term(), top, TRUE, wl_psi_term::type, unify, wl_int_list::value_1, and wl_psi_term::value_3.
long c_glb | ( | ) |
long c_glb
greatest lower bound (djd)
C_GLB(A,B) Return glb(A,B). Continued calls will return each following type in the disjunction of the glb of A,B.
Definition at line 708 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), decode(), deref, deref_args, deref_ptr, Errorline(), FALSE, get_two_args(), glb(), isSubTypeValue(), isValue(), makePsiTerm(), wl_int_list::next, NULL, push_choice_point(), push_goal(), resid_aim, set_1_2, TRUE, wl_psi_term::type, type_disj, unify, wl_int_list::value_1, and wl_psi_term::value_3.
|
static |
c_is_function
Succeed iff argument is a function (built-in or user-defined).
Definition at line 488 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, function_it, get_one_arg(), set_1, TRUE, wl_psi_term::type, wl_definition::type_def, and unify_bool_result().
|
static |
static long c_is_number
Return true iff argument is an actual number.
Definition at line 632 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), NULL, real, set_1, sub_type(), TRUE, wl_psi_term::type, unify_bool_result(), and wl_psi_term::value_3.
|
static |
c_is_persistent
Succeed iff argument is a quoted persistent or on the heap.
Definition at line 516 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), global, wl_definition::global_value, heap_pointer, set_1, TRUE, wl_psi_term::type, wl_definition::type_def, and unify_bool_result().
|
static |
c_is_predicate
Succeed iff argument is a predicate (built-in or user-defined).
Definition at line 548 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), predicate, set_1, TRUE, wl_psi_term::type, wl_definition::type_def, and unify_bool_result().
|
static |
c_is_sort
Succeed iff argument is a sort (built-in or user-defined).
Definition at line 576 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_one_arg(), set_1, TRUE, wl_psi_term::type, wl_definition::type_def, type_it, and unify_bool_result().
|
static |
c_is_value
Return true iff argument has a value, i.e. if it is implemented in a quirky way in Wild_Life. This is true for integers, reals, strings (which are potentially infinite sets of objects), and list objects.
Definition at line 606 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), NULL, set_1, TRUE, unify_bool_result(), and wl_psi_term::value_3.
|
static |
|
static |
c_isa_eq
Type t1 equals t2 in the hierarchy, i.e. t1 is equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 382 of file bi_type.c.
References c_isa_main(), and isa_eq_sel.
|
static |
c_isa_ge
Type t2 isa t1 in the hierarchy, i.e. t2 is less than or equal to t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 352 of file bi_type.c.
References c_isa_main(), and isa_ge_sel.
|
static |
c_isa_gt
Type t2 is lt t1 in the hierarchy, i.e. t2 is less than to t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 367 of file bi_type.c.
References c_isa_main(), and isa_gt_sel.
|
static |
c_isa_le
Type t1 isa t2 in the hierarchy, i.e. t1 is less than or equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 322 of file bi_type.c.
References c_isa_main(), and isa_le_sel.
|
static |
c_isa_lt
Type t1 is lt t2 in the hierarchy, i.e. t1 is less than t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 337 of file bi_type.c.
References c_isa_main(), and isa_lt_sel.
|
static |
c_isa_main
long | sel |
Main routine to handle all the isa built-in functions.
Definition at line 290 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), isa_select(), set_1_2, TRUE, and unify_bool_result().
|
static |
|
static |
c_isa_neq
Type t1 is not eq t2 in the hierarchy, i.e. t1 is not equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 457 of file bi_type.c.
References c_isa_main(), and isa_neq_sel.
|
static |
c_isa_nge
Type t2 is not lt t1 in the hierarchy, i.e. t2 is not less than or equal to t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 427 of file bi_type.c.
References c_isa_main(), and isa_nge_sel.
|
static |
c_isa_ngt
Type t2 is not t1 in the hierarchy, i.e. t2 is not less than t1. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 442 of file bi_type.c.
References c_isa_main(), and isa_ngt_sel.
|
static |
c_isa_nle
Type t1 is not a t2 in the hierarchy, i.e. t1 is not less than or equal to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 397 of file bi_type.c.
References c_isa_main(), and isa_nle_sel.
|
static |
c_isa_nlt
Type t1 is not lt t2 in the hierarchy, i.e. t1 is not less than to t2. This boolean function requires two arguments and never residuates. It will curry if insufficient arguments are given. It works correctly on the 'value' types, i.e. on integers, reals, strings, and lists. For lists, it looks only at the top level, i.e. whether the object is nil or a cons cell.
Definition at line 412 of file bi_type.c.
References c_isa_main(), and isa_nlt_sel.
long c_isa_subsort | ( | ) |
long c_isa_subsort
C_ISA_SUBSORT(A,B) if A is a subsort of B => succeed and residuate on B else => fail
Definition at line 661 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, deref, deref_args, deref_ptr, FALSE, get_two_args(), isa(), reportAndAbort(), residuate(), set_1_2, and TRUE.
long c_lub | ( | ) |
long c_lub
least upper bound (djd)
C_LUB(A,B) Return lub(A,B). Continued calls will return each following type in the disjunction of the lub of A,B.
Definition at line 775 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), lub(), makePsiTerm(), wl_int_list::next, NULL, push_choice_point(), push_goal(), resid_aim, set_1_2, TRUE, type_disj, unify, and wl_int_list::value_1.
|
static |
Return a list of roots of the parent types of T.
Return a list of roots of the parent types of T.
Definition at line 96 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_psi_term::attr_list, wl_goal::bbbb_1, curry(), deref, deref_args, deref_ptr, get_two_args(), hidden_type(), integer, wl_int_list::next, NULL, wl_definition::parents, push_goal(), quoted_string, real, resid_aim, set_1, stack_cons(), stack_nil(), stack_psi_term(), top, TRUE, wl_psi_term::type, unify, wl_int_list::value_1, and wl_psi_term::value_3.
|
static |
c_smallest
Return the parents of bottom. This function has no arguments.
Definition at line 159 of file bi_type.c.
References wl_goal::aaaa_1, aim, wl_goal::bbbb_1, collect_symbols(), deref_args, least_sel, NULL, push_goal(), set_empty, TRUE, and unify.
void insert_type_builtins | ( | ) |
void insert_type_builtins
Definition at line 820 of file bi_type.c.
References bi_module, c_children(), c_glb(), c_is_function(), c_is_number(), c_is_persistent(), c_is_predicate(), c_is_sort(), c_is_value(), c_isa_cmp(), c_isa_eq(), c_isa_ge(), c_isa_gt(), c_isa_le(), c_isa_lt(), c_isa_ncmp(), c_isa_neq(), c_isa_nge(), c_isa_ngt(), c_isa_nle(), c_isa_nlt(), c_isa_subsort(), c_lub(), c_parents(), c_smallest(), function_it, new_built_in(), predicate, and syntax_module.
|
static |
Definition at line 217 of file bi_type.c.
References cut, integer, isSubTypeValue(), matches(), real, and TRUE.
|
static |
isa_select
Utility that selects one of several isa functions
Definition at line 249 of file bi_type.c.
References isa(), isa_cmp_sel, isa_eq_sel, isa_ge_sel, isa_gt_sel, isa_le_sel, isa_lt_sel, isa_ncmp_sel, isa_neq_sel, isa_nge_sel, isa_ngt_sel, isa_nle_sel, and isa_nlt_sel.
int isSubTypeValue | ( | ptr_psi_term | arg1, |
ptr_psi_term | arg2 | ||
) |
isSubTypeValue
ptr_psi_term | arg1 |
ptr_psi_term | arg2 |
Definition at line 180 of file bi_type.c.
References FALSE, integer, quoted_string, REAL, real, TRUE, wl_psi_term::type, and wl_psi_term::value_3.
long isValue | ( | ptr_psi_term | p | ) |
isValue(p)
ptr_psi_term | p |
Definition at line 691 of file bi_type.c.
References NULL, and wl_psi_term::value_3.