diff --git a/C/atomic.c b/C/atomic.c index 4fb14bb92..5d71caac7 100755 --- a/C/atomic.c +++ b/C/atomic.c @@ -210,6 +210,16 @@ static Int unhide_atom(USES_REGS1) { /* unhide_atom(+Atom) */ return (TRUE); } + /** @pred char_code(? _A_,? _I_) is iso + + + The built-in succeeds with _A_ bound to character represented as an + atom, and _I_ bound to the character code represented as an + integer. At least, one of either _A_ or _I_ must be bound before + the call. + + + */ static Int char_code(USES_REGS1) { Int t0 = Deref(ARG1); if (IsVarTerm(t0)) { @@ -269,7 +279,36 @@ static Int char_code(USES_REGS1) { } } -static Int name(USES_REGS1) { /* name(?Atomic,?String) */ + /** @pred name( _A_, _L_) + + + The predicate holds when at least one of the arguments is ground + (otherwise, an error message will be displayed). The argument _A_ will + be unified with an atomic symbol and _L_ with the list of the ASCII + codes for the characters of the external representation of _A_. + + ~~~~~{.prolog} + name(yap,L). + ~~~~~ + will return: + + ~~~~~{.prolog} + L = [121,97,112]. + ~~~~~ + and + + ~~~~~{.prolog} + name(3,L). + ~~~~~ + will return: + + ~~~~~{.prolog} + L = [51]. + ~~~~~ + + + */ + static Int name(USES_REGS1) { /* name(?Atomic,?String) */ Term t = Deref(ARG2), NewT, AtomNameT = Deref(ARG1); LOCAL_MAX_SIZE = 1024; @@ -341,6 +380,30 @@ restart_aux: ReleaseAndReturn(FALSE); } + +/// @pred atomic_to_string(?Atomic.?String) +// +// reverse to string_to_atomic(_Atomic_, _String_). +// The second argument may be a sequence of codes or atoms. +// +static Int atomic_to_string( + USES_REGS1) { + Term t1 = ARG1; ARG1 = ARG2, ARG2 = t1; + return string_to_atomic(PASS_REGS1); +} + +/// @pred string_to_atom(?String, ?Atom) +// +// Verifies if (a) at least one of the argument is bound. If _String_ +// is bound it must be a string term, list if codes, or list of atoms, +// and _Atom_ musr be bound to a symbol with the same text. Otherwise, +// _Atom_ must be an _Atom_ and _String_ will unify with a string term +// of the same text. +// +// Notes: +// - some versions of YAP allow the first argument to be a number. Please use +// atomic_to_string/2 in this YAP. +// static Int string_to_atom( USES_REGS1) { /* string_to_atom(?String,?Atom) */ Term t2 = Deref(ARG2), t1 = Deref(ARG1); @@ -375,6 +438,19 @@ restart_aux: ReleaseAndReturn(FALSE); } + +/// @pred atom_to_string(?Atom.?String) +// +// reverse to string_to_atom(_Atom_, _String_). +// The second argument may be a sequence of codes or atoms. +// +static Int atom_to_string( + USES_REGS1) { /* string_to_atom(?String,?Atom) */ + Term t2 = ARG1; ARG1 = ARG2; ARG2 = t2; + return string_to_atom(PASS_REGS1); + } + + static Int string_to_list(USES_REGS1) { Term list = Deref(ARG2), string = Deref(ARG1); LOCAL_MAX_SIZE = 1024; @@ -403,6 +479,12 @@ restart_aux: ReleaseAndReturn(FALSE); } + +/// @pred atom_string(?Atom.?String) +// +// reverse to string_to_atom(_Atom_, _String_). +// The second argument may be a sequence of codes or atoms. +// static Int atom_string(USES_REGS1) { Term t1 = Deref(ARG1), t2 = Deref(ARG2); LOCAL_MAX_SIZE = 1024; @@ -431,6 +513,25 @@ restart_aux: ReleaseAndReturn(FALSE); } +// The second argument may be a sequence of codes or atoms. +// +static Int string_atom( + USES_REGS1) { /* string_to_atom(?String,?Atom) */ + Term t2 = ARG1; ARG1 = ARG2; ARG2 = t2; + return atom_string(PASS_REGS1); + } + + + /** @pred atom_chars(? _A_,? _L_) is iso + + + The predicate holds when at least one of the arguments is ground + (otherwise, an error message will be displayed). The argument _A_ must + be unifiable with an atom, and the argument _L_ with the list of the + characters of _A_. + + + */ static Int atom_chars(USES_REGS1) { Term t1; LOCAL_MAX_SIZE = 1024; @@ -579,6 +680,17 @@ restart_aux: ReleaseAndReturn(false); } + /** @pred number_atom(? _I_,? _A_) + + + + The predicate holds when at least one of the arguments is ground + (otherwise, an error message will be displayed). The argument _I_ must + be unifiable with a number, and the argument _A_ must be unifiable + with an atom representing the number. + + + */ static Int number_atom(USES_REGS1) { Term t1; int l = push_text_stack(); @@ -613,6 +725,17 @@ restart_aux: ReleaseAndReturn(false); } + /** @pred number_string(? _I_,? _L_) + + + The predicate holds when at least one of the arguments is ground + (otherwise, an error message will be displayed). The argument _I_ must + be unifiable with a number, and the argument _L_ must be unifiable + with a term string representing the number. + + + */ + static Int number_string(USES_REGS1) { Term t1; int l = push_text_stack(); @@ -639,6 +762,16 @@ restart_aux: ReleaseAndReturn(FALSE); } + /** @pred number_codes(? _I_,? _L_) + + + The predicate holds when at least one of the arguments is ground + (otherwise, an error message will be displayed). The argument _I_ must + be unifiable with a number, and the argument _L_ must be unifiable + with a list of UNICODE numbers representing the number. + + + */ static Int number_codes(USES_REGS1) { Term t1; int l = push_text_stack(); @@ -1304,6 +1437,15 @@ error: ReleaseAndReturn(FALSE); } + /** @pred atom_length(+ _A_,? _I_) is iso + + + The predicate holds when the first argument is an atom, and the + second unifies with the number of characters forming that atom. If + bound, _I_ must be a non-negative integer. + + + */ static Int atom_length(USES_REGS1) { Term t1 = Deref(ARG1); Term t2 = Deref(ARG2); @@ -1339,6 +1481,15 @@ restart_aux: ReleaseAndReturn(FALSE); } + /** @pred atomic_length(+ _A_,? _I_) is iso + + + The predicate holds when the first argument is a number or atom, and + the second unifies with the number of characters needed to represent + the number, or atom. + + + */ static Int atomic_length(USES_REGS1) { Term t1 = Deref(ARG1); Term t2 = Deref(ARG2); @@ -1724,6 +1875,17 @@ static Int atom_split(USES_REGS1) { (Yap_unify_constant(ARG3, to1) && Yap_unify_constant(ARG4, to2))); } + /** @pred atom_number(? _Atom_,? _Number_) + + + The predicate holds when at least one of the arguments is ground + (otherwise, an error message will be displayed). If the argument + _Atom_ is an atom, _Number_ must be the number corresponding + to the characters in _Atom_, otherwise the characters in + _Atom_ must encode a number _Number_. + + + */ static Int atom_number(USES_REGS1) { Term t1; int l = push_text_stack(); @@ -1748,6 +1910,17 @@ restart_aux: ReleaseAndReturn(FALSE); } + /** @pred atom_number(? _String_,? _Number_) + + + The predicate holds when at least one of the arguments is ground + (otherwise, an error message will be displayed). If the argument + _String_ is a string term, _String_ must be the number corresponding + to the characters in _Atom_, otherwise the characters in + _String_ must encode the number _Number_. + + + */ static Int string_number(USES_REGS1) { Term t1; int l = push_text_stack(); @@ -2297,118 +2470,31 @@ void Yap_InitBackAtoms(void) { void Yap_InitAtomPreds(void) { Yap_InitCPred("name", 2, name, 0); - /** @pred name( _A_, _L_) - - - The predicate holds when at least one of the arguments is ground - (otherwise, an error message will be displayed). The argument _A_ will - be unified with an atomic symbol and _L_ with the list of the ASCII - codes for the characters of the external representation of _A_. - - ~~~~~{.prolog} - name(yap,L). - ~~~~~ - will return: - - ~~~~~{.prolog} - L = [121,97,112]. - ~~~~~ - and - - ~~~~~{.prolog} - name(3,L). - ~~~~~ - will return: - - ~~~~~{.prolog} - L = [51]. - ~~~~~ - - - */ Yap_InitCPred("string_to_atom", 2, string_to_atom, 0); - Yap_InitCPred("atom_string", 2, atom_string, 0); + Yap_InitCPred("atom_to_string", 2, atom_to_string, 0); Yap_InitCPred("string_to_atomic", 2, string_to_atomic, 0); + Yap_InitCPred("atomic_to_string", 2, atomic_to_string, 0); Yap_InitCPred("string_to_list", 2, string_to_list, 0); Yap_InitCPred("char_code", 2, char_code, SafePredFlag); - /** @pred char_code(? _A_,? _I_) is iso - - - The built-in succeeds with _A_ bound to character represented as an - atom, and _I_ bound to the character code represented as an - integer. At least, one of either _A_ or _I_ must be bound before - the call. - - - */ Yap_InitCPred("atom_chars", 2, atom_chars, 0); - /** @pred atom_chars(? _A_,? _L_) is iso - - - The predicate holds when at least one of the arguments is ground - (otherwise, an error message will be displayed). The argument _A_ must - be unifiable with an atom, and the argument _L_ with the list of the - characters of _A_. - - - */ Yap_InitCPred("atom_codes", 2, atom_codes, 0); + Yap_InitCPred("atom_string", 2, atom_string, 0); + Yap_InitCPred("string_atom", 2, string_atom, 0); Yap_InitCPred("string_codes", 2, string_codes, 0); Yap_InitCPred("string_chars", 2, string_chars, 0); Yap_InitCPred("atom_length", 2, atom_length, SafePredFlag); - /** @pred atom_length(+ _A_,? _I_) is iso - - - The predicate holds when the first argument is an atom, and the second - unifies with the number of characters forming that atom. - - - */ Yap_InitCPred("atomic_length", 2, atomic_length, SafePredFlag); Yap_InitCPred("string_length", 2, string_length, SafePredFlag); Yap_InitCPred("$atom_split", 4, atom_split, SafePredFlag); Yap_InitCPred("number_chars", 2, number_chars, 0); Yap_InitCPred("number_atom", 2, number_atom, 0); - /** @pred number_atom(? _I_,? _L_) - - - - The predicate holds when at least one of the arguments is ground - (otherwise, an error message will be displayed). The argument _I_ must - be unifiable with a number, and the argument _L_ must be unifiable - with an atom representing the number. - - - */ Yap_InitCPred("number_string", 2, number_string, 0); Yap_InitCPred("number_codes", 2, number_codes, 0); Yap_InitCPred("atom_number", 2, atom_number, 0); - /** @pred atom_number(? _Atom_,? _Number_) - - - The predicate holds when at least one of the arguments is ground - (otherwise, an error message will be displayed). If the argument - _Atom_ is an atom, _Number_ must be the number corresponding - to the characters in _Atom_, otherwise the characters in - _Atom_ must encode a number _Number_. - - - */ Yap_InitCPred("string_number", 2, string_number, 0); Yap_InitCPred("$atom_concat", 2, atom_concat2, 0); Yap_InitCPred("$string_concat", 2, string_concat2, 0); Yap_InitCPred("atomic_concat", 2, atomic_concat2, 0); - /** @pred atomic_concat(+ _As_,? _A_) - - - The predicate holds when the first argument is a list of atomic terms, - and - the second unifies with the atom obtained by concatenating all the - atomic terms in the first list. The first argument thus may contain - atoms or numbers. - - - */ Yap_InitCPred("atomics_to_string", 2, atomics_to_string2, 0); Yap_InitCPred("atomics_to_string", 3, atomics_to_string3, 0); Yap_InitCPred("get_string_code", 3, get_string_code3, 0); diff --git a/C/cdmgr.c b/C/cdmgr.c index 7ba47985a..2497b8cc6 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -1,3 +1,4 @@ + /************************************************************************* * * * YAP Prolog * @@ -19,8 +20,8 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98"; #endif #include "Yap.h" -#include "clause.h" #include "YapEval.h" +#include "clause.h" #include "tracer.h" #include "yapio.h" #ifdef YAPOR @@ -115,7 +116,8 @@ restart: Yap_Error(INSTANTIATION_ERROR, t0, pname); return NULL; } else if (IsAtomTerm(t)) { - return RepPredProp(Yap_GetPredPropByAtom(AtomOfTerm(t), tmod)); + PredEntry *ap = RepPredProp(Yap_GetPredPropByAtom(AtomOfTerm(t), tmod)); + return ap; } else if (IsIntegerTerm(t) && tmod == IDB_MODULE) { return Yap_FindLUIntKey(IntegerOfTerm(t)); } else if (IsPairTerm(t)) { @@ -140,7 +142,8 @@ restart: t = ArgOfTerm(2, t); goto restart; } - return RepPredProp(Yap_GetPredPropByFunc(fun, tmod)); + PredEntry *ap = RepPredProp(Yap_GetPredPropByFunc(fun, tmod)); + return ap; } else { Yap_Error(TYPE_ERROR_CALLABLE, t0, pname); } @@ -496,7 +499,7 @@ static void RemoveMainIndex(PredEntry *ap) { #ifdef TABLING || ap->PredFlags & TabledPredFlag #endif /* TABLING */ - ) { + ) { ap->OpcodeOfPred = INDEX_OPCODE; ap->CodeOfPred = ap->cs.p_code.TrueCodeOfPred = (yamop *)(&(ap->OpcodeOfPred)); @@ -1453,7 +1456,7 @@ static void addcl_permission_error(AtomEntry *ap, Int Arity, int in_use) { CACHE_REGS LOCAL_Error_TYPE = PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE; - LOCAL_ErrorMessage = Malloc( 256 ); + LOCAL_ErrorMessage = Malloc(256); if (in_use) { if (Arity == 0) @@ -1648,7 +1651,7 @@ bool Yap_constPred(PredEntry *p) { pred_flags_t pflags; pflags = p->PredFlags; - if (pflags & + if (pflags & ((UserCPredFlag | CArgsPredFlag | NumberDBPredFlag | AtomDBPredFlag | TestPredFlag | AsmPredFlag | CPredFlag | BinaryPredFlag))) return true; @@ -1810,7 +1813,7 @@ bool Yap_addclause(Term t, yamop *cp, Term tmode, Term mod, Term *t4ref) p->PredFlags = p->PredFlags | CompiledPredFlag; } if (p->cs.p_code.FirstClause == NULL) { - p->PredFlags &= ~UndefPredFlag; + p->PredFlags &= ~UndefPredFlag; if (!(pflags & DynamicPredFlag)) { add_first_static(p, cp, spy_flag); /* make sure we have a place to jump to */ @@ -1911,9 +1914,14 @@ void Yap_EraseStaticClause(StaticClause *cl, PredEntry *ap, Term mod) { if (ap->cs.p_code.LastClause == cl->ClCode) { /* got rid of all clauses */ ap->cs.p_code.LastClause = ap->cs.p_code.FirstClause = NULL; + if (!(ap->PredFlags & MultiFileFlag)) { + ap->OpcodeOfPred = FAIL_OPCODE; + } else { ap->OpcodeOfPred = UNDEF_OPCODE; ap->PredFlags |= UndefPredFlag; - ap->cs.p_code.TrueCodeOfPred = (yamop *)(&(ap->OpcodeOfPred)); + } + ap->cs.p_code.TrueCodeOfPred = (yamop + *)(&(ap->OpcodeOfPred)); } else { yamop *ncl = cl->ClNext->ClCode; ap->cs.p_code.FirstClause = ncl; @@ -1981,7 +1989,6 @@ void Yap_add_logupd_clause(PredEntry *pe, LogUpdClause *cl, int mode) { Yap_AddClauseToIndex(pe, cp, mode == asserta); } if (pe->cs.p_code.FirstClause == NULL) { - pe->PredFlags &= ~UndefPredFlag; add_first_static(pe, cp, FALSE); /* make sure we have a place to jump to */ if (pe->OpcodeOfPred == UNDEF_OPCODE || @@ -2433,7 +2440,8 @@ static Int p_new_multifile(USES_REGS1) { /* '$new_multifile'(+N,+Ar,+Mod) */ UNLOCKPE(26, pe); addcl_permission_error(RepAtom(at), arity, FALSE); return false; - } +} +pe->PredFlags &= ~UndefPredFlag; if (pe->PredFlags & MultiFileFlag) { UNLOCKPE(26, pe); return true; @@ -2467,6 +2475,7 @@ static Int p_is_multifile(USES_REGS1) { /* '$is_multifile'(+S,+Mod) */ if (EndOfPAEntr(pe)) return FALSE; PELOCK(27, pe); + out = (pe->PredFlags & MultiFileFlag); UNLOCKPE(44, pe); return (out); @@ -2510,15 +2519,20 @@ static Int new_system_predicate( static Int p_is_system_predicate(USES_REGS1) { /* '$is_multifile'(+S,+Mod) */ PredEntry *pe; - bool out; + Term t1 = Deref(ARG1); - pe = Yap_get_pred(Deref(ARG1), Deref(ARG2), "system_predicate"); + // pe = Yap_get_pred(t1, Deref(ARG2), "system_predicate"); + // if (!pe) + pe = Yap_get_pred(t1, Deref(ARG2), "system_predicate"); + // if (!pe) pe = Yap_get_pred(t1, USER_MODULE, "system_predicate"); if (EndOfPAEntr(pe)) return FALSE; - PELOCK(27, pe); - out = (pe->PredFlags & SystemPredFlags); - UNLOCKPE(44, pe); - return (out); + return (pe->ModuleOfPred == 0); + // return true; + // PELOCK(27, pe); + // out = (pe->PredFlags & SystemPredFlags); + // UNLOCKPE(44, pe); + // return (out); } static Int p_is_thread_local(USES_REGS1) { /* '$is_dynamic'(+P) */ @@ -2719,7 +2733,7 @@ static Int p_pred_exists(USES_REGS1) { /* '$pred_exists'(+P,+M) */ } static Int p_set_pred_module(USES_REGS1) { /* '$set_pred_module'(+P,+Mod) - */ + */ PredEntry *pe; pe = Yap_get_pred(Deref(ARG1), CurrentModule, "set_pred_module/1"); @@ -2732,7 +2746,7 @@ static Int p_set_pred_module(USES_REGS1) { /* '$set_pred_module'(+P,+Mod) } static Int p_set_pred_owner(USES_REGS1) { /* '$set_pred_module'(+P,+File) - */ + */ PredEntry *pe; Term a2 = Deref(ARG2); @@ -2772,7 +2786,8 @@ static Int undefp_handler(USES_REGS1) { /* '$undefp_handler'(P,Mod) */ if (EndOfPAEntr(pe)) return false; PELOCK(59, pe); - if (pe->OpcodeOfPred == UNDEF_OPCODE) { + if (pe->OpcodeOfPred == UNDEF_OPCODE && + !(pe->PredFlags & (LogUpdatePredFlag|DynamicPredFlag|MultiFileFlag))) { UNLOCKPE(59, pe); return false; } @@ -2788,7 +2803,7 @@ static Int p_undefined(USES_REGS1) { /* '$undefined'(P,Mod) */ if (EndOfPAEntr(pe)) return TRUE; PELOCK(36, pe); - if (pe->PredFlags & (CPredFlag | UserCPredFlag | TestPredFlag | AsmPredFlag | + if (pe->PredFlags & (CPredFlag | UserCPredFlag | TestPredFlag | AsmPredFlag |MultiFileFlag| DynamicPredFlag | LogUpdatePredFlag | TabledPredFlag)) { UNLOCKPE(57, pe); return FALSE; @@ -2825,7 +2840,7 @@ static Int p_kill_dynamic(USES_REGS1) { /* '$kill_dynamic'(P,M) */ pe->OpcodeOfPred = UNDEF_OPCODE; pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred = (yamop *)(&(pe->OpcodeOfPred)); - pe->PredFlags = UndefPredFlag; + pe->PredFlags = UndefPredFlag; UNLOCKPE(62, pe); return (TRUE); } @@ -3029,7 +3044,7 @@ void Yap_HidePred(PredEntry *pe) { } static Int /* $system_predicate(P) */ - p_stash_predicate(USES_REGS1) { +p_stash_predicate(USES_REGS1) { PredEntry *pe; Term t1 = Deref(ARG1); @@ -3072,7 +3087,7 @@ restart_system_pred: } static Int /* $system_predicate(P) */ - hide_predicate(USES_REGS1) { +hide_predicate(USES_REGS1) { PredEntry *pe; Term t1 = Deref(ARG1); @@ -3115,7 +3130,7 @@ restart_system_pred: } static Int /* $hidden_predicate(P) */ - p_hidden_predicate(USES_REGS1) { +p_hidden_predicate(USES_REGS1) { PredEntry *pe; Term t1 = Deref(ARG1); @@ -3266,7 +3281,7 @@ static Int fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, } static Int /* $hidden_predicate(P) */ - p_log_update_clause(USES_REGS1) { +p_log_update_clause(USES_REGS1) { PredEntry *pe; Term t1 = Deref(ARG1); Int ret; @@ -3286,7 +3301,7 @@ static Int /* $hidden_predicate(P) */ } static Int /* $hidden_predicate(P) */ - p_continue_log_update_clause(USES_REGS1) { +p_continue_log_update_clause(USES_REGS1) { PredEntry *pe = (PredEntry *)IntegerOfTerm(Deref(ARG1)); yamop *ipc = (yamop *)IntegerOfTerm(ARG2); @@ -3416,7 +3431,7 @@ static Int fetch_next_lu_clause_erase(PredEntry *pe, yamop *i_code, Term th, } static Int /* $hidden_predicate(P) */ - p_log_update_clause_erase(USES_REGS1) { +p_log_update_clause_erase(USES_REGS1) { PredEntry *pe; Term t1 = Deref(ARG1); Int ret; @@ -3437,7 +3452,7 @@ static Int /* $hidden_predicate(P) */ } static Int /* $hidden_predicate(P) */ - p_continue_log_update_clause_erase(USES_REGS1) { +p_continue_log_update_clause_erase(USES_REGS1) { PredEntry *pe = (PredEntry *)IntegerOfTerm(Deref(ARG1)); yamop *ipc = (yamop *)IntegerOfTerm(ARG2); @@ -3878,7 +3893,7 @@ static Int fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, } static Int /* $hidden_predicate(P) */ - p_static_clause(USES_REGS1) { +p_static_clause(USES_REGS1) { PredEntry *pe; Term t1 = Deref(ARG1); yamop *new_cp; @@ -3897,7 +3912,7 @@ static Int /* $hidden_predicate(P) */ } static Int /* $hidden_predicate(P) */ - p_continue_static_clause(USES_REGS1) { +p_continue_static_clause(USES_REGS1) { PredEntry *pe = (PredEntry *)IntegerOfTerm(Deref(ARG1)); yamop *ipc = (yamop *)IntegerOfTerm(ARG2); @@ -4056,7 +4071,7 @@ static Int #ifdef TABLING | TabledPredFlag #endif /* TABLING */ - )) { + )) { Yap_Error(PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE, t, "dbload_get_space/4"); return FALSE; diff --git a/C/exec.c b/C/exec.c index 28f021332..9058b6bfc 100755 --- a/C/exec.c +++ b/C/exec.c @@ -126,12 +126,12 @@ inline static bool CallMetaCall(Term t, Term mod USES_REGS) { * @param mod current module * @return su */ -Term Yap_ExecuteCallMetaCall(Term mod) { +Term Yap_ExecuteCallMetaCall(Term g, Term mod) { CACHE_REGS Term ts[4]; - ts[0] = ARG1; + ts[0] = g; ts[1] = cp_as_integer(B PASS_REGS); /* p_current_choice_point */ - ts[2] = ARG1; + ts[2] = g; ts[3] = mod; if (Yap_GetGlobal(AtomDebugMeta) == TermOn) { return Yap_MkApplTerm(PredTraceMetaCall->FunctorOfPred, 3, ts); diff --git a/CXX/yapdb.hh b/CXX/yapdb.hh index aeda8fb70..f4816345c 100644 --- a/CXX/yapdb.hh +++ b/CXX/yapdb.hh @@ -46,13 +46,14 @@ class YAPModule; class YAPModule : protected YAPAtomTerm { friend class YAPPredicate; friend class YAPModuleProp; - YAPModule(YAP_Term t) : YAPAtomTerm(t){}; Term t() { return gt(); } Term curModule() { CACHE_REGS return Yap_CurrentModule(); } public: + YAPModule(YAP_Term t) : YAPAtomTerm(t){}; YAPModule() : YAPAtomTerm(curModule()){}; YAPModule(YAPAtom t) : YAPAtomTerm(t){}; + Term term() { return gt(); }; }; /** @@ -288,6 +289,7 @@ Yap_ThrowError(DOMAIN_ERROR_OUT_OF_RANGE, MkIntTerm(0), "YAPFunctor::functor"); /// we return a positive number. uintptr_t getArity() { return ap->ArityOfPE; } arity_t arity() { return ap->ArityOfPE; } + PredEntry *predEntry() { return ap; } }; /** diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index bec79321f..690fd9965 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -435,7 +435,7 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) { CACHE_REGS if (ap.ap == NULL) - return false; + return false; BACKUP_MACHINE_REGS(); arity_t arity = ap.getArity(); bool result; @@ -444,6 +444,13 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) for (arity_t i = 0; i < arity; i++) XREGS[i + 1] = ts[i].term(); + + if (ap.ap == nullptr || ap.ap->OpcodeOfPred == UNDEF_OPCODE) + { + Term g = YAP_MkApplTerm(ap.ap->FunctorOfPred, arity, XREGS+1); + ap = YAPPredicate(rewriteUndefEngineQuery(ap.ap, g, ap.ap->ModuleOfPred)); + } + q.CurSlot = Yap_StartSlots(); q.p = P; q.cp = CP; @@ -476,27 +483,36 @@ bool YAPEngine::mgoal(Term t, Term tmod) BACKUP_MACHINE_REGS(); Term *ts = nullptr; PredEntry *ap = Yap_get_pred(t, tmod, "C++"); - if (ap == nullptr) + + if (ap == nullptr || ap->OpcodeOfPred == UNDEF_OPCODE) + { + ap = rewriteUndefEngineQuery(ap, t, tmod); + } + if (ap==nullptr) + return false; - arity_t arity = ap->ArityOfPE; + { + /* legal ap */ + arity_t arity = ap->ArityOfPE; + + if (arity) { + if (IsApplTerm(t)) + { + ts = RepAppl(t) + 1; + } + else + { + ts = RepPair(t); + } + for (arity_t i = 0; i < arity; i++) + XREGS[i + 1] = ts[i]; + } else if ( IsAtomTerm(t)) { + ts = nullptr; + } + + } bool result; sigjmp_buf q_env; - - - if (arity) { - if (IsApplTerm(t)) - { - ts = RepAppl(t) + 1; - } - else - { - ts = RepPair(t); - } - for (arity_t i = 0; i < arity; i++) - XREGS[i + 1] = ts[i]; - } else if ( IsAtomTerm(t)) { - ts = nullptr; - } q.CurSlot = Yap_StartSlots(); q.p = P; q.cp = CP; @@ -578,6 +594,11 @@ Term YAPEngine::fun(Term t) arity++; f = Yap_MkFunctor(name, arity); ap = (PredEntry *)(PredPropByFunc(f, tmod)); + if (ap == nullptr || ap->OpcodeOfPred == UNDEF_OPCODE) + { + Term g = (Yap_MkApplTerm(f,arity, ts) ); + ap = rewriteUndefEngineQuery(ap, g, (ap->ModuleOfPred)); + } q.CurSlot = Yap_StartSlots(); q.p = P; q.cp = CP; @@ -615,13 +636,13 @@ YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm ts[]) { /* ignore flags for now */ BACKUP_MACHINE_REGS(); - CELL *nts; + Term *nts; Term goal; + + if ( ts) { - if (ts) { - - goal = Yap_MkApplTerm(f.f, f.arity(), nts); - nts = RepAppl(goal)+1; + goal = YAPApplTerm(f, ts).term(); + nts = RepAppl(goal)+1; } else { goal = MkVarTerm(); @@ -676,7 +697,7 @@ YAPQuery::YAPQuery(YAPPredicate p, YAPTerm ts[]) : YAPPredicate(p.ap) { arity_t arity = p.ap->ArityOfPE; if (arity) { goal = YAPApplTerm(YAPFunctor(p.ap->FunctorOfPred), ts).term(); - for (int i =0; i < arity; i++) + for (arity_t i =0; i < arity; i++) XREGS[i+1]=ts[i].term(); openQuery(goal.term(), nullptr); } else { @@ -692,6 +713,9 @@ bool YAPQuery::next() CACHE_REGS bool result = false; Term terr; + if (ap == NULL || ap->OpcodeOfPred == UNDEF_OPCODE) { + ap = rewriteUndefQuery(); + } LOCAL_RestartEnv = &q_env; try { @@ -759,6 +783,28 @@ bool YAPQuery::next() } } +PredEntry * +YAPQuery::rewriteUndefQuery() +{ + Term ts[3]; + ARG1 = ts[0] = goal.term(); + ARG2 = ts[1] = ap->ModuleOfPred; + ARG3 = ts[2] = Yap_cp_as_integer(B PASS_REGS); + goal = YAPApplTerm(FunctorUndefinedQuery, ts); + return ap = PredUndefinedQuery; +} + +PredEntry * +YAPEngine::rewriteUndefEngineQuery(PredEntry *a, Term goal, Term mod) +{ + Term ts[3]; + ARG1 = ts[0] = goal; + ARG2 = ts[1] = mod; + ARG3 = ts[2] = Yap_cp_as_integer(B PASS_REGS); + return PredUndefinedQuery; + //return YAPApplTerm(FunctorUndefinedQuery, ts); +} + void YAPQuery::cut() { CACHE_REGS @@ -884,14 +930,9 @@ void YAPEngine::doInit(YAP_file_type_t BootMode) YAPQuery initq = YAPQuery(YAPPredicate(p), nullptr); if (initq.next()) { - std::cerr << "init\n" ; initq.cut(); - std::cerr << "cut\n" ; } - else - { - std::cerr << "fail\n" ; - } + CurrentModule = TermUser; } diff --git a/CXX/yapq.hh b/CXX/yapq.hh index 5d80ed47e..46d45a7d0 100644 --- a/CXX/yapq.hh +++ b/CXX/yapq.hh @@ -56,10 +56,12 @@ class YAPQuery : public YAPPredicate q_cp = CP; // make sure this is safe q_handles = LOCAL_CurSlot; -} +}; - void openQuery(Term t, Term *pt); +void openQuery(Term t, Term *ts); + +PredEntry *rewriteUndefQuery(); public: YAPQuery() { @@ -358,10 +360,12 @@ private: YAPError yerror; void doInit(YAP_file_type_t BootMode); YAP_dogoalinfo q; + PredEntry *rewriteUndefEngineQuery(PredEntry *ap, Term t, Term tmod); -public: - /// construct a new engine; may use a variable number of arguments - YAPEngine(YAPEngineArgs *cargs) { + public : + /// construct a new engine; may use a variable number of arguments + YAPEngine(YAPEngineArgs *cargs) + { engine_args = cargs; //doInit(cargs->init_args.boot_file_type); doInit(YAP_QLY); diff --git a/H/ATOMS b/H/ATOMS index c43c033f1..e694c5e64 100644 --- a/H/ATOMS +++ b/H/ATOMS @@ -414,6 +414,7 @@ A Tuple N "tuple" A Txt N "txt" A TypeError N "type_error" A Undefined N "undefined" +A UndefinedQuery N "undefined_query" A Undefp F "$undefp" A Undefp0 F "$undefp0" A Underflow N "underflow" @@ -583,6 +584,7 @@ F TimeoutError TimeoutError 2 F TraceMetaCall TraceMetaCall 3 F TypeError TypeError 2 F UMinus Minus 1 +F UndefinedQuery UndefinedQuery 3 F UPlus Plus 1 F VBar VBar 2 F WriteTerm WriteTerm 2 diff --git a/H/HEAPFIELDS b/H/HEAPFIELDS index 6a4f69ec8..b0a7d9c1b 100644 --- a/H/HEAPFIELDS +++ b/H/HEAPFIELDS @@ -168,6 +168,8 @@ struct pred_entry *PredThrow MkPred FunctorThrow PROLOG_MODULE struct pred_entry *PredTraceMetaCall MkPred FunctorTraceMetaCall PROLOG_MODULE struct pred_entry *PredCommentHook MkPred FunctorCommentHook PROLOG_MODULE struct pred_entry *PredProcedure MkLogPred FunctorProcedure PROLOG_MODULE +struct pred_entry *PredUndefinedQuery MkPred FunctorUndefinedQuery PROLOG_MODULE + /* low-level tracer */ #ifdef LOW_LEVEL_TRACER diff --git a/H/Yapproto.h b/H/Yapproto.h index 35ef45f5a..238c88133 100755 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -191,7 +191,7 @@ extern void Yap_InitEval(void); /* exec.c */ extern void Yap_fail_all(choiceptr bb USES_REGS); -extern Term Yap_ExecuteCallMetaCall(Term); +extern Term Yap_ExecuteCallMetaCall(Term,Term); extern void Yap_InitExecFs(void); extern bool Yap_JumpToEnv(Term); extern Term Yap_RunTopGoal(Term, bool); @@ -519,4 +519,4 @@ extern void init_myddas(void); #define strncpy(X, Y, Z) strcpy(X, Y) #endif -#endif /* YAP_PROTOS_H */ \ No newline at end of file +#endif /* YAP_PROTOS_H */ diff --git a/H/generated/dhstruct.h b/H/generated/dhstruct.h index 9df73084f..7a6826813 100644 --- a/H/generated/dhstruct.h +++ b/H/generated/dhstruct.h @@ -152,6 +152,7 @@ #define PredTraceMetaCall Yap_heap_regs->PredTraceMetaCall_ #define PredCommentHook Yap_heap_regs->PredCommentHook_ #define PredProcedure Yap_heap_regs->PredProcedure_ +#define PredUndefinedQuery Yap_heap_regs->PredUndefinedQuery_ #ifdef LOW_LEVEL_TRACER #define Yap_do_low_level_trace Yap_heap_regs->Yap_do_low_level_trace_ diff --git a/H/generated/h0struct.h b/H/generated/h0struct.h index d3a8ee61f..5fad53212 100644 --- a/H/generated/h0struct.h +++ b/H/generated/h0struct.h @@ -156,6 +156,7 @@ EXTERNAL struct pred_entry *PredThrow; EXTERNAL struct pred_entry *PredTraceMetaCall; EXTERNAL struct pred_entry *PredCommentHook; EXTERNAL struct pred_entry *PredProcedure; +EXTERNAL struct pred_entry *PredUndefinedQuery; /* low-level tracer */ #ifdef LOW_LEVEL_TRACER EXTERNAL int Yap_do_low_level_trace; diff --git a/H/generated/hstruct.h b/H/generated/hstruct.h index 863b7e35e..4acedf892 100755 --- a/H/generated/hstruct.h +++ b/H/generated/hstruct.h @@ -156,6 +156,7 @@ struct pred_entry *PredTraceMetaCall_; struct pred_entry *PredCommentHook_; struct pred_entry *PredProcedure_; + struct pred_entry *PredUndefinedQuery_; /* low-level tracer */ #ifdef LOW_LEVEL_TRACER int Yap_do_low_level_trace_; diff --git a/H/generated/iatoms.h b/H/generated/iatoms.h index 180728605..12b690fc8 100644 --- a/H/generated/iatoms.h +++ b/H/generated/iatoms.h @@ -1,584 +1,586 @@ - - /* This file, iatoms.h, was generated automatically by "yap -L misc/buildatoms" - {lease do not update, update misc/ATOMS instead */ - - Atom3Dots = Yap_LookupAtom("..."); - AtomAbol = Yap_FullLookupAtom("$abol"); TermAbol = MkAtomTerm(AtomAbol); - AtomAccess = Yap_LookupAtom("access"); TermAccess = MkAtomTerm(AtomAccess); - AtomAfInet = Yap_LookupAtom("AF_INET"); TermAfInet = MkAtomTerm(AtomAfInet); - AtomAfLocal = Yap_LookupAtom("AF_LOCAL"); TermAfLocal = MkAtomTerm(AtomAfLocal); - AtomAfUnix = Yap_LookupAtom("AF_UNIX"); TermAfUnix = MkAtomTerm(AtomAfUnix); - AtomAlarm = Yap_FullLookupAtom("$alarm"); TermAlarm = MkAtomTerm(AtomAlarm); - AtomAlias = Yap_LookupAtom("alias"); TermAlias = MkAtomTerm(AtomAlias); - AtomAll = Yap_LookupAtom("all"); TermAll = MkAtomTerm(AtomAll); - AtomAltNot = Yap_LookupAtom("not"); TermAltNot = MkAtomTerm(AtomAltNot); - AtomAnswer = Yap_LookupAtom("answer"); TermAnswer = MkAtomTerm(AtomAnswer); - AtomAny = Yap_LookupAtom("any"); TermAny = MkAtomTerm(AtomAny); - AtomAppend = Yap_LookupAtom("append"); TermAppend = MkAtomTerm(AtomAppend); - AtomArg = Yap_LookupAtom("arg"); TermArg = MkAtomTerm(AtomArg); - AtomArray = Yap_FullLookupAtom("$array"); TermArray = MkAtomTerm(AtomArray); - AtomArrayAccess = Yap_FullLookupAtom("$array_arg"); TermArrayAccess = MkAtomTerm(AtomArrayAccess); - AtomArrayOverflow = Yap_LookupAtom("array_overflow"); TermArrayOverflow = MkAtomTerm(AtomArrayOverflow); - AtomArrayType = Yap_LookupAtom("array_type"); TermArrayType = MkAtomTerm(AtomArrayType); - AtomArrow = Yap_LookupAtom("->"); TermArrow = MkAtomTerm(AtomArrow); - AtomAttributedModule = Yap_LookupAtom("attributes_module"); TermAttributedModule = MkAtomTerm(AtomAttributedModule); - AtomDoubleArrow = Yap_LookupAtom("-->"); TermDoubleArrow = MkAtomTerm(AtomDoubleArrow); - AtomAssert = Yap_LookupAtom(":-"); TermAssert = MkAtomTerm(AtomAssert); - AtomBeginBracket = Yap_LookupAtom("("); TermBeginBracket = MkAtomTerm(AtomBeginBracket); - AtomEndBracket = Yap_LookupAtom(")"); TermEndBracket = MkAtomTerm(AtomEndBracket); - AtomBeginSquareBracket = Yap_LookupAtom("["); TermBeginSquareBracket = MkAtomTerm(AtomBeginSquareBracket); - AtomEndSquareBracket = Yap_LookupAtom("]"); TermEndSquareBracket = MkAtomTerm(AtomEndSquareBracket); - AtomBeginCurlyBracket = Yap_LookupAtom("{"); TermBeginCurlyBracket = MkAtomTerm(AtomBeginCurlyBracket); - AtomEndCurlyBracket = Yap_LookupAtom("}"); TermEndCurlyBracket = MkAtomTerm(AtomEndCurlyBracket); - AtomEmptyBrackets = Yap_LookupAtom("()"); TermEmptyBrackets = MkAtomTerm(AtomEmptyBrackets); - AtomEmptySquareBrackets = Yap_LookupAtom("[]"); TermEmptySquareBrackets = MkAtomTerm(AtomEmptySquareBrackets); - AtomAsserta = Yap_LookupAtom("asserta"); TermAsserta = MkAtomTerm(AtomAsserta); - AtomAssertaStatic = Yap_LookupAtom("asserta_static"); TermAssertaStatic = MkAtomTerm(AtomAssertaStatic); - AtomAssertz = Yap_LookupAtom("assertz"); TermAssertz = MkAtomTerm(AtomAssertz); - AtomAssertzStatic = Yap_LookupAtom("assertz_static"); TermAssertzStatic = MkAtomTerm(AtomAssertzStatic); - AtomAt = Yap_LookupAtom("at"); TermAt = MkAtomTerm(AtomAt); - AtomAtom = Yap_LookupAtom("atom"); TermAtom = MkAtomTerm(AtomAtom); - AtomAtomic = Yap_LookupAtom("atomic"); TermAtomic = MkAtomTerm(AtomAtomic); - AtomAtt = Yap_FullLookupAtom("$att"); TermAtt = MkAtomTerm(AtomAtt); - AtomAtt1 = Yap_LookupAtom("att"); TermAtt1 = MkAtomTerm(AtomAtt1); - AtomAttDo = Yap_FullLookupAtom("$att_do"); TermAttDo = MkAtomTerm(AtomAttDo); - AtomAttributes = Yap_LookupAtom("attributes"); TermAttributes = MkAtomTerm(AtomAttributes); - AtomB = Yap_FullLookupAtom("$last_choice_pt"); TermB = MkAtomTerm(AtomB); - AtomBatched = Yap_LookupAtom("batched"); TermBatched = MkAtomTerm(AtomBatched); - AtomBetween = Yap_LookupAtom("between"); TermBetween = MkAtomTerm(AtomBetween); - AtomBinary = Yap_LookupAtom("binary"); TermBinary = MkAtomTerm(AtomBinary); - AtomBigNum = Yap_LookupAtom("big_num"); TermBigNum = MkAtomTerm(AtomBigNum); - AtomBinaryStream = Yap_LookupAtom("binary_stream"); TermBinaryStream = MkAtomTerm(AtomBinaryStream); - AtomBoolean = Yap_LookupAtom("boolean"); TermBoolean = MkAtomTerm(AtomBoolean); - AtomBraces = Yap_LookupAtom("{}"); TermBraces = MkAtomTerm(AtomBraces); - AtomBreak = Yap_FullLookupAtom("$break"); TermBreak = MkAtomTerm(AtomBreak); - AtomByte = Yap_LookupAtom("byte"); TermByte = MkAtomTerm(AtomByte); - AtomCArith = Yap_FullLookupAtom("$c_arith"); TermCArith = MkAtomTerm(AtomCArith); - AtomCall = Yap_LookupAtom("call"); TermCall = MkAtomTerm(AtomCall); - AtomCallAndRetryCounter = Yap_LookupAtom("call_and_retry_counter"); TermCallAndRetryCounter = MkAtomTerm(AtomCallAndRetryCounter); - AtomCallCounter = Yap_LookupAtom("call_counter"); TermCallCounter = MkAtomTerm(AtomCallCounter); - AtomCallable = Yap_LookupAtom("callable"); TermCallable = MkAtomTerm(AtomCallable); - AtomCatch = Yap_FullLookupAtom("$catch"); TermCatch = MkAtomTerm(AtomCatch); - AtomChangeModule = Yap_FullLookupAtom("$change_module"); TermChangeModule = MkAtomTerm(AtomChangeModule); - AtomChar = Yap_LookupAtom("char"); TermChar = MkAtomTerm(AtomChar); - AtomCharsio = Yap_LookupAtom("charsio"); TermCharsio = MkAtomTerm(AtomCharsio); - AtomCharacter = Yap_LookupAtom("character"); TermCharacter = MkAtomTerm(AtomCharacter); - AtomCharacterCode = Yap_LookupAtom("character_code"); TermCharacterCode = MkAtomTerm(AtomCharacterCode); - AtomChars = Yap_LookupAtom("chars"); TermChars = MkAtomTerm(AtomChars); - AtomCharset = Yap_LookupAtom("charset"); TermCharset = MkAtomTerm(AtomCharset); - AtomChType = Yap_FullLookupAtom("$char_type"); TermChType = MkAtomTerm(AtomChType); - AtomCleanCall = Yap_FullLookupAtom("$clean_call"); TermCleanCall = MkAtomTerm(AtomCleanCall); - AtomClose = Yap_LookupAtom("close"); TermClose = MkAtomTerm(AtomClose); - AtomColon = Yap_LookupAtom(":"); TermColon = MkAtomTerm(AtomColon); - AtomCodeSpace = Yap_LookupAtom("code_space"); TermCodeSpace = MkAtomTerm(AtomCodeSpace); - AtomCodes = Yap_LookupAtom("codes"); TermCodes = MkAtomTerm(AtomCodes); - AtomCoInductive = Yap_LookupAtom("coinductive"); TermCoInductive = MkAtomTerm(AtomCoInductive); - AtomComma = Yap_LookupAtom(","); TermComma = MkAtomTerm(AtomComma); - AtomCommentHook = Yap_LookupAtom("comment_hook"); TermCommentHook = MkAtomTerm(AtomCommentHook); - AtomCompact = Yap_LookupAtom("compact"); TermCompact = MkAtomTerm(AtomCompact); - AtomCompound = Yap_LookupAtom("compound"); TermCompound = MkAtomTerm(AtomCompound); - AtomConsistencyError = Yap_LookupAtom("consistency_error"); TermConsistencyError = MkAtomTerm(AtomConsistencyError); - AtomConsult = Yap_LookupAtom("consult"); TermConsult = MkAtomTerm(AtomConsult); - AtomConsultOnBoot = Yap_FullLookupAtom("$consult_on_boot"); TermConsultOnBoot = MkAtomTerm(AtomConsultOnBoot); - AtomContext = Yap_LookupAtom("context"); TermContext = MkAtomTerm(AtomContext); - AtomCputime = Yap_LookupAtom("cputime"); TermCputime = MkAtomTerm(AtomCputime); - AtomCreate = Yap_LookupAtom("create"); TermCreate = MkAtomTerm(AtomCreate); - AtomCreep = Yap_FullLookupAtom("$creep"); TermCreep = MkAtomTerm(AtomCreep); - AtomCryptAtoms = Yap_LookupAtom("crypt_atoms"); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms); - AtomCurly = Yap_LookupAtom("{}"); TermCurly = MkAtomTerm(AtomCurly); - AtomCsult = Yap_FullLookupAtom("$csult"); TermCsult = MkAtomTerm(AtomCsult); - AtomCurrentModule = Yap_FullLookupAtom("$current_module"); TermCurrentModule = MkAtomTerm(AtomCurrentModule); - AtomCut = Yap_LookupAtom("!"); TermCut = MkAtomTerm(AtomCut); - AtomCutBy = Yap_FullLookupAtom("$cut_by"); TermCutBy = MkAtomTerm(AtomCutBy); - AtomDAbort = Yap_LookupAtom("abort"); TermDAbort = MkAtomTerm(AtomDAbort); - AtomDBLoad = Yap_FullLookupAtom("$db_load"); TermDBLoad = MkAtomTerm(AtomDBLoad); - AtomDBREF = Yap_LookupAtom("DBRef"); TermDBREF = MkAtomTerm(AtomDBREF); - AtomDBReference = Yap_LookupAtom("db_reference"); TermDBReference = MkAtomTerm(AtomDBReference); - AtomDBTerm = Yap_LookupAtom("db_term"); TermDBTerm = MkAtomTerm(AtomDBTerm); - AtomDBref = Yap_FullLookupAtom("$dbref"); TermDBref = MkAtomTerm(AtomDBref); - AtomDInteger = Yap_FullLookupAtom("$integer"); TermDInteger = MkAtomTerm(AtomDInteger); - AtomDebugMeta = Yap_FullLookupAtom("$debug_meta"); TermDebugMeta = MkAtomTerm(AtomDebugMeta); - AtomDebuggerInput = Yap_LookupAtom("debugger_input"); TermDebuggerInput = MkAtomTerm(AtomDebuggerInput); - AtomDec10 = Yap_LookupAtom("dec10"); TermDec10 = MkAtomTerm(AtomDec10); - AtomDefault = Yap_LookupAtom("default"); TermDefault = MkAtomTerm(AtomDefault); - AtomDevNull = Yap_LookupAtom("/dev/null"); TermDevNull = MkAtomTerm(AtomDevNull); - AtomDiff = Yap_LookupAtom("\\="); TermDiff = MkAtomTerm(AtomDiff); - AtomDirectory = Yap_LookupAtom("disrectorys"); TermDirectory = MkAtomTerm(AtomDirectory); - AtomDiscontiguous = Yap_LookupAtom("discontiguous"); TermDiscontiguous = MkAtomTerm(AtomDiscontiguous); - AtomDiscontiguousWarnings = Yap_LookupAtom("discontiguous_warnings"); TermDiscontiguousWarnings = MkAtomTerm(AtomDiscontiguousWarnings); - AtomDollar = Yap_FullLookupAtom("$"); TermDollar = MkAtomTerm(AtomDollar); - AtomDoLogUpdClause = Yap_FullLookupAtom("$do_log_upd_clause"); TermDoLogUpdClause = MkAtomTerm(AtomDoLogUpdClause); - AtomDoLogUpdClause0 = Yap_FullLookupAtom("$do_log_upd_clause0"); TermDoLogUpdClause0 = MkAtomTerm(AtomDoLogUpdClause0); - AtomDoLogUpdClauseErase = Yap_FullLookupAtom("$do_log_upd_clause_erase"); TermDoLogUpdClauseErase = MkAtomTerm(AtomDoLogUpdClauseErase); - AtomDollarU = Yap_FullLookupAtom("$u"); TermDollarU = MkAtomTerm(AtomDollarU); - AtomDollarUndef = Yap_FullLookupAtom("$undef"); TermDollarUndef = MkAtomTerm(AtomDollarUndef); - AtomDomainError = Yap_LookupAtom("domain_error"); TermDomainError = MkAtomTerm(AtomDomainError); - AtomDoStaticClause = Yap_FullLookupAtom("$do_static_clause"); TermDoStaticClause = MkAtomTerm(AtomDoStaticClause); - AtomDots = Yap_LookupAtom("dots"); TermDots = MkAtomTerm(AtomDots); - AtomDOUBLE = Yap_FullLookupAtom("Double"); TermDOUBLE = MkAtomTerm(AtomDOUBLE); - AtomDoubleSlash = Yap_FullLookupAtom("//"); TermDoubleSlash = MkAtomTerm(AtomDoubleSlash); - AtomE = Yap_LookupAtom("e"); TermE = MkAtomTerm(AtomE); - AtomEOFBeforeEOT = Yap_LookupAtom("end_of_file_found_before_end_of_term"); TermEOFBeforeEOT = MkAtomTerm(AtomEOFBeforeEOT); - AtomEQ = Yap_LookupAtom("="); TermEQ = MkAtomTerm(AtomEQ); - AtomEmptyAtom = Yap_LookupAtom(""); TermEmptyAtom = MkAtomTerm(AtomEmptyAtom); - AtomEncoding = Yap_LookupAtom("encoding"); TermEncoding = MkAtomTerm(AtomEncoding); - AtomEndOfStream = Yap_LookupAtom("$end_of_stream"); TermEndOfStream = MkAtomTerm(AtomEndOfStream); - AtomEof = Yap_LookupAtom("end_of_file"); TermEof = MkAtomTerm(AtomEof); - AtomEOfCode = Yap_LookupAtom("eof_code"); TermEOfCode = MkAtomTerm(AtomEOfCode); - AtomEq = Yap_LookupAtom("="); TermEq = MkAtomTerm(AtomEq); - AtomError = Yap_LookupAtom("error"); TermError = MkAtomTerm(AtomError); - AtomException = Yap_LookupAtom("exception"); TermException = MkAtomTerm(AtomException); - AtomExtensions = Yap_LookupAtom("extensions"); TermExtensions = MkAtomTerm(AtomExtensions); - AtomEvaluable = Yap_LookupAtom("evaluable"); TermEvaluable = MkAtomTerm(AtomEvaluable); - AtomEvaluationError = Yap_LookupAtom("evaluation_error"); TermEvaluationError = MkAtomTerm(AtomEvaluationError); - AtomExecutable = Yap_LookupAtom("executable"); TermExecutable = MkAtomTerm(AtomExecutable); - AtomExecute = Yap_LookupAtom("execute"); TermExecute = MkAtomTerm(AtomExecute); - AtomExecAnswers = Yap_LookupAtom("exec_answers"); TermExecAnswers = MkAtomTerm(AtomExecAnswers); - AtomExecuteInMod = Yap_FullLookupAtom("$execute_in_mod"); TermExecuteInMod = MkAtomTerm(AtomExecuteInMod); - AtomExecuteWithin = Yap_FullLookupAtom("$execute_within"); TermExecuteWithin = MkAtomTerm(AtomExecuteWithin); - AtomExecuteWoMod = Yap_FullLookupAtom("$execute_wo_mod"); TermExecuteWoMod = MkAtomTerm(AtomExecuteWoMod); - AtomExist = Yap_LookupAtom("exist"); TermExist = MkAtomTerm(AtomExist); - AtomExists = Yap_LookupAtom("exists"); TermExists = MkAtomTerm(AtomExists); - AtomExit = Yap_LookupAtom("exit"); TermExit = MkAtomTerm(AtomExit); - AtomExistenceError = Yap_LookupAtom("existence_error"); TermExistenceError = MkAtomTerm(AtomExistenceError); - AtomExoClause = Yap_FullLookupAtom("$exo_clause"); TermExoClause = MkAtomTerm(AtomExoClause); - AtomExpectedNumber = Yap_LookupAtom("expected_number_syntax"); TermExpectedNumber = MkAtomTerm(AtomExpectedNumber); - AtomExpand = Yap_LookupAtom("expand"); TermExpand = MkAtomTerm(AtomExpand); - AtomExtendFileSearchPath = Yap_FullLookupAtom("$extend_file_search_path"); TermExtendFileSearchPath = MkAtomTerm(AtomExtendFileSearchPath); - AtomExtendsions = Yap_LookupAtom("extensionh"); TermExtendsions = MkAtomTerm(AtomExtendsions); - AtomFB = Yap_LookupAtom("fb"); TermFB = MkAtomTerm(AtomFB); - AtomFail = Yap_LookupAtom("fail"); TermFail = MkAtomTerm(AtomFail); - AtomFalse = Yap_LookupAtom("false"); TermFalse = MkAtomTerm(AtomFalse); - AtomFast = Yap_FullLookupAtom("$fast"); TermFast = MkAtomTerm(AtomFast); - AtomFastFail = Yap_LookupAtom("fast_fail"); TermFastFail = MkAtomTerm(AtomFastFail); - AtomFileErrors = Yap_LookupAtom("file_errors"); TermFileErrors = MkAtomTerm(AtomFileErrors); - AtomFileerrors = Yap_LookupAtom("fileerrors"); TermFileerrors = MkAtomTerm(AtomFileerrors); - AtomFileType = Yap_LookupAtom("file_type"); TermFileType = MkAtomTerm(AtomFileType); - AtomFirst = Yap_LookupAtom("first"); TermFirst = MkAtomTerm(AtomFirst); - AtomFloat = Yap_LookupAtom("float"); TermFloat = MkAtomTerm(AtomFloat); - AtomFloatFormat = Yap_LookupAtom("\%.15g"); TermFloatFormat = MkAtomTerm(AtomFloatFormat); - AtomFloatOverflow = Yap_LookupAtom("float_overflow"); TermFloatOverflow = MkAtomTerm(AtomFloatOverflow); - AtomFloatUnderflow = Yap_LookupAtom("float_underflow"); TermFloatUnderflow = MkAtomTerm(AtomFloatUnderflow); - AtomFormat = Yap_LookupAtom("format"); TermFormat = MkAtomTerm(AtomFormat); - AtomFormatAt = Yap_FullLookupAtom("$format@"); TermFormatAt = MkAtomTerm(AtomFormatAt); - AtomFull = Yap_LookupAtom("full"); TermFull = MkAtomTerm(AtomFull); - AtomFunctor = Yap_LookupAtom("functor"); TermFunctor = MkAtomTerm(AtomFunctor); - AtomGT = Yap_LookupAtom(">"); TermGT = MkAtomTerm(AtomGT); - AtomGVar = Yap_LookupAtom("var"); TermGVar = MkAtomTerm(AtomGVar); - AtomGc = Yap_FullLookupAtom("$gc"); TermGc = MkAtomTerm(AtomGc); - AtomGcMargin = Yap_FullLookupAtom("$gc_margin"); TermGcMargin = MkAtomTerm(AtomGcMargin); - AtomGcTrace = Yap_FullLookupAtom("$gc_trace"); TermGcTrace = MkAtomTerm(AtomGcTrace); - AtomGcVerbose = Yap_FullLookupAtom("$gc_verbose"); TermGcVerbose = MkAtomTerm(AtomGcVerbose); - AtomGcVeryVerbose = Yap_FullLookupAtom("$gc_very_verbose"); TermGcVeryVerbose = MkAtomTerm(AtomGcVeryVerbose); - AtomGeneratePredInfo = Yap_FullLookupAtom("$generate_pred_info"); TermGeneratePredInfo = MkAtomTerm(AtomGeneratePredInfo); - AtomGetwork = Yap_FullLookupAtom("$getwork"); TermGetwork = MkAtomTerm(AtomGetwork); - AtomGetworkSeq = Yap_FullLookupAtom("$getwork_seq"); TermGetworkSeq = MkAtomTerm(AtomGetworkSeq); - AtomGlob = Yap_LookupAtom("glob"); TermGlob = MkAtomTerm(AtomGlob); - AtomGlobal = Yap_LookupAtom("global"); TermGlobal = MkAtomTerm(AtomGlobal); - AtomGlobalSp = Yap_LookupAtom("global_sp"); TermGlobalSp = MkAtomTerm(AtomGlobalSp); - AtomGlobalTrie = Yap_LookupAtom("global_trie"); TermGlobalTrie = MkAtomTerm(AtomGlobalTrie); - AtomGoalExpansion = Yap_LookupAtom("goal_expansion"); TermGoalExpansion = MkAtomTerm(AtomGoalExpansion); - AtomHat = Yap_LookupAtom("^"); TermHat = MkAtomTerm(AtomHat); - AtomHERE = Yap_LookupAtom("\n <====HERE====> \n"); TermHERE = MkAtomTerm(AtomHERE); - AtomHandleThrow = Yap_FullLookupAtom("$handle_throw"); TermHandleThrow = MkAtomTerm(AtomHandleThrow); - AtomHeap = Yap_LookupAtom("heap"); TermHeap = MkAtomTerm(AtomHeap); - AtomHeapUsed = Yap_LookupAtom("heapused"); TermHeapUsed = MkAtomTerm(AtomHeapUsed); - AtomHugeInt = Yap_LookupAtom("huge_int"); TermHugeInt = MkAtomTerm(AtomHugeInt); - AtomIDB = Yap_LookupAtom("idb"); TermIDB = MkAtomTerm(AtomIDB); - AtomIOMode = Yap_LookupAtom("io_mode"); TermIOMode = MkAtomTerm(AtomIOMode); - AtomI = Yap_LookupAtom("i"); TermI = MkAtomTerm(AtomI); - AtomId = Yap_LookupAtom("id"); TermId = MkAtomTerm(AtomId); - AtomIgnore = Yap_LookupAtom("ignore"); TermIgnore = MkAtomTerm(AtomIgnore); - AtomInf = Yap_LookupAtom("inf"); TermInf = MkAtomTerm(AtomInf); - AtomInfinity = Yap_LookupAtom("infinity"); TermInfinity = MkAtomTerm(AtomInfinity); - AtomInfo = Yap_LookupAtom("info"); TermInfo = MkAtomTerm(AtomInfo); - AtomInitGoal = Yap_FullLookupAtom("$init_goal"); TermInitGoal = MkAtomTerm(AtomInitGoal); - AtomInitProlog = Yap_FullLookupAtom("$init_prolog"); TermInitProlog = MkAtomTerm(AtomInitProlog); - AtomInStackExpansion = Yap_LookupAtom("in stack expansion"); TermInStackExpansion = MkAtomTerm(AtomInStackExpansion); - AtomInput = Yap_LookupAtom("input"); TermInput = MkAtomTerm(AtomInput); - AtomInstantiationError = Yap_LookupAtom("instantiation_error"); TermInstantiationError = MkAtomTerm(AtomInstantiationError); - AtomInt = Yap_LookupAtom("int"); TermInt = MkAtomTerm(AtomInt); - AtomIntOverflow = Yap_LookupAtom("int_overflow"); TermIntOverflow = MkAtomTerm(AtomIntOverflow); - AtomInteger = Yap_LookupAtom("integer"); TermInteger = MkAtomTerm(AtomInteger); - AtomInternalCompilerError = Yap_LookupAtom("internal_compiler_error"); TermInternalCompilerError = MkAtomTerm(AtomInternalCompilerError); - AtomIs = Yap_LookupAtom("is"); TermIs = MkAtomTerm(AtomIs); - AtomJ = Yap_LookupAtom("j"); TermJ = MkAtomTerm(AtomJ); - Atoml = Yap_LookupAtom("l"); Terml = MkAtomTerm(Atoml); - AtomKey = Yap_LookupAtom("key"); TermKey = MkAtomTerm(AtomKey); - AtomLDLibraryPath = Yap_LookupAtom("LD_LIBRARY_PATH"); TermLDLibraryPath = MkAtomTerm(AtomLDLibraryPath); - AtomLONGINT = Yap_LookupAtom("LongInt"); TermLONGINT = MkAtomTerm(AtomLONGINT); - AtomLOOP = Yap_LookupAtom("_LOOP_"); TermLOOP = MkAtomTerm(AtomLOOP); - AtomLoopStream = Yap_LookupAtom("loop_stream"); TermLoopStream = MkAtomTerm(AtomLoopStream); - AtomLT = Yap_LookupAtom("<"); TermLT = MkAtomTerm(AtomLT); - AtomLastExecuteWithin = Yap_FullLookupAtom("$last_execute_within"); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin); - AtomLeash = Yap_FullLookupAtom("$leash"); TermLeash = MkAtomTerm(AtomLeash); - AtomLeast = Yap_LookupAtom("least"); TermLeast = MkAtomTerm(AtomLeast); - AtomLength = Yap_FullLookupAtom("length"); TermLength = MkAtomTerm(AtomLength); - AtomList = Yap_LookupAtom("list"); TermList = MkAtomTerm(AtomList); - AtomLine = Yap_LookupAtom("line"); TermLine = MkAtomTerm(AtomLine); - AtomLive = Yap_FullLookupAtom("$live"); TermLive = MkAtomTerm(AtomLive); - AtomLoadAnswers = Yap_LookupAtom("load_answers"); TermLoadAnswers = MkAtomTerm(AtomLoadAnswers); - AtomLocal = Yap_LookupAtom("local"); TermLocal = MkAtomTerm(AtomLocal); - AtomLocalSp = Yap_LookupAtom("local_sp"); TermLocalSp = MkAtomTerm(AtomLocalSp); - AtomLocalTrie = Yap_LookupAtom("local_trie"); TermLocalTrie = MkAtomTerm(AtomLocalTrie); - AtomMax = Yap_LookupAtom("max"); TermMax = MkAtomTerm(AtomMax); - AtomMaximum = Yap_LookupAtom("maximum"); TermMaximum = MkAtomTerm(AtomMaximum); - AtomMaxArity = Yap_LookupAtom("max_arity"); TermMaxArity = MkAtomTerm(AtomMaxArity); - AtomMaxFiles = Yap_LookupAtom("max_files"); TermMaxFiles = MkAtomTerm(AtomMaxFiles); - AtomMegaClause = Yap_FullLookupAtom("$mega_clause"); TermMegaClause = MkAtomTerm(AtomMegaClause); - AtomMetaCall = Yap_FullLookupAtom("$call"); TermMetaCall = MkAtomTerm(AtomMetaCall); - AtomMfClause = Yap_FullLookupAtom("$mf_clause"); TermMfClause = MkAtomTerm(AtomMfClause); - AtomMin = Yap_LookupAtom("min"); TermMin = MkAtomTerm(AtomMin); - AtomMinimum = Yap_LookupAtom("minimum"); TermMinimum = MkAtomTerm(AtomMinimum); - AtomMinus = Yap_LookupAtom("-"); TermMinus = MkAtomTerm(AtomMinus); - AtomModify = Yap_LookupAtom("modify"); TermModify = MkAtomTerm(AtomModify); - AtomModule = Yap_LookupAtom("module"); TermModule = MkAtomTerm(AtomModule); - AtomMost = Yap_LookupAtom("most"); TermMost = MkAtomTerm(AtomMost); - AtomMulti = Yap_LookupAtom("multi"); TermMulti = MkAtomTerm(AtomMulti); - AtomMultiFile = Yap_FullLookupAtom("$mf"); TermMultiFile = MkAtomTerm(AtomMultiFile); - AtomMultiple = Yap_FullLookupAtom("multiple"); TermMultiple = MkAtomTerm(AtomMultiple); - AtomMutable = Yap_LookupAtom("mutable"); TermMutable = MkAtomTerm(AtomMutable); - AtomMutableVariable = Yap_FullLookupAtom("$mutable_variable"); TermMutableVariable = MkAtomTerm(AtomMutableVariable); - AtomMutex = Yap_LookupAtom("mutex"); TermMutex = MkAtomTerm(AtomMutex); - AtomMyddasDB = Yap_FullLookupAtom("$myddas_db"); TermMyddasDB = MkAtomTerm(AtomMyddasDB); - AtomMyddasGoal = Yap_FullLookupAtom("$myddas_goal"); TermMyddasGoal = MkAtomTerm(AtomMyddasGoal); - AtomMyddasHost = Yap_FullLookupAtom("$myddas_host"); TermMyddasHost = MkAtomTerm(AtomMyddasHost); - AtomMyddasPass = Yap_FullLookupAtom("$myddas_pass"); TermMyddasPass = MkAtomTerm(AtomMyddasPass); - AtomMyddasUser = Yap_FullLookupAtom("$myddas_user"); TermMyddasUser = MkAtomTerm(AtomMyddasUser); - AtomMyddasVersionName = Yap_FullLookupAtom("$myddas_version_name"); TermMyddasVersionName = MkAtomTerm(AtomMyddasVersionName); - AtomNan = Yap_LookupAtom("nan"); TermNan = MkAtomTerm(AtomNan); - AtomNb = Yap_LookupAtom("nb"); TermNb = MkAtomTerm(AtomNb); - AtomNbTerm = Yap_LookupAtom("nb_term"); TermNbTerm = MkAtomTerm(AtomNbTerm); - AtomNew = Yap_LookupAtom("new"); TermNew = MkAtomTerm(AtomNew); - AtomNewLine = Yap_LookupAtom("nl"); TermNewLine = MkAtomTerm(AtomNewLine); - AtomNl = Yap_LookupAtom("nl"); TermNl = MkAtomTerm(AtomNl); - AtomNoEffect = Yap_LookupAtom("no_effect"); TermNoEffect = MkAtomTerm(AtomNoEffect); - AtomNoMemory = Yap_LookupAtom("no_memory"); TermNoMemory = MkAtomTerm(AtomNoMemory); - AtomNone = Yap_LookupAtom("none"); TermNone = MkAtomTerm(AtomNone); - AtomNonEmptyList = Yap_LookupAtom("non_empty_list"); TermNonEmptyList = MkAtomTerm(AtomNonEmptyList); - AtomNot = Yap_LookupAtom("\\+"); TermNot = MkAtomTerm(AtomNot); - AtomNotImplemented = Yap_LookupAtom("not_implemented"); TermNotImplemented = MkAtomTerm(AtomNotImplemented); - AtomNotLessThanZero = Yap_LookupAtom("not_less_than_zero"); TermNotLessThanZero = MkAtomTerm(AtomNotLessThanZero); - AtomNotNewline = Yap_LookupAtom("not_newline"); TermNotNewline = MkAtomTerm(AtomNotNewline); - AtomNotZero = Yap_LookupAtom("not_zero"); TermNotZero = MkAtomTerm(AtomNotZero); - AtomNumber = Yap_LookupAtom("number"); TermNumber = MkAtomTerm(AtomNumber); - AtomObj = Yap_LookupAtom("o__bj__"); TermObj = MkAtomTerm(AtomObj); - AtomOff = Yap_LookupAtom("off"); TermOff = MkAtomTerm(AtomOff); - AtomOffline = Yap_LookupAtom("offline"); TermOffline = MkAtomTerm(AtomOffline); - AtomOn = Yap_LookupAtom("on"); TermOn = MkAtomTerm(AtomOn); - AtomOnline = Yap_LookupAtom("online"); TermOnline = MkAtomTerm(AtomOnline); - AtomOpen = Yap_LookupAtom("open"); TermOpen = MkAtomTerm(AtomOpen); - AtomOperatingSystemError = Yap_LookupAtom("operating_SYSTEM_ERROR_INTERNAL"); TermOperatingSystemError = MkAtomTerm(AtomOperatingSystemError); - AtomOperatingSystemSupport = Yap_LookupAtom("operating_system_support"); TermOperatingSystemSupport = MkAtomTerm(AtomOperatingSystemSupport); - AtomOperator = Yap_LookupAtom("operator"); TermOperator = MkAtomTerm(AtomOperator); - AtomOperatorPriority = Yap_LookupAtom("operator_priority"); TermOperatorPriority = MkAtomTerm(AtomOperatorPriority); - AtomOperatorSpecifier = Yap_LookupAtom("operator_specifier"); TermOperatorSpecifier = MkAtomTerm(AtomOperatorSpecifier); - AtomOpt = Yap_LookupAtom("opt"); TermOpt = MkAtomTerm(AtomOpt); - AtomOtherwise = Yap_LookupAtom("otherwise"); TermOtherwise = MkAtomTerm(AtomOtherwise); - AtomOutOfAttvarsError = Yap_LookupAtom("out_of_attvars_error"); TermOutOfAttvarsError = MkAtomTerm(AtomOutOfAttvarsError); - AtomOutOfAuxspaceError = Yap_LookupAtom("out_of_auxspace_error"); TermOutOfAuxspaceError = MkAtomTerm(AtomOutOfAuxspaceError); - AtomOutOfHeapError = Yap_LookupAtom("out_of_heap_error"); TermOutOfHeapError = MkAtomTerm(AtomOutOfHeapError); - AtomOutOfRange = Yap_LookupAtom("out_of_range"); TermOutOfRange = MkAtomTerm(AtomOutOfRange); - AtomOutOfStackError = Yap_LookupAtom("out_of_stack_error"); TermOutOfStackError = MkAtomTerm(AtomOutOfStackError); - AtomOutOfTrailError = Yap_LookupAtom("out_of_trail_error"); TermOutOfTrailError = MkAtomTerm(AtomOutOfTrailError); - AtomOutput = Yap_LookupAtom("output"); TermOutput = MkAtomTerm(AtomOutput); - AtomParameter = Yap_LookupAtom("parameter"); TermParameter = MkAtomTerm(AtomParameter); - AtomPrologCommonsDir = Yap_LookupAtom("prolog_commons_directory"); TermPrologCommonsDir = MkAtomTerm(AtomPrologCommonsDir); - AtomPast = Yap_LookupAtom("past"); TermPast = MkAtomTerm(AtomPast); - AtomPastEndOfStream = Yap_LookupAtom("past_end_of_stream"); TermPastEndOfStream = MkAtomTerm(AtomPastEndOfStream); - AtomPermissionError = Yap_LookupAtom("permission_error"); TermPermissionError = MkAtomTerm(AtomPermissionError); - AtomPi = Yap_LookupAtom("pi"); TermPi = MkAtomTerm(AtomPi); - AtomPipe = Yap_LookupAtom("pipe"); TermPipe = MkAtomTerm(AtomPipe); - AtomPriority = Yap_LookupAtom("priority"); TermPriority = MkAtomTerm(AtomPriority); - AtomPlus = Yap_LookupAtom("+"); TermPlus = MkAtomTerm(AtomPlus); - AtomPointer = Yap_LookupAtom("pointer"); TermPointer = MkAtomTerm(AtomPointer); - AtomPortray = Yap_FullLookupAtom("portray"); TermPortray = MkAtomTerm(AtomPortray); - AtomPredicateIndicator = Yap_LookupAtom("predicate_indicator"); TermPredicateIndicator = MkAtomTerm(AtomPredicateIndicator); - AtomPrimitive = Yap_LookupAtom("primitive"); TermPrimitive = MkAtomTerm(AtomPrimitive); - AtomPrintMessage = Yap_LookupAtom("print_message"); TermPrintMessage = MkAtomTerm(AtomPrintMessage); - AtomPrivateProcedure = Yap_LookupAtom("private_procedure"); TermPrivateProcedure = MkAtomTerm(AtomPrivateProcedure); - AtomProcedure = Yap_LookupAtom("procedure"); TermProcedure = MkAtomTerm(AtomProcedure); - AtomProfile = Yap_FullLookupAtom("$profile"); TermProfile = MkAtomTerm(AtomProfile); - AtomProlog = Yap_LookupAtom("prolog"); TermProlog = MkAtomTerm(AtomProlog); - AtomProtectStack = Yap_FullLookupAtom("$protect_stack"); TermProtectStack = MkAtomTerm(AtomProtectStack); - AtomQly = Yap_LookupAtom("qly"); TermQly = MkAtomTerm(AtomQly); - AtomQuery = Yap_LookupAtom("?-"); TermQuery = MkAtomTerm(AtomQuery); - AtomQueue = Yap_LookupAtom("queue"); TermQueue = MkAtomTerm(AtomQueue); - AtomQuiet = Yap_LookupAtom("quiet"); TermQuiet = MkAtomTerm(AtomQuiet); - AtomRadix = Yap_LookupAtom("radix"); TermRadix = MkAtomTerm(AtomRadix); - AtomRandom = Yap_LookupAtom("random"); TermRandom = MkAtomTerm(AtomRandom); - AtomRange = Yap_LookupAtom("range"); TermRange = MkAtomTerm(AtomRange); - AtomRDiv = Yap_LookupAtom("rdiv"); TermRDiv = MkAtomTerm(AtomRDiv); - AtomRead = Yap_LookupAtom("read"); TermRead = MkAtomTerm(AtomRead); - AtomReadOnly = Yap_LookupAtom("read_only"); TermReadOnly = MkAtomTerm(AtomReadOnly); - AtomReadWrite = Yap_LookupAtom("read_write"); TermReadWrite = MkAtomTerm(AtomReadWrite); - AtomReadutil = Yap_LookupAtom("readutil"); TermReadutil = MkAtomTerm(AtomReadutil); - AtomReconsult = Yap_LookupAtom("reconsult"); TermReconsult = MkAtomTerm(AtomReconsult); - AtomRecordedP = Yap_FullLookupAtom("$recordep"); TermRecordedP = MkAtomTerm(AtomRecordedP); - AtomRecordedWithKey = Yap_FullLookupAtom("$recorded_with_key"); TermRecordedWithKey = MkAtomTerm(AtomRecordedWithKey); - AtomRedefineWarnings = Yap_LookupAtom("redefine_warnings"); TermRedefineWarnings = MkAtomTerm(AtomRedefineWarnings); - AtomRedoFreeze = Yap_FullLookupAtom("$redo_freeze"); TermRedoFreeze = MkAtomTerm(AtomRedoFreeze); - AtomRefoundVar = Yap_FullLookupAtom("$I_FOUND_THE_VARIABLE_AGAIN"); TermRefoundVar = MkAtomTerm(AtomRefoundVar); - AtomRelativeTo = Yap_FullLookupAtom("relative_to"); TermRelativeTo = MkAtomTerm(AtomRelativeTo); - AtomRepeat = Yap_LookupAtom("repeat"); TermRepeat = MkAtomTerm(AtomRepeat); - AtomRepeatSpace = Yap_LookupAtom("repeat "); TermRepeatSpace = MkAtomTerm(AtomRepeatSpace); - AtomReposition = Yap_LookupAtom("reposition"); TermReposition = MkAtomTerm(AtomReposition); - AtomRepresentationError = Yap_LookupAtom("representation_error"); TermRepresentationError = MkAtomTerm(AtomRepresentationError); - AtomReset = Yap_LookupAtom("reset"); TermReset = MkAtomTerm(AtomReset); - AtomResize = Yap_LookupAtom("resize"); TermResize = MkAtomTerm(AtomResize); - AtomResourceError = Yap_LookupAtom("resource_error"); TermResourceError = MkAtomTerm(AtomResourceError); - AtomRestoreRegs = Yap_FullLookupAtom("$restore_regs"); TermRestoreRegs = MkAtomTerm(AtomRestoreRegs); - AtomRetry = Yap_LookupAtom("retry"); TermRetry = MkAtomTerm(AtomRetry); - AtomRetryCounter = Yap_LookupAtom("retry_counter"); TermRetryCounter = MkAtomTerm(AtomRetryCounter); - AtomRTree = Yap_LookupAtom("rtree"); TermRTree = MkAtomTerm(AtomRTree); - AtomSafe = Yap_FullLookupAtom("$safe"); TermSafe = MkAtomTerm(AtomSafe); - AtomSafeCallCleanup = Yap_FullLookupAtom("$safe_call_cleanup"); TermSafeCallCleanup = MkAtomTerm(AtomSafeCallCleanup); - AtomSame = Yap_LookupAtom("=="); TermSame = MkAtomTerm(AtomSame); - AtomSemic = Yap_LookupAtom(";"); TermSemic = MkAtomTerm(AtomSemic); - AtomShiftCountOverflow = Yap_LookupAtom("shift_count_overflow"); TermShiftCountOverflow = MkAtomTerm(AtomShiftCountOverflow); - AtomSigAlarm = Yap_LookupAtom("sig_alarm"); TermSigAlarm = MkAtomTerm(AtomSigAlarm); - AtomSigBreak = Yap_LookupAtom("sig_break"); TermSigBreak = MkAtomTerm(AtomSigBreak); - AtomSigCreep = Yap_LookupAtom("sig_creep"); TermSigCreep = MkAtomTerm(AtomSigCreep); - AtomSigDebug = Yap_LookupAtom("sig_debug"); TermSigDebug = MkAtomTerm(AtomSigDebug); - AtomSigDelayCreep = Yap_LookupAtom("sig_delay_creep"); TermSigDelayCreep = MkAtomTerm(AtomSigDelayCreep); - AtomSigFPE = Yap_LookupAtom("sig_fpe"); TermSigFPE = MkAtomTerm(AtomSigFPE); - AtomSigHup = Yap_LookupAtom("sig_hup"); TermSigHup = MkAtomTerm(AtomSigHup); - AtomSigInt = Yap_LookupAtom("sig_int"); TermSigInt = MkAtomTerm(AtomSigInt); - AtomSigIti = Yap_LookupAtom("sig_iti"); TermSigIti = MkAtomTerm(AtomSigIti); - AtomSigPending = Yap_FullLookupAtom("$sig_pending"); TermSigPending = MkAtomTerm(AtomSigPending); - AtomSigPipe = Yap_LookupAtom("sig_pipe"); TermSigPipe = MkAtomTerm(AtomSigPipe); - AtomSigStackDump = Yap_LookupAtom("sig_stack_dump"); TermSigStackDump = MkAtomTerm(AtomSigStackDump); - AtomSigStatistics = Yap_LookupAtom("sig_statistics"); TermSigStatistics = MkAtomTerm(AtomSigStatistics); - AtomSigTrace = Yap_LookupAtom("sig_trace"); TermSigTrace = MkAtomTerm(AtomSigTrace); - AtomSigUsr1 = Yap_LookupAtom("sig_usr1"); TermSigUsr1 = MkAtomTerm(AtomSigUsr1); - AtomSigUsr2 = Yap_LookupAtom("sig_usr2"); TermSigUsr2 = MkAtomTerm(AtomSigUsr2); - AtomSigVTAlarm = Yap_LookupAtom("sig_vtalarm"); TermSigVTAlarm = MkAtomTerm(AtomSigVTAlarm); - AtomSigWakeUp = Yap_LookupAtom("sig_wake_up"); TermSigWakeUp = MkAtomTerm(AtomSigWakeUp); - AtomSilent = Yap_LookupAtom("Silent"); TermSilent = MkAtomTerm(AtomSilent); - AtomSingle = Yap_LookupAtom("single"); TermSingle = MkAtomTerm(AtomSingle); - AtomSingleVarWarnings = Yap_LookupAtom("single_var_warnings"); TermSingleVarWarnings = MkAtomTerm(AtomSingleVarWarnings); - AtomSingleton = Yap_LookupAtom("singleton"); TermSingleton = MkAtomTerm(AtomSingleton); - AtomSlash = Yap_LookupAtom("/"); TermSlash = MkAtomTerm(AtomSlash); - AtomSocket = Yap_LookupAtom("socket"); TermSocket = MkAtomTerm(AtomSocket); - AtomSolutions = Yap_LookupAtom("solutions"); TermSolutions = MkAtomTerm(AtomSolutions); - AtomSource = Yap_LookupAtom("source"); TermSource = MkAtomTerm(AtomSource); - AtomSourceSink = Yap_LookupAtom("source_sink"); TermSourceSink = MkAtomTerm(AtomSourceSink); - AtomSpy = Yap_FullLookupAtom("$spy"); TermSpy = MkAtomTerm(AtomSpy); - AtomStack = Yap_LookupAtom("stack"); TermStack = MkAtomTerm(AtomStack); - AtomStackFree = Yap_LookupAtom("stackfree"); TermStackFree = MkAtomTerm(AtomStackFree); - AtomStartupSavedState = Yap_FullLookupAtom("$startup_saved_state"); TermStartupSavedState = MkAtomTerm(AtomStartupSavedState); - AtomStaticClause = Yap_FullLookupAtom("$static_clause"); TermStaticClause = MkAtomTerm(AtomStaticClause); - AtomStaticProcedure = Yap_LookupAtom("static_procedure"); TermStaticProcedure = MkAtomTerm(AtomStaticProcedure); - AtomStream = Yap_FullLookupAtom("$stream"); TermStream = MkAtomTerm(AtomStream); - AtomSWIStream = Yap_FullLookupAtom(""); TermSWIStream = MkAtomTerm(AtomSWIStream); - AtomVStream = Yap_LookupAtom("stream"); TermVStream = MkAtomTerm(AtomVStream); - AtomStreams = Yap_LookupAtom("streams"); TermStreams = MkAtomTerm(AtomStreams); - AtomStreamOrAlias = Yap_LookupAtom("stream_or_alias"); TermStreamOrAlias = MkAtomTerm(AtomStreamOrAlias); - AtomStreamPos = Yap_FullLookupAtom("$stream_position"); TermStreamPos = MkAtomTerm(AtomStreamPos); - AtomStreamPosition = Yap_LookupAtom("stream_position"); TermStreamPosition = MkAtomTerm(AtomStreamPosition); - AtomString = Yap_LookupAtom("string"); TermString = MkAtomTerm(AtomString); - AtomStyleCheck = Yap_LookupAtom("style_check"); TermStyleCheck = MkAtomTerm(AtomStyleCheck); - AtomSTRING = Yap_FullLookupAtom("String"); TermSTRING = MkAtomTerm(AtomSTRING); - AtomSwi = Yap_LookupAtom("swi"); TermSwi = MkAtomTerm(AtomSwi); - AtomSymbolChar = Yap_LookupAtom("symbol_char"); TermSymbolChar = MkAtomTerm(AtomSymbolChar); - AtomSyntaxError = Yap_LookupAtom("syntax_error"); TermSyntaxError = MkAtomTerm(AtomSyntaxError); - AtomSyntaxErrors = Yap_LookupAtom("syntax_errors"); TermSyntaxErrors = MkAtomTerm(AtomSyntaxErrors); - AtomSyntaxErrorHandler = Yap_LookupAtom("syntax_error_handler"); TermSyntaxErrorHandler = MkAtomTerm(AtomSyntaxErrorHandler); - AtomSystem = Yap_LookupAtom("system"); TermSystem = MkAtomTerm(AtomSystem); - AtomSystemError = Yap_LookupAtom("SYSTEM_ERROR_INTERNAL"); TermSystemError = MkAtomTerm(AtomSystemError); - AtomSystemLibraryDir = Yap_LookupAtom("system_library_directory"); TermSystemLibraryDir = MkAtomTerm(AtomSystemLibraryDir); - AtomT = Yap_LookupAtom("t"); TermT = MkAtomTerm(AtomT); - AtomTerm = Yap_LookupAtom("term"); TermTerm = MkAtomTerm(AtomTerm); - AtomTermExpansion = Yap_LookupAtom("term_expansion"); TermTermExpansion = MkAtomTerm(AtomTermExpansion); - AtomTerms = Yap_LookupAtom("terms"); TermTerms = MkAtomTerm(AtomTerms); - AtomText = Yap_LookupAtom("text"); TermText = MkAtomTerm(AtomText); - AtomTextStream = Yap_LookupAtom("text_stream"); TermTextStream = MkAtomTerm(AtomTextStream); - AtomThread = Yap_LookupAtom("thread"); TermThread = MkAtomTerm(AtomThread); - AtomThreads = Yap_LookupAtom("threads"); TermThreads = MkAtomTerm(AtomThreads); - AtomThrow = Yap_LookupAtom("throw"); TermThrow = MkAtomTerm(AtomThrow); - AtomTimeOutSpec = Yap_LookupAtom("time_out_spec"); TermTimeOutSpec = MkAtomTerm(AtomTimeOutSpec); - AtomTimeoutError = Yap_LookupAtom("timeout_error"); TermTimeoutError = MkAtomTerm(AtomTimeoutError); - AtomTopLevelGoal = Yap_FullLookupAtom("$top_level_goal"); TermTopLevelGoal = MkAtomTerm(AtomTopLevelGoal); - AtomTopThreadGoal = Yap_FullLookupAtom("$top_thread_goal"); TermTopThreadGoal = MkAtomTerm(AtomTopThreadGoal); - AtomTraceMetaCall = Yap_FullLookupAtom("$trace_meta_call"); TermTraceMetaCall = MkAtomTerm(AtomTraceMetaCall); - AtomTrail = Yap_LookupAtom("trail"); - AtomTrue = Yap_LookupAtom("true"); TermTrue = MkAtomTerm(AtomTrue); - AtomTty = Yap_LookupAtom("tty"); TermTty = MkAtomTerm(AtomTty); - AtomTtys = Yap_LookupAtom("ttys"); TermTtys = MkAtomTerm(AtomTtys); - AtomTuple = Yap_LookupAtom("tuple"); TermTuple = MkAtomTerm(AtomTuple); - AtomTxt = Yap_LookupAtom("txt"); TermTxt = MkAtomTerm(AtomTxt); - AtomTypeError = Yap_LookupAtom("type_error"); TermTypeError = MkAtomTerm(AtomTypeError); - AtomUndefined = Yap_LookupAtom("undefined"); TermUndefined = MkAtomTerm(AtomUndefined); - AtomUndefp = Yap_FullLookupAtom("$undefp"); TermUndefp = MkAtomTerm(AtomUndefp); - AtomUndefp0 = Yap_FullLookupAtom("$undefp0"); TermUndefp0 = MkAtomTerm(AtomUndefp0); - AtomUnderflow = Yap_LookupAtom("underflow"); TermUnderflow = MkAtomTerm(AtomUnderflow); - AtomUnificationStack = Yap_LookupAtom("unification_stack"); TermUnificationStack = MkAtomTerm(AtomUnificationStack); - AtomUnique = Yap_LookupAtom("unique"); TermUnique = MkAtomTerm(AtomUnique); - AtomUnsignedByte = Yap_LookupAtom("unsigned_byte"); TermUnsignedByte = MkAtomTerm(AtomUnsignedByte); - AtomUnsignedChar = Yap_LookupAtom("unsigned_char"); TermUnsignedChar = MkAtomTerm(AtomUnsignedChar); - AtomUser = Yap_LookupAtom("user"); TermUser = MkAtomTerm(AtomUser); - AtomUserErr = Yap_LookupAtom("user_error"); TermUserErr = MkAtomTerm(AtomUserErr); - AtomUserIn = Yap_LookupAtom("user_input"); TermUserIn = MkAtomTerm(AtomUserIn); - AtomUserOut = Yap_LookupAtom("user_output"); TermUserOut = MkAtomTerm(AtomUserOut); - AtomDollarVar = Yap_LookupAtom("$VAR"); TermDollarVar = MkAtomTerm(AtomDollarVar); - AtomVBar = Yap_LookupAtom("|"); TermVBar = MkAtomTerm(AtomVBar); - AtomVarBranches = Yap_LookupAtom("var_branches"); TermVarBranches = MkAtomTerm(AtomVarBranches); - AtomVariableNames = Yap_LookupAtom("variable_names"); TermVariableNames = MkAtomTerm(AtomVariableNames); - AtomHiddenVar = Yap_FullLookupAtom("$V"); TermHiddenVar = MkAtomTerm(AtomHiddenVar); - AtomVariable = Yap_LookupAtom("variable"); TermVariable = MkAtomTerm(AtomVariable); - AtomVerbose = Yap_LookupAtom("verbose"); TermVerbose = MkAtomTerm(AtomVerbose); - AtomVerboseFileSearch = Yap_LookupAtom("verbose_file_search"); TermVerboseFileSearch = MkAtomTerm(AtomVerboseFileSearch); - AtomVersionNumber = Yap_FullLookupAtom("$version_name"); TermVersionNumber = MkAtomTerm(AtomVersionNumber); - AtomVeryVerbose = Yap_LookupAtom("very_verbose"); TermVeryVerbose = MkAtomTerm(AtomVeryVerbose); - AtomWakeUpGoal = Yap_FullLookupAtom("$wake_up_goal"); TermWakeUpGoal = MkAtomTerm(AtomWakeUpGoal); - AtomWarning = Yap_LookupAtom("warning"); TermWarning = MkAtomTerm(AtomWarning); - AtomWhen = Yap_FullLookupAtom("$when"); TermWhen = MkAtomTerm(AtomWhen); - AtomWrite = Yap_LookupAtom("write"); TermWrite = MkAtomTerm(AtomWrite); - AtomWriteTerm = Yap_LookupAtom("write_term"); TermWriteTerm = MkAtomTerm(AtomWriteTerm); - AtomXml = Yap_LookupAtom("xml"); TermXml = MkAtomTerm(AtomXml); - AtomYapHacks = Yap_LookupAtom("yap_hacks"); TermYapHacks = MkAtomTerm(AtomYapHacks); - AtomZeroDivisor = Yap_LookupAtom("zero_divisor"); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor); - FunctorAfInet = Yap_MkFunctor(AtomAfInet,2); - FunctorAfLocal = Yap_MkFunctor(AtomAfLocal,1); - FunctorAfUnix = Yap_MkFunctor(AtomAfUnix,1); - FunctorAltNot = Yap_MkFunctor(AtomAltNot,1); - FunctorArg = Yap_MkFunctor(AtomArg,3); - FunctorArrayEntry = Yap_MkFunctor(AtomArrayAccess,3); - FunctorArrow = Yap_MkFunctor(AtomArrow,2); - FunctorDoubleArrow = Yap_MkFunctor(AtomDoubleArrow,2); - FunctorAssert1 = Yap_MkFunctor(AtomAssert,1); - FunctorAssert = Yap_MkFunctor(AtomAssert,2); - FunctorAtFoundOne = Yap_MkFunctor(AtomFoundVar,2); - FunctorAtom = Yap_MkFunctor(AtomAtom,1); - FunctorAtt1 = Yap_MkFunctor(AtomAtt1,3); - FunctorAttGoal = Yap_MkFunctor(AtomAttDo,2); - FunctorBraces = Yap_MkFunctor(AtomBraces,1); - FunctorCall = Yap_MkFunctor(AtomCall,1); - FunctorCatch = Yap_MkFunctor(AtomCatch,3); - FunctorChangeModule = Yap_MkFunctor(AtomChangeModule,1); - FunctorChars = Yap_MkFunctor(AtomChars,2); - FunctorChars1 = Yap_MkFunctor(AtomChars,1); - FunctorCleanCall = Yap_MkFunctor(AtomCleanCall,2); - FunctorClist = Yap_MkFunctor(AtomWhen,4); - FunctorCodes = Yap_MkFunctor(AtomCodes,2); - FunctorCodes1 = Yap_MkFunctor(AtomCodes,1); - FunctorColon = Yap_MkFunctor(AtomColon,2); - FunctorComma = Yap_MkFunctor(AtomComma,2); - FunctorCommentHook = Yap_MkFunctor(AtomCommentHook,3); - FunctorContext2 = Yap_MkFunctor(AtomContext,2); - FunctorConsistencyError = Yap_MkFunctor(AtomConsistencyError,1); - FunctorCreep = Yap_MkFunctor(AtomCreep,1); - FunctorCsult = Yap_MkFunctor(AtomCsult,2); - FunctorCurrentModule = Yap_MkFunctor(AtomCurrentModule,1); - FunctorCutBy = Yap_MkFunctor(AtomCutBy,1); - FunctorDBREF = Yap_MkFunctor(AtomDBREF,1); - FunctorDiff = Yap_MkFunctor(AtomDiff,2); - FunctorDoLogUpdClause = Yap_MkFunctor(AtomDoLogUpdClause,6); - FunctorDoLogUpdClause0 = Yap_MkFunctor(AtomDoLogUpdClause0,6); - FunctorDoLogUpdClauseErase = Yap_MkFunctor(AtomDoLogUpdClauseErase,6); - FunctorDoStaticClause = Yap_MkFunctor(AtomDoStaticClause,5); - FunctorDollar = Yap_MkFunctor(AtomDollar,1); - FunctorDollarVar = Yap_MkFunctor(AtomDollarVar,1); - FunctorDomainError = Yap_MkFunctor(AtomDomainError,2); - FunctorDot = Yap_MkFunctor(AtomDot,2); - FunctorDot10 = Yap_MkFunctor(AtomDot,10); - FunctorDot11 = Yap_MkFunctor(AtomDot,11); - FunctorDot12 = Yap_MkFunctor(AtomDot,12); - FunctorDot2 = Yap_MkFunctor(AtomDot,2); - FunctorDot3 = Yap_MkFunctor(AtomDot,3); - FunctorDot4 = Yap_MkFunctor(AtomDot,4); - FunctorDot5 = Yap_MkFunctor(AtomDot,5); - FunctorDot6 = Yap_MkFunctor(AtomDot,6); - FunctorDot7 = Yap_MkFunctor(AtomDot,7); - FunctorDot8 = Yap_MkFunctor(AtomDot,8); - FunctorDot9 = Yap_MkFunctor(AtomDot,9); - FunctorDoubleArrow = Yap_MkFunctor(AtomDoubleArrow,2); - FunctorDoubleSlash = Yap_MkFunctor(AtomDoubleSlash,2); - FunctorEmptySquareBrackets = Yap_MkFunctor(AtomEmptySquareBrackets,2); - FunctorEq = Yap_MkFunctor(AtomEq,2); - FunctorError = Yap_MkFunctor(AtomError,2); - FunctorEvaluationError = Yap_MkFunctor(AtomEvaluationError,1); - FunctorException = Yap_MkFunctor(AtomException,1); - FunctorExecute2InMod = Yap_MkFunctor(AtomExecuteWoMod,2); - FunctorExecuteInMod = Yap_MkFunctor(AtomExecuteInMod,2); - FunctorExecuteWithin = Yap_MkFunctor(AtomExecuteWithin,1); - FunctorExistenceError = Yap_MkFunctor(AtomExistenceError,2); - FunctorExoClause = Yap_MkFunctor(AtomExoClause,2); - FunctorFunctor = Yap_MkFunctor(AtomFunctor,3); - FunctorGAtom = Yap_MkFunctor(AtomAtom,1); - FunctorGAtomic = Yap_MkFunctor(AtomAtomic,1); - FunctorGCompound = Yap_MkFunctor(AtomCompound,1); - FunctorGFloat = Yap_MkFunctor(AtomFloat,1); - FunctorGFormatAt = Yap_MkFunctor(AtomFormatAt,2); - FunctorGInteger = Yap_MkFunctor(AtomInteger,1); - FunctorGNumber = Yap_MkFunctor(AtomNumber,1); - FunctorGPrimitive = Yap_MkFunctor(AtomPrimitive,1); - FunctorGVar = Yap_MkFunctor(AtomGVar,1); - FunctorGeneratePredInfo = Yap_MkFunctor(AtomGeneratePredInfo,4); - FunctorGoalExpansion2 = Yap_MkFunctor(AtomGoalExpansion,2); - FunctorGoalExpansion = Yap_MkFunctor(AtomGoalExpansion,3); - FunctorHandleThrow = Yap_MkFunctor(AtomHandleThrow,3); - FunctorHat = Yap_MkFunctor(AtomHat,2); - FunctorI = Yap_MkFunctor(AtomI,2); - FunctorId = Yap_MkFunctor(AtomId,1); - FunctorInfo1 = Yap_MkFunctor(AtomInfo,1); - FunctorInfo2 = Yap_MkFunctor(AtomInfo,2); - FunctorInfo3 = Yap_MkFunctor(AtomInfo,3); - FunctorInfo4 = Yap_MkFunctor(AtomInfo,4); - FunctorIs = Yap_MkFunctor(AtomIs,2); - FunctorJ = Yap_MkFunctor(AtomJ,2); - FunctorLastExecuteWithin = Yap_MkFunctor(AtomLastExecuteWithin,1); - FunctorList = Yap_MkFunctor(AtomDot,2); - FunctorLOOP = Yap_MkFunctor(AtomLOOP,1); - FunctorMegaClause = Yap_MkFunctor(AtomMegaClause,2); - FunctorMetaCall = Yap_MkFunctor(AtomMetaCall,4); - FunctorMinus = Yap_MkFunctor(AtomMinus,2); - FunctorModule = Yap_MkFunctor(AtomColon,2); - FunctorMultiFileClause = Yap_MkFunctor(AtomMfClause,5); - FunctorMutable = Yap_MkFunctor(AtomMutableVariable,(sizeof(timed_var)/sizeof(CELL))); - FunctorMutex = Yap_MkFunctor(AtomMutex,2); - FunctorNotImplemented = Yap_MkFunctor(AtomNotImplemented,2); - FunctorNBQueue = Yap_MkFunctor(AtomQueue,4); - FunctorNot = Yap_MkFunctor(AtomNot,1); - FunctorObj = Yap_MkFunctor(AtomObj,1); - FunctorOr = Yap_MkFunctor(AtomSemic,2); - FunctorOutput = Yap_MkFunctor(AtomOutput,1); - FunctorPermissionError = Yap_MkFunctor(AtomPermissionError,3); - FunctorPlus = Yap_MkFunctor(AtomPlus,2); - FunctorPortray = Yap_MkFunctor(AtomPortray,1); - FunctorPrintMessage = Yap_MkFunctor(AtomPrintMessage,2); - FunctorProcedure = Yap_MkFunctor(AtomProcedure,5); - FunctorPriority = Yap_MkFunctor(AtomPriority,1); - FunctorPrologConstraint = Yap_MkFunctor(AtomProlog,2); - FunctorProtectStack = Yap_MkFunctor(AtomProtectStack,4); - FunctorQuery = Yap_MkFunctor(AtomQuery,1); - FunctorRecordedWithKey = Yap_MkFunctor(AtomRecordedWithKey,6); - FunctorRDiv = Yap_MkFunctor(AtomRDiv,2); - FunctorRedoFreeze = Yap_MkFunctor(AtomRedoFreeze,3); - FunctorRepresentationError = Yap_MkFunctor(AtomRepresentationError,1); - FunctorResourceError = Yap_MkFunctor(AtomResourceError,1); - FunctorRestoreRegs = Yap_MkFunctor(AtomRestoreRegs,2); - FunctorRestoreRegs1 = Yap_MkFunctor(AtomRestoreRegs,1); - FunctorSafe = Yap_MkFunctor(AtomSafe,1); - FunctorSafeCallCleanup = Yap_MkFunctor(AtomSafeCallCleanup,4); - FunctorSame = Yap_MkFunctor(AtomSame,2); - FunctorSlash = Yap_MkFunctor(AtomSlash,2); - FunctorStaticClause = Yap_MkFunctor(AtomStaticClause,2); - FunctorStream = Yap_MkFunctor(AtomStream,1); - FunctorStreamEOS = Yap_MkFunctor(AtomEndOfStream,1); - FunctorStreamPos = Yap_MkFunctor(AtomStreamPos,4); - FunctorString1 = Yap_MkFunctor(AtomString,1); - FunctorStyleCheck = Yap_MkFunctor(AtomStyleCheck,4); - FunctorSyntaxError = Yap_MkFunctor(AtomSyntaxError,4); - FunctorShortSyntaxError = Yap_MkFunctor(AtomSyntaxError,1); - FunctorTermExpansion = Yap_MkFunctor(AtomTermExpansion,2); - FunctorThreadRun = Yap_MkFunctor(AtomTopThreadGoal,2); - FunctorThrow = Yap_MkFunctor(AtomThrow,1); - FunctorTimeoutError = Yap_MkFunctor(AtomTimeoutError,2); - FunctorTraceMetaCall = Yap_MkFunctor(AtomTraceMetaCall,3); - FunctorTypeError = Yap_MkFunctor(AtomTypeError,2); - FunctorUMinus = Yap_MkFunctor(AtomMinus,1); - FunctorUPlus = Yap_MkFunctor(AtomPlus,1); - FunctorVBar = Yap_MkFunctor(AtomVBar,2); - FunctorWriteTerm = Yap_MkFunctor(AtomWriteTerm,2); - FunctorHiddenVar = Yap_MkFunctor(AtomHiddenVar,1); + + /* This file, iatoms.h, was generated automatically by "yap -L misc/buildatoms" + {lease do not update, update misc/ATOMS instead */ + + Atom3Dots = Yap_LookupAtom("..."); + AtomAbol = Yap_FullLookupAtom("$abol"); TermAbol = MkAtomTerm(AtomAbol); + AtomAccess = Yap_LookupAtom("access"); TermAccess = MkAtomTerm(AtomAccess); + AtomAfInet = Yap_LookupAtom("AF_INET"); TermAfInet = MkAtomTerm(AtomAfInet); + AtomAfLocal = Yap_LookupAtom("AF_LOCAL"); TermAfLocal = MkAtomTerm(AtomAfLocal); + AtomAfUnix = Yap_LookupAtom("AF_UNIX"); TermAfUnix = MkAtomTerm(AtomAfUnix); + AtomAlarm = Yap_FullLookupAtom("$alarm"); TermAlarm = MkAtomTerm(AtomAlarm); + AtomAlias = Yap_LookupAtom("alias"); TermAlias = MkAtomTerm(AtomAlias); + AtomAll = Yap_LookupAtom("all"); TermAll = MkAtomTerm(AtomAll); + AtomAltNot = Yap_LookupAtom("not"); TermAltNot = MkAtomTerm(AtomAltNot); + AtomAnswer = Yap_LookupAtom("answer"); TermAnswer = MkAtomTerm(AtomAnswer); + AtomAny = Yap_LookupAtom("any"); TermAny = MkAtomTerm(AtomAny); + AtomAppend = Yap_LookupAtom("append"); TermAppend = MkAtomTerm(AtomAppend); + AtomArg = Yap_LookupAtom("arg"); TermArg = MkAtomTerm(AtomArg); + AtomArray = Yap_FullLookupAtom("$array"); TermArray = MkAtomTerm(AtomArray); + AtomArrayAccess = Yap_FullLookupAtom("$array_arg"); TermArrayAccess = MkAtomTerm(AtomArrayAccess); + AtomArrayOverflow = Yap_LookupAtom("array_overflow"); TermArrayOverflow = MkAtomTerm(AtomArrayOverflow); + AtomArrayType = Yap_LookupAtom("array_type"); TermArrayType = MkAtomTerm(AtomArrayType); + AtomArrow = Yap_LookupAtom("->"); TermArrow = MkAtomTerm(AtomArrow); + AtomAttributedModule = Yap_LookupAtom("attributes_module"); TermAttributedModule = MkAtomTerm(AtomAttributedModule); + AtomDoubleArrow = Yap_LookupAtom("-->"); TermDoubleArrow = MkAtomTerm(AtomDoubleArrow); + AtomAssert = Yap_LookupAtom(":-"); TermAssert = MkAtomTerm(AtomAssert); + AtomBeginBracket = Yap_LookupAtom("("); TermBeginBracket = MkAtomTerm(AtomBeginBracket); + AtomEndBracket = Yap_LookupAtom(")"); TermEndBracket = MkAtomTerm(AtomEndBracket); + AtomBeginSquareBracket = Yap_LookupAtom("["); TermBeginSquareBracket = MkAtomTerm(AtomBeginSquareBracket); + AtomEndSquareBracket = Yap_LookupAtom("]"); TermEndSquareBracket = MkAtomTerm(AtomEndSquareBracket); + AtomBeginCurlyBracket = Yap_LookupAtom("{"); TermBeginCurlyBracket = MkAtomTerm(AtomBeginCurlyBracket); + AtomEndCurlyBracket = Yap_LookupAtom("}"); TermEndCurlyBracket = MkAtomTerm(AtomEndCurlyBracket); + AtomEmptyBrackets = Yap_LookupAtom("()"); TermEmptyBrackets = MkAtomTerm(AtomEmptyBrackets); + AtomEmptySquareBrackets = Yap_LookupAtom("[]"); TermEmptySquareBrackets = MkAtomTerm(AtomEmptySquareBrackets); + AtomAsserta = Yap_LookupAtom("asserta"); TermAsserta = MkAtomTerm(AtomAsserta); + AtomAssertaStatic = Yap_LookupAtom("asserta_static"); TermAssertaStatic = MkAtomTerm(AtomAssertaStatic); + AtomAssertz = Yap_LookupAtom("assertz"); TermAssertz = MkAtomTerm(AtomAssertz); + AtomAssertzStatic = Yap_LookupAtom("assertz_static"); TermAssertzStatic = MkAtomTerm(AtomAssertzStatic); + AtomAt = Yap_LookupAtom("at"); TermAt = MkAtomTerm(AtomAt); + AtomAtom = Yap_LookupAtom("atom"); TermAtom = MkAtomTerm(AtomAtom); + AtomAtomic = Yap_LookupAtom("atomic"); TermAtomic = MkAtomTerm(AtomAtomic); + AtomAtt = Yap_FullLookupAtom("$att"); TermAtt = MkAtomTerm(AtomAtt); + AtomAtt1 = Yap_LookupAtom("att"); TermAtt1 = MkAtomTerm(AtomAtt1); + AtomAttDo = Yap_FullLookupAtom("$att_do"); TermAttDo = MkAtomTerm(AtomAttDo); + AtomAttributes = Yap_LookupAtom("attributes"); TermAttributes = MkAtomTerm(AtomAttributes); + AtomB = Yap_FullLookupAtom("$last_choice_pt"); TermB = MkAtomTerm(AtomB); + AtomBatched = Yap_LookupAtom("batched"); TermBatched = MkAtomTerm(AtomBatched); + AtomBetween = Yap_LookupAtom("between"); TermBetween = MkAtomTerm(AtomBetween); + AtomBinary = Yap_LookupAtom("binary"); TermBinary = MkAtomTerm(AtomBinary); + AtomBigNum = Yap_LookupAtom("big_num"); TermBigNum = MkAtomTerm(AtomBigNum); + AtomBinaryStream = Yap_LookupAtom("binary_stream"); TermBinaryStream = MkAtomTerm(AtomBinaryStream); + AtomBoolean = Yap_LookupAtom("boolean"); TermBoolean = MkAtomTerm(AtomBoolean); + AtomBraces = Yap_LookupAtom("{}"); TermBraces = MkAtomTerm(AtomBraces); + AtomBreak = Yap_FullLookupAtom("$break"); TermBreak = MkAtomTerm(AtomBreak); + AtomByte = Yap_LookupAtom("byte"); TermByte = MkAtomTerm(AtomByte); + AtomCArith = Yap_FullLookupAtom("$c_arith"); TermCArith = MkAtomTerm(AtomCArith); + AtomCall = Yap_LookupAtom("call"); TermCall = MkAtomTerm(AtomCall); + AtomCallAndRetryCounter = Yap_LookupAtom("call_and_retry_counter"); TermCallAndRetryCounter = MkAtomTerm(AtomCallAndRetryCounter); + AtomCallCounter = Yap_LookupAtom("call_counter"); TermCallCounter = MkAtomTerm(AtomCallCounter); + AtomCallable = Yap_LookupAtom("callable"); TermCallable = MkAtomTerm(AtomCallable); + AtomCatch = Yap_FullLookupAtom("$catch"); TermCatch = MkAtomTerm(AtomCatch); + AtomChangeModule = Yap_FullLookupAtom("$change_module"); TermChangeModule = MkAtomTerm(AtomChangeModule); + AtomChar = Yap_LookupAtom("char"); TermChar = MkAtomTerm(AtomChar); + AtomCharsio = Yap_LookupAtom("charsio"); TermCharsio = MkAtomTerm(AtomCharsio); + AtomCharacter = Yap_LookupAtom("character"); TermCharacter = MkAtomTerm(AtomCharacter); + AtomCharacterCode = Yap_LookupAtom("character_code"); TermCharacterCode = MkAtomTerm(AtomCharacterCode); + AtomChars = Yap_LookupAtom("chars"); TermChars = MkAtomTerm(AtomChars); + AtomCharset = Yap_LookupAtom("charset"); TermCharset = MkAtomTerm(AtomCharset); + AtomChType = Yap_FullLookupAtom("$char_type"); TermChType = MkAtomTerm(AtomChType); + AtomCleanCall = Yap_FullLookupAtom("$clean_call"); TermCleanCall = MkAtomTerm(AtomCleanCall); + AtomClose = Yap_LookupAtom("close"); TermClose = MkAtomTerm(AtomClose); + AtomColon = Yap_LookupAtom(":"); TermColon = MkAtomTerm(AtomColon); + AtomCodeSpace = Yap_LookupAtom("code_space"); TermCodeSpace = MkAtomTerm(AtomCodeSpace); + AtomCodes = Yap_LookupAtom("codes"); TermCodes = MkAtomTerm(AtomCodes); + AtomCoInductive = Yap_LookupAtom("coinductive"); TermCoInductive = MkAtomTerm(AtomCoInductive); + AtomComma = Yap_LookupAtom(","); TermComma = MkAtomTerm(AtomComma); + AtomCommentHook = Yap_LookupAtom("comment_hook"); TermCommentHook = MkAtomTerm(AtomCommentHook); + AtomCompact = Yap_LookupAtom("compact"); TermCompact = MkAtomTerm(AtomCompact); + AtomCompound = Yap_LookupAtom("compound"); TermCompound = MkAtomTerm(AtomCompound); + AtomConsistencyError = Yap_LookupAtom("consistency_error"); TermConsistencyError = MkAtomTerm(AtomConsistencyError); + AtomConsult = Yap_LookupAtom("consult"); TermConsult = MkAtomTerm(AtomConsult); + AtomConsultOnBoot = Yap_FullLookupAtom("$consult_on_boot"); TermConsultOnBoot = MkAtomTerm(AtomConsultOnBoot); + AtomContext = Yap_LookupAtom("context"); TermContext = MkAtomTerm(AtomContext); + AtomCputime = Yap_LookupAtom("cputime"); TermCputime = MkAtomTerm(AtomCputime); + AtomCreate = Yap_LookupAtom("create"); TermCreate = MkAtomTerm(AtomCreate); + AtomCreep = Yap_FullLookupAtom("$creep"); TermCreep = MkAtomTerm(AtomCreep); + AtomCryptAtoms = Yap_LookupAtom("crypt_atoms"); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms); + AtomCurly = Yap_LookupAtom("{}"); TermCurly = MkAtomTerm(AtomCurly); + AtomCsult = Yap_FullLookupAtom("$csult"); TermCsult = MkAtomTerm(AtomCsult); + AtomCurrentModule = Yap_FullLookupAtom("$current_module"); TermCurrentModule = MkAtomTerm(AtomCurrentModule); + AtomCut = Yap_LookupAtom("!"); TermCut = MkAtomTerm(AtomCut); + AtomCutBy = Yap_FullLookupAtom("$cut_by"); TermCutBy = MkAtomTerm(AtomCutBy); + AtomDAbort = Yap_LookupAtom("abort"); TermDAbort = MkAtomTerm(AtomDAbort); + AtomDBLoad = Yap_FullLookupAtom("$db_load"); TermDBLoad = MkAtomTerm(AtomDBLoad); + AtomDBREF = Yap_LookupAtom("DBRef"); TermDBREF = MkAtomTerm(AtomDBREF); + AtomDBReference = Yap_LookupAtom("db_reference"); TermDBReference = MkAtomTerm(AtomDBReference); + AtomDBTerm = Yap_LookupAtom("db_term"); TermDBTerm = MkAtomTerm(AtomDBTerm); + AtomDBref = Yap_FullLookupAtom("$dbref"); TermDBref = MkAtomTerm(AtomDBref); + AtomDInteger = Yap_FullLookupAtom("$integer"); TermDInteger = MkAtomTerm(AtomDInteger); + AtomDebugMeta = Yap_FullLookupAtom("$debug_meta"); TermDebugMeta = MkAtomTerm(AtomDebugMeta); + AtomDebuggerInput = Yap_LookupAtom("debugger_input"); TermDebuggerInput = MkAtomTerm(AtomDebuggerInput); + AtomDec10 = Yap_LookupAtom("dec10"); TermDec10 = MkAtomTerm(AtomDec10); + AtomDefault = Yap_LookupAtom("default"); TermDefault = MkAtomTerm(AtomDefault); + AtomDevNull = Yap_LookupAtom("/dev/null"); TermDevNull = MkAtomTerm(AtomDevNull); + AtomDiff = Yap_LookupAtom("\\="); TermDiff = MkAtomTerm(AtomDiff); + AtomDirectory = Yap_LookupAtom("disrectorys"); TermDirectory = MkAtomTerm(AtomDirectory); + AtomDiscontiguous = Yap_LookupAtom("discontiguous"); TermDiscontiguous = MkAtomTerm(AtomDiscontiguous); + AtomDiscontiguousWarnings = Yap_LookupAtom("discontiguous_warnings"); TermDiscontiguousWarnings = MkAtomTerm(AtomDiscontiguousWarnings); + AtomDollar = Yap_FullLookupAtom("$"); TermDollar = MkAtomTerm(AtomDollar); + AtomDoLogUpdClause = Yap_FullLookupAtom("$do_log_upd_clause"); TermDoLogUpdClause = MkAtomTerm(AtomDoLogUpdClause); + AtomDoLogUpdClause0 = Yap_FullLookupAtom("$do_log_upd_clause0"); TermDoLogUpdClause0 = MkAtomTerm(AtomDoLogUpdClause0); + AtomDoLogUpdClauseErase = Yap_FullLookupAtom("$do_log_upd_clause_erase"); TermDoLogUpdClauseErase = MkAtomTerm(AtomDoLogUpdClauseErase); + AtomDollarU = Yap_FullLookupAtom("$u"); TermDollarU = MkAtomTerm(AtomDollarU); + AtomDollarUndef = Yap_FullLookupAtom("$undef"); TermDollarUndef = MkAtomTerm(AtomDollarUndef); + AtomDomainError = Yap_LookupAtom("domain_error"); TermDomainError = MkAtomTerm(AtomDomainError); + AtomDoStaticClause = Yap_FullLookupAtom("$do_static_clause"); TermDoStaticClause = MkAtomTerm(AtomDoStaticClause); + AtomDots = Yap_LookupAtom("dots"); TermDots = MkAtomTerm(AtomDots); + AtomDOUBLE = Yap_FullLookupAtom("Double"); TermDOUBLE = MkAtomTerm(AtomDOUBLE); + AtomDoubleSlash = Yap_FullLookupAtom("//"); TermDoubleSlash = MkAtomTerm(AtomDoubleSlash); + AtomE = Yap_LookupAtom("e"); TermE = MkAtomTerm(AtomE); + AtomEOFBeforeEOT = Yap_LookupAtom("end_of_file_found_before_end_of_term"); TermEOFBeforeEOT = MkAtomTerm(AtomEOFBeforeEOT); + AtomEQ = Yap_LookupAtom("="); TermEQ = MkAtomTerm(AtomEQ); + AtomEmptyAtom = Yap_LookupAtom(""); TermEmptyAtom = MkAtomTerm(AtomEmptyAtom); + AtomEncoding = Yap_LookupAtom("encoding"); TermEncoding = MkAtomTerm(AtomEncoding); + AtomEndOfStream = Yap_LookupAtom("$end_of_stream"); TermEndOfStream = MkAtomTerm(AtomEndOfStream); + AtomEof = Yap_LookupAtom("end_of_file"); TermEof = MkAtomTerm(AtomEof); + AtomEOfCode = Yap_LookupAtom("eof_code"); TermEOfCode = MkAtomTerm(AtomEOfCode); + AtomEq = Yap_LookupAtom("="); TermEq = MkAtomTerm(AtomEq); + AtomError = Yap_LookupAtom("error"); TermError = MkAtomTerm(AtomError); + AtomException = Yap_LookupAtom("exception"); TermException = MkAtomTerm(AtomException); + AtomExtensions = Yap_LookupAtom("extensions"); TermExtensions = MkAtomTerm(AtomExtensions); + AtomEvaluable = Yap_LookupAtom("evaluable"); TermEvaluable = MkAtomTerm(AtomEvaluable); + AtomEvaluationError = Yap_LookupAtom("evaluation_error"); TermEvaluationError = MkAtomTerm(AtomEvaluationError); + AtomExecutable = Yap_LookupAtom("executable"); TermExecutable = MkAtomTerm(AtomExecutable); + AtomExecute = Yap_LookupAtom("execute"); TermExecute = MkAtomTerm(AtomExecute); + AtomExecAnswers = Yap_LookupAtom("exec_answers"); TermExecAnswers = MkAtomTerm(AtomExecAnswers); + AtomExecuteInMod = Yap_FullLookupAtom("$execute_in_mod"); TermExecuteInMod = MkAtomTerm(AtomExecuteInMod); + AtomExecuteWithin = Yap_FullLookupAtom("$execute_within"); TermExecuteWithin = MkAtomTerm(AtomExecuteWithin); + AtomExecuteWoMod = Yap_FullLookupAtom("$execute_wo_mod"); TermExecuteWoMod = MkAtomTerm(AtomExecuteWoMod); + AtomExist = Yap_LookupAtom("exist"); TermExist = MkAtomTerm(AtomExist); + AtomExists = Yap_LookupAtom("exists"); TermExists = MkAtomTerm(AtomExists); + AtomExit = Yap_LookupAtom("exit"); TermExit = MkAtomTerm(AtomExit); + AtomExistenceError = Yap_LookupAtom("existence_error"); TermExistenceError = MkAtomTerm(AtomExistenceError); + AtomExoClause = Yap_FullLookupAtom("$exo_clause"); TermExoClause = MkAtomTerm(AtomExoClause); + AtomExpectedNumber = Yap_LookupAtom("expected_number_syntax"); TermExpectedNumber = MkAtomTerm(AtomExpectedNumber); + AtomExpand = Yap_LookupAtom("expand"); TermExpand = MkAtomTerm(AtomExpand); + AtomExtendFileSearchPath = Yap_FullLookupAtom("$extend_file_search_path"); TermExtendFileSearchPath = MkAtomTerm(AtomExtendFileSearchPath); + AtomExtendsions = Yap_LookupAtom("extensionh"); TermExtendsions = MkAtomTerm(AtomExtendsions); + AtomFB = Yap_LookupAtom("fb"); TermFB = MkAtomTerm(AtomFB); + AtomFail = Yap_LookupAtom("fail"); TermFail = MkAtomTerm(AtomFail); + AtomFalse = Yap_LookupAtom("false"); TermFalse = MkAtomTerm(AtomFalse); + AtomFast = Yap_FullLookupAtom("$fast"); TermFast = MkAtomTerm(AtomFast); + AtomFastFail = Yap_LookupAtom("fast_fail"); TermFastFail = MkAtomTerm(AtomFastFail); + AtomFileErrors = Yap_LookupAtom("file_errors"); TermFileErrors = MkAtomTerm(AtomFileErrors); + AtomFileerrors = Yap_LookupAtom("fileerrors"); TermFileerrors = MkAtomTerm(AtomFileerrors); + AtomFileType = Yap_LookupAtom("file_type"); TermFileType = MkAtomTerm(AtomFileType); + AtomFirst = Yap_LookupAtom("first"); TermFirst = MkAtomTerm(AtomFirst); + AtomFloat = Yap_LookupAtom("float"); TermFloat = MkAtomTerm(AtomFloat); + AtomFloatFormat = Yap_LookupAtom("\%.15g"); TermFloatFormat = MkAtomTerm(AtomFloatFormat); + AtomFloatOverflow = Yap_LookupAtom("float_overflow"); TermFloatOverflow = MkAtomTerm(AtomFloatOverflow); + AtomFloatUnderflow = Yap_LookupAtom("float_underflow"); TermFloatUnderflow = MkAtomTerm(AtomFloatUnderflow); + AtomFormat = Yap_LookupAtom("format"); TermFormat = MkAtomTerm(AtomFormat); + AtomFormatAt = Yap_FullLookupAtom("$format@"); TermFormatAt = MkAtomTerm(AtomFormatAt); + AtomFull = Yap_LookupAtom("full"); TermFull = MkAtomTerm(AtomFull); + AtomFunctor = Yap_LookupAtom("functor"); TermFunctor = MkAtomTerm(AtomFunctor); + AtomGT = Yap_LookupAtom(">"); TermGT = MkAtomTerm(AtomGT); + AtomGVar = Yap_LookupAtom("var"); TermGVar = MkAtomTerm(AtomGVar); + AtomGc = Yap_FullLookupAtom("$gc"); TermGc = MkAtomTerm(AtomGc); + AtomGcMargin = Yap_FullLookupAtom("$gc_margin"); TermGcMargin = MkAtomTerm(AtomGcMargin); + AtomGcTrace = Yap_FullLookupAtom("$gc_trace"); TermGcTrace = MkAtomTerm(AtomGcTrace); + AtomGcVerbose = Yap_FullLookupAtom("$gc_verbose"); TermGcVerbose = MkAtomTerm(AtomGcVerbose); + AtomGcVeryVerbose = Yap_FullLookupAtom("$gc_very_verbose"); TermGcVeryVerbose = MkAtomTerm(AtomGcVeryVerbose); + AtomGeneratePredInfo = Yap_FullLookupAtom("$generate_pred_info"); TermGeneratePredInfo = MkAtomTerm(AtomGeneratePredInfo); + AtomGetwork = Yap_FullLookupAtom("$getwork"); TermGetwork = MkAtomTerm(AtomGetwork); + AtomGetworkSeq = Yap_FullLookupAtom("$getwork_seq"); TermGetworkSeq = MkAtomTerm(AtomGetworkSeq); + AtomGlob = Yap_LookupAtom("glob"); TermGlob = MkAtomTerm(AtomGlob); + AtomGlobal = Yap_LookupAtom("global"); TermGlobal = MkAtomTerm(AtomGlobal); + AtomGlobalSp = Yap_LookupAtom("global_sp"); TermGlobalSp = MkAtomTerm(AtomGlobalSp); + AtomGlobalTrie = Yap_LookupAtom("global_trie"); TermGlobalTrie = MkAtomTerm(AtomGlobalTrie); + AtomGoalExpansion = Yap_LookupAtom("goal_expansion"); TermGoalExpansion = MkAtomTerm(AtomGoalExpansion); + AtomHat = Yap_LookupAtom("^"); TermHat = MkAtomTerm(AtomHat); + AtomHERE = Yap_LookupAtom("\n <====HERE====> \n"); TermHERE = MkAtomTerm(AtomHERE); + AtomHandleThrow = Yap_FullLookupAtom("$handle_throw"); TermHandleThrow = MkAtomTerm(AtomHandleThrow); + AtomHeap = Yap_LookupAtom("heap"); TermHeap = MkAtomTerm(AtomHeap); + AtomHeapUsed = Yap_LookupAtom("heapused"); TermHeapUsed = MkAtomTerm(AtomHeapUsed); + AtomHugeInt = Yap_LookupAtom("huge_int"); TermHugeInt = MkAtomTerm(AtomHugeInt); + AtomIDB = Yap_LookupAtom("idb"); TermIDB = MkAtomTerm(AtomIDB); + AtomIOMode = Yap_LookupAtom("io_mode"); TermIOMode = MkAtomTerm(AtomIOMode); + AtomI = Yap_LookupAtom("i"); TermI = MkAtomTerm(AtomI); + AtomId = Yap_LookupAtom("id"); TermId = MkAtomTerm(AtomId); + AtomIgnore = Yap_LookupAtom("ignore"); TermIgnore = MkAtomTerm(AtomIgnore); + AtomInf = Yap_LookupAtom("inf"); TermInf = MkAtomTerm(AtomInf); + AtomInfinity = Yap_LookupAtom("infinity"); TermInfinity = MkAtomTerm(AtomInfinity); + AtomInfo = Yap_LookupAtom("info"); TermInfo = MkAtomTerm(AtomInfo); + AtomInitGoal = Yap_FullLookupAtom("$init_goal"); TermInitGoal = MkAtomTerm(AtomInitGoal); + AtomInitProlog = Yap_FullLookupAtom("$init_prolog"); TermInitProlog = MkAtomTerm(AtomInitProlog); + AtomInStackExpansion = Yap_LookupAtom("in stack expansion"); TermInStackExpansion = MkAtomTerm(AtomInStackExpansion); + AtomInput = Yap_LookupAtom("input"); TermInput = MkAtomTerm(AtomInput); + AtomInstantiationError = Yap_LookupAtom("instantiation_error"); TermInstantiationError = MkAtomTerm(AtomInstantiationError); + AtomInt = Yap_LookupAtom("int"); TermInt = MkAtomTerm(AtomInt); + AtomIntOverflow = Yap_LookupAtom("int_overflow"); TermIntOverflow = MkAtomTerm(AtomIntOverflow); + AtomInteger = Yap_LookupAtom("integer"); TermInteger = MkAtomTerm(AtomInteger); + AtomInternalCompilerError = Yap_LookupAtom("internal_compiler_error"); TermInternalCompilerError = MkAtomTerm(AtomInternalCompilerError); + AtomIs = Yap_LookupAtom("is"); TermIs = MkAtomTerm(AtomIs); + AtomJ = Yap_LookupAtom("j"); TermJ = MkAtomTerm(AtomJ); + Atoml = Yap_LookupAtom("l"); Terml = MkAtomTerm(Atoml); + AtomKey = Yap_LookupAtom("key"); TermKey = MkAtomTerm(AtomKey); + AtomLDLibraryPath = Yap_LookupAtom("LD_LIBRARY_PATH"); TermLDLibraryPath = MkAtomTerm(AtomLDLibraryPath); + AtomLONGINT = Yap_LookupAtom("LongInt"); TermLONGINT = MkAtomTerm(AtomLONGINT); + AtomLOOP = Yap_LookupAtom("_LOOP_"); TermLOOP = MkAtomTerm(AtomLOOP); + AtomLoopStream = Yap_LookupAtom("loop_stream"); TermLoopStream = MkAtomTerm(AtomLoopStream); + AtomLT = Yap_LookupAtom("<"); TermLT = MkAtomTerm(AtomLT); + AtomLastExecuteWithin = Yap_FullLookupAtom("$last_execute_within"); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin); + AtomLeash = Yap_FullLookupAtom("$leash"); TermLeash = MkAtomTerm(AtomLeash); + AtomLeast = Yap_LookupAtom("least"); TermLeast = MkAtomTerm(AtomLeast); + AtomLength = Yap_FullLookupAtom("length"); TermLength = MkAtomTerm(AtomLength); + AtomList = Yap_LookupAtom("list"); TermList = MkAtomTerm(AtomList); + AtomLine = Yap_LookupAtom("line"); TermLine = MkAtomTerm(AtomLine); + AtomLive = Yap_FullLookupAtom("$live"); TermLive = MkAtomTerm(AtomLive); + AtomLoadAnswers = Yap_LookupAtom("load_answers"); TermLoadAnswers = MkAtomTerm(AtomLoadAnswers); + AtomLocal = Yap_LookupAtom("local"); TermLocal = MkAtomTerm(AtomLocal); + AtomLocalSp = Yap_LookupAtom("local_sp"); TermLocalSp = MkAtomTerm(AtomLocalSp); + AtomLocalTrie = Yap_LookupAtom("local_trie"); TermLocalTrie = MkAtomTerm(AtomLocalTrie); + AtomMax = Yap_LookupAtom("max"); TermMax = MkAtomTerm(AtomMax); + AtomMaximum = Yap_LookupAtom("maximum"); TermMaximum = MkAtomTerm(AtomMaximum); + AtomMaxArity = Yap_LookupAtom("max_arity"); TermMaxArity = MkAtomTerm(AtomMaxArity); + AtomMaxFiles = Yap_LookupAtom("max_files"); TermMaxFiles = MkAtomTerm(AtomMaxFiles); + AtomMegaClause = Yap_FullLookupAtom("$mega_clause"); TermMegaClause = MkAtomTerm(AtomMegaClause); + AtomMetaCall = Yap_FullLookupAtom("$call"); TermMetaCall = MkAtomTerm(AtomMetaCall); + AtomMfClause = Yap_FullLookupAtom("$mf_clause"); TermMfClause = MkAtomTerm(AtomMfClause); + AtomMin = Yap_LookupAtom("min"); TermMin = MkAtomTerm(AtomMin); + AtomMinimum = Yap_LookupAtom("minimum"); TermMinimum = MkAtomTerm(AtomMinimum); + AtomMinus = Yap_LookupAtom("-"); TermMinus = MkAtomTerm(AtomMinus); + AtomModify = Yap_LookupAtom("modify"); TermModify = MkAtomTerm(AtomModify); + AtomModule = Yap_LookupAtom("module"); TermModule = MkAtomTerm(AtomModule); + AtomMost = Yap_LookupAtom("most"); TermMost = MkAtomTerm(AtomMost); + AtomMulti = Yap_LookupAtom("multi"); TermMulti = MkAtomTerm(AtomMulti); + AtomMultiFile = Yap_FullLookupAtom("$mf"); TermMultiFile = MkAtomTerm(AtomMultiFile); + AtomMultiple = Yap_FullLookupAtom("multiple"); TermMultiple = MkAtomTerm(AtomMultiple); + AtomMutable = Yap_LookupAtom("mutable"); TermMutable = MkAtomTerm(AtomMutable); + AtomMutableVariable = Yap_FullLookupAtom("$mutable_variable"); TermMutableVariable = MkAtomTerm(AtomMutableVariable); + AtomMutex = Yap_LookupAtom("mutex"); TermMutex = MkAtomTerm(AtomMutex); + AtomMyddasDB = Yap_FullLookupAtom("$myddas_db"); TermMyddasDB = MkAtomTerm(AtomMyddasDB); + AtomMyddasGoal = Yap_FullLookupAtom("$myddas_goal"); TermMyddasGoal = MkAtomTerm(AtomMyddasGoal); + AtomMyddasHost = Yap_FullLookupAtom("$myddas_host"); TermMyddasHost = MkAtomTerm(AtomMyddasHost); + AtomMyddasPass = Yap_FullLookupAtom("$myddas_pass"); TermMyddasPass = MkAtomTerm(AtomMyddasPass); + AtomMyddasUser = Yap_FullLookupAtom("$myddas_user"); TermMyddasUser = MkAtomTerm(AtomMyddasUser); + AtomMyddasVersionName = Yap_FullLookupAtom("$myddas_version_name"); TermMyddasVersionName = MkAtomTerm(AtomMyddasVersionName); + AtomNan = Yap_LookupAtom("nan"); TermNan = MkAtomTerm(AtomNan); + AtomNb = Yap_LookupAtom("nb"); TermNb = MkAtomTerm(AtomNb); + AtomNbTerm = Yap_LookupAtom("nb_term"); TermNbTerm = MkAtomTerm(AtomNbTerm); + AtomNew = Yap_LookupAtom("new"); TermNew = MkAtomTerm(AtomNew); + AtomNewLine = Yap_LookupAtom("nl"); TermNewLine = MkAtomTerm(AtomNewLine); + AtomNl = Yap_LookupAtom("nl"); TermNl = MkAtomTerm(AtomNl); + AtomNoEffect = Yap_LookupAtom("no_effect"); TermNoEffect = MkAtomTerm(AtomNoEffect); + AtomNoMemory = Yap_LookupAtom("no_memory"); TermNoMemory = MkAtomTerm(AtomNoMemory); + AtomNone = Yap_LookupAtom("none"); TermNone = MkAtomTerm(AtomNone); + AtomNonEmptyList = Yap_LookupAtom("non_empty_list"); TermNonEmptyList = MkAtomTerm(AtomNonEmptyList); + AtomNot = Yap_LookupAtom("\\+"); TermNot = MkAtomTerm(AtomNot); + AtomNotImplemented = Yap_LookupAtom("not_implemented"); TermNotImplemented = MkAtomTerm(AtomNotImplemented); + AtomNotLessThanZero = Yap_LookupAtom("not_less_than_zero"); TermNotLessThanZero = MkAtomTerm(AtomNotLessThanZero); + AtomNotNewline = Yap_LookupAtom("not_newline"); TermNotNewline = MkAtomTerm(AtomNotNewline); + AtomNotZero = Yap_LookupAtom("not_zero"); TermNotZero = MkAtomTerm(AtomNotZero); + AtomNumber = Yap_LookupAtom("number"); TermNumber = MkAtomTerm(AtomNumber); + AtomObj = Yap_LookupAtom("o__bj__"); TermObj = MkAtomTerm(AtomObj); + AtomOff = Yap_LookupAtom("off"); TermOff = MkAtomTerm(AtomOff); + AtomOffline = Yap_LookupAtom("offline"); TermOffline = MkAtomTerm(AtomOffline); + AtomOn = Yap_LookupAtom("on"); TermOn = MkAtomTerm(AtomOn); + AtomOnline = Yap_LookupAtom("online"); TermOnline = MkAtomTerm(AtomOnline); + AtomOpen = Yap_LookupAtom("open"); TermOpen = MkAtomTerm(AtomOpen); + AtomOperatingSystemError = Yap_LookupAtom("operating_SYSTEM_ERROR_INTERNAL"); TermOperatingSystemError = MkAtomTerm(AtomOperatingSystemError); + AtomOperatingSystemSupport = Yap_LookupAtom("operating_system_support"); TermOperatingSystemSupport = MkAtomTerm(AtomOperatingSystemSupport); + AtomOperator = Yap_LookupAtom("operator"); TermOperator = MkAtomTerm(AtomOperator); + AtomOperatorPriority = Yap_LookupAtom("operator_priority"); TermOperatorPriority = MkAtomTerm(AtomOperatorPriority); + AtomOperatorSpecifier = Yap_LookupAtom("operator_specifier"); TermOperatorSpecifier = MkAtomTerm(AtomOperatorSpecifier); + AtomOpt = Yap_LookupAtom("opt"); TermOpt = MkAtomTerm(AtomOpt); + AtomOtherwise = Yap_LookupAtom("otherwise"); TermOtherwise = MkAtomTerm(AtomOtherwise); + AtomOutOfAttvarsError = Yap_LookupAtom("out_of_attvars_error"); TermOutOfAttvarsError = MkAtomTerm(AtomOutOfAttvarsError); + AtomOutOfAuxspaceError = Yap_LookupAtom("out_of_auxspace_error"); TermOutOfAuxspaceError = MkAtomTerm(AtomOutOfAuxspaceError); + AtomOutOfHeapError = Yap_LookupAtom("out_of_heap_error"); TermOutOfHeapError = MkAtomTerm(AtomOutOfHeapError); + AtomOutOfRange = Yap_LookupAtom("out_of_range"); TermOutOfRange = MkAtomTerm(AtomOutOfRange); + AtomOutOfStackError = Yap_LookupAtom("out_of_stack_error"); TermOutOfStackError = MkAtomTerm(AtomOutOfStackError); + AtomOutOfTrailError = Yap_LookupAtom("out_of_trail_error"); TermOutOfTrailError = MkAtomTerm(AtomOutOfTrailError); + AtomOutput = Yap_LookupAtom("output"); TermOutput = MkAtomTerm(AtomOutput); + AtomParameter = Yap_LookupAtom("parameter"); TermParameter = MkAtomTerm(AtomParameter); + AtomPrologCommonsDir = Yap_LookupAtom("prolog_commons_directory"); TermPrologCommonsDir = MkAtomTerm(AtomPrologCommonsDir); + AtomPast = Yap_LookupAtom("past"); TermPast = MkAtomTerm(AtomPast); + AtomPastEndOfStream = Yap_LookupAtom("past_end_of_stream"); TermPastEndOfStream = MkAtomTerm(AtomPastEndOfStream); + AtomPermissionError = Yap_LookupAtom("permission_error"); TermPermissionError = MkAtomTerm(AtomPermissionError); + AtomPi = Yap_LookupAtom("pi"); TermPi = MkAtomTerm(AtomPi); + AtomPipe = Yap_LookupAtom("pipe"); TermPipe = MkAtomTerm(AtomPipe); + AtomPriority = Yap_LookupAtom("priority"); TermPriority = MkAtomTerm(AtomPriority); + AtomPlus = Yap_LookupAtom("+"); TermPlus = MkAtomTerm(AtomPlus); + AtomPointer = Yap_LookupAtom("pointer"); TermPointer = MkAtomTerm(AtomPointer); + AtomPortray = Yap_FullLookupAtom("portray"); TermPortray = MkAtomTerm(AtomPortray); + AtomPredicateIndicator = Yap_LookupAtom("predicate_indicator"); TermPredicateIndicator = MkAtomTerm(AtomPredicateIndicator); + AtomPrimitive = Yap_LookupAtom("primitive"); TermPrimitive = MkAtomTerm(AtomPrimitive); + AtomPrintMessage = Yap_LookupAtom("print_message"); TermPrintMessage = MkAtomTerm(AtomPrintMessage); + AtomPrivateProcedure = Yap_LookupAtom("private_procedure"); TermPrivateProcedure = MkAtomTerm(AtomPrivateProcedure); + AtomProcedure = Yap_LookupAtom("procedure"); TermProcedure = MkAtomTerm(AtomProcedure); + AtomProfile = Yap_FullLookupAtom("$profile"); TermProfile = MkAtomTerm(AtomProfile); + AtomProlog = Yap_LookupAtom("prolog"); TermProlog = MkAtomTerm(AtomProlog); + AtomProtectStack = Yap_FullLookupAtom("$protect_stack"); TermProtectStack = MkAtomTerm(AtomProtectStack); + AtomQly = Yap_LookupAtom("qly"); TermQly = MkAtomTerm(AtomQly); + AtomQuery = Yap_LookupAtom("?-"); TermQuery = MkAtomTerm(AtomQuery); + AtomQueue = Yap_LookupAtom("queue"); TermQueue = MkAtomTerm(AtomQueue); + AtomQuiet = Yap_LookupAtom("quiet"); TermQuiet = MkAtomTerm(AtomQuiet); + AtomRadix = Yap_LookupAtom("radix"); TermRadix = MkAtomTerm(AtomRadix); + AtomRandom = Yap_LookupAtom("random"); TermRandom = MkAtomTerm(AtomRandom); + AtomRange = Yap_LookupAtom("range"); TermRange = MkAtomTerm(AtomRange); + AtomRDiv = Yap_LookupAtom("rdiv"); TermRDiv = MkAtomTerm(AtomRDiv); + AtomRead = Yap_LookupAtom("read"); TermRead = MkAtomTerm(AtomRead); + AtomReadOnly = Yap_LookupAtom("read_only"); TermReadOnly = MkAtomTerm(AtomReadOnly); + AtomReadWrite = Yap_LookupAtom("read_write"); TermReadWrite = MkAtomTerm(AtomReadWrite); + AtomReadutil = Yap_LookupAtom("readutil"); TermReadutil = MkAtomTerm(AtomReadutil); + AtomReconsult = Yap_LookupAtom("reconsult"); TermReconsult = MkAtomTerm(AtomReconsult); + AtomRecordedP = Yap_FullLookupAtom("$recordep"); TermRecordedP = MkAtomTerm(AtomRecordedP); + AtomRecordedWithKey = Yap_FullLookupAtom("$recorded_with_key"); TermRecordedWithKey = MkAtomTerm(AtomRecordedWithKey); + AtomRedefineWarnings = Yap_LookupAtom("redefine_warnings"); TermRedefineWarnings = MkAtomTerm(AtomRedefineWarnings); + AtomRedoFreeze = Yap_FullLookupAtom("$redo_freeze"); TermRedoFreeze = MkAtomTerm(AtomRedoFreeze); + AtomRefoundVar = Yap_FullLookupAtom("$I_FOUND_THE_VARIABLE_AGAIN"); TermRefoundVar = MkAtomTerm(AtomRefoundVar); + AtomRelativeTo = Yap_FullLookupAtom("relative_to"); TermRelativeTo = MkAtomTerm(AtomRelativeTo); + AtomRepeat = Yap_LookupAtom("repeat"); TermRepeat = MkAtomTerm(AtomRepeat); + AtomRepeatSpace = Yap_LookupAtom("repeat "); TermRepeatSpace = MkAtomTerm(AtomRepeatSpace); + AtomReposition = Yap_LookupAtom("reposition"); TermReposition = MkAtomTerm(AtomReposition); + AtomRepresentationError = Yap_LookupAtom("representation_error"); TermRepresentationError = MkAtomTerm(AtomRepresentationError); + AtomReset = Yap_LookupAtom("reset"); TermReset = MkAtomTerm(AtomReset); + AtomResize = Yap_LookupAtom("resize"); TermResize = MkAtomTerm(AtomResize); + AtomResourceError = Yap_LookupAtom("resource_error"); TermResourceError = MkAtomTerm(AtomResourceError); + AtomRestoreRegs = Yap_FullLookupAtom("$restore_regs"); TermRestoreRegs = MkAtomTerm(AtomRestoreRegs); + AtomRetry = Yap_LookupAtom("retry"); TermRetry = MkAtomTerm(AtomRetry); + AtomRetryCounter = Yap_LookupAtom("retry_counter"); TermRetryCounter = MkAtomTerm(AtomRetryCounter); + AtomRTree = Yap_LookupAtom("rtree"); TermRTree = MkAtomTerm(AtomRTree); + AtomSafe = Yap_FullLookupAtom("$safe"); TermSafe = MkAtomTerm(AtomSafe); + AtomSafeCallCleanup = Yap_FullLookupAtom("$safe_call_cleanup"); TermSafeCallCleanup = MkAtomTerm(AtomSafeCallCleanup); + AtomSame = Yap_LookupAtom("=="); TermSame = MkAtomTerm(AtomSame); + AtomSemic = Yap_LookupAtom(";"); TermSemic = MkAtomTerm(AtomSemic); + AtomShiftCountOverflow = Yap_LookupAtom("shift_count_overflow"); TermShiftCountOverflow = MkAtomTerm(AtomShiftCountOverflow); + AtomSigAlarm = Yap_LookupAtom("sig_alarm"); TermSigAlarm = MkAtomTerm(AtomSigAlarm); + AtomSigBreak = Yap_LookupAtom("sig_break"); TermSigBreak = MkAtomTerm(AtomSigBreak); + AtomSigCreep = Yap_LookupAtom("sig_creep"); TermSigCreep = MkAtomTerm(AtomSigCreep); + AtomSigDebug = Yap_LookupAtom("sig_debug"); TermSigDebug = MkAtomTerm(AtomSigDebug); + AtomSigDelayCreep = Yap_LookupAtom("sig_delay_creep"); TermSigDelayCreep = MkAtomTerm(AtomSigDelayCreep); + AtomSigFPE = Yap_LookupAtom("sig_fpe"); TermSigFPE = MkAtomTerm(AtomSigFPE); + AtomSigHup = Yap_LookupAtom("sig_hup"); TermSigHup = MkAtomTerm(AtomSigHup); + AtomSigInt = Yap_LookupAtom("sig_int"); TermSigInt = MkAtomTerm(AtomSigInt); + AtomSigIti = Yap_LookupAtom("sig_iti"); TermSigIti = MkAtomTerm(AtomSigIti); + AtomSigPending = Yap_FullLookupAtom("$sig_pending"); TermSigPending = MkAtomTerm(AtomSigPending); + AtomSigPipe = Yap_LookupAtom("sig_pipe"); TermSigPipe = MkAtomTerm(AtomSigPipe); + AtomSigStackDump = Yap_LookupAtom("sig_stack_dump"); TermSigStackDump = MkAtomTerm(AtomSigStackDump); + AtomSigStatistics = Yap_LookupAtom("sig_statistics"); TermSigStatistics = MkAtomTerm(AtomSigStatistics); + AtomSigTrace = Yap_LookupAtom("sig_trace"); TermSigTrace = MkAtomTerm(AtomSigTrace); + AtomSigUsr1 = Yap_LookupAtom("sig_usr1"); TermSigUsr1 = MkAtomTerm(AtomSigUsr1); + AtomSigUsr2 = Yap_LookupAtom("sig_usr2"); TermSigUsr2 = MkAtomTerm(AtomSigUsr2); + AtomSigVTAlarm = Yap_LookupAtom("sig_vtalarm"); TermSigVTAlarm = MkAtomTerm(AtomSigVTAlarm); + AtomSigWakeUp = Yap_LookupAtom("sig_wake_up"); TermSigWakeUp = MkAtomTerm(AtomSigWakeUp); + AtomSilent = Yap_LookupAtom("Silent"); TermSilent = MkAtomTerm(AtomSilent); + AtomSingle = Yap_LookupAtom("single"); TermSingle = MkAtomTerm(AtomSingle); + AtomSingleVarWarnings = Yap_LookupAtom("single_var_warnings"); TermSingleVarWarnings = MkAtomTerm(AtomSingleVarWarnings); + AtomSingleton = Yap_LookupAtom("singleton"); TermSingleton = MkAtomTerm(AtomSingleton); + AtomSlash = Yap_LookupAtom("/"); TermSlash = MkAtomTerm(AtomSlash); + AtomSocket = Yap_LookupAtom("socket"); TermSocket = MkAtomTerm(AtomSocket); + AtomSolutions = Yap_LookupAtom("solutions"); TermSolutions = MkAtomTerm(AtomSolutions); + AtomSource = Yap_LookupAtom("source"); TermSource = MkAtomTerm(AtomSource); + AtomSourceSink = Yap_LookupAtom("source_sink"); TermSourceSink = MkAtomTerm(AtomSourceSink); + AtomSpy = Yap_FullLookupAtom("$spy"); TermSpy = MkAtomTerm(AtomSpy); + AtomStack = Yap_LookupAtom("stack"); TermStack = MkAtomTerm(AtomStack); + AtomStackFree = Yap_LookupAtom("stackfree"); TermStackFree = MkAtomTerm(AtomStackFree); + AtomStartupSavedState = Yap_FullLookupAtom("$startup_saved_state"); TermStartupSavedState = MkAtomTerm(AtomStartupSavedState); + AtomStaticClause = Yap_FullLookupAtom("$static_clause"); TermStaticClause = MkAtomTerm(AtomStaticClause); + AtomStaticProcedure = Yap_LookupAtom("static_procedure"); TermStaticProcedure = MkAtomTerm(AtomStaticProcedure); + AtomStream = Yap_FullLookupAtom("$stream"); TermStream = MkAtomTerm(AtomStream); + AtomSWIStream = Yap_FullLookupAtom(""); TermSWIStream = MkAtomTerm(AtomSWIStream); + AtomVStream = Yap_LookupAtom("stream"); TermVStream = MkAtomTerm(AtomVStream); + AtomStreams = Yap_LookupAtom("streams"); TermStreams = MkAtomTerm(AtomStreams); + AtomStreamOrAlias = Yap_LookupAtom("stream_or_alias"); TermStreamOrAlias = MkAtomTerm(AtomStreamOrAlias); + AtomStreamPos = Yap_FullLookupAtom("$stream_position"); TermStreamPos = MkAtomTerm(AtomStreamPos); + AtomStreamPosition = Yap_LookupAtom("stream_position"); TermStreamPosition = MkAtomTerm(AtomStreamPosition); + AtomString = Yap_LookupAtom("string"); TermString = MkAtomTerm(AtomString); + AtomStyleCheck = Yap_LookupAtom("style_check"); TermStyleCheck = MkAtomTerm(AtomStyleCheck); + AtomSTRING = Yap_FullLookupAtom("String"); TermSTRING = MkAtomTerm(AtomSTRING); + AtomSwi = Yap_LookupAtom("swi"); TermSwi = MkAtomTerm(AtomSwi); + AtomSymbolChar = Yap_LookupAtom("symbol_char"); TermSymbolChar = MkAtomTerm(AtomSymbolChar); + AtomSyntaxError = Yap_LookupAtom("syntax_error"); TermSyntaxError = MkAtomTerm(AtomSyntaxError); + AtomSyntaxErrors = Yap_LookupAtom("syntax_errors"); TermSyntaxErrors = MkAtomTerm(AtomSyntaxErrors); + AtomSyntaxErrorHandler = Yap_LookupAtom("syntax_error_handler"); TermSyntaxErrorHandler = MkAtomTerm(AtomSyntaxErrorHandler); + AtomSystem = Yap_LookupAtom("system"); TermSystem = MkAtomTerm(AtomSystem); + AtomSystemError = Yap_LookupAtom("SYSTEM_ERROR_INTERNAL"); TermSystemError = MkAtomTerm(AtomSystemError); + AtomSystemLibraryDir = Yap_LookupAtom("system_library_directory"); TermSystemLibraryDir = MkAtomTerm(AtomSystemLibraryDir); + AtomT = Yap_LookupAtom("t"); TermT = MkAtomTerm(AtomT); + AtomTerm = Yap_LookupAtom("term"); TermTerm = MkAtomTerm(AtomTerm); + AtomTermExpansion = Yap_LookupAtom("term_expansion"); TermTermExpansion = MkAtomTerm(AtomTermExpansion); + AtomTerms = Yap_LookupAtom("terms"); TermTerms = MkAtomTerm(AtomTerms); + AtomText = Yap_LookupAtom("text"); TermText = MkAtomTerm(AtomText); + AtomTextStream = Yap_LookupAtom("text_stream"); TermTextStream = MkAtomTerm(AtomTextStream); + AtomThread = Yap_LookupAtom("thread"); TermThread = MkAtomTerm(AtomThread); + AtomThreads = Yap_LookupAtom("threads"); TermThreads = MkAtomTerm(AtomThreads); + AtomThrow = Yap_LookupAtom("throw"); TermThrow = MkAtomTerm(AtomThrow); + AtomTimeOutSpec = Yap_LookupAtom("time_out_spec"); TermTimeOutSpec = MkAtomTerm(AtomTimeOutSpec); + AtomTimeoutError = Yap_LookupAtom("timeout_error"); TermTimeoutError = MkAtomTerm(AtomTimeoutError); + AtomTopLevelGoal = Yap_FullLookupAtom("$top_level_goal"); TermTopLevelGoal = MkAtomTerm(AtomTopLevelGoal); + AtomTopThreadGoal = Yap_FullLookupAtom("$top_thread_goal"); TermTopThreadGoal = MkAtomTerm(AtomTopThreadGoal); + AtomTraceMetaCall = Yap_FullLookupAtom("$trace_meta_call"); TermTraceMetaCall = MkAtomTerm(AtomTraceMetaCall); + AtomTrail = Yap_LookupAtom("trail"); + AtomTrue = Yap_LookupAtom("true"); TermTrue = MkAtomTerm(AtomTrue); + AtomTty = Yap_LookupAtom("tty"); TermTty = MkAtomTerm(AtomTty); + AtomTtys = Yap_LookupAtom("ttys"); TermTtys = MkAtomTerm(AtomTtys); + AtomTuple = Yap_LookupAtom("tuple"); TermTuple = MkAtomTerm(AtomTuple); + AtomTxt = Yap_LookupAtom("txt"); TermTxt = MkAtomTerm(AtomTxt); + AtomTypeError = Yap_LookupAtom("type_error"); TermTypeError = MkAtomTerm(AtomTypeError); + AtomUndefined = Yap_LookupAtom("undefined"); TermUndefined = MkAtomTerm(AtomUndefined); + AtomUndefinedQuery = Yap_LookupAtom("undefined_query"); TermUndefinedQuery = MkAtomTerm(AtomUndefinedQuery); + AtomUndefp = Yap_FullLookupAtom("$undefp"); TermUndefp = MkAtomTerm(AtomUndefp); + AtomUndefp0 = Yap_FullLookupAtom("$undefp0"); TermUndefp0 = MkAtomTerm(AtomUndefp0); + AtomUnderflow = Yap_LookupAtom("underflow"); TermUnderflow = MkAtomTerm(AtomUnderflow); + AtomUnificationStack = Yap_LookupAtom("unification_stack"); TermUnificationStack = MkAtomTerm(AtomUnificationStack); + AtomUnique = Yap_LookupAtom("unique"); TermUnique = MkAtomTerm(AtomUnique); + AtomUnsignedByte = Yap_LookupAtom("unsigned_byte"); TermUnsignedByte = MkAtomTerm(AtomUnsignedByte); + AtomUnsignedChar = Yap_LookupAtom("unsigned_char"); TermUnsignedChar = MkAtomTerm(AtomUnsignedChar); + AtomUser = Yap_LookupAtom("user"); TermUser = MkAtomTerm(AtomUser); + AtomUserErr = Yap_LookupAtom("user_error"); TermUserErr = MkAtomTerm(AtomUserErr); + AtomUserIn = Yap_LookupAtom("user_input"); TermUserIn = MkAtomTerm(AtomUserIn); + AtomUserOut = Yap_LookupAtom("user_output"); TermUserOut = MkAtomTerm(AtomUserOut); + AtomDollarVar = Yap_LookupAtom("$VAR"); TermDollarVar = MkAtomTerm(AtomDollarVar); + AtomVBar = Yap_LookupAtom("|"); TermVBar = MkAtomTerm(AtomVBar); + AtomVarBranches = Yap_LookupAtom("var_branches"); TermVarBranches = MkAtomTerm(AtomVarBranches); + AtomVariableNames = Yap_LookupAtom("variable_names"); TermVariableNames = MkAtomTerm(AtomVariableNames); + AtomHiddenVar = Yap_FullLookupAtom("$V"); TermHiddenVar = MkAtomTerm(AtomHiddenVar); + AtomVariable = Yap_LookupAtom("variable"); TermVariable = MkAtomTerm(AtomVariable); + AtomVerbose = Yap_LookupAtom("verbose"); TermVerbose = MkAtomTerm(AtomVerbose); + AtomVerboseFileSearch = Yap_LookupAtom("verbose_file_search"); TermVerboseFileSearch = MkAtomTerm(AtomVerboseFileSearch); + AtomVersionNumber = Yap_FullLookupAtom("$version_name"); TermVersionNumber = MkAtomTerm(AtomVersionNumber); + AtomVeryVerbose = Yap_LookupAtom("very_verbose"); TermVeryVerbose = MkAtomTerm(AtomVeryVerbose); + AtomWakeUpGoal = Yap_FullLookupAtom("$wake_up_goal"); TermWakeUpGoal = MkAtomTerm(AtomWakeUpGoal); + AtomWarning = Yap_LookupAtom("warning"); TermWarning = MkAtomTerm(AtomWarning); + AtomWhen = Yap_FullLookupAtom("$when"); TermWhen = MkAtomTerm(AtomWhen); + AtomWrite = Yap_LookupAtom("write"); TermWrite = MkAtomTerm(AtomWrite); + AtomWriteTerm = Yap_LookupAtom("write_term"); TermWriteTerm = MkAtomTerm(AtomWriteTerm); + AtomXml = Yap_LookupAtom("xml"); TermXml = MkAtomTerm(AtomXml); + AtomYapHacks = Yap_LookupAtom("yap_hacks"); TermYapHacks = MkAtomTerm(AtomYapHacks); + AtomZeroDivisor = Yap_LookupAtom("zero_divisor"); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor); + FunctorAfInet = Yap_MkFunctor(AtomAfInet,2); + FunctorAfLocal = Yap_MkFunctor(AtomAfLocal,1); + FunctorAfUnix = Yap_MkFunctor(AtomAfUnix,1); + FunctorAltNot = Yap_MkFunctor(AtomAltNot,1); + FunctorArg = Yap_MkFunctor(AtomArg,3); + FunctorArrayEntry = Yap_MkFunctor(AtomArrayAccess,3); + FunctorArrow = Yap_MkFunctor(AtomArrow,2); + FunctorDoubleArrow = Yap_MkFunctor(AtomDoubleArrow,2); + FunctorAssert1 = Yap_MkFunctor(AtomAssert,1); + FunctorAssert = Yap_MkFunctor(AtomAssert,2); + FunctorAtFoundOne = Yap_MkFunctor(AtomFoundVar,2); + FunctorAtom = Yap_MkFunctor(AtomAtom,1); + FunctorAtt1 = Yap_MkFunctor(AtomAtt1,3); + FunctorAttGoal = Yap_MkFunctor(AtomAttDo,2); + FunctorBraces = Yap_MkFunctor(AtomBraces,1); + FunctorCall = Yap_MkFunctor(AtomCall,1); + FunctorCatch = Yap_MkFunctor(AtomCatch,3); + FunctorChangeModule = Yap_MkFunctor(AtomChangeModule,1); + FunctorChars = Yap_MkFunctor(AtomChars,2); + FunctorChars1 = Yap_MkFunctor(AtomChars,1); + FunctorCleanCall = Yap_MkFunctor(AtomCleanCall,2); + FunctorClist = Yap_MkFunctor(AtomWhen,4); + FunctorCodes = Yap_MkFunctor(AtomCodes,2); + FunctorCodes1 = Yap_MkFunctor(AtomCodes,1); + FunctorColon = Yap_MkFunctor(AtomColon,2); + FunctorComma = Yap_MkFunctor(AtomComma,2); + FunctorCommentHook = Yap_MkFunctor(AtomCommentHook,3); + FunctorContext2 = Yap_MkFunctor(AtomContext,2); + FunctorConsistencyError = Yap_MkFunctor(AtomConsistencyError,1); + FunctorCreep = Yap_MkFunctor(AtomCreep,1); + FunctorCsult = Yap_MkFunctor(AtomCsult,2); + FunctorCurrentModule = Yap_MkFunctor(AtomCurrentModule,1); + FunctorCutBy = Yap_MkFunctor(AtomCutBy,1); + FunctorDBREF = Yap_MkFunctor(AtomDBREF,1); + FunctorDiff = Yap_MkFunctor(AtomDiff,2); + FunctorDoLogUpdClause = Yap_MkFunctor(AtomDoLogUpdClause,6); + FunctorDoLogUpdClause0 = Yap_MkFunctor(AtomDoLogUpdClause0,6); + FunctorDoLogUpdClauseErase = Yap_MkFunctor(AtomDoLogUpdClauseErase,6); + FunctorDoStaticClause = Yap_MkFunctor(AtomDoStaticClause,5); + FunctorDollar = Yap_MkFunctor(AtomDollar,1); + FunctorDollarVar = Yap_MkFunctor(AtomDollarVar,1); + FunctorDomainError = Yap_MkFunctor(AtomDomainError,2); + FunctorDot = Yap_MkFunctor(AtomDot,2); + FunctorDot10 = Yap_MkFunctor(AtomDot,10); + FunctorDot11 = Yap_MkFunctor(AtomDot,11); + FunctorDot12 = Yap_MkFunctor(AtomDot,12); + FunctorDot2 = Yap_MkFunctor(AtomDot,2); + FunctorDot3 = Yap_MkFunctor(AtomDot,3); + FunctorDot4 = Yap_MkFunctor(AtomDot,4); + FunctorDot5 = Yap_MkFunctor(AtomDot,5); + FunctorDot6 = Yap_MkFunctor(AtomDot,6); + FunctorDot7 = Yap_MkFunctor(AtomDot,7); + FunctorDot8 = Yap_MkFunctor(AtomDot,8); + FunctorDot9 = Yap_MkFunctor(AtomDot,9); + FunctorDoubleArrow = Yap_MkFunctor(AtomDoubleArrow,2); + FunctorDoubleSlash = Yap_MkFunctor(AtomDoubleSlash,2); + FunctorEmptySquareBrackets = Yap_MkFunctor(AtomEmptySquareBrackets,2); + FunctorEq = Yap_MkFunctor(AtomEq,2); + FunctorError = Yap_MkFunctor(AtomError,2); + FunctorEvaluationError = Yap_MkFunctor(AtomEvaluationError,1); + FunctorException = Yap_MkFunctor(AtomException,1); + FunctorExecute2InMod = Yap_MkFunctor(AtomExecuteWoMod,2); + FunctorExecuteInMod = Yap_MkFunctor(AtomExecuteInMod,2); + FunctorExecuteWithin = Yap_MkFunctor(AtomExecuteWithin,1); + FunctorExistenceError = Yap_MkFunctor(AtomExistenceError,2); + FunctorExoClause = Yap_MkFunctor(AtomExoClause,2); + FunctorFunctor = Yap_MkFunctor(AtomFunctor,3); + FunctorGAtom = Yap_MkFunctor(AtomAtom,1); + FunctorGAtomic = Yap_MkFunctor(AtomAtomic,1); + FunctorGCompound = Yap_MkFunctor(AtomCompound,1); + FunctorGFloat = Yap_MkFunctor(AtomFloat,1); + FunctorGFormatAt = Yap_MkFunctor(AtomFormatAt,2); + FunctorGInteger = Yap_MkFunctor(AtomInteger,1); + FunctorGNumber = Yap_MkFunctor(AtomNumber,1); + FunctorGPrimitive = Yap_MkFunctor(AtomPrimitive,1); + FunctorGVar = Yap_MkFunctor(AtomGVar,1); + FunctorGeneratePredInfo = Yap_MkFunctor(AtomGeneratePredInfo,4); + FunctorGoalExpansion2 = Yap_MkFunctor(AtomGoalExpansion,2); + FunctorGoalExpansion = Yap_MkFunctor(AtomGoalExpansion,3); + FunctorHandleThrow = Yap_MkFunctor(AtomHandleThrow,3); + FunctorHat = Yap_MkFunctor(AtomHat,2); + FunctorI = Yap_MkFunctor(AtomI,2); + FunctorId = Yap_MkFunctor(AtomId,1); + FunctorInfo1 = Yap_MkFunctor(AtomInfo,1); + FunctorInfo2 = Yap_MkFunctor(AtomInfo,2); + FunctorInfo3 = Yap_MkFunctor(AtomInfo,3); + FunctorInfo4 = Yap_MkFunctor(AtomInfo,4); + FunctorIs = Yap_MkFunctor(AtomIs,2); + FunctorJ = Yap_MkFunctor(AtomJ,2); + FunctorLastExecuteWithin = Yap_MkFunctor(AtomLastExecuteWithin,1); + FunctorList = Yap_MkFunctor(AtomDot,2); + FunctorLOOP = Yap_MkFunctor(AtomLOOP,1); + FunctorMegaClause = Yap_MkFunctor(AtomMegaClause,2); + FunctorMetaCall = Yap_MkFunctor(AtomMetaCall,4); + FunctorMinus = Yap_MkFunctor(AtomMinus,2); + FunctorModule = Yap_MkFunctor(AtomColon,2); + FunctorMultiFileClause = Yap_MkFunctor(AtomMfClause,5); + FunctorMutable = Yap_MkFunctor(AtomMutableVariable,(sizeof(timed_var)/sizeof(CELL))); + FunctorMutex = Yap_MkFunctor(AtomMutex,2); + FunctorNotImplemented = Yap_MkFunctor(AtomNotImplemented,2); + FunctorNBQueue = Yap_MkFunctor(AtomQueue,4); + FunctorNot = Yap_MkFunctor(AtomNot,1); + FunctorObj = Yap_MkFunctor(AtomObj,1); + FunctorOr = Yap_MkFunctor(AtomSemic,2); + FunctorOutput = Yap_MkFunctor(AtomOutput,1); + FunctorPermissionError = Yap_MkFunctor(AtomPermissionError,3); + FunctorPlus = Yap_MkFunctor(AtomPlus,2); + FunctorPortray = Yap_MkFunctor(AtomPortray,1); + FunctorPrintMessage = Yap_MkFunctor(AtomPrintMessage,2); + FunctorProcedure = Yap_MkFunctor(AtomProcedure,5); + FunctorPriority = Yap_MkFunctor(AtomPriority,1); + FunctorPrologConstraint = Yap_MkFunctor(AtomProlog,2); + FunctorProtectStack = Yap_MkFunctor(AtomProtectStack,4); + FunctorQuery = Yap_MkFunctor(AtomQuery,1); + FunctorRecordedWithKey = Yap_MkFunctor(AtomRecordedWithKey,6); + FunctorRDiv = Yap_MkFunctor(AtomRDiv,2); + FunctorRedoFreeze = Yap_MkFunctor(AtomRedoFreeze,3); + FunctorRepresentationError = Yap_MkFunctor(AtomRepresentationError,1); + FunctorResourceError = Yap_MkFunctor(AtomResourceError,1); + FunctorRestoreRegs = Yap_MkFunctor(AtomRestoreRegs,2); + FunctorRestoreRegs1 = Yap_MkFunctor(AtomRestoreRegs,1); + FunctorSafe = Yap_MkFunctor(AtomSafe,1); + FunctorSafeCallCleanup = Yap_MkFunctor(AtomSafeCallCleanup,4); + FunctorSame = Yap_MkFunctor(AtomSame,2); + FunctorSlash = Yap_MkFunctor(AtomSlash,2); + FunctorStaticClause = Yap_MkFunctor(AtomStaticClause,2); + FunctorStream = Yap_MkFunctor(AtomStream,1); + FunctorStreamEOS = Yap_MkFunctor(AtomEndOfStream,1); + FunctorStreamPos = Yap_MkFunctor(AtomStreamPos,4); + FunctorString1 = Yap_MkFunctor(AtomString,1); + FunctorStyleCheck = Yap_MkFunctor(AtomStyleCheck,4); + FunctorSyntaxError = Yap_MkFunctor(AtomSyntaxError,4); + FunctorShortSyntaxError = Yap_MkFunctor(AtomSyntaxError,1); + FunctorTermExpansion = Yap_MkFunctor(AtomTermExpansion,2); + FunctorThreadRun = Yap_MkFunctor(AtomTopThreadGoal,2); + FunctorThrow = Yap_MkFunctor(AtomThrow,1); + FunctorTimeoutError = Yap_MkFunctor(AtomTimeoutError,2); + FunctorTraceMetaCall = Yap_MkFunctor(AtomTraceMetaCall,3); + FunctorTypeError = Yap_MkFunctor(AtomTypeError,2); + FunctorUMinus = Yap_MkFunctor(AtomMinus,1); + FunctorUndefinedQuery = Yap_MkFunctor(AtomUndefinedQuery,3); + FunctorUPlus = Yap_MkFunctor(AtomPlus,1); + FunctorVBar = Yap_MkFunctor(AtomVBar,2); + FunctorWriteTerm = Yap_MkFunctor(AtomWriteTerm,2); + FunctorHiddenVar = Yap_MkFunctor(AtomHiddenVar,1); diff --git a/H/generated/ihstruct.h b/H/generated/ihstruct.h index ade7235ec..c3043b726 100644 --- a/H/generated/ihstruct.h +++ b/H/generated/ihstruct.h @@ -152,6 +152,7 @@ PredTraceMetaCall = RepPredProp(PredPropByFunc(FunctorTraceMetaCall,PROLOG_MODULE)); PredCommentHook = RepPredProp(PredPropByFunc(FunctorCommentHook,PROLOG_MODULE)); PredProcedure = Yap_MkLogPred(RepPredProp(PredPropByFunc(FunctorProcedure,PROLOG_MODULE))); + PredUndefinedQuery = RepPredProp(PredPropByFunc(FunctorUndefinedQuery,PROLOG_MODULE)); #ifdef LOW_LEVEL_TRACER Yap_do_low_level_trace = FALSE; diff --git a/H/generated/ratoms.h b/H/generated/ratoms.h index 1deb1e028..f2589b54b 100644 --- a/H/generated/ratoms.h +++ b/H/generated/ratoms.h @@ -1,584 +1,586 @@ - - /* This file, ratoms.h, was generated automatically by "yap -L misc/buildatoms" - {lease do not update, update misc/ATOMS instead */ - - Atom3Dots = AtomAdjust(Atom3Dots); - AtomAbol = AtomAdjust(AtomAbol); TermAbol = MkAtomTerm(AtomAbol); - AtomAccess = AtomAdjust(AtomAccess); TermAccess = MkAtomTerm(AtomAccess); - AtomAfInet = AtomAdjust(AtomAfInet); TermAfInet = MkAtomTerm(AtomAfInet); - AtomAfLocal = AtomAdjust(AtomAfLocal); TermAfLocal = MkAtomTerm(AtomAfLocal); - AtomAfUnix = AtomAdjust(AtomAfUnix); TermAfUnix = MkAtomTerm(AtomAfUnix); - AtomAlarm = AtomAdjust(AtomAlarm); TermAlarm = MkAtomTerm(AtomAlarm); - AtomAlias = AtomAdjust(AtomAlias); TermAlias = MkAtomTerm(AtomAlias); - AtomAll = AtomAdjust(AtomAll); TermAll = MkAtomTerm(AtomAll); - AtomAltNot = AtomAdjust(AtomAltNot); TermAltNot = MkAtomTerm(AtomAltNot); - AtomAnswer = AtomAdjust(AtomAnswer); TermAnswer = MkAtomTerm(AtomAnswer); - AtomAny = AtomAdjust(AtomAny); TermAny = MkAtomTerm(AtomAny); - AtomAppend = AtomAdjust(AtomAppend); TermAppend = MkAtomTerm(AtomAppend); - AtomArg = AtomAdjust(AtomArg); TermArg = MkAtomTerm(AtomArg); - AtomArray = AtomAdjust(AtomArray); TermArray = MkAtomTerm(AtomArray); - AtomArrayAccess = AtomAdjust(AtomArrayAccess); TermArrayAccess = MkAtomTerm(AtomArrayAccess); - AtomArrayOverflow = AtomAdjust(AtomArrayOverflow); TermArrayOverflow = MkAtomTerm(AtomArrayOverflow); - AtomArrayType = AtomAdjust(AtomArrayType); TermArrayType = MkAtomTerm(AtomArrayType); - AtomArrow = AtomAdjust(AtomArrow); TermArrow = MkAtomTerm(AtomArrow); - AtomAttributedModule = AtomAdjust(AtomAttributedModule); TermAttributedModule = MkAtomTerm(AtomAttributedModule); - AtomDoubleArrow = AtomAdjust(AtomDoubleArrow); TermDoubleArrow = MkAtomTerm(AtomDoubleArrow); - AtomAssert = AtomAdjust(AtomAssert); TermAssert = MkAtomTerm(AtomAssert); - AtomBeginBracket = AtomAdjust(AtomBeginBracket); TermBeginBracket = MkAtomTerm(AtomBeginBracket); - AtomEndBracket = AtomAdjust(AtomEndBracket); TermEndBracket = MkAtomTerm(AtomEndBracket); - AtomBeginSquareBracket = AtomAdjust(AtomBeginSquareBracket); TermBeginSquareBracket = MkAtomTerm(AtomBeginSquareBracket); - AtomEndSquareBracket = AtomAdjust(AtomEndSquareBracket); TermEndSquareBracket = MkAtomTerm(AtomEndSquareBracket); - AtomBeginCurlyBracket = AtomAdjust(AtomBeginCurlyBracket); TermBeginCurlyBracket = MkAtomTerm(AtomBeginCurlyBracket); - AtomEndCurlyBracket = AtomAdjust(AtomEndCurlyBracket); TermEndCurlyBracket = MkAtomTerm(AtomEndCurlyBracket); - AtomEmptyBrackets = AtomAdjust(AtomEmptyBrackets); TermEmptyBrackets = MkAtomTerm(AtomEmptyBrackets); - AtomEmptySquareBrackets = AtomAdjust(AtomEmptySquareBrackets); TermEmptySquareBrackets = MkAtomTerm(AtomEmptySquareBrackets); - AtomAsserta = AtomAdjust(AtomAsserta); TermAsserta = MkAtomTerm(AtomAsserta); - AtomAssertaStatic = AtomAdjust(AtomAssertaStatic); TermAssertaStatic = MkAtomTerm(AtomAssertaStatic); - AtomAssertz = AtomAdjust(AtomAssertz); TermAssertz = MkAtomTerm(AtomAssertz); - AtomAssertzStatic = AtomAdjust(AtomAssertzStatic); TermAssertzStatic = MkAtomTerm(AtomAssertzStatic); - AtomAt = AtomAdjust(AtomAt); TermAt = MkAtomTerm(AtomAt); - AtomAtom = AtomAdjust(AtomAtom); TermAtom = MkAtomTerm(AtomAtom); - AtomAtomic = AtomAdjust(AtomAtomic); TermAtomic = MkAtomTerm(AtomAtomic); - AtomAtt = AtomAdjust(AtomAtt); TermAtt = MkAtomTerm(AtomAtt); - AtomAtt1 = AtomAdjust(AtomAtt1); TermAtt1 = MkAtomTerm(AtomAtt1); - AtomAttDo = AtomAdjust(AtomAttDo); TermAttDo = MkAtomTerm(AtomAttDo); - AtomAttributes = AtomAdjust(AtomAttributes); TermAttributes = MkAtomTerm(AtomAttributes); - AtomB = AtomAdjust(AtomB); TermB = MkAtomTerm(AtomB); - AtomBatched = AtomAdjust(AtomBatched); TermBatched = MkAtomTerm(AtomBatched); - AtomBetween = AtomAdjust(AtomBetween); TermBetween = MkAtomTerm(AtomBetween); - AtomBinary = AtomAdjust(AtomBinary); TermBinary = MkAtomTerm(AtomBinary); - AtomBigNum = AtomAdjust(AtomBigNum); TermBigNum = MkAtomTerm(AtomBigNum); - AtomBinaryStream = AtomAdjust(AtomBinaryStream); TermBinaryStream = MkAtomTerm(AtomBinaryStream); - AtomBoolean = AtomAdjust(AtomBoolean); TermBoolean = MkAtomTerm(AtomBoolean); - AtomBraces = AtomAdjust(AtomBraces); TermBraces = MkAtomTerm(AtomBraces); - AtomBreak = AtomAdjust(AtomBreak); TermBreak = MkAtomTerm(AtomBreak); - AtomByte = AtomAdjust(AtomByte); TermByte = MkAtomTerm(AtomByte); - AtomCArith = AtomAdjust(AtomCArith); TermCArith = MkAtomTerm(AtomCArith); - AtomCall = AtomAdjust(AtomCall); TermCall = MkAtomTerm(AtomCall); - AtomCallAndRetryCounter = AtomAdjust(AtomCallAndRetryCounter); TermCallAndRetryCounter = MkAtomTerm(AtomCallAndRetryCounter); - AtomCallCounter = AtomAdjust(AtomCallCounter); TermCallCounter = MkAtomTerm(AtomCallCounter); - AtomCallable = AtomAdjust(AtomCallable); TermCallable = MkAtomTerm(AtomCallable); - AtomCatch = AtomAdjust(AtomCatch); TermCatch = MkAtomTerm(AtomCatch); - AtomChangeModule = AtomAdjust(AtomChangeModule); TermChangeModule = MkAtomTerm(AtomChangeModule); - AtomChar = AtomAdjust(AtomChar); TermChar = MkAtomTerm(AtomChar); - AtomCharsio = AtomAdjust(AtomCharsio); TermCharsio = MkAtomTerm(AtomCharsio); - AtomCharacter = AtomAdjust(AtomCharacter); TermCharacter = MkAtomTerm(AtomCharacter); - AtomCharacterCode = AtomAdjust(AtomCharacterCode); TermCharacterCode = MkAtomTerm(AtomCharacterCode); - AtomChars = AtomAdjust(AtomChars); TermChars = MkAtomTerm(AtomChars); - AtomCharset = AtomAdjust(AtomCharset); TermCharset = MkAtomTerm(AtomCharset); - AtomChType = AtomAdjust(AtomChType); TermChType = MkAtomTerm(AtomChType); - AtomCleanCall = AtomAdjust(AtomCleanCall); TermCleanCall = MkAtomTerm(AtomCleanCall); - AtomClose = AtomAdjust(AtomClose); TermClose = MkAtomTerm(AtomClose); - AtomColon = AtomAdjust(AtomColon); TermColon = MkAtomTerm(AtomColon); - AtomCodeSpace = AtomAdjust(AtomCodeSpace); TermCodeSpace = MkAtomTerm(AtomCodeSpace); - AtomCodes = AtomAdjust(AtomCodes); TermCodes = MkAtomTerm(AtomCodes); - AtomCoInductive = AtomAdjust(AtomCoInductive); TermCoInductive = MkAtomTerm(AtomCoInductive); - AtomComma = AtomAdjust(AtomComma); TermComma = MkAtomTerm(AtomComma); - AtomCommentHook = AtomAdjust(AtomCommentHook); TermCommentHook = MkAtomTerm(AtomCommentHook); - AtomCompact = AtomAdjust(AtomCompact); TermCompact = MkAtomTerm(AtomCompact); - AtomCompound = AtomAdjust(AtomCompound); TermCompound = MkAtomTerm(AtomCompound); - AtomConsistencyError = AtomAdjust(AtomConsistencyError); TermConsistencyError = MkAtomTerm(AtomConsistencyError); - AtomConsult = AtomAdjust(AtomConsult); TermConsult = MkAtomTerm(AtomConsult); - AtomConsultOnBoot = AtomAdjust(AtomConsultOnBoot); TermConsultOnBoot = MkAtomTerm(AtomConsultOnBoot); - AtomContext = AtomAdjust(AtomContext); TermContext = MkAtomTerm(AtomContext); - AtomCputime = AtomAdjust(AtomCputime); TermCputime = MkAtomTerm(AtomCputime); - AtomCreate = AtomAdjust(AtomCreate); TermCreate = MkAtomTerm(AtomCreate); - AtomCreep = AtomAdjust(AtomCreep); TermCreep = MkAtomTerm(AtomCreep); - AtomCryptAtoms = AtomAdjust(AtomCryptAtoms); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms); - AtomCurly = AtomAdjust(AtomCurly); TermCurly = MkAtomTerm(AtomCurly); - AtomCsult = AtomAdjust(AtomCsult); TermCsult = MkAtomTerm(AtomCsult); - AtomCurrentModule = AtomAdjust(AtomCurrentModule); TermCurrentModule = MkAtomTerm(AtomCurrentModule); - AtomCut = AtomAdjust(AtomCut); TermCut = MkAtomTerm(AtomCut); - AtomCutBy = AtomAdjust(AtomCutBy); TermCutBy = MkAtomTerm(AtomCutBy); - AtomDAbort = AtomAdjust(AtomDAbort); TermDAbort = MkAtomTerm(AtomDAbort); - AtomDBLoad = AtomAdjust(AtomDBLoad); TermDBLoad = MkAtomTerm(AtomDBLoad); - AtomDBREF = AtomAdjust(AtomDBREF); TermDBREF = MkAtomTerm(AtomDBREF); - AtomDBReference = AtomAdjust(AtomDBReference); TermDBReference = MkAtomTerm(AtomDBReference); - AtomDBTerm = AtomAdjust(AtomDBTerm); TermDBTerm = MkAtomTerm(AtomDBTerm); - AtomDBref = AtomAdjust(AtomDBref); TermDBref = MkAtomTerm(AtomDBref); - AtomDInteger = AtomAdjust(AtomDInteger); TermDInteger = MkAtomTerm(AtomDInteger); - AtomDebugMeta = AtomAdjust(AtomDebugMeta); TermDebugMeta = MkAtomTerm(AtomDebugMeta); - AtomDebuggerInput = AtomAdjust(AtomDebuggerInput); TermDebuggerInput = MkAtomTerm(AtomDebuggerInput); - AtomDec10 = AtomAdjust(AtomDec10); TermDec10 = MkAtomTerm(AtomDec10); - AtomDefault = AtomAdjust(AtomDefault); TermDefault = MkAtomTerm(AtomDefault); - AtomDevNull = AtomAdjust(AtomDevNull); TermDevNull = MkAtomTerm(AtomDevNull); - AtomDiff = AtomAdjust(AtomDiff); TermDiff = MkAtomTerm(AtomDiff); - AtomDirectory = AtomAdjust(AtomDirectory); TermDirectory = MkAtomTerm(AtomDirectory); - AtomDiscontiguous = AtomAdjust(AtomDiscontiguous); TermDiscontiguous = MkAtomTerm(AtomDiscontiguous); - AtomDiscontiguousWarnings = AtomAdjust(AtomDiscontiguousWarnings); TermDiscontiguousWarnings = MkAtomTerm(AtomDiscontiguousWarnings); - AtomDollar = AtomAdjust(AtomDollar); TermDollar = MkAtomTerm(AtomDollar); - AtomDoLogUpdClause = AtomAdjust(AtomDoLogUpdClause); TermDoLogUpdClause = MkAtomTerm(AtomDoLogUpdClause); - AtomDoLogUpdClause0 = AtomAdjust(AtomDoLogUpdClause0); TermDoLogUpdClause0 = MkAtomTerm(AtomDoLogUpdClause0); - AtomDoLogUpdClauseErase = AtomAdjust(AtomDoLogUpdClauseErase); TermDoLogUpdClauseErase = MkAtomTerm(AtomDoLogUpdClauseErase); - AtomDollarU = AtomAdjust(AtomDollarU); TermDollarU = MkAtomTerm(AtomDollarU); - AtomDollarUndef = AtomAdjust(AtomDollarUndef); TermDollarUndef = MkAtomTerm(AtomDollarUndef); - AtomDomainError = AtomAdjust(AtomDomainError); TermDomainError = MkAtomTerm(AtomDomainError); - AtomDoStaticClause = AtomAdjust(AtomDoStaticClause); TermDoStaticClause = MkAtomTerm(AtomDoStaticClause); - AtomDots = AtomAdjust(AtomDots); TermDots = MkAtomTerm(AtomDots); - AtomDOUBLE = AtomAdjust(AtomDOUBLE); TermDOUBLE = MkAtomTerm(AtomDOUBLE); - AtomDoubleSlash = AtomAdjust(AtomDoubleSlash); TermDoubleSlash = MkAtomTerm(AtomDoubleSlash); - AtomE = AtomAdjust(AtomE); TermE = MkAtomTerm(AtomE); - AtomEOFBeforeEOT = AtomAdjust(AtomEOFBeforeEOT); TermEOFBeforeEOT = MkAtomTerm(AtomEOFBeforeEOT); - AtomEQ = AtomAdjust(AtomEQ); TermEQ = MkAtomTerm(AtomEQ); - AtomEmptyAtom = AtomAdjust(AtomEmptyAtom); TermEmptyAtom = MkAtomTerm(AtomEmptyAtom); - AtomEncoding = AtomAdjust(AtomEncoding); TermEncoding = MkAtomTerm(AtomEncoding); - AtomEndOfStream = AtomAdjust(AtomEndOfStream); TermEndOfStream = MkAtomTerm(AtomEndOfStream); - AtomEof = AtomAdjust(AtomEof); TermEof = MkAtomTerm(AtomEof); - AtomEOfCode = AtomAdjust(AtomEOfCode); TermEOfCode = MkAtomTerm(AtomEOfCode); - AtomEq = AtomAdjust(AtomEq); TermEq = MkAtomTerm(AtomEq); - AtomError = AtomAdjust(AtomError); TermError = MkAtomTerm(AtomError); - AtomException = AtomAdjust(AtomException); TermException = MkAtomTerm(AtomException); - AtomExtensions = AtomAdjust(AtomExtensions); TermExtensions = MkAtomTerm(AtomExtensions); - AtomEvaluable = AtomAdjust(AtomEvaluable); TermEvaluable = MkAtomTerm(AtomEvaluable); - AtomEvaluationError = AtomAdjust(AtomEvaluationError); TermEvaluationError = MkAtomTerm(AtomEvaluationError); - AtomExecutable = AtomAdjust(AtomExecutable); TermExecutable = MkAtomTerm(AtomExecutable); - AtomExecute = AtomAdjust(AtomExecute); TermExecute = MkAtomTerm(AtomExecute); - AtomExecAnswers = AtomAdjust(AtomExecAnswers); TermExecAnswers = MkAtomTerm(AtomExecAnswers); - AtomExecuteInMod = AtomAdjust(AtomExecuteInMod); TermExecuteInMod = MkAtomTerm(AtomExecuteInMod); - AtomExecuteWithin = AtomAdjust(AtomExecuteWithin); TermExecuteWithin = MkAtomTerm(AtomExecuteWithin); - AtomExecuteWoMod = AtomAdjust(AtomExecuteWoMod); TermExecuteWoMod = MkAtomTerm(AtomExecuteWoMod); - AtomExist = AtomAdjust(AtomExist); TermExist = MkAtomTerm(AtomExist); - AtomExists = AtomAdjust(AtomExists); TermExists = MkAtomTerm(AtomExists); - AtomExit = AtomAdjust(AtomExit); TermExit = MkAtomTerm(AtomExit); - AtomExistenceError = AtomAdjust(AtomExistenceError); TermExistenceError = MkAtomTerm(AtomExistenceError); - AtomExoClause = AtomAdjust(AtomExoClause); TermExoClause = MkAtomTerm(AtomExoClause); - AtomExpectedNumber = AtomAdjust(AtomExpectedNumber); TermExpectedNumber = MkAtomTerm(AtomExpectedNumber); - AtomExpand = AtomAdjust(AtomExpand); TermExpand = MkAtomTerm(AtomExpand); - AtomExtendFileSearchPath = AtomAdjust(AtomExtendFileSearchPath); TermExtendFileSearchPath = MkAtomTerm(AtomExtendFileSearchPath); - AtomExtendsions = AtomAdjust(AtomExtendsions); TermExtendsions = MkAtomTerm(AtomExtendsions); - AtomFB = AtomAdjust(AtomFB); TermFB = MkAtomTerm(AtomFB); - AtomFail = AtomAdjust(AtomFail); TermFail = MkAtomTerm(AtomFail); - AtomFalse = AtomAdjust(AtomFalse); TermFalse = MkAtomTerm(AtomFalse); - AtomFast = AtomAdjust(AtomFast); TermFast = MkAtomTerm(AtomFast); - AtomFastFail = AtomAdjust(AtomFastFail); TermFastFail = MkAtomTerm(AtomFastFail); - AtomFileErrors = AtomAdjust(AtomFileErrors); TermFileErrors = MkAtomTerm(AtomFileErrors); - AtomFileerrors = AtomAdjust(AtomFileerrors); TermFileerrors = MkAtomTerm(AtomFileerrors); - AtomFileType = AtomAdjust(AtomFileType); TermFileType = MkAtomTerm(AtomFileType); - AtomFirst = AtomAdjust(AtomFirst); TermFirst = MkAtomTerm(AtomFirst); - AtomFloat = AtomAdjust(AtomFloat); TermFloat = MkAtomTerm(AtomFloat); - AtomFloatFormat = AtomAdjust(AtomFloatFormat); TermFloatFormat = MkAtomTerm(AtomFloatFormat); - AtomFloatOverflow = AtomAdjust(AtomFloatOverflow); TermFloatOverflow = MkAtomTerm(AtomFloatOverflow); - AtomFloatUnderflow = AtomAdjust(AtomFloatUnderflow); TermFloatUnderflow = MkAtomTerm(AtomFloatUnderflow); - AtomFormat = AtomAdjust(AtomFormat); TermFormat = MkAtomTerm(AtomFormat); - AtomFormatAt = AtomAdjust(AtomFormatAt); TermFormatAt = MkAtomTerm(AtomFormatAt); - AtomFull = AtomAdjust(AtomFull); TermFull = MkAtomTerm(AtomFull); - AtomFunctor = AtomAdjust(AtomFunctor); TermFunctor = MkAtomTerm(AtomFunctor); - AtomGT = AtomAdjust(AtomGT); TermGT = MkAtomTerm(AtomGT); - AtomGVar = AtomAdjust(AtomGVar); TermGVar = MkAtomTerm(AtomGVar); - AtomGc = AtomAdjust(AtomGc); TermGc = MkAtomTerm(AtomGc); - AtomGcMargin = AtomAdjust(AtomGcMargin); TermGcMargin = MkAtomTerm(AtomGcMargin); - AtomGcTrace = AtomAdjust(AtomGcTrace); TermGcTrace = MkAtomTerm(AtomGcTrace); - AtomGcVerbose = AtomAdjust(AtomGcVerbose); TermGcVerbose = MkAtomTerm(AtomGcVerbose); - AtomGcVeryVerbose = AtomAdjust(AtomGcVeryVerbose); TermGcVeryVerbose = MkAtomTerm(AtomGcVeryVerbose); - AtomGeneratePredInfo = AtomAdjust(AtomGeneratePredInfo); TermGeneratePredInfo = MkAtomTerm(AtomGeneratePredInfo); - AtomGetwork = AtomAdjust(AtomGetwork); TermGetwork = MkAtomTerm(AtomGetwork); - AtomGetworkSeq = AtomAdjust(AtomGetworkSeq); TermGetworkSeq = MkAtomTerm(AtomGetworkSeq); - AtomGlob = AtomAdjust(AtomGlob); TermGlob = MkAtomTerm(AtomGlob); - AtomGlobal = AtomAdjust(AtomGlobal); TermGlobal = MkAtomTerm(AtomGlobal); - AtomGlobalSp = AtomAdjust(AtomGlobalSp); TermGlobalSp = MkAtomTerm(AtomGlobalSp); - AtomGlobalTrie = AtomAdjust(AtomGlobalTrie); TermGlobalTrie = MkAtomTerm(AtomGlobalTrie); - AtomGoalExpansion = AtomAdjust(AtomGoalExpansion); TermGoalExpansion = MkAtomTerm(AtomGoalExpansion); - AtomHat = AtomAdjust(AtomHat); TermHat = MkAtomTerm(AtomHat); - AtomHERE = AtomAdjust(AtomHERE); TermHERE = MkAtomTerm(AtomHERE); - AtomHandleThrow = AtomAdjust(AtomHandleThrow); TermHandleThrow = MkAtomTerm(AtomHandleThrow); - AtomHeap = AtomAdjust(AtomHeap); TermHeap = MkAtomTerm(AtomHeap); - AtomHeapUsed = AtomAdjust(AtomHeapUsed); TermHeapUsed = MkAtomTerm(AtomHeapUsed); - AtomHugeInt = AtomAdjust(AtomHugeInt); TermHugeInt = MkAtomTerm(AtomHugeInt); - AtomIDB = AtomAdjust(AtomIDB); TermIDB = MkAtomTerm(AtomIDB); - AtomIOMode = AtomAdjust(AtomIOMode); TermIOMode = MkAtomTerm(AtomIOMode); - AtomI = AtomAdjust(AtomI); TermI = MkAtomTerm(AtomI); - AtomId = AtomAdjust(AtomId); TermId = MkAtomTerm(AtomId); - AtomIgnore = AtomAdjust(AtomIgnore); TermIgnore = MkAtomTerm(AtomIgnore); - AtomInf = AtomAdjust(AtomInf); TermInf = MkAtomTerm(AtomInf); - AtomInfinity = AtomAdjust(AtomInfinity); TermInfinity = MkAtomTerm(AtomInfinity); - AtomInfo = AtomAdjust(AtomInfo); TermInfo = MkAtomTerm(AtomInfo); - AtomInitGoal = AtomAdjust(AtomInitGoal); TermInitGoal = MkAtomTerm(AtomInitGoal); - AtomInitProlog = AtomAdjust(AtomInitProlog); TermInitProlog = MkAtomTerm(AtomInitProlog); - AtomInStackExpansion = AtomAdjust(AtomInStackExpansion); TermInStackExpansion = MkAtomTerm(AtomInStackExpansion); - AtomInput = AtomAdjust(AtomInput); TermInput = MkAtomTerm(AtomInput); - AtomInstantiationError = AtomAdjust(AtomInstantiationError); TermInstantiationError = MkAtomTerm(AtomInstantiationError); - AtomInt = AtomAdjust(AtomInt); TermInt = MkAtomTerm(AtomInt); - AtomIntOverflow = AtomAdjust(AtomIntOverflow); TermIntOverflow = MkAtomTerm(AtomIntOverflow); - AtomInteger = AtomAdjust(AtomInteger); TermInteger = MkAtomTerm(AtomInteger); - AtomInternalCompilerError = AtomAdjust(AtomInternalCompilerError); TermInternalCompilerError = MkAtomTerm(AtomInternalCompilerError); - AtomIs = AtomAdjust(AtomIs); TermIs = MkAtomTerm(AtomIs); - AtomJ = AtomAdjust(AtomJ); TermJ = MkAtomTerm(AtomJ); - Atoml = AtomAdjust(Atoml); Terml = MkAtomTerm(Atoml); - AtomKey = AtomAdjust(AtomKey); TermKey = MkAtomTerm(AtomKey); - AtomLDLibraryPath = AtomAdjust(AtomLDLibraryPath); TermLDLibraryPath = MkAtomTerm(AtomLDLibraryPath); - AtomLONGINT = AtomAdjust(AtomLONGINT); TermLONGINT = MkAtomTerm(AtomLONGINT); - AtomLOOP = AtomAdjust(AtomLOOP); TermLOOP = MkAtomTerm(AtomLOOP); - AtomLoopStream = AtomAdjust(AtomLoopStream); TermLoopStream = MkAtomTerm(AtomLoopStream); - AtomLT = AtomAdjust(AtomLT); TermLT = MkAtomTerm(AtomLT); - AtomLastExecuteWithin = AtomAdjust(AtomLastExecuteWithin); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin); - AtomLeash = AtomAdjust(AtomLeash); TermLeash = MkAtomTerm(AtomLeash); - AtomLeast = AtomAdjust(AtomLeast); TermLeast = MkAtomTerm(AtomLeast); - AtomLength = AtomAdjust(AtomLength); TermLength = MkAtomTerm(AtomLength); - AtomList = AtomAdjust(AtomList); TermList = MkAtomTerm(AtomList); - AtomLine = AtomAdjust(AtomLine); TermLine = MkAtomTerm(AtomLine); - AtomLive = AtomAdjust(AtomLive); TermLive = MkAtomTerm(AtomLive); - AtomLoadAnswers = AtomAdjust(AtomLoadAnswers); TermLoadAnswers = MkAtomTerm(AtomLoadAnswers); - AtomLocal = AtomAdjust(AtomLocal); TermLocal = MkAtomTerm(AtomLocal); - AtomLocalSp = AtomAdjust(AtomLocalSp); TermLocalSp = MkAtomTerm(AtomLocalSp); - AtomLocalTrie = AtomAdjust(AtomLocalTrie); TermLocalTrie = MkAtomTerm(AtomLocalTrie); - AtomMax = AtomAdjust(AtomMax); TermMax = MkAtomTerm(AtomMax); - AtomMaximum = AtomAdjust(AtomMaximum); TermMaximum = MkAtomTerm(AtomMaximum); - AtomMaxArity = AtomAdjust(AtomMaxArity); TermMaxArity = MkAtomTerm(AtomMaxArity); - AtomMaxFiles = AtomAdjust(AtomMaxFiles); TermMaxFiles = MkAtomTerm(AtomMaxFiles); - AtomMegaClause = AtomAdjust(AtomMegaClause); TermMegaClause = MkAtomTerm(AtomMegaClause); - AtomMetaCall = AtomAdjust(AtomMetaCall); TermMetaCall = MkAtomTerm(AtomMetaCall); - AtomMfClause = AtomAdjust(AtomMfClause); TermMfClause = MkAtomTerm(AtomMfClause); - AtomMin = AtomAdjust(AtomMin); TermMin = MkAtomTerm(AtomMin); - AtomMinimum = AtomAdjust(AtomMinimum); TermMinimum = MkAtomTerm(AtomMinimum); - AtomMinus = AtomAdjust(AtomMinus); TermMinus = MkAtomTerm(AtomMinus); - AtomModify = AtomAdjust(AtomModify); TermModify = MkAtomTerm(AtomModify); - AtomModule = AtomAdjust(AtomModule); TermModule = MkAtomTerm(AtomModule); - AtomMost = AtomAdjust(AtomMost); TermMost = MkAtomTerm(AtomMost); - AtomMulti = AtomAdjust(AtomMulti); TermMulti = MkAtomTerm(AtomMulti); - AtomMultiFile = AtomAdjust(AtomMultiFile); TermMultiFile = MkAtomTerm(AtomMultiFile); - AtomMultiple = AtomAdjust(AtomMultiple); TermMultiple = MkAtomTerm(AtomMultiple); - AtomMutable = AtomAdjust(AtomMutable); TermMutable = MkAtomTerm(AtomMutable); - AtomMutableVariable = AtomAdjust(AtomMutableVariable); TermMutableVariable = MkAtomTerm(AtomMutableVariable); - AtomMutex = AtomAdjust(AtomMutex); TermMutex = MkAtomTerm(AtomMutex); - AtomMyddasDB = AtomAdjust(AtomMyddasDB); TermMyddasDB = MkAtomTerm(AtomMyddasDB); - AtomMyddasGoal = AtomAdjust(AtomMyddasGoal); TermMyddasGoal = MkAtomTerm(AtomMyddasGoal); - AtomMyddasHost = AtomAdjust(AtomMyddasHost); TermMyddasHost = MkAtomTerm(AtomMyddasHost); - AtomMyddasPass = AtomAdjust(AtomMyddasPass); TermMyddasPass = MkAtomTerm(AtomMyddasPass); - AtomMyddasUser = AtomAdjust(AtomMyddasUser); TermMyddasUser = MkAtomTerm(AtomMyddasUser); - AtomMyddasVersionName = AtomAdjust(AtomMyddasVersionName); TermMyddasVersionName = MkAtomTerm(AtomMyddasVersionName); - AtomNan = AtomAdjust(AtomNan); TermNan = MkAtomTerm(AtomNan); - AtomNb = AtomAdjust(AtomNb); TermNb = MkAtomTerm(AtomNb); - AtomNbTerm = AtomAdjust(AtomNbTerm); TermNbTerm = MkAtomTerm(AtomNbTerm); - AtomNew = AtomAdjust(AtomNew); TermNew = MkAtomTerm(AtomNew); - AtomNewLine = AtomAdjust(AtomNewLine); TermNewLine = MkAtomTerm(AtomNewLine); - AtomNl = AtomAdjust(AtomNl); TermNl = MkAtomTerm(AtomNl); - AtomNoEffect = AtomAdjust(AtomNoEffect); TermNoEffect = MkAtomTerm(AtomNoEffect); - AtomNoMemory = AtomAdjust(AtomNoMemory); TermNoMemory = MkAtomTerm(AtomNoMemory); - AtomNone = AtomAdjust(AtomNone); TermNone = MkAtomTerm(AtomNone); - AtomNonEmptyList = AtomAdjust(AtomNonEmptyList); TermNonEmptyList = MkAtomTerm(AtomNonEmptyList); - AtomNot = AtomAdjust(AtomNot); TermNot = MkAtomTerm(AtomNot); - AtomNotImplemented = AtomAdjust(AtomNotImplemented); TermNotImplemented = MkAtomTerm(AtomNotImplemented); - AtomNotLessThanZero = AtomAdjust(AtomNotLessThanZero); TermNotLessThanZero = MkAtomTerm(AtomNotLessThanZero); - AtomNotNewline = AtomAdjust(AtomNotNewline); TermNotNewline = MkAtomTerm(AtomNotNewline); - AtomNotZero = AtomAdjust(AtomNotZero); TermNotZero = MkAtomTerm(AtomNotZero); - AtomNumber = AtomAdjust(AtomNumber); TermNumber = MkAtomTerm(AtomNumber); - AtomObj = AtomAdjust(AtomObj); TermObj = MkAtomTerm(AtomObj); - AtomOff = AtomAdjust(AtomOff); TermOff = MkAtomTerm(AtomOff); - AtomOffline = AtomAdjust(AtomOffline); TermOffline = MkAtomTerm(AtomOffline); - AtomOn = AtomAdjust(AtomOn); TermOn = MkAtomTerm(AtomOn); - AtomOnline = AtomAdjust(AtomOnline); TermOnline = MkAtomTerm(AtomOnline); - AtomOpen = AtomAdjust(AtomOpen); TermOpen = MkAtomTerm(AtomOpen); - AtomOperatingSystemError = AtomAdjust(AtomOperatingSystemError); TermOperatingSystemError = MkAtomTerm(AtomOperatingSystemError); - AtomOperatingSystemSupport = AtomAdjust(AtomOperatingSystemSupport); TermOperatingSystemSupport = MkAtomTerm(AtomOperatingSystemSupport); - AtomOperator = AtomAdjust(AtomOperator); TermOperator = MkAtomTerm(AtomOperator); - AtomOperatorPriority = AtomAdjust(AtomOperatorPriority); TermOperatorPriority = MkAtomTerm(AtomOperatorPriority); - AtomOperatorSpecifier = AtomAdjust(AtomOperatorSpecifier); TermOperatorSpecifier = MkAtomTerm(AtomOperatorSpecifier); - AtomOpt = AtomAdjust(AtomOpt); TermOpt = MkAtomTerm(AtomOpt); - AtomOtherwise = AtomAdjust(AtomOtherwise); TermOtherwise = MkAtomTerm(AtomOtherwise); - AtomOutOfAttvarsError = AtomAdjust(AtomOutOfAttvarsError); TermOutOfAttvarsError = MkAtomTerm(AtomOutOfAttvarsError); - AtomOutOfAuxspaceError = AtomAdjust(AtomOutOfAuxspaceError); TermOutOfAuxspaceError = MkAtomTerm(AtomOutOfAuxspaceError); - AtomOutOfHeapError = AtomAdjust(AtomOutOfHeapError); TermOutOfHeapError = MkAtomTerm(AtomOutOfHeapError); - AtomOutOfRange = AtomAdjust(AtomOutOfRange); TermOutOfRange = MkAtomTerm(AtomOutOfRange); - AtomOutOfStackError = AtomAdjust(AtomOutOfStackError); TermOutOfStackError = MkAtomTerm(AtomOutOfStackError); - AtomOutOfTrailError = AtomAdjust(AtomOutOfTrailError); TermOutOfTrailError = MkAtomTerm(AtomOutOfTrailError); - AtomOutput = AtomAdjust(AtomOutput); TermOutput = MkAtomTerm(AtomOutput); - AtomParameter = AtomAdjust(AtomParameter); TermParameter = MkAtomTerm(AtomParameter); - AtomPrologCommonsDir = AtomAdjust(AtomPrologCommonsDir); TermPrologCommonsDir = MkAtomTerm(AtomPrologCommonsDir); - AtomPast = AtomAdjust(AtomPast); TermPast = MkAtomTerm(AtomPast); - AtomPastEndOfStream = AtomAdjust(AtomPastEndOfStream); TermPastEndOfStream = MkAtomTerm(AtomPastEndOfStream); - AtomPermissionError = AtomAdjust(AtomPermissionError); TermPermissionError = MkAtomTerm(AtomPermissionError); - AtomPi = AtomAdjust(AtomPi); TermPi = MkAtomTerm(AtomPi); - AtomPipe = AtomAdjust(AtomPipe); TermPipe = MkAtomTerm(AtomPipe); - AtomPriority = AtomAdjust(AtomPriority); TermPriority = MkAtomTerm(AtomPriority); - AtomPlus = AtomAdjust(AtomPlus); TermPlus = MkAtomTerm(AtomPlus); - AtomPointer = AtomAdjust(AtomPointer); TermPointer = MkAtomTerm(AtomPointer); - AtomPortray = AtomAdjust(AtomPortray); TermPortray = MkAtomTerm(AtomPortray); - AtomPredicateIndicator = AtomAdjust(AtomPredicateIndicator); TermPredicateIndicator = MkAtomTerm(AtomPredicateIndicator); - AtomPrimitive = AtomAdjust(AtomPrimitive); TermPrimitive = MkAtomTerm(AtomPrimitive); - AtomPrintMessage = AtomAdjust(AtomPrintMessage); TermPrintMessage = MkAtomTerm(AtomPrintMessage); - AtomPrivateProcedure = AtomAdjust(AtomPrivateProcedure); TermPrivateProcedure = MkAtomTerm(AtomPrivateProcedure); - AtomProcedure = AtomAdjust(AtomProcedure); TermProcedure = MkAtomTerm(AtomProcedure); - AtomProfile = AtomAdjust(AtomProfile); TermProfile = MkAtomTerm(AtomProfile); - AtomProlog = AtomAdjust(AtomProlog); TermProlog = MkAtomTerm(AtomProlog); - AtomProtectStack = AtomAdjust(AtomProtectStack); TermProtectStack = MkAtomTerm(AtomProtectStack); - AtomQly = AtomAdjust(AtomQly); TermQly = MkAtomTerm(AtomQly); - AtomQuery = AtomAdjust(AtomQuery); TermQuery = MkAtomTerm(AtomQuery); - AtomQueue = AtomAdjust(AtomQueue); TermQueue = MkAtomTerm(AtomQueue); - AtomQuiet = AtomAdjust(AtomQuiet); TermQuiet = MkAtomTerm(AtomQuiet); - AtomRadix = AtomAdjust(AtomRadix); TermRadix = MkAtomTerm(AtomRadix); - AtomRandom = AtomAdjust(AtomRandom); TermRandom = MkAtomTerm(AtomRandom); - AtomRange = AtomAdjust(AtomRange); TermRange = MkAtomTerm(AtomRange); - AtomRDiv = AtomAdjust(AtomRDiv); TermRDiv = MkAtomTerm(AtomRDiv); - AtomRead = AtomAdjust(AtomRead); TermRead = MkAtomTerm(AtomRead); - AtomReadOnly = AtomAdjust(AtomReadOnly); TermReadOnly = MkAtomTerm(AtomReadOnly); - AtomReadWrite = AtomAdjust(AtomReadWrite); TermReadWrite = MkAtomTerm(AtomReadWrite); - AtomReadutil = AtomAdjust(AtomReadutil); TermReadutil = MkAtomTerm(AtomReadutil); - AtomReconsult = AtomAdjust(AtomReconsult); TermReconsult = MkAtomTerm(AtomReconsult); - AtomRecordedP = AtomAdjust(AtomRecordedP); TermRecordedP = MkAtomTerm(AtomRecordedP); - AtomRecordedWithKey = AtomAdjust(AtomRecordedWithKey); TermRecordedWithKey = MkAtomTerm(AtomRecordedWithKey); - AtomRedefineWarnings = AtomAdjust(AtomRedefineWarnings); TermRedefineWarnings = MkAtomTerm(AtomRedefineWarnings); - AtomRedoFreeze = AtomAdjust(AtomRedoFreeze); TermRedoFreeze = MkAtomTerm(AtomRedoFreeze); - AtomRefoundVar = AtomAdjust(AtomRefoundVar); TermRefoundVar = MkAtomTerm(AtomRefoundVar); - AtomRelativeTo = AtomAdjust(AtomRelativeTo); TermRelativeTo = MkAtomTerm(AtomRelativeTo); - AtomRepeat = AtomAdjust(AtomRepeat); TermRepeat = MkAtomTerm(AtomRepeat); - AtomRepeatSpace = AtomAdjust(AtomRepeatSpace); TermRepeatSpace = MkAtomTerm(AtomRepeatSpace); - AtomReposition = AtomAdjust(AtomReposition); TermReposition = MkAtomTerm(AtomReposition); - AtomRepresentationError = AtomAdjust(AtomRepresentationError); TermRepresentationError = MkAtomTerm(AtomRepresentationError); - AtomReset = AtomAdjust(AtomReset); TermReset = MkAtomTerm(AtomReset); - AtomResize = AtomAdjust(AtomResize); TermResize = MkAtomTerm(AtomResize); - AtomResourceError = AtomAdjust(AtomResourceError); TermResourceError = MkAtomTerm(AtomResourceError); - AtomRestoreRegs = AtomAdjust(AtomRestoreRegs); TermRestoreRegs = MkAtomTerm(AtomRestoreRegs); - AtomRetry = AtomAdjust(AtomRetry); TermRetry = MkAtomTerm(AtomRetry); - AtomRetryCounter = AtomAdjust(AtomRetryCounter); TermRetryCounter = MkAtomTerm(AtomRetryCounter); - AtomRTree = AtomAdjust(AtomRTree); TermRTree = MkAtomTerm(AtomRTree); - AtomSafe = AtomAdjust(AtomSafe); TermSafe = MkAtomTerm(AtomSafe); - AtomSafeCallCleanup = AtomAdjust(AtomSafeCallCleanup); TermSafeCallCleanup = MkAtomTerm(AtomSafeCallCleanup); - AtomSame = AtomAdjust(AtomSame); TermSame = MkAtomTerm(AtomSame); - AtomSemic = AtomAdjust(AtomSemic); TermSemic = MkAtomTerm(AtomSemic); - AtomShiftCountOverflow = AtomAdjust(AtomShiftCountOverflow); TermShiftCountOverflow = MkAtomTerm(AtomShiftCountOverflow); - AtomSigAlarm = AtomAdjust(AtomSigAlarm); TermSigAlarm = MkAtomTerm(AtomSigAlarm); - AtomSigBreak = AtomAdjust(AtomSigBreak); TermSigBreak = MkAtomTerm(AtomSigBreak); - AtomSigCreep = AtomAdjust(AtomSigCreep); TermSigCreep = MkAtomTerm(AtomSigCreep); - AtomSigDebug = AtomAdjust(AtomSigDebug); TermSigDebug = MkAtomTerm(AtomSigDebug); - AtomSigDelayCreep = AtomAdjust(AtomSigDelayCreep); TermSigDelayCreep = MkAtomTerm(AtomSigDelayCreep); - AtomSigFPE = AtomAdjust(AtomSigFPE); TermSigFPE = MkAtomTerm(AtomSigFPE); - AtomSigHup = AtomAdjust(AtomSigHup); TermSigHup = MkAtomTerm(AtomSigHup); - AtomSigInt = AtomAdjust(AtomSigInt); TermSigInt = MkAtomTerm(AtomSigInt); - AtomSigIti = AtomAdjust(AtomSigIti); TermSigIti = MkAtomTerm(AtomSigIti); - AtomSigPending = AtomAdjust(AtomSigPending); TermSigPending = MkAtomTerm(AtomSigPending); - AtomSigPipe = AtomAdjust(AtomSigPipe); TermSigPipe = MkAtomTerm(AtomSigPipe); - AtomSigStackDump = AtomAdjust(AtomSigStackDump); TermSigStackDump = MkAtomTerm(AtomSigStackDump); - AtomSigStatistics = AtomAdjust(AtomSigStatistics); TermSigStatistics = MkAtomTerm(AtomSigStatistics); - AtomSigTrace = AtomAdjust(AtomSigTrace); TermSigTrace = MkAtomTerm(AtomSigTrace); - AtomSigUsr1 = AtomAdjust(AtomSigUsr1); TermSigUsr1 = MkAtomTerm(AtomSigUsr1); - AtomSigUsr2 = AtomAdjust(AtomSigUsr2); TermSigUsr2 = MkAtomTerm(AtomSigUsr2); - AtomSigVTAlarm = AtomAdjust(AtomSigVTAlarm); TermSigVTAlarm = MkAtomTerm(AtomSigVTAlarm); - AtomSigWakeUp = AtomAdjust(AtomSigWakeUp); TermSigWakeUp = MkAtomTerm(AtomSigWakeUp); - AtomSilent = AtomAdjust(AtomSilent); TermSilent = MkAtomTerm(AtomSilent); - AtomSingle = AtomAdjust(AtomSingle); TermSingle = MkAtomTerm(AtomSingle); - AtomSingleVarWarnings = AtomAdjust(AtomSingleVarWarnings); TermSingleVarWarnings = MkAtomTerm(AtomSingleVarWarnings); - AtomSingleton = AtomAdjust(AtomSingleton); TermSingleton = MkAtomTerm(AtomSingleton); - AtomSlash = AtomAdjust(AtomSlash); TermSlash = MkAtomTerm(AtomSlash); - AtomSocket = AtomAdjust(AtomSocket); TermSocket = MkAtomTerm(AtomSocket); - AtomSolutions = AtomAdjust(AtomSolutions); TermSolutions = MkAtomTerm(AtomSolutions); - AtomSource = AtomAdjust(AtomSource); TermSource = MkAtomTerm(AtomSource); - AtomSourceSink = AtomAdjust(AtomSourceSink); TermSourceSink = MkAtomTerm(AtomSourceSink); - AtomSpy = AtomAdjust(AtomSpy); TermSpy = MkAtomTerm(AtomSpy); - AtomStack = AtomAdjust(AtomStack); TermStack = MkAtomTerm(AtomStack); - AtomStackFree = AtomAdjust(AtomStackFree); TermStackFree = MkAtomTerm(AtomStackFree); - AtomStartupSavedState = AtomAdjust(AtomStartupSavedState); TermStartupSavedState = MkAtomTerm(AtomStartupSavedState); - AtomStaticClause = AtomAdjust(AtomStaticClause); TermStaticClause = MkAtomTerm(AtomStaticClause); - AtomStaticProcedure = AtomAdjust(AtomStaticProcedure); TermStaticProcedure = MkAtomTerm(AtomStaticProcedure); - AtomStream = AtomAdjust(AtomStream); TermStream = MkAtomTerm(AtomStream); - AtomSWIStream = AtomAdjust(AtomSWIStream); TermSWIStream = MkAtomTerm(AtomSWIStream); - AtomVStream = AtomAdjust(AtomVStream); TermVStream = MkAtomTerm(AtomVStream); - AtomStreams = AtomAdjust(AtomStreams); TermStreams = MkAtomTerm(AtomStreams); - AtomStreamOrAlias = AtomAdjust(AtomStreamOrAlias); TermStreamOrAlias = MkAtomTerm(AtomStreamOrAlias); - AtomStreamPos = AtomAdjust(AtomStreamPos); TermStreamPos = MkAtomTerm(AtomStreamPos); - AtomStreamPosition = AtomAdjust(AtomStreamPosition); TermStreamPosition = MkAtomTerm(AtomStreamPosition); - AtomString = AtomAdjust(AtomString); TermString = MkAtomTerm(AtomString); - AtomStyleCheck = AtomAdjust(AtomStyleCheck); TermStyleCheck = MkAtomTerm(AtomStyleCheck); - AtomSTRING = AtomAdjust(AtomSTRING); TermSTRING = MkAtomTerm(AtomSTRING); - AtomSwi = AtomAdjust(AtomSwi); TermSwi = MkAtomTerm(AtomSwi); - AtomSymbolChar = AtomAdjust(AtomSymbolChar); TermSymbolChar = MkAtomTerm(AtomSymbolChar); - AtomSyntaxError = AtomAdjust(AtomSyntaxError); TermSyntaxError = MkAtomTerm(AtomSyntaxError); - AtomSyntaxErrors = AtomAdjust(AtomSyntaxErrors); TermSyntaxErrors = MkAtomTerm(AtomSyntaxErrors); - AtomSyntaxErrorHandler = AtomAdjust(AtomSyntaxErrorHandler); TermSyntaxErrorHandler = MkAtomTerm(AtomSyntaxErrorHandler); - AtomSystem = AtomAdjust(AtomSystem); TermSystem = MkAtomTerm(AtomSystem); - AtomSystemError = AtomAdjust(AtomSystemError); TermSystemError = MkAtomTerm(AtomSystemError); - AtomSystemLibraryDir = AtomAdjust(AtomSystemLibraryDir); TermSystemLibraryDir = MkAtomTerm(AtomSystemLibraryDir); - AtomT = AtomAdjust(AtomT); TermT = MkAtomTerm(AtomT); - AtomTerm = AtomAdjust(AtomTerm); TermTerm = MkAtomTerm(AtomTerm); - AtomTermExpansion = AtomAdjust(AtomTermExpansion); TermTermExpansion = MkAtomTerm(AtomTermExpansion); - AtomTerms = AtomAdjust(AtomTerms); TermTerms = MkAtomTerm(AtomTerms); - AtomText = AtomAdjust(AtomText); TermText = MkAtomTerm(AtomText); - AtomTextStream = AtomAdjust(AtomTextStream); TermTextStream = MkAtomTerm(AtomTextStream); - AtomThread = AtomAdjust(AtomThread); TermThread = MkAtomTerm(AtomThread); - AtomThreads = AtomAdjust(AtomThreads); TermThreads = MkAtomTerm(AtomThreads); - AtomThrow = AtomAdjust(AtomThrow); TermThrow = MkAtomTerm(AtomThrow); - AtomTimeOutSpec = AtomAdjust(AtomTimeOutSpec); TermTimeOutSpec = MkAtomTerm(AtomTimeOutSpec); - AtomTimeoutError = AtomAdjust(AtomTimeoutError); TermTimeoutError = MkAtomTerm(AtomTimeoutError); - AtomTopLevelGoal = AtomAdjust(AtomTopLevelGoal); TermTopLevelGoal = MkAtomTerm(AtomTopLevelGoal); - AtomTopThreadGoal = AtomAdjust(AtomTopThreadGoal); TermTopThreadGoal = MkAtomTerm(AtomTopThreadGoal); - AtomTraceMetaCall = AtomAdjust(AtomTraceMetaCall); TermTraceMetaCall = MkAtomTerm(AtomTraceMetaCall); - AtomTrail = AtomAdjust(AtomTrail); - AtomTrue = AtomAdjust(AtomTrue); TermTrue = MkAtomTerm(AtomTrue); - AtomTty = AtomAdjust(AtomTty); TermTty = MkAtomTerm(AtomTty); - AtomTtys = AtomAdjust(AtomTtys); TermTtys = MkAtomTerm(AtomTtys); - AtomTuple = AtomAdjust(AtomTuple); TermTuple = MkAtomTerm(AtomTuple); - AtomTxt = AtomAdjust(AtomTxt); TermTxt = MkAtomTerm(AtomTxt); - AtomTypeError = AtomAdjust(AtomTypeError); TermTypeError = MkAtomTerm(AtomTypeError); - AtomUndefined = AtomAdjust(AtomUndefined); TermUndefined = MkAtomTerm(AtomUndefined); - AtomUndefp = AtomAdjust(AtomUndefp); TermUndefp = MkAtomTerm(AtomUndefp); - AtomUndefp0 = AtomAdjust(AtomUndefp0); TermUndefp0 = MkAtomTerm(AtomUndefp0); - AtomUnderflow = AtomAdjust(AtomUnderflow); TermUnderflow = MkAtomTerm(AtomUnderflow); - AtomUnificationStack = AtomAdjust(AtomUnificationStack); TermUnificationStack = MkAtomTerm(AtomUnificationStack); - AtomUnique = AtomAdjust(AtomUnique); TermUnique = MkAtomTerm(AtomUnique); - AtomUnsignedByte = AtomAdjust(AtomUnsignedByte); TermUnsignedByte = MkAtomTerm(AtomUnsignedByte); - AtomUnsignedChar = AtomAdjust(AtomUnsignedChar); TermUnsignedChar = MkAtomTerm(AtomUnsignedChar); - AtomUser = AtomAdjust(AtomUser); TermUser = MkAtomTerm(AtomUser); - AtomUserErr = AtomAdjust(AtomUserErr); TermUserErr = MkAtomTerm(AtomUserErr); - AtomUserIn = AtomAdjust(AtomUserIn); TermUserIn = MkAtomTerm(AtomUserIn); - AtomUserOut = AtomAdjust(AtomUserOut); TermUserOut = MkAtomTerm(AtomUserOut); - AtomDollarVar = AtomAdjust(AtomDollarVar); TermDollarVar = MkAtomTerm(AtomDollarVar); - AtomVBar = AtomAdjust(AtomVBar); TermVBar = MkAtomTerm(AtomVBar); - AtomVarBranches = AtomAdjust(AtomVarBranches); TermVarBranches = MkAtomTerm(AtomVarBranches); - AtomVariableNames = AtomAdjust(AtomVariableNames); TermVariableNames = MkAtomTerm(AtomVariableNames); - AtomHiddenVar = AtomAdjust(AtomHiddenVar); TermHiddenVar = MkAtomTerm(AtomHiddenVar); - AtomVariable = AtomAdjust(AtomVariable); TermVariable = MkAtomTerm(AtomVariable); - AtomVerbose = AtomAdjust(AtomVerbose); TermVerbose = MkAtomTerm(AtomVerbose); - AtomVerboseFileSearch = AtomAdjust(AtomVerboseFileSearch); TermVerboseFileSearch = MkAtomTerm(AtomVerboseFileSearch); - AtomVersionNumber = AtomAdjust(AtomVersionNumber); TermVersionNumber = MkAtomTerm(AtomVersionNumber); - AtomVeryVerbose = AtomAdjust(AtomVeryVerbose); TermVeryVerbose = MkAtomTerm(AtomVeryVerbose); - AtomWakeUpGoal = AtomAdjust(AtomWakeUpGoal); TermWakeUpGoal = MkAtomTerm(AtomWakeUpGoal); - AtomWarning = AtomAdjust(AtomWarning); TermWarning = MkAtomTerm(AtomWarning); - AtomWhen = AtomAdjust(AtomWhen); TermWhen = MkAtomTerm(AtomWhen); - AtomWrite = AtomAdjust(AtomWrite); TermWrite = MkAtomTerm(AtomWrite); - AtomWriteTerm = AtomAdjust(AtomWriteTerm); TermWriteTerm = MkAtomTerm(AtomWriteTerm); - AtomXml = AtomAdjust(AtomXml); TermXml = MkAtomTerm(AtomXml); - AtomYapHacks = AtomAdjust(AtomYapHacks); TermYapHacks = MkAtomTerm(AtomYapHacks); - AtomZeroDivisor = AtomAdjust(AtomZeroDivisor); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor); - FunctorAfInet = FuncAdjust(FunctorAfInet); - FunctorAfLocal = FuncAdjust(FunctorAfLocal); - FunctorAfUnix = FuncAdjust(FunctorAfUnix); - FunctorAltNot = FuncAdjust(FunctorAltNot); - FunctorArg = FuncAdjust(FunctorArg); - FunctorArrayEntry = FuncAdjust(FunctorArrayEntry); - FunctorArrow = FuncAdjust(FunctorArrow); - FunctorDoubleArrow = FuncAdjust(FunctorDoubleArrow); - FunctorAssert1 = FuncAdjust(FunctorAssert1); - FunctorAssert = FuncAdjust(FunctorAssert); - FunctorAtFoundOne = FuncAdjust(FunctorAtFoundOne); - FunctorAtom = FuncAdjust(FunctorAtom); - FunctorAtt1 = FuncAdjust(FunctorAtt1); - FunctorAttGoal = FuncAdjust(FunctorAttGoal); - FunctorBraces = FuncAdjust(FunctorBraces); - FunctorCall = FuncAdjust(FunctorCall); - FunctorCatch = FuncAdjust(FunctorCatch); - FunctorChangeModule = FuncAdjust(FunctorChangeModule); - FunctorChars = FuncAdjust(FunctorChars); - FunctorChars1 = FuncAdjust(FunctorChars1); - FunctorCleanCall = FuncAdjust(FunctorCleanCall); - FunctorClist = FuncAdjust(FunctorClist); - FunctorCodes = FuncAdjust(FunctorCodes); - FunctorCodes1 = FuncAdjust(FunctorCodes1); - FunctorColon = FuncAdjust(FunctorColon); - FunctorComma = FuncAdjust(FunctorComma); - FunctorCommentHook = FuncAdjust(FunctorCommentHook); - FunctorContext2 = FuncAdjust(FunctorContext2); - FunctorConsistencyError = FuncAdjust(FunctorConsistencyError); - FunctorCreep = FuncAdjust(FunctorCreep); - FunctorCsult = FuncAdjust(FunctorCsult); - FunctorCurrentModule = FuncAdjust(FunctorCurrentModule); - FunctorCutBy = FuncAdjust(FunctorCutBy); - FunctorDBREF = FuncAdjust(FunctorDBREF); - FunctorDiff = FuncAdjust(FunctorDiff); - FunctorDoLogUpdClause = FuncAdjust(FunctorDoLogUpdClause); - FunctorDoLogUpdClause0 = FuncAdjust(FunctorDoLogUpdClause0); - FunctorDoLogUpdClauseErase = FuncAdjust(FunctorDoLogUpdClauseErase); - FunctorDoStaticClause = FuncAdjust(FunctorDoStaticClause); - FunctorDollar = FuncAdjust(FunctorDollar); - FunctorDollarVar = FuncAdjust(FunctorDollarVar); - FunctorDomainError = FuncAdjust(FunctorDomainError); - FunctorDot = FuncAdjust(FunctorDot); - FunctorDot10 = FuncAdjust(FunctorDot10); - FunctorDot11 = FuncAdjust(FunctorDot11); - FunctorDot12 = FuncAdjust(FunctorDot12); - FunctorDot2 = FuncAdjust(FunctorDot2); - FunctorDot3 = FuncAdjust(FunctorDot3); - FunctorDot4 = FuncAdjust(FunctorDot4); - FunctorDot5 = FuncAdjust(FunctorDot5); - FunctorDot6 = FuncAdjust(FunctorDot6); - FunctorDot7 = FuncAdjust(FunctorDot7); - FunctorDot8 = FuncAdjust(FunctorDot8); - FunctorDot9 = FuncAdjust(FunctorDot9); - FunctorDoubleArrow = FuncAdjust(FunctorDoubleArrow); - FunctorDoubleSlash = FuncAdjust(FunctorDoubleSlash); - FunctorEmptySquareBrackets = FuncAdjust(FunctorEmptySquareBrackets); - FunctorEq = FuncAdjust(FunctorEq); - FunctorError = FuncAdjust(FunctorError); - FunctorEvaluationError = FuncAdjust(FunctorEvaluationError); - FunctorException = FuncAdjust(FunctorException); - FunctorExecute2InMod = FuncAdjust(FunctorExecute2InMod); - FunctorExecuteInMod = FuncAdjust(FunctorExecuteInMod); - FunctorExecuteWithin = FuncAdjust(FunctorExecuteWithin); - FunctorExistenceError = FuncAdjust(FunctorExistenceError); - FunctorExoClause = FuncAdjust(FunctorExoClause); - FunctorFunctor = FuncAdjust(FunctorFunctor); - FunctorGAtom = FuncAdjust(FunctorGAtom); - FunctorGAtomic = FuncAdjust(FunctorGAtomic); - FunctorGCompound = FuncAdjust(FunctorGCompound); - FunctorGFloat = FuncAdjust(FunctorGFloat); - FunctorGFormatAt = FuncAdjust(FunctorGFormatAt); - FunctorGInteger = FuncAdjust(FunctorGInteger); - FunctorGNumber = FuncAdjust(FunctorGNumber); - FunctorGPrimitive = FuncAdjust(FunctorGPrimitive); - FunctorGVar = FuncAdjust(FunctorGVar); - FunctorGeneratePredInfo = FuncAdjust(FunctorGeneratePredInfo); - FunctorGoalExpansion2 = FuncAdjust(FunctorGoalExpansion2); - FunctorGoalExpansion = FuncAdjust(FunctorGoalExpansion); - FunctorHandleThrow = FuncAdjust(FunctorHandleThrow); - FunctorHat = FuncAdjust(FunctorHat); - FunctorI = FuncAdjust(FunctorI); - FunctorId = FuncAdjust(FunctorId); - FunctorInfo1 = FuncAdjust(FunctorInfo1); - FunctorInfo2 = FuncAdjust(FunctorInfo2); - FunctorInfo3 = FuncAdjust(FunctorInfo3); - FunctorInfo4 = FuncAdjust(FunctorInfo4); - FunctorIs = FuncAdjust(FunctorIs); - FunctorJ = FuncAdjust(FunctorJ); - FunctorLastExecuteWithin = FuncAdjust(FunctorLastExecuteWithin); - FunctorList = FuncAdjust(FunctorList); - FunctorLOOP = FuncAdjust(FunctorLOOP); - FunctorMegaClause = FuncAdjust(FunctorMegaClause); - FunctorMetaCall = FuncAdjust(FunctorMetaCall); - FunctorMinus = FuncAdjust(FunctorMinus); - FunctorModule = FuncAdjust(FunctorModule); - FunctorMultiFileClause = FuncAdjust(FunctorMultiFileClause); - FunctorMutable = FuncAdjust(FunctorMutable); - FunctorMutex = FuncAdjust(FunctorMutex); - FunctorNotImplemented = FuncAdjust(FunctorNotImplemented); - FunctorNBQueue = FuncAdjust(FunctorNBQueue); - FunctorNot = FuncAdjust(FunctorNot); - FunctorObj = FuncAdjust(FunctorObj); - FunctorOr = FuncAdjust(FunctorOr); - FunctorOutput = FuncAdjust(FunctorOutput); - FunctorPermissionError = FuncAdjust(FunctorPermissionError); - FunctorPlus = FuncAdjust(FunctorPlus); - FunctorPortray = FuncAdjust(FunctorPortray); - FunctorPrintMessage = FuncAdjust(FunctorPrintMessage); - FunctorProcedure = FuncAdjust(FunctorProcedure); - FunctorPriority = FuncAdjust(FunctorPriority); - FunctorPrologConstraint = FuncAdjust(FunctorPrologConstraint); - FunctorProtectStack = FuncAdjust(FunctorProtectStack); - FunctorQuery = FuncAdjust(FunctorQuery); - FunctorRecordedWithKey = FuncAdjust(FunctorRecordedWithKey); - FunctorRDiv = FuncAdjust(FunctorRDiv); - FunctorRedoFreeze = FuncAdjust(FunctorRedoFreeze); - FunctorRepresentationError = FuncAdjust(FunctorRepresentationError); - FunctorResourceError = FuncAdjust(FunctorResourceError); - FunctorRestoreRegs = FuncAdjust(FunctorRestoreRegs); - FunctorRestoreRegs1 = FuncAdjust(FunctorRestoreRegs1); - FunctorSafe = FuncAdjust(FunctorSafe); - FunctorSafeCallCleanup = FuncAdjust(FunctorSafeCallCleanup); - FunctorSame = FuncAdjust(FunctorSame); - FunctorSlash = FuncAdjust(FunctorSlash); - FunctorStaticClause = FuncAdjust(FunctorStaticClause); - FunctorStream = FuncAdjust(FunctorStream); - FunctorStreamEOS = FuncAdjust(FunctorStreamEOS); - FunctorStreamPos = FuncAdjust(FunctorStreamPos); - FunctorString1 = FuncAdjust(FunctorString1); - FunctorStyleCheck = FuncAdjust(FunctorStyleCheck); - FunctorSyntaxError = FuncAdjust(FunctorSyntaxError); - FunctorShortSyntaxError = FuncAdjust(FunctorShortSyntaxError); - FunctorTermExpansion = FuncAdjust(FunctorTermExpansion); - FunctorThreadRun = FuncAdjust(FunctorThreadRun); - FunctorThrow = FuncAdjust(FunctorThrow); - FunctorTimeoutError = FuncAdjust(FunctorTimeoutError); - FunctorTraceMetaCall = FuncAdjust(FunctorTraceMetaCall); - FunctorTypeError = FuncAdjust(FunctorTypeError); - FunctorUMinus = FuncAdjust(FunctorUMinus); - FunctorUPlus = FuncAdjust(FunctorUPlus); - FunctorVBar = FuncAdjust(FunctorVBar); - FunctorWriteTerm = FuncAdjust(FunctorWriteTerm); - FunctorHiddenVar = FuncAdjust(FunctorHiddenVar); + + /* This file, ratoms.h, was generated automatically by "yap -L misc/buildatoms" + {lease do not update, update misc/ATOMS instead */ + + Atom3Dots = AtomAdjust(Atom3Dots); + AtomAbol = AtomAdjust(AtomAbol); TermAbol = MkAtomTerm(AtomAbol); + AtomAccess = AtomAdjust(AtomAccess); TermAccess = MkAtomTerm(AtomAccess); + AtomAfInet = AtomAdjust(AtomAfInet); TermAfInet = MkAtomTerm(AtomAfInet); + AtomAfLocal = AtomAdjust(AtomAfLocal); TermAfLocal = MkAtomTerm(AtomAfLocal); + AtomAfUnix = AtomAdjust(AtomAfUnix); TermAfUnix = MkAtomTerm(AtomAfUnix); + AtomAlarm = AtomAdjust(AtomAlarm); TermAlarm = MkAtomTerm(AtomAlarm); + AtomAlias = AtomAdjust(AtomAlias); TermAlias = MkAtomTerm(AtomAlias); + AtomAll = AtomAdjust(AtomAll); TermAll = MkAtomTerm(AtomAll); + AtomAltNot = AtomAdjust(AtomAltNot); TermAltNot = MkAtomTerm(AtomAltNot); + AtomAnswer = AtomAdjust(AtomAnswer); TermAnswer = MkAtomTerm(AtomAnswer); + AtomAny = AtomAdjust(AtomAny); TermAny = MkAtomTerm(AtomAny); + AtomAppend = AtomAdjust(AtomAppend); TermAppend = MkAtomTerm(AtomAppend); + AtomArg = AtomAdjust(AtomArg); TermArg = MkAtomTerm(AtomArg); + AtomArray = AtomAdjust(AtomArray); TermArray = MkAtomTerm(AtomArray); + AtomArrayAccess = AtomAdjust(AtomArrayAccess); TermArrayAccess = MkAtomTerm(AtomArrayAccess); + AtomArrayOverflow = AtomAdjust(AtomArrayOverflow); TermArrayOverflow = MkAtomTerm(AtomArrayOverflow); + AtomArrayType = AtomAdjust(AtomArrayType); TermArrayType = MkAtomTerm(AtomArrayType); + AtomArrow = AtomAdjust(AtomArrow); TermArrow = MkAtomTerm(AtomArrow); + AtomAttributedModule = AtomAdjust(AtomAttributedModule); TermAttributedModule = MkAtomTerm(AtomAttributedModule); + AtomDoubleArrow = AtomAdjust(AtomDoubleArrow); TermDoubleArrow = MkAtomTerm(AtomDoubleArrow); + AtomAssert = AtomAdjust(AtomAssert); TermAssert = MkAtomTerm(AtomAssert); + AtomBeginBracket = AtomAdjust(AtomBeginBracket); TermBeginBracket = MkAtomTerm(AtomBeginBracket); + AtomEndBracket = AtomAdjust(AtomEndBracket); TermEndBracket = MkAtomTerm(AtomEndBracket); + AtomBeginSquareBracket = AtomAdjust(AtomBeginSquareBracket); TermBeginSquareBracket = MkAtomTerm(AtomBeginSquareBracket); + AtomEndSquareBracket = AtomAdjust(AtomEndSquareBracket); TermEndSquareBracket = MkAtomTerm(AtomEndSquareBracket); + AtomBeginCurlyBracket = AtomAdjust(AtomBeginCurlyBracket); TermBeginCurlyBracket = MkAtomTerm(AtomBeginCurlyBracket); + AtomEndCurlyBracket = AtomAdjust(AtomEndCurlyBracket); TermEndCurlyBracket = MkAtomTerm(AtomEndCurlyBracket); + AtomEmptyBrackets = AtomAdjust(AtomEmptyBrackets); TermEmptyBrackets = MkAtomTerm(AtomEmptyBrackets); + AtomEmptySquareBrackets = AtomAdjust(AtomEmptySquareBrackets); TermEmptySquareBrackets = MkAtomTerm(AtomEmptySquareBrackets); + AtomAsserta = AtomAdjust(AtomAsserta); TermAsserta = MkAtomTerm(AtomAsserta); + AtomAssertaStatic = AtomAdjust(AtomAssertaStatic); TermAssertaStatic = MkAtomTerm(AtomAssertaStatic); + AtomAssertz = AtomAdjust(AtomAssertz); TermAssertz = MkAtomTerm(AtomAssertz); + AtomAssertzStatic = AtomAdjust(AtomAssertzStatic); TermAssertzStatic = MkAtomTerm(AtomAssertzStatic); + AtomAt = AtomAdjust(AtomAt); TermAt = MkAtomTerm(AtomAt); + AtomAtom = AtomAdjust(AtomAtom); TermAtom = MkAtomTerm(AtomAtom); + AtomAtomic = AtomAdjust(AtomAtomic); TermAtomic = MkAtomTerm(AtomAtomic); + AtomAtt = AtomAdjust(AtomAtt); TermAtt = MkAtomTerm(AtomAtt); + AtomAtt1 = AtomAdjust(AtomAtt1); TermAtt1 = MkAtomTerm(AtomAtt1); + AtomAttDo = AtomAdjust(AtomAttDo); TermAttDo = MkAtomTerm(AtomAttDo); + AtomAttributes = AtomAdjust(AtomAttributes); TermAttributes = MkAtomTerm(AtomAttributes); + AtomB = AtomAdjust(AtomB); TermB = MkAtomTerm(AtomB); + AtomBatched = AtomAdjust(AtomBatched); TermBatched = MkAtomTerm(AtomBatched); + AtomBetween = AtomAdjust(AtomBetween); TermBetween = MkAtomTerm(AtomBetween); + AtomBinary = AtomAdjust(AtomBinary); TermBinary = MkAtomTerm(AtomBinary); + AtomBigNum = AtomAdjust(AtomBigNum); TermBigNum = MkAtomTerm(AtomBigNum); + AtomBinaryStream = AtomAdjust(AtomBinaryStream); TermBinaryStream = MkAtomTerm(AtomBinaryStream); + AtomBoolean = AtomAdjust(AtomBoolean); TermBoolean = MkAtomTerm(AtomBoolean); + AtomBraces = AtomAdjust(AtomBraces); TermBraces = MkAtomTerm(AtomBraces); + AtomBreak = AtomAdjust(AtomBreak); TermBreak = MkAtomTerm(AtomBreak); + AtomByte = AtomAdjust(AtomByte); TermByte = MkAtomTerm(AtomByte); + AtomCArith = AtomAdjust(AtomCArith); TermCArith = MkAtomTerm(AtomCArith); + AtomCall = AtomAdjust(AtomCall); TermCall = MkAtomTerm(AtomCall); + AtomCallAndRetryCounter = AtomAdjust(AtomCallAndRetryCounter); TermCallAndRetryCounter = MkAtomTerm(AtomCallAndRetryCounter); + AtomCallCounter = AtomAdjust(AtomCallCounter); TermCallCounter = MkAtomTerm(AtomCallCounter); + AtomCallable = AtomAdjust(AtomCallable); TermCallable = MkAtomTerm(AtomCallable); + AtomCatch = AtomAdjust(AtomCatch); TermCatch = MkAtomTerm(AtomCatch); + AtomChangeModule = AtomAdjust(AtomChangeModule); TermChangeModule = MkAtomTerm(AtomChangeModule); + AtomChar = AtomAdjust(AtomChar); TermChar = MkAtomTerm(AtomChar); + AtomCharsio = AtomAdjust(AtomCharsio); TermCharsio = MkAtomTerm(AtomCharsio); + AtomCharacter = AtomAdjust(AtomCharacter); TermCharacter = MkAtomTerm(AtomCharacter); + AtomCharacterCode = AtomAdjust(AtomCharacterCode); TermCharacterCode = MkAtomTerm(AtomCharacterCode); + AtomChars = AtomAdjust(AtomChars); TermChars = MkAtomTerm(AtomChars); + AtomCharset = AtomAdjust(AtomCharset); TermCharset = MkAtomTerm(AtomCharset); + AtomChType = AtomAdjust(AtomChType); TermChType = MkAtomTerm(AtomChType); + AtomCleanCall = AtomAdjust(AtomCleanCall); TermCleanCall = MkAtomTerm(AtomCleanCall); + AtomClose = AtomAdjust(AtomClose); TermClose = MkAtomTerm(AtomClose); + AtomColon = AtomAdjust(AtomColon); TermColon = MkAtomTerm(AtomColon); + AtomCodeSpace = AtomAdjust(AtomCodeSpace); TermCodeSpace = MkAtomTerm(AtomCodeSpace); + AtomCodes = AtomAdjust(AtomCodes); TermCodes = MkAtomTerm(AtomCodes); + AtomCoInductive = AtomAdjust(AtomCoInductive); TermCoInductive = MkAtomTerm(AtomCoInductive); + AtomComma = AtomAdjust(AtomComma); TermComma = MkAtomTerm(AtomComma); + AtomCommentHook = AtomAdjust(AtomCommentHook); TermCommentHook = MkAtomTerm(AtomCommentHook); + AtomCompact = AtomAdjust(AtomCompact); TermCompact = MkAtomTerm(AtomCompact); + AtomCompound = AtomAdjust(AtomCompound); TermCompound = MkAtomTerm(AtomCompound); + AtomConsistencyError = AtomAdjust(AtomConsistencyError); TermConsistencyError = MkAtomTerm(AtomConsistencyError); + AtomConsult = AtomAdjust(AtomConsult); TermConsult = MkAtomTerm(AtomConsult); + AtomConsultOnBoot = AtomAdjust(AtomConsultOnBoot); TermConsultOnBoot = MkAtomTerm(AtomConsultOnBoot); + AtomContext = AtomAdjust(AtomContext); TermContext = MkAtomTerm(AtomContext); + AtomCputime = AtomAdjust(AtomCputime); TermCputime = MkAtomTerm(AtomCputime); + AtomCreate = AtomAdjust(AtomCreate); TermCreate = MkAtomTerm(AtomCreate); + AtomCreep = AtomAdjust(AtomCreep); TermCreep = MkAtomTerm(AtomCreep); + AtomCryptAtoms = AtomAdjust(AtomCryptAtoms); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms); + AtomCurly = AtomAdjust(AtomCurly); TermCurly = MkAtomTerm(AtomCurly); + AtomCsult = AtomAdjust(AtomCsult); TermCsult = MkAtomTerm(AtomCsult); + AtomCurrentModule = AtomAdjust(AtomCurrentModule); TermCurrentModule = MkAtomTerm(AtomCurrentModule); + AtomCut = AtomAdjust(AtomCut); TermCut = MkAtomTerm(AtomCut); + AtomCutBy = AtomAdjust(AtomCutBy); TermCutBy = MkAtomTerm(AtomCutBy); + AtomDAbort = AtomAdjust(AtomDAbort); TermDAbort = MkAtomTerm(AtomDAbort); + AtomDBLoad = AtomAdjust(AtomDBLoad); TermDBLoad = MkAtomTerm(AtomDBLoad); + AtomDBREF = AtomAdjust(AtomDBREF); TermDBREF = MkAtomTerm(AtomDBREF); + AtomDBReference = AtomAdjust(AtomDBReference); TermDBReference = MkAtomTerm(AtomDBReference); + AtomDBTerm = AtomAdjust(AtomDBTerm); TermDBTerm = MkAtomTerm(AtomDBTerm); + AtomDBref = AtomAdjust(AtomDBref); TermDBref = MkAtomTerm(AtomDBref); + AtomDInteger = AtomAdjust(AtomDInteger); TermDInteger = MkAtomTerm(AtomDInteger); + AtomDebugMeta = AtomAdjust(AtomDebugMeta); TermDebugMeta = MkAtomTerm(AtomDebugMeta); + AtomDebuggerInput = AtomAdjust(AtomDebuggerInput); TermDebuggerInput = MkAtomTerm(AtomDebuggerInput); + AtomDec10 = AtomAdjust(AtomDec10); TermDec10 = MkAtomTerm(AtomDec10); + AtomDefault = AtomAdjust(AtomDefault); TermDefault = MkAtomTerm(AtomDefault); + AtomDevNull = AtomAdjust(AtomDevNull); TermDevNull = MkAtomTerm(AtomDevNull); + AtomDiff = AtomAdjust(AtomDiff); TermDiff = MkAtomTerm(AtomDiff); + AtomDirectory = AtomAdjust(AtomDirectory); TermDirectory = MkAtomTerm(AtomDirectory); + AtomDiscontiguous = AtomAdjust(AtomDiscontiguous); TermDiscontiguous = MkAtomTerm(AtomDiscontiguous); + AtomDiscontiguousWarnings = AtomAdjust(AtomDiscontiguousWarnings); TermDiscontiguousWarnings = MkAtomTerm(AtomDiscontiguousWarnings); + AtomDollar = AtomAdjust(AtomDollar); TermDollar = MkAtomTerm(AtomDollar); + AtomDoLogUpdClause = AtomAdjust(AtomDoLogUpdClause); TermDoLogUpdClause = MkAtomTerm(AtomDoLogUpdClause); + AtomDoLogUpdClause0 = AtomAdjust(AtomDoLogUpdClause0); TermDoLogUpdClause0 = MkAtomTerm(AtomDoLogUpdClause0); + AtomDoLogUpdClauseErase = AtomAdjust(AtomDoLogUpdClauseErase); TermDoLogUpdClauseErase = MkAtomTerm(AtomDoLogUpdClauseErase); + AtomDollarU = AtomAdjust(AtomDollarU); TermDollarU = MkAtomTerm(AtomDollarU); + AtomDollarUndef = AtomAdjust(AtomDollarUndef); TermDollarUndef = MkAtomTerm(AtomDollarUndef); + AtomDomainError = AtomAdjust(AtomDomainError); TermDomainError = MkAtomTerm(AtomDomainError); + AtomDoStaticClause = AtomAdjust(AtomDoStaticClause); TermDoStaticClause = MkAtomTerm(AtomDoStaticClause); + AtomDots = AtomAdjust(AtomDots); TermDots = MkAtomTerm(AtomDots); + AtomDOUBLE = AtomAdjust(AtomDOUBLE); TermDOUBLE = MkAtomTerm(AtomDOUBLE); + AtomDoubleSlash = AtomAdjust(AtomDoubleSlash); TermDoubleSlash = MkAtomTerm(AtomDoubleSlash); + AtomE = AtomAdjust(AtomE); TermE = MkAtomTerm(AtomE); + AtomEOFBeforeEOT = AtomAdjust(AtomEOFBeforeEOT); TermEOFBeforeEOT = MkAtomTerm(AtomEOFBeforeEOT); + AtomEQ = AtomAdjust(AtomEQ); TermEQ = MkAtomTerm(AtomEQ); + AtomEmptyAtom = AtomAdjust(AtomEmptyAtom); TermEmptyAtom = MkAtomTerm(AtomEmptyAtom); + AtomEncoding = AtomAdjust(AtomEncoding); TermEncoding = MkAtomTerm(AtomEncoding); + AtomEndOfStream = AtomAdjust(AtomEndOfStream); TermEndOfStream = MkAtomTerm(AtomEndOfStream); + AtomEof = AtomAdjust(AtomEof); TermEof = MkAtomTerm(AtomEof); + AtomEOfCode = AtomAdjust(AtomEOfCode); TermEOfCode = MkAtomTerm(AtomEOfCode); + AtomEq = AtomAdjust(AtomEq); TermEq = MkAtomTerm(AtomEq); + AtomError = AtomAdjust(AtomError); TermError = MkAtomTerm(AtomError); + AtomException = AtomAdjust(AtomException); TermException = MkAtomTerm(AtomException); + AtomExtensions = AtomAdjust(AtomExtensions); TermExtensions = MkAtomTerm(AtomExtensions); + AtomEvaluable = AtomAdjust(AtomEvaluable); TermEvaluable = MkAtomTerm(AtomEvaluable); + AtomEvaluationError = AtomAdjust(AtomEvaluationError); TermEvaluationError = MkAtomTerm(AtomEvaluationError); + AtomExecutable = AtomAdjust(AtomExecutable); TermExecutable = MkAtomTerm(AtomExecutable); + AtomExecute = AtomAdjust(AtomExecute); TermExecute = MkAtomTerm(AtomExecute); + AtomExecAnswers = AtomAdjust(AtomExecAnswers); TermExecAnswers = MkAtomTerm(AtomExecAnswers); + AtomExecuteInMod = AtomAdjust(AtomExecuteInMod); TermExecuteInMod = MkAtomTerm(AtomExecuteInMod); + AtomExecuteWithin = AtomAdjust(AtomExecuteWithin); TermExecuteWithin = MkAtomTerm(AtomExecuteWithin); + AtomExecuteWoMod = AtomAdjust(AtomExecuteWoMod); TermExecuteWoMod = MkAtomTerm(AtomExecuteWoMod); + AtomExist = AtomAdjust(AtomExist); TermExist = MkAtomTerm(AtomExist); + AtomExists = AtomAdjust(AtomExists); TermExists = MkAtomTerm(AtomExists); + AtomExit = AtomAdjust(AtomExit); TermExit = MkAtomTerm(AtomExit); + AtomExistenceError = AtomAdjust(AtomExistenceError); TermExistenceError = MkAtomTerm(AtomExistenceError); + AtomExoClause = AtomAdjust(AtomExoClause); TermExoClause = MkAtomTerm(AtomExoClause); + AtomExpectedNumber = AtomAdjust(AtomExpectedNumber); TermExpectedNumber = MkAtomTerm(AtomExpectedNumber); + AtomExpand = AtomAdjust(AtomExpand); TermExpand = MkAtomTerm(AtomExpand); + AtomExtendFileSearchPath = AtomAdjust(AtomExtendFileSearchPath); TermExtendFileSearchPath = MkAtomTerm(AtomExtendFileSearchPath); + AtomExtendsions = AtomAdjust(AtomExtendsions); TermExtendsions = MkAtomTerm(AtomExtendsions); + AtomFB = AtomAdjust(AtomFB); TermFB = MkAtomTerm(AtomFB); + AtomFail = AtomAdjust(AtomFail); TermFail = MkAtomTerm(AtomFail); + AtomFalse = AtomAdjust(AtomFalse); TermFalse = MkAtomTerm(AtomFalse); + AtomFast = AtomAdjust(AtomFast); TermFast = MkAtomTerm(AtomFast); + AtomFastFail = AtomAdjust(AtomFastFail); TermFastFail = MkAtomTerm(AtomFastFail); + AtomFileErrors = AtomAdjust(AtomFileErrors); TermFileErrors = MkAtomTerm(AtomFileErrors); + AtomFileerrors = AtomAdjust(AtomFileerrors); TermFileerrors = MkAtomTerm(AtomFileerrors); + AtomFileType = AtomAdjust(AtomFileType); TermFileType = MkAtomTerm(AtomFileType); + AtomFirst = AtomAdjust(AtomFirst); TermFirst = MkAtomTerm(AtomFirst); + AtomFloat = AtomAdjust(AtomFloat); TermFloat = MkAtomTerm(AtomFloat); + AtomFloatFormat = AtomAdjust(AtomFloatFormat); TermFloatFormat = MkAtomTerm(AtomFloatFormat); + AtomFloatOverflow = AtomAdjust(AtomFloatOverflow); TermFloatOverflow = MkAtomTerm(AtomFloatOverflow); + AtomFloatUnderflow = AtomAdjust(AtomFloatUnderflow); TermFloatUnderflow = MkAtomTerm(AtomFloatUnderflow); + AtomFormat = AtomAdjust(AtomFormat); TermFormat = MkAtomTerm(AtomFormat); + AtomFormatAt = AtomAdjust(AtomFormatAt); TermFormatAt = MkAtomTerm(AtomFormatAt); + AtomFull = AtomAdjust(AtomFull); TermFull = MkAtomTerm(AtomFull); + AtomFunctor = AtomAdjust(AtomFunctor); TermFunctor = MkAtomTerm(AtomFunctor); + AtomGT = AtomAdjust(AtomGT); TermGT = MkAtomTerm(AtomGT); + AtomGVar = AtomAdjust(AtomGVar); TermGVar = MkAtomTerm(AtomGVar); + AtomGc = AtomAdjust(AtomGc); TermGc = MkAtomTerm(AtomGc); + AtomGcMargin = AtomAdjust(AtomGcMargin); TermGcMargin = MkAtomTerm(AtomGcMargin); + AtomGcTrace = AtomAdjust(AtomGcTrace); TermGcTrace = MkAtomTerm(AtomGcTrace); + AtomGcVerbose = AtomAdjust(AtomGcVerbose); TermGcVerbose = MkAtomTerm(AtomGcVerbose); + AtomGcVeryVerbose = AtomAdjust(AtomGcVeryVerbose); TermGcVeryVerbose = MkAtomTerm(AtomGcVeryVerbose); + AtomGeneratePredInfo = AtomAdjust(AtomGeneratePredInfo); TermGeneratePredInfo = MkAtomTerm(AtomGeneratePredInfo); + AtomGetwork = AtomAdjust(AtomGetwork); TermGetwork = MkAtomTerm(AtomGetwork); + AtomGetworkSeq = AtomAdjust(AtomGetworkSeq); TermGetworkSeq = MkAtomTerm(AtomGetworkSeq); + AtomGlob = AtomAdjust(AtomGlob); TermGlob = MkAtomTerm(AtomGlob); + AtomGlobal = AtomAdjust(AtomGlobal); TermGlobal = MkAtomTerm(AtomGlobal); + AtomGlobalSp = AtomAdjust(AtomGlobalSp); TermGlobalSp = MkAtomTerm(AtomGlobalSp); + AtomGlobalTrie = AtomAdjust(AtomGlobalTrie); TermGlobalTrie = MkAtomTerm(AtomGlobalTrie); + AtomGoalExpansion = AtomAdjust(AtomGoalExpansion); TermGoalExpansion = MkAtomTerm(AtomGoalExpansion); + AtomHat = AtomAdjust(AtomHat); TermHat = MkAtomTerm(AtomHat); + AtomHERE = AtomAdjust(AtomHERE); TermHERE = MkAtomTerm(AtomHERE); + AtomHandleThrow = AtomAdjust(AtomHandleThrow); TermHandleThrow = MkAtomTerm(AtomHandleThrow); + AtomHeap = AtomAdjust(AtomHeap); TermHeap = MkAtomTerm(AtomHeap); + AtomHeapUsed = AtomAdjust(AtomHeapUsed); TermHeapUsed = MkAtomTerm(AtomHeapUsed); + AtomHugeInt = AtomAdjust(AtomHugeInt); TermHugeInt = MkAtomTerm(AtomHugeInt); + AtomIDB = AtomAdjust(AtomIDB); TermIDB = MkAtomTerm(AtomIDB); + AtomIOMode = AtomAdjust(AtomIOMode); TermIOMode = MkAtomTerm(AtomIOMode); + AtomI = AtomAdjust(AtomI); TermI = MkAtomTerm(AtomI); + AtomId = AtomAdjust(AtomId); TermId = MkAtomTerm(AtomId); + AtomIgnore = AtomAdjust(AtomIgnore); TermIgnore = MkAtomTerm(AtomIgnore); + AtomInf = AtomAdjust(AtomInf); TermInf = MkAtomTerm(AtomInf); + AtomInfinity = AtomAdjust(AtomInfinity); TermInfinity = MkAtomTerm(AtomInfinity); + AtomInfo = AtomAdjust(AtomInfo); TermInfo = MkAtomTerm(AtomInfo); + AtomInitGoal = AtomAdjust(AtomInitGoal); TermInitGoal = MkAtomTerm(AtomInitGoal); + AtomInitProlog = AtomAdjust(AtomInitProlog); TermInitProlog = MkAtomTerm(AtomInitProlog); + AtomInStackExpansion = AtomAdjust(AtomInStackExpansion); TermInStackExpansion = MkAtomTerm(AtomInStackExpansion); + AtomInput = AtomAdjust(AtomInput); TermInput = MkAtomTerm(AtomInput); + AtomInstantiationError = AtomAdjust(AtomInstantiationError); TermInstantiationError = MkAtomTerm(AtomInstantiationError); + AtomInt = AtomAdjust(AtomInt); TermInt = MkAtomTerm(AtomInt); + AtomIntOverflow = AtomAdjust(AtomIntOverflow); TermIntOverflow = MkAtomTerm(AtomIntOverflow); + AtomInteger = AtomAdjust(AtomInteger); TermInteger = MkAtomTerm(AtomInteger); + AtomInternalCompilerError = AtomAdjust(AtomInternalCompilerError); TermInternalCompilerError = MkAtomTerm(AtomInternalCompilerError); + AtomIs = AtomAdjust(AtomIs); TermIs = MkAtomTerm(AtomIs); + AtomJ = AtomAdjust(AtomJ); TermJ = MkAtomTerm(AtomJ); + Atoml = AtomAdjust(Atoml); Terml = MkAtomTerm(Atoml); + AtomKey = AtomAdjust(AtomKey); TermKey = MkAtomTerm(AtomKey); + AtomLDLibraryPath = AtomAdjust(AtomLDLibraryPath); TermLDLibraryPath = MkAtomTerm(AtomLDLibraryPath); + AtomLONGINT = AtomAdjust(AtomLONGINT); TermLONGINT = MkAtomTerm(AtomLONGINT); + AtomLOOP = AtomAdjust(AtomLOOP); TermLOOP = MkAtomTerm(AtomLOOP); + AtomLoopStream = AtomAdjust(AtomLoopStream); TermLoopStream = MkAtomTerm(AtomLoopStream); + AtomLT = AtomAdjust(AtomLT); TermLT = MkAtomTerm(AtomLT); + AtomLastExecuteWithin = AtomAdjust(AtomLastExecuteWithin); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin); + AtomLeash = AtomAdjust(AtomLeash); TermLeash = MkAtomTerm(AtomLeash); + AtomLeast = AtomAdjust(AtomLeast); TermLeast = MkAtomTerm(AtomLeast); + AtomLength = AtomAdjust(AtomLength); TermLength = MkAtomTerm(AtomLength); + AtomList = AtomAdjust(AtomList); TermList = MkAtomTerm(AtomList); + AtomLine = AtomAdjust(AtomLine); TermLine = MkAtomTerm(AtomLine); + AtomLive = AtomAdjust(AtomLive); TermLive = MkAtomTerm(AtomLive); + AtomLoadAnswers = AtomAdjust(AtomLoadAnswers); TermLoadAnswers = MkAtomTerm(AtomLoadAnswers); + AtomLocal = AtomAdjust(AtomLocal); TermLocal = MkAtomTerm(AtomLocal); + AtomLocalSp = AtomAdjust(AtomLocalSp); TermLocalSp = MkAtomTerm(AtomLocalSp); + AtomLocalTrie = AtomAdjust(AtomLocalTrie); TermLocalTrie = MkAtomTerm(AtomLocalTrie); + AtomMax = AtomAdjust(AtomMax); TermMax = MkAtomTerm(AtomMax); + AtomMaximum = AtomAdjust(AtomMaximum); TermMaximum = MkAtomTerm(AtomMaximum); + AtomMaxArity = AtomAdjust(AtomMaxArity); TermMaxArity = MkAtomTerm(AtomMaxArity); + AtomMaxFiles = AtomAdjust(AtomMaxFiles); TermMaxFiles = MkAtomTerm(AtomMaxFiles); + AtomMegaClause = AtomAdjust(AtomMegaClause); TermMegaClause = MkAtomTerm(AtomMegaClause); + AtomMetaCall = AtomAdjust(AtomMetaCall); TermMetaCall = MkAtomTerm(AtomMetaCall); + AtomMfClause = AtomAdjust(AtomMfClause); TermMfClause = MkAtomTerm(AtomMfClause); + AtomMin = AtomAdjust(AtomMin); TermMin = MkAtomTerm(AtomMin); + AtomMinimum = AtomAdjust(AtomMinimum); TermMinimum = MkAtomTerm(AtomMinimum); + AtomMinus = AtomAdjust(AtomMinus); TermMinus = MkAtomTerm(AtomMinus); + AtomModify = AtomAdjust(AtomModify); TermModify = MkAtomTerm(AtomModify); + AtomModule = AtomAdjust(AtomModule); TermModule = MkAtomTerm(AtomModule); + AtomMost = AtomAdjust(AtomMost); TermMost = MkAtomTerm(AtomMost); + AtomMulti = AtomAdjust(AtomMulti); TermMulti = MkAtomTerm(AtomMulti); + AtomMultiFile = AtomAdjust(AtomMultiFile); TermMultiFile = MkAtomTerm(AtomMultiFile); + AtomMultiple = AtomAdjust(AtomMultiple); TermMultiple = MkAtomTerm(AtomMultiple); + AtomMutable = AtomAdjust(AtomMutable); TermMutable = MkAtomTerm(AtomMutable); + AtomMutableVariable = AtomAdjust(AtomMutableVariable); TermMutableVariable = MkAtomTerm(AtomMutableVariable); + AtomMutex = AtomAdjust(AtomMutex); TermMutex = MkAtomTerm(AtomMutex); + AtomMyddasDB = AtomAdjust(AtomMyddasDB); TermMyddasDB = MkAtomTerm(AtomMyddasDB); + AtomMyddasGoal = AtomAdjust(AtomMyddasGoal); TermMyddasGoal = MkAtomTerm(AtomMyddasGoal); + AtomMyddasHost = AtomAdjust(AtomMyddasHost); TermMyddasHost = MkAtomTerm(AtomMyddasHost); + AtomMyddasPass = AtomAdjust(AtomMyddasPass); TermMyddasPass = MkAtomTerm(AtomMyddasPass); + AtomMyddasUser = AtomAdjust(AtomMyddasUser); TermMyddasUser = MkAtomTerm(AtomMyddasUser); + AtomMyddasVersionName = AtomAdjust(AtomMyddasVersionName); TermMyddasVersionName = MkAtomTerm(AtomMyddasVersionName); + AtomNan = AtomAdjust(AtomNan); TermNan = MkAtomTerm(AtomNan); + AtomNb = AtomAdjust(AtomNb); TermNb = MkAtomTerm(AtomNb); + AtomNbTerm = AtomAdjust(AtomNbTerm); TermNbTerm = MkAtomTerm(AtomNbTerm); + AtomNew = AtomAdjust(AtomNew); TermNew = MkAtomTerm(AtomNew); + AtomNewLine = AtomAdjust(AtomNewLine); TermNewLine = MkAtomTerm(AtomNewLine); + AtomNl = AtomAdjust(AtomNl); TermNl = MkAtomTerm(AtomNl); + AtomNoEffect = AtomAdjust(AtomNoEffect); TermNoEffect = MkAtomTerm(AtomNoEffect); + AtomNoMemory = AtomAdjust(AtomNoMemory); TermNoMemory = MkAtomTerm(AtomNoMemory); + AtomNone = AtomAdjust(AtomNone); TermNone = MkAtomTerm(AtomNone); + AtomNonEmptyList = AtomAdjust(AtomNonEmptyList); TermNonEmptyList = MkAtomTerm(AtomNonEmptyList); + AtomNot = AtomAdjust(AtomNot); TermNot = MkAtomTerm(AtomNot); + AtomNotImplemented = AtomAdjust(AtomNotImplemented); TermNotImplemented = MkAtomTerm(AtomNotImplemented); + AtomNotLessThanZero = AtomAdjust(AtomNotLessThanZero); TermNotLessThanZero = MkAtomTerm(AtomNotLessThanZero); + AtomNotNewline = AtomAdjust(AtomNotNewline); TermNotNewline = MkAtomTerm(AtomNotNewline); + AtomNotZero = AtomAdjust(AtomNotZero); TermNotZero = MkAtomTerm(AtomNotZero); + AtomNumber = AtomAdjust(AtomNumber); TermNumber = MkAtomTerm(AtomNumber); + AtomObj = AtomAdjust(AtomObj); TermObj = MkAtomTerm(AtomObj); + AtomOff = AtomAdjust(AtomOff); TermOff = MkAtomTerm(AtomOff); + AtomOffline = AtomAdjust(AtomOffline); TermOffline = MkAtomTerm(AtomOffline); + AtomOn = AtomAdjust(AtomOn); TermOn = MkAtomTerm(AtomOn); + AtomOnline = AtomAdjust(AtomOnline); TermOnline = MkAtomTerm(AtomOnline); + AtomOpen = AtomAdjust(AtomOpen); TermOpen = MkAtomTerm(AtomOpen); + AtomOperatingSystemError = AtomAdjust(AtomOperatingSystemError); TermOperatingSystemError = MkAtomTerm(AtomOperatingSystemError); + AtomOperatingSystemSupport = AtomAdjust(AtomOperatingSystemSupport); TermOperatingSystemSupport = MkAtomTerm(AtomOperatingSystemSupport); + AtomOperator = AtomAdjust(AtomOperator); TermOperator = MkAtomTerm(AtomOperator); + AtomOperatorPriority = AtomAdjust(AtomOperatorPriority); TermOperatorPriority = MkAtomTerm(AtomOperatorPriority); + AtomOperatorSpecifier = AtomAdjust(AtomOperatorSpecifier); TermOperatorSpecifier = MkAtomTerm(AtomOperatorSpecifier); + AtomOpt = AtomAdjust(AtomOpt); TermOpt = MkAtomTerm(AtomOpt); + AtomOtherwise = AtomAdjust(AtomOtherwise); TermOtherwise = MkAtomTerm(AtomOtherwise); + AtomOutOfAttvarsError = AtomAdjust(AtomOutOfAttvarsError); TermOutOfAttvarsError = MkAtomTerm(AtomOutOfAttvarsError); + AtomOutOfAuxspaceError = AtomAdjust(AtomOutOfAuxspaceError); TermOutOfAuxspaceError = MkAtomTerm(AtomOutOfAuxspaceError); + AtomOutOfHeapError = AtomAdjust(AtomOutOfHeapError); TermOutOfHeapError = MkAtomTerm(AtomOutOfHeapError); + AtomOutOfRange = AtomAdjust(AtomOutOfRange); TermOutOfRange = MkAtomTerm(AtomOutOfRange); + AtomOutOfStackError = AtomAdjust(AtomOutOfStackError); TermOutOfStackError = MkAtomTerm(AtomOutOfStackError); + AtomOutOfTrailError = AtomAdjust(AtomOutOfTrailError); TermOutOfTrailError = MkAtomTerm(AtomOutOfTrailError); + AtomOutput = AtomAdjust(AtomOutput); TermOutput = MkAtomTerm(AtomOutput); + AtomParameter = AtomAdjust(AtomParameter); TermParameter = MkAtomTerm(AtomParameter); + AtomPrologCommonsDir = AtomAdjust(AtomPrologCommonsDir); TermPrologCommonsDir = MkAtomTerm(AtomPrologCommonsDir); + AtomPast = AtomAdjust(AtomPast); TermPast = MkAtomTerm(AtomPast); + AtomPastEndOfStream = AtomAdjust(AtomPastEndOfStream); TermPastEndOfStream = MkAtomTerm(AtomPastEndOfStream); + AtomPermissionError = AtomAdjust(AtomPermissionError); TermPermissionError = MkAtomTerm(AtomPermissionError); + AtomPi = AtomAdjust(AtomPi); TermPi = MkAtomTerm(AtomPi); + AtomPipe = AtomAdjust(AtomPipe); TermPipe = MkAtomTerm(AtomPipe); + AtomPriority = AtomAdjust(AtomPriority); TermPriority = MkAtomTerm(AtomPriority); + AtomPlus = AtomAdjust(AtomPlus); TermPlus = MkAtomTerm(AtomPlus); + AtomPointer = AtomAdjust(AtomPointer); TermPointer = MkAtomTerm(AtomPointer); + AtomPortray = AtomAdjust(AtomPortray); TermPortray = MkAtomTerm(AtomPortray); + AtomPredicateIndicator = AtomAdjust(AtomPredicateIndicator); TermPredicateIndicator = MkAtomTerm(AtomPredicateIndicator); + AtomPrimitive = AtomAdjust(AtomPrimitive); TermPrimitive = MkAtomTerm(AtomPrimitive); + AtomPrintMessage = AtomAdjust(AtomPrintMessage); TermPrintMessage = MkAtomTerm(AtomPrintMessage); + AtomPrivateProcedure = AtomAdjust(AtomPrivateProcedure); TermPrivateProcedure = MkAtomTerm(AtomPrivateProcedure); + AtomProcedure = AtomAdjust(AtomProcedure); TermProcedure = MkAtomTerm(AtomProcedure); + AtomProfile = AtomAdjust(AtomProfile); TermProfile = MkAtomTerm(AtomProfile); + AtomProlog = AtomAdjust(AtomProlog); TermProlog = MkAtomTerm(AtomProlog); + AtomProtectStack = AtomAdjust(AtomProtectStack); TermProtectStack = MkAtomTerm(AtomProtectStack); + AtomQly = AtomAdjust(AtomQly); TermQly = MkAtomTerm(AtomQly); + AtomQuery = AtomAdjust(AtomQuery); TermQuery = MkAtomTerm(AtomQuery); + AtomQueue = AtomAdjust(AtomQueue); TermQueue = MkAtomTerm(AtomQueue); + AtomQuiet = AtomAdjust(AtomQuiet); TermQuiet = MkAtomTerm(AtomQuiet); + AtomRadix = AtomAdjust(AtomRadix); TermRadix = MkAtomTerm(AtomRadix); + AtomRandom = AtomAdjust(AtomRandom); TermRandom = MkAtomTerm(AtomRandom); + AtomRange = AtomAdjust(AtomRange); TermRange = MkAtomTerm(AtomRange); + AtomRDiv = AtomAdjust(AtomRDiv); TermRDiv = MkAtomTerm(AtomRDiv); + AtomRead = AtomAdjust(AtomRead); TermRead = MkAtomTerm(AtomRead); + AtomReadOnly = AtomAdjust(AtomReadOnly); TermReadOnly = MkAtomTerm(AtomReadOnly); + AtomReadWrite = AtomAdjust(AtomReadWrite); TermReadWrite = MkAtomTerm(AtomReadWrite); + AtomReadutil = AtomAdjust(AtomReadutil); TermReadutil = MkAtomTerm(AtomReadutil); + AtomReconsult = AtomAdjust(AtomReconsult); TermReconsult = MkAtomTerm(AtomReconsult); + AtomRecordedP = AtomAdjust(AtomRecordedP); TermRecordedP = MkAtomTerm(AtomRecordedP); + AtomRecordedWithKey = AtomAdjust(AtomRecordedWithKey); TermRecordedWithKey = MkAtomTerm(AtomRecordedWithKey); + AtomRedefineWarnings = AtomAdjust(AtomRedefineWarnings); TermRedefineWarnings = MkAtomTerm(AtomRedefineWarnings); + AtomRedoFreeze = AtomAdjust(AtomRedoFreeze); TermRedoFreeze = MkAtomTerm(AtomRedoFreeze); + AtomRefoundVar = AtomAdjust(AtomRefoundVar); TermRefoundVar = MkAtomTerm(AtomRefoundVar); + AtomRelativeTo = AtomAdjust(AtomRelativeTo); TermRelativeTo = MkAtomTerm(AtomRelativeTo); + AtomRepeat = AtomAdjust(AtomRepeat); TermRepeat = MkAtomTerm(AtomRepeat); + AtomRepeatSpace = AtomAdjust(AtomRepeatSpace); TermRepeatSpace = MkAtomTerm(AtomRepeatSpace); + AtomReposition = AtomAdjust(AtomReposition); TermReposition = MkAtomTerm(AtomReposition); + AtomRepresentationError = AtomAdjust(AtomRepresentationError); TermRepresentationError = MkAtomTerm(AtomRepresentationError); + AtomReset = AtomAdjust(AtomReset); TermReset = MkAtomTerm(AtomReset); + AtomResize = AtomAdjust(AtomResize); TermResize = MkAtomTerm(AtomResize); + AtomResourceError = AtomAdjust(AtomResourceError); TermResourceError = MkAtomTerm(AtomResourceError); + AtomRestoreRegs = AtomAdjust(AtomRestoreRegs); TermRestoreRegs = MkAtomTerm(AtomRestoreRegs); + AtomRetry = AtomAdjust(AtomRetry); TermRetry = MkAtomTerm(AtomRetry); + AtomRetryCounter = AtomAdjust(AtomRetryCounter); TermRetryCounter = MkAtomTerm(AtomRetryCounter); + AtomRTree = AtomAdjust(AtomRTree); TermRTree = MkAtomTerm(AtomRTree); + AtomSafe = AtomAdjust(AtomSafe); TermSafe = MkAtomTerm(AtomSafe); + AtomSafeCallCleanup = AtomAdjust(AtomSafeCallCleanup); TermSafeCallCleanup = MkAtomTerm(AtomSafeCallCleanup); + AtomSame = AtomAdjust(AtomSame); TermSame = MkAtomTerm(AtomSame); + AtomSemic = AtomAdjust(AtomSemic); TermSemic = MkAtomTerm(AtomSemic); + AtomShiftCountOverflow = AtomAdjust(AtomShiftCountOverflow); TermShiftCountOverflow = MkAtomTerm(AtomShiftCountOverflow); + AtomSigAlarm = AtomAdjust(AtomSigAlarm); TermSigAlarm = MkAtomTerm(AtomSigAlarm); + AtomSigBreak = AtomAdjust(AtomSigBreak); TermSigBreak = MkAtomTerm(AtomSigBreak); + AtomSigCreep = AtomAdjust(AtomSigCreep); TermSigCreep = MkAtomTerm(AtomSigCreep); + AtomSigDebug = AtomAdjust(AtomSigDebug); TermSigDebug = MkAtomTerm(AtomSigDebug); + AtomSigDelayCreep = AtomAdjust(AtomSigDelayCreep); TermSigDelayCreep = MkAtomTerm(AtomSigDelayCreep); + AtomSigFPE = AtomAdjust(AtomSigFPE); TermSigFPE = MkAtomTerm(AtomSigFPE); + AtomSigHup = AtomAdjust(AtomSigHup); TermSigHup = MkAtomTerm(AtomSigHup); + AtomSigInt = AtomAdjust(AtomSigInt); TermSigInt = MkAtomTerm(AtomSigInt); + AtomSigIti = AtomAdjust(AtomSigIti); TermSigIti = MkAtomTerm(AtomSigIti); + AtomSigPending = AtomAdjust(AtomSigPending); TermSigPending = MkAtomTerm(AtomSigPending); + AtomSigPipe = AtomAdjust(AtomSigPipe); TermSigPipe = MkAtomTerm(AtomSigPipe); + AtomSigStackDump = AtomAdjust(AtomSigStackDump); TermSigStackDump = MkAtomTerm(AtomSigStackDump); + AtomSigStatistics = AtomAdjust(AtomSigStatistics); TermSigStatistics = MkAtomTerm(AtomSigStatistics); + AtomSigTrace = AtomAdjust(AtomSigTrace); TermSigTrace = MkAtomTerm(AtomSigTrace); + AtomSigUsr1 = AtomAdjust(AtomSigUsr1); TermSigUsr1 = MkAtomTerm(AtomSigUsr1); + AtomSigUsr2 = AtomAdjust(AtomSigUsr2); TermSigUsr2 = MkAtomTerm(AtomSigUsr2); + AtomSigVTAlarm = AtomAdjust(AtomSigVTAlarm); TermSigVTAlarm = MkAtomTerm(AtomSigVTAlarm); + AtomSigWakeUp = AtomAdjust(AtomSigWakeUp); TermSigWakeUp = MkAtomTerm(AtomSigWakeUp); + AtomSilent = AtomAdjust(AtomSilent); TermSilent = MkAtomTerm(AtomSilent); + AtomSingle = AtomAdjust(AtomSingle); TermSingle = MkAtomTerm(AtomSingle); + AtomSingleVarWarnings = AtomAdjust(AtomSingleVarWarnings); TermSingleVarWarnings = MkAtomTerm(AtomSingleVarWarnings); + AtomSingleton = AtomAdjust(AtomSingleton); TermSingleton = MkAtomTerm(AtomSingleton); + AtomSlash = AtomAdjust(AtomSlash); TermSlash = MkAtomTerm(AtomSlash); + AtomSocket = AtomAdjust(AtomSocket); TermSocket = MkAtomTerm(AtomSocket); + AtomSolutions = AtomAdjust(AtomSolutions); TermSolutions = MkAtomTerm(AtomSolutions); + AtomSource = AtomAdjust(AtomSource); TermSource = MkAtomTerm(AtomSource); + AtomSourceSink = AtomAdjust(AtomSourceSink); TermSourceSink = MkAtomTerm(AtomSourceSink); + AtomSpy = AtomAdjust(AtomSpy); TermSpy = MkAtomTerm(AtomSpy); + AtomStack = AtomAdjust(AtomStack); TermStack = MkAtomTerm(AtomStack); + AtomStackFree = AtomAdjust(AtomStackFree); TermStackFree = MkAtomTerm(AtomStackFree); + AtomStartupSavedState = AtomAdjust(AtomStartupSavedState); TermStartupSavedState = MkAtomTerm(AtomStartupSavedState); + AtomStaticClause = AtomAdjust(AtomStaticClause); TermStaticClause = MkAtomTerm(AtomStaticClause); + AtomStaticProcedure = AtomAdjust(AtomStaticProcedure); TermStaticProcedure = MkAtomTerm(AtomStaticProcedure); + AtomStream = AtomAdjust(AtomStream); TermStream = MkAtomTerm(AtomStream); + AtomSWIStream = AtomAdjust(AtomSWIStream); TermSWIStream = MkAtomTerm(AtomSWIStream); + AtomVStream = AtomAdjust(AtomVStream); TermVStream = MkAtomTerm(AtomVStream); + AtomStreams = AtomAdjust(AtomStreams); TermStreams = MkAtomTerm(AtomStreams); + AtomStreamOrAlias = AtomAdjust(AtomStreamOrAlias); TermStreamOrAlias = MkAtomTerm(AtomStreamOrAlias); + AtomStreamPos = AtomAdjust(AtomStreamPos); TermStreamPos = MkAtomTerm(AtomStreamPos); + AtomStreamPosition = AtomAdjust(AtomStreamPosition); TermStreamPosition = MkAtomTerm(AtomStreamPosition); + AtomString = AtomAdjust(AtomString); TermString = MkAtomTerm(AtomString); + AtomStyleCheck = AtomAdjust(AtomStyleCheck); TermStyleCheck = MkAtomTerm(AtomStyleCheck); + AtomSTRING = AtomAdjust(AtomSTRING); TermSTRING = MkAtomTerm(AtomSTRING); + AtomSwi = AtomAdjust(AtomSwi); TermSwi = MkAtomTerm(AtomSwi); + AtomSymbolChar = AtomAdjust(AtomSymbolChar); TermSymbolChar = MkAtomTerm(AtomSymbolChar); + AtomSyntaxError = AtomAdjust(AtomSyntaxError); TermSyntaxError = MkAtomTerm(AtomSyntaxError); + AtomSyntaxErrors = AtomAdjust(AtomSyntaxErrors); TermSyntaxErrors = MkAtomTerm(AtomSyntaxErrors); + AtomSyntaxErrorHandler = AtomAdjust(AtomSyntaxErrorHandler); TermSyntaxErrorHandler = MkAtomTerm(AtomSyntaxErrorHandler); + AtomSystem = AtomAdjust(AtomSystem); TermSystem = MkAtomTerm(AtomSystem); + AtomSystemError = AtomAdjust(AtomSystemError); TermSystemError = MkAtomTerm(AtomSystemError); + AtomSystemLibraryDir = AtomAdjust(AtomSystemLibraryDir); TermSystemLibraryDir = MkAtomTerm(AtomSystemLibraryDir); + AtomT = AtomAdjust(AtomT); TermT = MkAtomTerm(AtomT); + AtomTerm = AtomAdjust(AtomTerm); TermTerm = MkAtomTerm(AtomTerm); + AtomTermExpansion = AtomAdjust(AtomTermExpansion); TermTermExpansion = MkAtomTerm(AtomTermExpansion); + AtomTerms = AtomAdjust(AtomTerms); TermTerms = MkAtomTerm(AtomTerms); + AtomText = AtomAdjust(AtomText); TermText = MkAtomTerm(AtomText); + AtomTextStream = AtomAdjust(AtomTextStream); TermTextStream = MkAtomTerm(AtomTextStream); + AtomThread = AtomAdjust(AtomThread); TermThread = MkAtomTerm(AtomThread); + AtomThreads = AtomAdjust(AtomThreads); TermThreads = MkAtomTerm(AtomThreads); + AtomThrow = AtomAdjust(AtomThrow); TermThrow = MkAtomTerm(AtomThrow); + AtomTimeOutSpec = AtomAdjust(AtomTimeOutSpec); TermTimeOutSpec = MkAtomTerm(AtomTimeOutSpec); + AtomTimeoutError = AtomAdjust(AtomTimeoutError); TermTimeoutError = MkAtomTerm(AtomTimeoutError); + AtomTopLevelGoal = AtomAdjust(AtomTopLevelGoal); TermTopLevelGoal = MkAtomTerm(AtomTopLevelGoal); + AtomTopThreadGoal = AtomAdjust(AtomTopThreadGoal); TermTopThreadGoal = MkAtomTerm(AtomTopThreadGoal); + AtomTraceMetaCall = AtomAdjust(AtomTraceMetaCall); TermTraceMetaCall = MkAtomTerm(AtomTraceMetaCall); + AtomTrail = AtomAdjust(AtomTrail); + AtomTrue = AtomAdjust(AtomTrue); TermTrue = MkAtomTerm(AtomTrue); + AtomTty = AtomAdjust(AtomTty); TermTty = MkAtomTerm(AtomTty); + AtomTtys = AtomAdjust(AtomTtys); TermTtys = MkAtomTerm(AtomTtys); + AtomTuple = AtomAdjust(AtomTuple); TermTuple = MkAtomTerm(AtomTuple); + AtomTxt = AtomAdjust(AtomTxt); TermTxt = MkAtomTerm(AtomTxt); + AtomTypeError = AtomAdjust(AtomTypeError); TermTypeError = MkAtomTerm(AtomTypeError); + AtomUndefined = AtomAdjust(AtomUndefined); TermUndefined = MkAtomTerm(AtomUndefined); + AtomUndefinedQuery = AtomAdjust(AtomUndefinedQuery); TermUndefinedQuery = MkAtomTerm(AtomUndefinedQuery); + AtomUndefp = AtomAdjust(AtomUndefp); TermUndefp = MkAtomTerm(AtomUndefp); + AtomUndefp0 = AtomAdjust(AtomUndefp0); TermUndefp0 = MkAtomTerm(AtomUndefp0); + AtomUnderflow = AtomAdjust(AtomUnderflow); TermUnderflow = MkAtomTerm(AtomUnderflow); + AtomUnificationStack = AtomAdjust(AtomUnificationStack); TermUnificationStack = MkAtomTerm(AtomUnificationStack); + AtomUnique = AtomAdjust(AtomUnique); TermUnique = MkAtomTerm(AtomUnique); + AtomUnsignedByte = AtomAdjust(AtomUnsignedByte); TermUnsignedByte = MkAtomTerm(AtomUnsignedByte); + AtomUnsignedChar = AtomAdjust(AtomUnsignedChar); TermUnsignedChar = MkAtomTerm(AtomUnsignedChar); + AtomUser = AtomAdjust(AtomUser); TermUser = MkAtomTerm(AtomUser); + AtomUserErr = AtomAdjust(AtomUserErr); TermUserErr = MkAtomTerm(AtomUserErr); + AtomUserIn = AtomAdjust(AtomUserIn); TermUserIn = MkAtomTerm(AtomUserIn); + AtomUserOut = AtomAdjust(AtomUserOut); TermUserOut = MkAtomTerm(AtomUserOut); + AtomDollarVar = AtomAdjust(AtomDollarVar); TermDollarVar = MkAtomTerm(AtomDollarVar); + AtomVBar = AtomAdjust(AtomVBar); TermVBar = MkAtomTerm(AtomVBar); + AtomVarBranches = AtomAdjust(AtomVarBranches); TermVarBranches = MkAtomTerm(AtomVarBranches); + AtomVariableNames = AtomAdjust(AtomVariableNames); TermVariableNames = MkAtomTerm(AtomVariableNames); + AtomHiddenVar = AtomAdjust(AtomHiddenVar); TermHiddenVar = MkAtomTerm(AtomHiddenVar); + AtomVariable = AtomAdjust(AtomVariable); TermVariable = MkAtomTerm(AtomVariable); + AtomVerbose = AtomAdjust(AtomVerbose); TermVerbose = MkAtomTerm(AtomVerbose); + AtomVerboseFileSearch = AtomAdjust(AtomVerboseFileSearch); TermVerboseFileSearch = MkAtomTerm(AtomVerboseFileSearch); + AtomVersionNumber = AtomAdjust(AtomVersionNumber); TermVersionNumber = MkAtomTerm(AtomVersionNumber); + AtomVeryVerbose = AtomAdjust(AtomVeryVerbose); TermVeryVerbose = MkAtomTerm(AtomVeryVerbose); + AtomWakeUpGoal = AtomAdjust(AtomWakeUpGoal); TermWakeUpGoal = MkAtomTerm(AtomWakeUpGoal); + AtomWarning = AtomAdjust(AtomWarning); TermWarning = MkAtomTerm(AtomWarning); + AtomWhen = AtomAdjust(AtomWhen); TermWhen = MkAtomTerm(AtomWhen); + AtomWrite = AtomAdjust(AtomWrite); TermWrite = MkAtomTerm(AtomWrite); + AtomWriteTerm = AtomAdjust(AtomWriteTerm); TermWriteTerm = MkAtomTerm(AtomWriteTerm); + AtomXml = AtomAdjust(AtomXml); TermXml = MkAtomTerm(AtomXml); + AtomYapHacks = AtomAdjust(AtomYapHacks); TermYapHacks = MkAtomTerm(AtomYapHacks); + AtomZeroDivisor = AtomAdjust(AtomZeroDivisor); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor); + FunctorAfInet = FuncAdjust(FunctorAfInet); + FunctorAfLocal = FuncAdjust(FunctorAfLocal); + FunctorAfUnix = FuncAdjust(FunctorAfUnix); + FunctorAltNot = FuncAdjust(FunctorAltNot); + FunctorArg = FuncAdjust(FunctorArg); + FunctorArrayEntry = FuncAdjust(FunctorArrayEntry); + FunctorArrow = FuncAdjust(FunctorArrow); + FunctorDoubleArrow = FuncAdjust(FunctorDoubleArrow); + FunctorAssert1 = FuncAdjust(FunctorAssert1); + FunctorAssert = FuncAdjust(FunctorAssert); + FunctorAtFoundOne = FuncAdjust(FunctorAtFoundOne); + FunctorAtom = FuncAdjust(FunctorAtom); + FunctorAtt1 = FuncAdjust(FunctorAtt1); + FunctorAttGoal = FuncAdjust(FunctorAttGoal); + FunctorBraces = FuncAdjust(FunctorBraces); + FunctorCall = FuncAdjust(FunctorCall); + FunctorCatch = FuncAdjust(FunctorCatch); + FunctorChangeModule = FuncAdjust(FunctorChangeModule); + FunctorChars = FuncAdjust(FunctorChars); + FunctorChars1 = FuncAdjust(FunctorChars1); + FunctorCleanCall = FuncAdjust(FunctorCleanCall); + FunctorClist = FuncAdjust(FunctorClist); + FunctorCodes = FuncAdjust(FunctorCodes); + FunctorCodes1 = FuncAdjust(FunctorCodes1); + FunctorColon = FuncAdjust(FunctorColon); + FunctorComma = FuncAdjust(FunctorComma); + FunctorCommentHook = FuncAdjust(FunctorCommentHook); + FunctorContext2 = FuncAdjust(FunctorContext2); + FunctorConsistencyError = FuncAdjust(FunctorConsistencyError); + FunctorCreep = FuncAdjust(FunctorCreep); + FunctorCsult = FuncAdjust(FunctorCsult); + FunctorCurrentModule = FuncAdjust(FunctorCurrentModule); + FunctorCutBy = FuncAdjust(FunctorCutBy); + FunctorDBREF = FuncAdjust(FunctorDBREF); + FunctorDiff = FuncAdjust(FunctorDiff); + FunctorDoLogUpdClause = FuncAdjust(FunctorDoLogUpdClause); + FunctorDoLogUpdClause0 = FuncAdjust(FunctorDoLogUpdClause0); + FunctorDoLogUpdClauseErase = FuncAdjust(FunctorDoLogUpdClauseErase); + FunctorDoStaticClause = FuncAdjust(FunctorDoStaticClause); + FunctorDollar = FuncAdjust(FunctorDollar); + FunctorDollarVar = FuncAdjust(FunctorDollarVar); + FunctorDomainError = FuncAdjust(FunctorDomainError); + FunctorDot = FuncAdjust(FunctorDot); + FunctorDot10 = FuncAdjust(FunctorDot10); + FunctorDot11 = FuncAdjust(FunctorDot11); + FunctorDot12 = FuncAdjust(FunctorDot12); + FunctorDot2 = FuncAdjust(FunctorDot2); + FunctorDot3 = FuncAdjust(FunctorDot3); + FunctorDot4 = FuncAdjust(FunctorDot4); + FunctorDot5 = FuncAdjust(FunctorDot5); + FunctorDot6 = FuncAdjust(FunctorDot6); + FunctorDot7 = FuncAdjust(FunctorDot7); + FunctorDot8 = FuncAdjust(FunctorDot8); + FunctorDot9 = FuncAdjust(FunctorDot9); + FunctorDoubleArrow = FuncAdjust(FunctorDoubleArrow); + FunctorDoubleSlash = FuncAdjust(FunctorDoubleSlash); + FunctorEmptySquareBrackets = FuncAdjust(FunctorEmptySquareBrackets); + FunctorEq = FuncAdjust(FunctorEq); + FunctorError = FuncAdjust(FunctorError); + FunctorEvaluationError = FuncAdjust(FunctorEvaluationError); + FunctorException = FuncAdjust(FunctorException); + FunctorExecute2InMod = FuncAdjust(FunctorExecute2InMod); + FunctorExecuteInMod = FuncAdjust(FunctorExecuteInMod); + FunctorExecuteWithin = FuncAdjust(FunctorExecuteWithin); + FunctorExistenceError = FuncAdjust(FunctorExistenceError); + FunctorExoClause = FuncAdjust(FunctorExoClause); + FunctorFunctor = FuncAdjust(FunctorFunctor); + FunctorGAtom = FuncAdjust(FunctorGAtom); + FunctorGAtomic = FuncAdjust(FunctorGAtomic); + FunctorGCompound = FuncAdjust(FunctorGCompound); + FunctorGFloat = FuncAdjust(FunctorGFloat); + FunctorGFormatAt = FuncAdjust(FunctorGFormatAt); + FunctorGInteger = FuncAdjust(FunctorGInteger); + FunctorGNumber = FuncAdjust(FunctorGNumber); + FunctorGPrimitive = FuncAdjust(FunctorGPrimitive); + FunctorGVar = FuncAdjust(FunctorGVar); + FunctorGeneratePredInfo = FuncAdjust(FunctorGeneratePredInfo); + FunctorGoalExpansion2 = FuncAdjust(FunctorGoalExpansion2); + FunctorGoalExpansion = FuncAdjust(FunctorGoalExpansion); + FunctorHandleThrow = FuncAdjust(FunctorHandleThrow); + FunctorHat = FuncAdjust(FunctorHat); + FunctorI = FuncAdjust(FunctorI); + FunctorId = FuncAdjust(FunctorId); + FunctorInfo1 = FuncAdjust(FunctorInfo1); + FunctorInfo2 = FuncAdjust(FunctorInfo2); + FunctorInfo3 = FuncAdjust(FunctorInfo3); + FunctorInfo4 = FuncAdjust(FunctorInfo4); + FunctorIs = FuncAdjust(FunctorIs); + FunctorJ = FuncAdjust(FunctorJ); + FunctorLastExecuteWithin = FuncAdjust(FunctorLastExecuteWithin); + FunctorList = FuncAdjust(FunctorList); + FunctorLOOP = FuncAdjust(FunctorLOOP); + FunctorMegaClause = FuncAdjust(FunctorMegaClause); + FunctorMetaCall = FuncAdjust(FunctorMetaCall); + FunctorMinus = FuncAdjust(FunctorMinus); + FunctorModule = FuncAdjust(FunctorModule); + FunctorMultiFileClause = FuncAdjust(FunctorMultiFileClause); + FunctorMutable = FuncAdjust(FunctorMutable); + FunctorMutex = FuncAdjust(FunctorMutex); + FunctorNotImplemented = FuncAdjust(FunctorNotImplemented); + FunctorNBQueue = FuncAdjust(FunctorNBQueue); + FunctorNot = FuncAdjust(FunctorNot); + FunctorObj = FuncAdjust(FunctorObj); + FunctorOr = FuncAdjust(FunctorOr); + FunctorOutput = FuncAdjust(FunctorOutput); + FunctorPermissionError = FuncAdjust(FunctorPermissionError); + FunctorPlus = FuncAdjust(FunctorPlus); + FunctorPortray = FuncAdjust(FunctorPortray); + FunctorPrintMessage = FuncAdjust(FunctorPrintMessage); + FunctorProcedure = FuncAdjust(FunctorProcedure); + FunctorPriority = FuncAdjust(FunctorPriority); + FunctorPrologConstraint = FuncAdjust(FunctorPrologConstraint); + FunctorProtectStack = FuncAdjust(FunctorProtectStack); + FunctorQuery = FuncAdjust(FunctorQuery); + FunctorRecordedWithKey = FuncAdjust(FunctorRecordedWithKey); + FunctorRDiv = FuncAdjust(FunctorRDiv); + FunctorRedoFreeze = FuncAdjust(FunctorRedoFreeze); + FunctorRepresentationError = FuncAdjust(FunctorRepresentationError); + FunctorResourceError = FuncAdjust(FunctorResourceError); + FunctorRestoreRegs = FuncAdjust(FunctorRestoreRegs); + FunctorRestoreRegs1 = FuncAdjust(FunctorRestoreRegs1); + FunctorSafe = FuncAdjust(FunctorSafe); + FunctorSafeCallCleanup = FuncAdjust(FunctorSafeCallCleanup); + FunctorSame = FuncAdjust(FunctorSame); + FunctorSlash = FuncAdjust(FunctorSlash); + FunctorStaticClause = FuncAdjust(FunctorStaticClause); + FunctorStream = FuncAdjust(FunctorStream); + FunctorStreamEOS = FuncAdjust(FunctorStreamEOS); + FunctorStreamPos = FuncAdjust(FunctorStreamPos); + FunctorString1 = FuncAdjust(FunctorString1); + FunctorStyleCheck = FuncAdjust(FunctorStyleCheck); + FunctorSyntaxError = FuncAdjust(FunctorSyntaxError); + FunctorShortSyntaxError = FuncAdjust(FunctorShortSyntaxError); + FunctorTermExpansion = FuncAdjust(FunctorTermExpansion); + FunctorThreadRun = FuncAdjust(FunctorThreadRun); + FunctorThrow = FuncAdjust(FunctorThrow); + FunctorTimeoutError = FuncAdjust(FunctorTimeoutError); + FunctorTraceMetaCall = FuncAdjust(FunctorTraceMetaCall); + FunctorTypeError = FuncAdjust(FunctorTypeError); + FunctorUMinus = FuncAdjust(FunctorUMinus); + FunctorUndefinedQuery = FuncAdjust(FunctorUndefinedQuery); + FunctorUPlus = FuncAdjust(FunctorUPlus); + FunctorVBar = FuncAdjust(FunctorVBar); + FunctorWriteTerm = FuncAdjust(FunctorWriteTerm); + FunctorHiddenVar = FuncAdjust(FunctorHiddenVar); diff --git a/H/generated/rhstruct.h b/H/generated/rhstruct.h index 1c8faa7e0..2ed86a7b7 100644 --- a/H/generated/rhstruct.h +++ b/H/generated/rhstruct.h @@ -152,6 +152,7 @@ PredTraceMetaCall = PtoPredAdjust(PredTraceMetaCall); PredCommentHook = PtoPredAdjust(PredCommentHook); PredProcedure = PtoPredAdjust(PredProcedure); + PredUndefinedQuery = PtoPredAdjust(PredUndefinedQuery); #ifdef LOW_LEVEL_TRACER diff --git a/H/generated/tatoms.h b/H/generated/tatoms.h index beee9ff0c..ca69c6b18 100644 --- a/H/generated/tatoms.h +++ b/H/generated/tatoms.h @@ -1,1161 +1,731 @@ - -/* This file, tatoms.h, was generated automatically by "yap -L misc/buildatoms" - {lease do not update, update misc/ATOMS instead */ - -X_API EXTERNAL Atom Atom3Dots; -X_API EXTERNAL Atom AtomAbol; -X_API EXTERNAL Term TermAbol; -X_API EXTERNAL Atom AtomAccess; -X_API EXTERNAL Term TermAccess; -X_API EXTERNAL Atom AtomAfInet; -X_API EXTERNAL Term TermAfInet; -X_API EXTERNAL Atom AtomAfLocal; -X_API EXTERNAL Term TermAfLocal; -X_API EXTERNAL Atom AtomAfUnix; -X_API EXTERNAL Term TermAfUnix; -X_API EXTERNAL Atom AtomAlarm; -X_API EXTERNAL Term TermAlarm; -X_API EXTERNAL Atom AtomAlias; -X_API EXTERNAL Term TermAlias; -X_API EXTERNAL Atom AtomAll; -X_API EXTERNAL Term TermAll; -X_API EXTERNAL Atom AtomAltNot; -X_API EXTERNAL Term TermAltNot; -X_API EXTERNAL Atom AtomAnswer; -X_API EXTERNAL Term TermAnswer; -X_API EXTERNAL Atom AtomAny; -X_API EXTERNAL Term TermAny; -X_API EXTERNAL Atom AtomAppend; -X_API EXTERNAL Term TermAppend; -X_API EXTERNAL Atom AtomArg; -X_API EXTERNAL Term TermArg; -X_API EXTERNAL Atom AtomArray; -X_API EXTERNAL Term TermArray; -X_API EXTERNAL Atom AtomArrayAccess; -X_API EXTERNAL Term TermArrayAccess; -X_API EXTERNAL Atom AtomArrayOverflow; -X_API EXTERNAL Term TermArrayOverflow; -X_API EXTERNAL Atom AtomArrayType; -X_API EXTERNAL Term TermArrayType; -X_API EXTERNAL Atom AtomArrow; -X_API EXTERNAL Term TermArrow; -X_API EXTERNAL Atom AtomAttributedModule; -X_API EXTERNAL Term TermAttributedModule; -X_API EXTERNAL Atom AtomDoubleArrow; -X_API EXTERNAL Term TermDoubleArrow; -X_API EXTERNAL Atom AtomAssert; -X_API EXTERNAL Term TermAssert; -X_API EXTERNAL Atom AtomBeginBracket; -X_API EXTERNAL Term TermBeginBracket; -X_API EXTERNAL Atom AtomEndBracket; -X_API EXTERNAL Term TermEndBracket; -X_API EXTERNAL Atom AtomBeginSquareBracket; -X_API EXTERNAL Term TermBeginSquareBracket; -X_API EXTERNAL Atom AtomEndSquareBracket; -X_API EXTERNAL Term TermEndSquareBracket; -X_API EXTERNAL Atom AtomBeginCurlyBracket; -X_API EXTERNAL Term TermBeginCurlyBracket; -X_API EXTERNAL Atom AtomEndCurlyBracket; -X_API EXTERNAL Term TermEndCurlyBracket; -X_API EXTERNAL Atom AtomEmptyBrackets; -X_API EXTERNAL Term TermEmptyBrackets; -X_API EXTERNAL Atom AtomEmptySquareBrackets; -X_API EXTERNAL Term TermEmptySquareBrackets; -X_API EXTERNAL Atom AtomAsserta; -X_API EXTERNAL Term TermAsserta; -X_API EXTERNAL Atom AtomAssertaStatic; -X_API EXTERNAL Term TermAssertaStatic; -X_API EXTERNAL Atom AtomAssertz; -X_API EXTERNAL Term TermAssertz; -X_API EXTERNAL Atom AtomAssertzStatic; -X_API EXTERNAL Term TermAssertzStatic; -X_API EXTERNAL Atom AtomAt; -X_API EXTERNAL Term TermAt; -X_API EXTERNAL Atom AtomAtom; -X_API EXTERNAL Term TermAtom; -X_API EXTERNAL Atom AtomAtomic; -X_API EXTERNAL Term TermAtomic; -X_API EXTERNAL Atom AtomAtt; -X_API EXTERNAL Term TermAtt; -X_API EXTERNAL Atom AtomAtt1; -X_API EXTERNAL Term TermAtt1; -X_API EXTERNAL Atom AtomAttDo; -X_API EXTERNAL Term TermAttDo; -X_API EXTERNAL Atom AtomAttributes; -X_API EXTERNAL Term TermAttributes; -X_API EXTERNAL Atom AtomB; -X_API EXTERNAL Term TermB; -X_API EXTERNAL Atom AtomBatched; -X_API EXTERNAL Term TermBatched; -X_API EXTERNAL Atom AtomBetween; -X_API EXTERNAL Term TermBetween; -X_API EXTERNAL Atom AtomBinary; -X_API EXTERNAL Term TermBinary; -X_API EXTERNAL Atom AtomBigNum; -X_API EXTERNAL Term TermBigNum; -X_API EXTERNAL Atom AtomBinaryStream; -X_API EXTERNAL Term TermBinaryStream; -X_API EXTERNAL Atom AtomBoolean; -X_API EXTERNAL Term TermBoolean; -X_API EXTERNAL Atom AtomBraces; -X_API EXTERNAL Term TermBraces; -X_API EXTERNAL Atom AtomBreak; -X_API EXTERNAL Term TermBreak; -X_API EXTERNAL Atom AtomByte; -X_API EXTERNAL Term TermByte; -X_API EXTERNAL Atom AtomCArith; -X_API EXTERNAL Term TermCArith; -X_API EXTERNAL Atom AtomCall; -X_API EXTERNAL Term TermCall; -X_API EXTERNAL Atom AtomCallAndRetryCounter; -X_API EXTERNAL Term TermCallAndRetryCounter; -X_API EXTERNAL Atom AtomCallCounter; -X_API EXTERNAL Term TermCallCounter; -X_API EXTERNAL Atom AtomCallable; -X_API EXTERNAL Term TermCallable; -X_API EXTERNAL Atom AtomCatch; -X_API EXTERNAL Term TermCatch; -X_API EXTERNAL Atom AtomChangeModule; -X_API EXTERNAL Term TermChangeModule; -X_API EXTERNAL Atom AtomChar; -X_API EXTERNAL Term TermChar; -X_API EXTERNAL Atom AtomCharsio; -X_API EXTERNAL Term TermCharsio; -X_API EXTERNAL Atom AtomCharacter; -X_API EXTERNAL Term TermCharacter; -X_API EXTERNAL Atom AtomCharacterCode; -X_API EXTERNAL Term TermCharacterCode; -X_API EXTERNAL Atom AtomChars; -X_API EXTERNAL Term TermChars; -X_API EXTERNAL Atom AtomCharset; -X_API EXTERNAL Term TermCharset; -X_API EXTERNAL Atom AtomChType; -X_API EXTERNAL Term TermChType; -X_API EXTERNAL Atom AtomCleanCall; -X_API EXTERNAL Term TermCleanCall; -X_API EXTERNAL Atom AtomClose; -X_API EXTERNAL Term TermClose; -X_API EXTERNAL Atom AtomColon; -X_API EXTERNAL Term TermColon; -X_API EXTERNAL Atom AtomCodeSpace; -X_API EXTERNAL Term TermCodeSpace; -X_API EXTERNAL Atom AtomCodes; -X_API EXTERNAL Term TermCodes; -X_API EXTERNAL Atom AtomCoInductive; -X_API EXTERNAL Term TermCoInductive; -X_API EXTERNAL Atom AtomComma; -X_API EXTERNAL Term TermComma; -X_API EXTERNAL Atom AtomCommentHook; -X_API EXTERNAL Term TermCommentHook; -X_API EXTERNAL Atom AtomCompact; -X_API EXTERNAL Term TermCompact; -X_API EXTERNAL Atom AtomCompound; -X_API EXTERNAL Term TermCompound; -X_API EXTERNAL Atom AtomConsistencyError; -X_API EXTERNAL Term TermConsistencyError; -X_API EXTERNAL Atom AtomConsult; -X_API EXTERNAL Term TermConsult; -X_API EXTERNAL Atom AtomConsultOnBoot; -X_API EXTERNAL Term TermConsultOnBoot; -X_API EXTERNAL Atom AtomContext; -X_API EXTERNAL Term TermContext; -X_API EXTERNAL Atom AtomCputime; -X_API EXTERNAL Term TermCputime; -X_API EXTERNAL Atom AtomCreate; -X_API EXTERNAL Term TermCreate; -X_API EXTERNAL Atom AtomCreep; -X_API EXTERNAL Term TermCreep; -X_API EXTERNAL Atom AtomCryptAtoms; -X_API EXTERNAL Term TermCryptAtoms; -X_API EXTERNAL Atom AtomCurly; -X_API EXTERNAL Term TermCurly; -X_API EXTERNAL Atom AtomCsult; -X_API EXTERNAL Term TermCsult; -X_API EXTERNAL Atom AtomCurrentModule; -X_API EXTERNAL Term TermCurrentModule; -X_API EXTERNAL Atom AtomCut; -X_API EXTERNAL Term TermCut; -X_API EXTERNAL Atom AtomCutBy; -X_API EXTERNAL Term TermCutBy; -X_API EXTERNAL Atom AtomDAbort; -X_API EXTERNAL Term TermDAbort; -X_API EXTERNAL Atom AtomDBLoad; -X_API EXTERNAL Term TermDBLoad; -X_API EXTERNAL Atom AtomDBREF; -X_API EXTERNAL Term TermDBREF; -X_API EXTERNAL Atom AtomDBReference; -X_API EXTERNAL Term TermDBReference; -X_API EXTERNAL Atom AtomDBTerm; -X_API EXTERNAL Term TermDBTerm; -X_API EXTERNAL Atom AtomDBref; -X_API EXTERNAL Term TermDBref; -X_API EXTERNAL Atom AtomDInteger; -X_API EXTERNAL Term TermDInteger; -X_API EXTERNAL Atom AtomDebugMeta; -X_API EXTERNAL Term TermDebugMeta; -X_API EXTERNAL Atom AtomDebuggerInput; -X_API EXTERNAL Term TermDebuggerInput; -X_API EXTERNAL Atom AtomDec10; -X_API EXTERNAL Term TermDec10; -X_API EXTERNAL Atom AtomDefault; -X_API EXTERNAL Term TermDefault; -X_API EXTERNAL Atom AtomDevNull; -X_API EXTERNAL Term TermDevNull; -X_API EXTERNAL Atom AtomDiff; -X_API EXTERNAL Term TermDiff; -X_API EXTERNAL Atom AtomDirectory; -X_API EXTERNAL Term TermDirectory; -X_API EXTERNAL Atom AtomDiscontiguous; -X_API EXTERNAL Term TermDiscontiguous; -X_API EXTERNAL Atom AtomDiscontiguousWarnings; -X_API EXTERNAL Term TermDiscontiguousWarnings; -X_API EXTERNAL Atom AtomDollar; -X_API EXTERNAL Term TermDollar; -X_API EXTERNAL Atom AtomDoLogUpdClause; -X_API EXTERNAL Term TermDoLogUpdClause; -X_API EXTERNAL Atom AtomDoLogUpdClause0; -X_API EXTERNAL Term TermDoLogUpdClause0; -X_API EXTERNAL Atom AtomDoLogUpdClauseErase; -X_API EXTERNAL Term TermDoLogUpdClauseErase; -X_API EXTERNAL Atom AtomDollarU; -X_API EXTERNAL Term TermDollarU; -X_API EXTERNAL Atom AtomDollarUndef; -X_API EXTERNAL Term TermDollarUndef; -X_API EXTERNAL Atom AtomDomainError; -X_API EXTERNAL Term TermDomainError; -X_API EXTERNAL Atom AtomDoStaticClause; -X_API EXTERNAL Term TermDoStaticClause; -X_API EXTERNAL Atom AtomDots; -X_API EXTERNAL Term TermDots; -X_API EXTERNAL Atom AtomDOUBLE; -X_API EXTERNAL Term TermDOUBLE; -X_API EXTERNAL Atom AtomDoubleSlash; -X_API EXTERNAL Term TermDoubleSlash; -X_API EXTERNAL Atom AtomE; -X_API EXTERNAL Term TermE; -X_API EXTERNAL Atom AtomEOFBeforeEOT; -X_API EXTERNAL Term TermEOFBeforeEOT; -X_API EXTERNAL Atom AtomEQ; -X_API EXTERNAL Term TermEQ; -X_API EXTERNAL Atom AtomEmptyAtom; -X_API EXTERNAL Term TermEmptyAtom; -X_API EXTERNAL Atom AtomEncoding; -X_API EXTERNAL Term TermEncoding; -X_API EXTERNAL Atom AtomEndOfStream; -X_API EXTERNAL Term TermEndOfStream; -X_API EXTERNAL Atom AtomEof; -X_API EXTERNAL Term TermEof; -X_API EXTERNAL Atom AtomEOfCode; -X_API EXTERNAL Term TermEOfCode; -X_API EXTERNAL Atom AtomEq; -X_API EXTERNAL Term TermEq; -X_API EXTERNAL Atom AtomError; -X_API EXTERNAL Term TermError; -X_API EXTERNAL Atom AtomException; -X_API EXTERNAL Term TermException; -X_API EXTERNAL Atom AtomExtensions; -X_API EXTERNAL Term TermExtensions; -X_API EXTERNAL Atom AtomEvaluable; -X_API EXTERNAL Term TermEvaluable; -X_API EXTERNAL Atom AtomEvaluationError; -X_API EXTERNAL Term TermEvaluationError; -X_API EXTERNAL Atom AtomExecutable; -X_API EXTERNAL Term TermExecutable; -X_API EXTERNAL Atom AtomExecute; -X_API EXTERNAL Term TermExecute; -X_API EXTERNAL Atom AtomExecAnswers; -X_API EXTERNAL Term TermExecAnswers; -X_API EXTERNAL Atom AtomExecuteInMod; -X_API EXTERNAL Term TermExecuteInMod; -X_API EXTERNAL Atom AtomExecuteWithin; -X_API EXTERNAL Term TermExecuteWithin; -X_API EXTERNAL Atom AtomExecuteWoMod; -X_API EXTERNAL Term TermExecuteWoMod; -X_API EXTERNAL Atom AtomExist; -X_API EXTERNAL Term TermExist; -X_API EXTERNAL Atom AtomExists; -X_API EXTERNAL Term TermExists; -X_API EXTERNAL Atom AtomExit; -X_API EXTERNAL Term TermExit; -X_API EXTERNAL Atom AtomExistenceError; -X_API EXTERNAL Term TermExistenceError; -X_API EXTERNAL Atom AtomExoClause; -X_API EXTERNAL Term TermExoClause; -X_API EXTERNAL Atom AtomExpectedNumber; -X_API EXTERNAL Term TermExpectedNumber; -X_API EXTERNAL Atom AtomExpand; -X_API EXTERNAL Term TermExpand; -X_API EXTERNAL Atom AtomExtendFileSearchPath; -X_API EXTERNAL Term TermExtendFileSearchPath; -X_API EXTERNAL Atom AtomExtendsions; -X_API EXTERNAL Term TermExtendsions; -X_API EXTERNAL Atom AtomFB; -X_API EXTERNAL Term TermFB; -X_API EXTERNAL Atom AtomFail; -X_API EXTERNAL Term TermFail; -X_API EXTERNAL Atom AtomFalse; -X_API EXTERNAL Term TermFalse; -X_API EXTERNAL Atom AtomFast; -X_API EXTERNAL Term TermFast; -X_API EXTERNAL Atom AtomFastFail; -X_API EXTERNAL Term TermFastFail; -X_API EXTERNAL Atom AtomFileErrors; -X_API EXTERNAL Term TermFileErrors; -X_API EXTERNAL Atom AtomFileerrors; -X_API EXTERNAL Term TermFileerrors; -X_API EXTERNAL Atom AtomFileType; -X_API EXTERNAL Term TermFileType; -X_API EXTERNAL Atom AtomFirst; -X_API EXTERNAL Term TermFirst; -X_API EXTERNAL Atom AtomFloat; -X_API EXTERNAL Term TermFloat; -X_API EXTERNAL Atom AtomFloatFormat; -X_API EXTERNAL Term TermFloatFormat; -X_API EXTERNAL Atom AtomFloatOverflow; -X_API EXTERNAL Term TermFloatOverflow; -X_API EXTERNAL Atom AtomFloatUnderflow; -X_API EXTERNAL Term TermFloatUnderflow; -X_API EXTERNAL Atom AtomFormat; -X_API EXTERNAL Term TermFormat; -X_API EXTERNAL Atom AtomFormatAt; -X_API EXTERNAL Term TermFormatAt; -X_API EXTERNAL Atom AtomFull; -X_API EXTERNAL Term TermFull; -X_API EXTERNAL Atom AtomFunctor; -X_API EXTERNAL Term TermFunctor; -X_API EXTERNAL Atom AtomGT; -X_API EXTERNAL Term TermGT; -X_API EXTERNAL Atom AtomGVar; -X_API EXTERNAL Term TermGVar; -X_API EXTERNAL Atom AtomGc; -X_API EXTERNAL Term TermGc; -X_API EXTERNAL Atom AtomGcMargin; -X_API EXTERNAL Term TermGcMargin; -X_API EXTERNAL Atom AtomGcTrace; -X_API EXTERNAL Term TermGcTrace; -X_API EXTERNAL Atom AtomGcVerbose; -X_API EXTERNAL Term TermGcVerbose; -X_API EXTERNAL Atom AtomGcVeryVerbose; -X_API EXTERNAL Term TermGcVeryVerbose; -X_API EXTERNAL Atom AtomGeneratePredInfo; -X_API EXTERNAL Term TermGeneratePredInfo; -X_API EXTERNAL Atom AtomGetwork; -X_API EXTERNAL Term TermGetwork; -X_API EXTERNAL Atom AtomGetworkSeq; -X_API EXTERNAL Term TermGetworkSeq; -X_API EXTERNAL Atom AtomGlob; -X_API EXTERNAL Term TermGlob; -X_API EXTERNAL Atom AtomGlobal; -X_API EXTERNAL Term TermGlobal; -X_API EXTERNAL Atom AtomGlobalSp; -X_API EXTERNAL Term TermGlobalSp; -X_API EXTERNAL Atom AtomGlobalTrie; -X_API EXTERNAL Term TermGlobalTrie; -X_API EXTERNAL Atom AtomGoalExpansion; -X_API EXTERNAL Term TermGoalExpansion; -X_API EXTERNAL Atom AtomHat; -X_API EXTERNAL Term TermHat; -X_API EXTERNAL Atom AtomHERE; -X_API EXTERNAL Term TermHERE; -X_API EXTERNAL Atom AtomHandleThrow; -X_API EXTERNAL Term TermHandleThrow; -X_API EXTERNAL Atom AtomHeap; -X_API EXTERNAL Term TermHeap; -X_API EXTERNAL Atom AtomHeapUsed; -X_API EXTERNAL Term TermHeapUsed; -X_API EXTERNAL Atom AtomHugeInt; -X_API EXTERNAL Term TermHugeInt; -X_API EXTERNAL Atom AtomIDB; -X_API EXTERNAL Term TermIDB; -X_API EXTERNAL Atom AtomIOMode; -X_API EXTERNAL Term TermIOMode; -X_API EXTERNAL Atom AtomI; -X_API EXTERNAL Term TermI; -X_API EXTERNAL Atom AtomId; -X_API EXTERNAL Term TermId; -X_API EXTERNAL Atom AtomIgnore; -X_API EXTERNAL Term TermIgnore; -X_API EXTERNAL Atom AtomInf; -X_API EXTERNAL Term TermInf; -X_API EXTERNAL Atom AtomInfinity; -X_API EXTERNAL Term TermInfinity; -X_API EXTERNAL Atom AtomInfo; -X_API EXTERNAL Term TermInfo; -X_API EXTERNAL Atom AtomInitGoal; -X_API EXTERNAL Term TermInitGoal; -X_API EXTERNAL Atom AtomInitProlog; -X_API EXTERNAL Term TermInitProlog; -X_API EXTERNAL Atom AtomInStackExpansion; -X_API EXTERNAL Term TermInStackExpansion; -X_API EXTERNAL Atom AtomInput; -X_API EXTERNAL Term TermInput; -X_API EXTERNAL Atom AtomInstantiationError; -X_API EXTERNAL Term TermInstantiationError; -X_API EXTERNAL Atom AtomInt; -X_API EXTERNAL Term TermInt; -X_API EXTERNAL Atom AtomIntOverflow; -X_API EXTERNAL Term TermIntOverflow; -X_API EXTERNAL Atom AtomInteger; -X_API EXTERNAL Term TermInteger; -X_API EXTERNAL Atom AtomInternalCompilerError; -X_API EXTERNAL Term TermInternalCompilerError; -X_API EXTERNAL Atom AtomIs; -X_API EXTERNAL Term TermIs; -X_API EXTERNAL Atom AtomJ; -X_API EXTERNAL Term TermJ; -X_API EXTERNAL Atom Atoml; -X_API EXTERNAL Term Terml; -X_API EXTERNAL Atom AtomKey; -X_API EXTERNAL Term TermKey; -X_API EXTERNAL Atom AtomLDLibraryPath; -X_API EXTERNAL Term TermLDLibraryPath; -X_API EXTERNAL Atom AtomLONGINT; -X_API EXTERNAL Term TermLONGINT; -X_API EXTERNAL Atom AtomLOOP; -X_API EXTERNAL Term TermLOOP; -X_API EXTERNAL Atom AtomLoopStream; -X_API EXTERNAL Term TermLoopStream; -X_API EXTERNAL Atom AtomLT; -X_API EXTERNAL Term TermLT; -X_API EXTERNAL Atom AtomLastExecuteWithin; -X_API EXTERNAL Term TermLastExecuteWithin; -X_API EXTERNAL Atom AtomLeash; -X_API EXTERNAL Term TermLeash; -X_API EXTERNAL Atom AtomLeast; -X_API EXTERNAL Term TermLeast; -X_API EXTERNAL Atom AtomLength; -X_API EXTERNAL Term TermLength; -X_API EXTERNAL Atom AtomList; -X_API EXTERNAL Term TermList; -X_API EXTERNAL Atom AtomLine; -X_API EXTERNAL Term TermLine; -X_API EXTERNAL Atom AtomLive; -X_API EXTERNAL Term TermLive; -X_API EXTERNAL Atom AtomLoadAnswers; -X_API EXTERNAL Term TermLoadAnswers; -X_API EXTERNAL Atom AtomLocal; -X_API EXTERNAL Term TermLocal; -X_API EXTERNAL Atom AtomLocalSp; -X_API EXTERNAL Term TermLocalSp; -X_API EXTERNAL Atom AtomLocalTrie; -X_API EXTERNAL Term TermLocalTrie; -X_API EXTERNAL Atom AtomMax; -X_API EXTERNAL Term TermMax; -X_API EXTERNAL Atom AtomMaximum; -X_API EXTERNAL Term TermMaximum; -X_API EXTERNAL Atom AtomMaxArity; -X_API EXTERNAL Term TermMaxArity; -X_API EXTERNAL Atom AtomMaxFiles; -X_API EXTERNAL Term TermMaxFiles; -X_API EXTERNAL Atom AtomMegaClause; -X_API EXTERNAL Term TermMegaClause; -X_API EXTERNAL Atom AtomMetaCall; -X_API EXTERNAL Term TermMetaCall; -X_API EXTERNAL Atom AtomMfClause; -X_API EXTERNAL Term TermMfClause; -X_API EXTERNAL Atom AtomMin; -X_API EXTERNAL Term TermMin; -X_API EXTERNAL Atom AtomMinimum; -X_API EXTERNAL Term TermMinimum; -X_API EXTERNAL Atom AtomMinus; -X_API EXTERNAL Term TermMinus; -X_API EXTERNAL Atom AtomModify; -X_API EXTERNAL Term TermModify; -X_API EXTERNAL Atom AtomModule; -X_API EXTERNAL Term TermModule; -X_API EXTERNAL Atom AtomMost; -X_API EXTERNAL Term TermMost; -X_API EXTERNAL Atom AtomMulti; -X_API EXTERNAL Term TermMulti; -X_API EXTERNAL Atom AtomMultiFile; -X_API EXTERNAL Term TermMultiFile; -X_API EXTERNAL Atom AtomMultiple; -X_API EXTERNAL Term TermMultiple; -X_API EXTERNAL Atom AtomMutable; -X_API EXTERNAL Term TermMutable; -X_API EXTERNAL Atom AtomMutableVariable; -X_API EXTERNAL Term TermMutableVariable; -X_API EXTERNAL Atom AtomMutex; -X_API EXTERNAL Term TermMutex; -X_API EXTERNAL Atom AtomMyddasDB; -X_API EXTERNAL Term TermMyddasDB; -X_API EXTERNAL Atom AtomMyddasGoal; -X_API EXTERNAL Term TermMyddasGoal; -X_API EXTERNAL Atom AtomMyddasHost; -X_API EXTERNAL Term TermMyddasHost; -X_API EXTERNAL Atom AtomMyddasPass; -X_API EXTERNAL Term TermMyddasPass; -X_API EXTERNAL Atom AtomMyddasUser; -X_API EXTERNAL Term TermMyddasUser; -X_API EXTERNAL Atom AtomMyddasVersionName; -X_API EXTERNAL Term TermMyddasVersionName; -X_API EXTERNAL Atom AtomNan; -X_API EXTERNAL Term TermNan; -X_API EXTERNAL Atom AtomNb; -X_API EXTERNAL Term TermNb; -X_API EXTERNAL Atom AtomNbTerm; -X_API EXTERNAL Term TermNbTerm; -X_API EXTERNAL Atom AtomNew; -X_API EXTERNAL Term TermNew; -X_API EXTERNAL Atom AtomNewLine; -X_API EXTERNAL Term TermNewLine; -X_API EXTERNAL Atom AtomNl; -X_API EXTERNAL Term TermNl; -X_API EXTERNAL Atom AtomNoEffect; -X_API EXTERNAL Term TermNoEffect; -X_API EXTERNAL Atom AtomNoMemory; -X_API EXTERNAL Term TermNoMemory; -X_API EXTERNAL Atom AtomNone; -X_API EXTERNAL Term TermNone; -X_API EXTERNAL Atom AtomNonEmptyList; -X_API EXTERNAL Term TermNonEmptyList; -X_API EXTERNAL Atom AtomNot; -X_API EXTERNAL Term TermNot; -X_API EXTERNAL Atom AtomNotImplemented; -X_API EXTERNAL Term TermNotImplemented; -X_API EXTERNAL Atom AtomNotLessThanZero; -X_API EXTERNAL Term TermNotLessThanZero; -X_API EXTERNAL Atom AtomNotNewline; -X_API EXTERNAL Term TermNotNewline; -X_API EXTERNAL Atom AtomNotZero; -X_API EXTERNAL Term TermNotZero; -X_API EXTERNAL Atom AtomNumber; -X_API EXTERNAL Term TermNumber; -X_API EXTERNAL Atom AtomObj; -X_API EXTERNAL Term TermObj; -X_API EXTERNAL Atom AtomOff; -X_API EXTERNAL Term TermOff; -X_API EXTERNAL Atom AtomOffline; -X_API EXTERNAL Term TermOffline; -X_API EXTERNAL Atom AtomOn; -X_API EXTERNAL Term TermOn; -X_API EXTERNAL Atom AtomOnline; -X_API EXTERNAL Term TermOnline; -X_API EXTERNAL Atom AtomOpen; -X_API EXTERNAL Term TermOpen; -X_API EXTERNAL Atom AtomOperatingSystemError; -X_API EXTERNAL Term TermOperatingSystemError; -X_API EXTERNAL Atom AtomOperatingSystemSupport; -X_API EXTERNAL Term TermOperatingSystemSupport; -X_API EXTERNAL Atom AtomOperator; -X_API EXTERNAL Term TermOperator; -X_API EXTERNAL Atom AtomOperatorPriority; -X_API EXTERNAL Term TermOperatorPriority; -X_API EXTERNAL Atom AtomOperatorSpecifier; -X_API EXTERNAL Term TermOperatorSpecifier; -X_API EXTERNAL Atom AtomOpt; -X_API EXTERNAL Term TermOpt; -X_API EXTERNAL Atom AtomOtherwise; -X_API EXTERNAL Term TermOtherwise; -X_API EXTERNAL Atom AtomOutOfAttvarsError; -X_API EXTERNAL Term TermOutOfAttvarsError; -X_API EXTERNAL Atom AtomOutOfAuxspaceError; -X_API EXTERNAL Term TermOutOfAuxspaceError; -X_API EXTERNAL Atom AtomOutOfHeapError; -X_API EXTERNAL Term TermOutOfHeapError; -X_API EXTERNAL Atom AtomOutOfRange; -X_API EXTERNAL Term TermOutOfRange; -X_API EXTERNAL Atom AtomOutOfStackError; -X_API EXTERNAL Term TermOutOfStackError; -X_API EXTERNAL Atom AtomOutOfTrailError; -X_API EXTERNAL Term TermOutOfTrailError; -X_API EXTERNAL Atom AtomOutput; -X_API EXTERNAL Term TermOutput; -X_API EXTERNAL Atom AtomParameter; -X_API EXTERNAL Term TermParameter; -X_API EXTERNAL Atom AtomPrologCommonsDir; -X_API EXTERNAL Term TermPrologCommonsDir; -X_API EXTERNAL Atom AtomPast; -X_API EXTERNAL Term TermPast; -X_API EXTERNAL Atom AtomPastEndOfStream; -X_API EXTERNAL Term TermPastEndOfStream; -X_API EXTERNAL Atom AtomPermissionError; -X_API EXTERNAL Term TermPermissionError; -X_API EXTERNAL Atom AtomPi; -X_API EXTERNAL Term TermPi; -X_API EXTERNAL Atom AtomPipe; -X_API EXTERNAL Term TermPipe; -X_API EXTERNAL Atom AtomPriority; -X_API EXTERNAL Term TermPriority; -X_API EXTERNAL Atom AtomPlus; -X_API EXTERNAL Term TermPlus; -X_API EXTERNAL Atom AtomPointer; -X_API EXTERNAL Term TermPointer; -X_API EXTERNAL Atom AtomPortray; -X_API EXTERNAL Term TermPortray; -X_API EXTERNAL Atom AtomPredicateIndicator; -X_API EXTERNAL Term TermPredicateIndicator; -X_API EXTERNAL Atom AtomPrimitive; -X_API EXTERNAL Term TermPrimitive; -X_API EXTERNAL Atom AtomPrintMessage; -X_API EXTERNAL Term TermPrintMessage; -X_API EXTERNAL Atom AtomPrivateProcedure; -X_API EXTERNAL Term TermPrivateProcedure; -X_API EXTERNAL Atom AtomProcedure; -X_API EXTERNAL Term TermProcedure; -X_API EXTERNAL Atom AtomProfile; -X_API EXTERNAL Term TermProfile; -X_API EXTERNAL Atom AtomProlog; -X_API EXTERNAL Term TermProlog; -X_API EXTERNAL Atom AtomProtectStack; -X_API EXTERNAL Term TermProtectStack; -X_API EXTERNAL Atom AtomQly; -X_API EXTERNAL Term TermQly; -X_API EXTERNAL Atom AtomQuery; -X_API EXTERNAL Term TermQuery; -X_API EXTERNAL Atom AtomQueue; -X_API EXTERNAL Term TermQueue; -X_API EXTERNAL Atom AtomQuiet; -X_API EXTERNAL Term TermQuiet; -X_API EXTERNAL Atom AtomRadix; -X_API EXTERNAL Term TermRadix; -X_API EXTERNAL Atom AtomRandom; -X_API EXTERNAL Term TermRandom; -X_API EXTERNAL Atom AtomRange; -X_API EXTERNAL Term TermRange; -X_API EXTERNAL Atom AtomRDiv; -X_API EXTERNAL Term TermRDiv; -X_API EXTERNAL Atom AtomRead; -X_API EXTERNAL Term TermRead; -X_API EXTERNAL Atom AtomReadOnly; -X_API EXTERNAL Term TermReadOnly; -X_API EXTERNAL Atom AtomReadWrite; -X_API EXTERNAL Term TermReadWrite; -X_API EXTERNAL Atom AtomReadutil; -X_API EXTERNAL Term TermReadutil; -X_API EXTERNAL Atom AtomReconsult; -X_API EXTERNAL Term TermReconsult; -X_API EXTERNAL Atom AtomRecordedP; -X_API EXTERNAL Term TermRecordedP; -X_API EXTERNAL Atom AtomRecordedWithKey; -X_API EXTERNAL Term TermRecordedWithKey; -X_API EXTERNAL Atom AtomRedefineWarnings; -X_API EXTERNAL Term TermRedefineWarnings; -X_API EXTERNAL Atom AtomRedoFreeze; -X_API EXTERNAL Term TermRedoFreeze; -X_API EXTERNAL Atom AtomRefoundVar; -X_API EXTERNAL Term TermRefoundVar; -X_API EXTERNAL Atom AtomRelativeTo; -X_API EXTERNAL Term TermRelativeTo; -X_API EXTERNAL Atom AtomRepeat; -X_API EXTERNAL Term TermRepeat; -X_API EXTERNAL Atom AtomRepeatSpace; -X_API EXTERNAL Term TermRepeatSpace; -X_API EXTERNAL Atom AtomReposition; -X_API EXTERNAL Term TermReposition; -X_API EXTERNAL Atom AtomRepresentationError; -X_API EXTERNAL Term TermRepresentationError; -X_API EXTERNAL Atom AtomReset; -X_API EXTERNAL Term TermReset; -X_API EXTERNAL Atom AtomResize; -X_API EXTERNAL Term TermResize; -X_API EXTERNAL Atom AtomResourceError; -X_API EXTERNAL Term TermResourceError; -X_API EXTERNAL Atom AtomRestoreRegs; -X_API EXTERNAL Term TermRestoreRegs; -X_API EXTERNAL Atom AtomRetry; -X_API EXTERNAL Term TermRetry; -X_API EXTERNAL Atom AtomRetryCounter; -X_API EXTERNAL Term TermRetryCounter; -X_API EXTERNAL Atom AtomRTree; -X_API EXTERNAL Term TermRTree; -X_API EXTERNAL Atom AtomSafe; -X_API EXTERNAL Term TermSafe; -X_API EXTERNAL Atom AtomSafeCallCleanup; -X_API EXTERNAL Term TermSafeCallCleanup; -X_API EXTERNAL Atom AtomSame; -X_API EXTERNAL Term TermSame; -X_API EXTERNAL Atom AtomSemic; -X_API EXTERNAL Term TermSemic; -X_API EXTERNAL Atom AtomShiftCountOverflow; -X_API EXTERNAL Term TermShiftCountOverflow; -X_API EXTERNAL Atom AtomSigAlarm; -X_API EXTERNAL Term TermSigAlarm; -X_API EXTERNAL Atom AtomSigBreak; -X_API EXTERNAL Term TermSigBreak; -X_API EXTERNAL Atom AtomSigCreep; -X_API EXTERNAL Term TermSigCreep; -X_API EXTERNAL Atom AtomSigDebug; -X_API EXTERNAL Term TermSigDebug; -X_API EXTERNAL Atom AtomSigDelayCreep; -X_API EXTERNAL Term TermSigDelayCreep; -X_API EXTERNAL Atom AtomSigFPE; -X_API EXTERNAL Term TermSigFPE; -X_API EXTERNAL Atom AtomSigHup; -X_API EXTERNAL Term TermSigHup; -X_API EXTERNAL Atom AtomSigInt; -X_API EXTERNAL Term TermSigInt; -X_API EXTERNAL Atom AtomSigIti; -X_API EXTERNAL Term TermSigIti; -X_API EXTERNAL Atom AtomSigPending; -X_API EXTERNAL Term TermSigPending; -X_API EXTERNAL Atom AtomSigPipe; -X_API EXTERNAL Term TermSigPipe; -X_API EXTERNAL Atom AtomSigStackDump; -X_API EXTERNAL Term TermSigStackDump; -X_API EXTERNAL Atom AtomSigStatistics; -X_API EXTERNAL Term TermSigStatistics; -X_API EXTERNAL Atom AtomSigTrace; -X_API EXTERNAL Term TermSigTrace; -X_API EXTERNAL Atom AtomSigUsr1; -X_API EXTERNAL Term TermSigUsr1; -X_API EXTERNAL Atom AtomSigUsr2; -X_API EXTERNAL Term TermSigUsr2; -X_API EXTERNAL Atom AtomSigVTAlarm; -X_API EXTERNAL Term TermSigVTAlarm; -X_API EXTERNAL Atom AtomSigWakeUp; -X_API EXTERNAL Term TermSigWakeUp; -X_API EXTERNAL Atom AtomSilent; -X_API EXTERNAL Term TermSilent; -X_API EXTERNAL Atom AtomSingle; -X_API EXTERNAL Term TermSingle; -X_API EXTERNAL Atom AtomSingleVarWarnings; -X_API EXTERNAL Term TermSingleVarWarnings; -X_API EXTERNAL Atom AtomSingleton; -X_API EXTERNAL Term TermSingleton; -X_API EXTERNAL Atom AtomSlash; -X_API EXTERNAL Term TermSlash; -X_API EXTERNAL Atom AtomSocket; -X_API EXTERNAL Term TermSocket; -X_API EXTERNAL Atom AtomSolutions; -X_API EXTERNAL Term TermSolutions; -X_API EXTERNAL Atom AtomSource; -X_API EXTERNAL Term TermSource; -X_API EXTERNAL Atom AtomSourceSink; -X_API EXTERNAL Term TermSourceSink; -X_API EXTERNAL Atom AtomSpy; -X_API EXTERNAL Term TermSpy; -X_API EXTERNAL Atom AtomStack; -X_API EXTERNAL Term TermStack; -X_API EXTERNAL Atom AtomStackFree; -X_API EXTERNAL Term TermStackFree; -X_API EXTERNAL Atom AtomStartupSavedState; -X_API EXTERNAL Term TermStartupSavedState; -X_API EXTERNAL Atom AtomStaticClause; -X_API EXTERNAL Term TermStaticClause; -X_API EXTERNAL Atom AtomStaticProcedure; -X_API EXTERNAL Term TermStaticProcedure; -X_API EXTERNAL Atom AtomStream; -X_API EXTERNAL Term TermStream; -X_API EXTERNAL Atom AtomSWIStream; -X_API EXTERNAL Term TermSWIStream; -X_API EXTERNAL Atom AtomVStream; -X_API EXTERNAL Term TermVStream; -X_API EXTERNAL Atom AtomStreams; -X_API EXTERNAL Term TermStreams; -X_API EXTERNAL Atom AtomStreamOrAlias; -X_API EXTERNAL Term TermStreamOrAlias; -X_API EXTERNAL Atom AtomStreamPos; -X_API EXTERNAL Term TermStreamPos; -X_API EXTERNAL Atom AtomStreamPosition; -X_API EXTERNAL Term TermStreamPosition; -X_API EXTERNAL Atom AtomString; -X_API EXTERNAL Term TermString; -X_API EXTERNAL Atom AtomStyleCheck; -X_API EXTERNAL Term TermStyleCheck; -X_API EXTERNAL Atom AtomSTRING; -X_API EXTERNAL Term TermSTRING; -X_API EXTERNAL Atom AtomSwi; -X_API EXTERNAL Term TermSwi; -X_API EXTERNAL Atom AtomSymbolChar; -X_API EXTERNAL Term TermSymbolChar; -X_API EXTERNAL Atom AtomSyntaxError; -X_API EXTERNAL Term TermSyntaxError; -X_API EXTERNAL Atom AtomSyntaxErrors; -X_API EXTERNAL Term TermSyntaxErrors; -X_API EXTERNAL Atom AtomSyntaxErrorHandler; -X_API EXTERNAL Term TermSyntaxErrorHandler; -X_API EXTERNAL Atom AtomSystem; -X_API EXTERNAL Term TermSystem; -X_API EXTERNAL Atom AtomSystemError; -X_API EXTERNAL Term TermSystemError; -X_API EXTERNAL Atom AtomSystemLibraryDir; -X_API EXTERNAL Term TermSystemLibraryDir; -X_API EXTERNAL Atom AtomT; -X_API EXTERNAL Term TermT; -X_API EXTERNAL Atom AtomTerm; -X_API EXTERNAL Term TermTerm; -X_API EXTERNAL Atom AtomTermExpansion; -X_API EXTERNAL Term TermTermExpansion; -X_API EXTERNAL Atom AtomTerms; -X_API EXTERNAL Term TermTerms; -X_API EXTERNAL Atom AtomText; -X_API EXTERNAL Term TermText; -X_API EXTERNAL Atom AtomTextStream; -X_API EXTERNAL Term TermTextStream; -X_API EXTERNAL Atom AtomThread; -X_API EXTERNAL Term TermThread; -X_API EXTERNAL Atom AtomThreads; -X_API EXTERNAL Term TermThreads; -X_API EXTERNAL Atom AtomThrow; -X_API EXTERNAL Term TermThrow; -X_API EXTERNAL Atom AtomTimeOutSpec; -X_API EXTERNAL Term TermTimeOutSpec; -X_API EXTERNAL Atom AtomTimeoutError; -X_API EXTERNAL Term TermTimeoutError; -X_API EXTERNAL Atom AtomTopLevelGoal; -X_API EXTERNAL Term TermTopLevelGoal; -X_API EXTERNAL Atom AtomTopThreadGoal; -X_API EXTERNAL Term TermTopThreadGoal; -X_API EXTERNAL Atom AtomTraceMetaCall; -X_API EXTERNAL Term TermTraceMetaCall; -X_API EXTERNAL Atom AtomTrail; -X_API EXTERNAL Atom AtomTrue; -X_API EXTERNAL Term TermTrue; -X_API EXTERNAL Atom AtomTty; -X_API EXTERNAL Term TermTty; -X_API EXTERNAL Atom AtomTtys; -X_API EXTERNAL Term TermTtys; -X_API EXTERNAL Atom AtomTuple; -X_API EXTERNAL Term TermTuple; -X_API EXTERNAL Atom AtomTxt; -X_API EXTERNAL Term TermTxt; -X_API EXTERNAL Atom AtomTypeError; -X_API EXTERNAL Term TermTypeError; -X_API EXTERNAL Atom AtomUndefined; -X_API EXTERNAL Term TermUndefined; -X_API EXTERNAL Atom AtomUndefp; -X_API EXTERNAL Term TermUndefp; -X_API EXTERNAL Atom AtomUndefp0; -X_API EXTERNAL Term TermUndefp0; -X_API EXTERNAL Atom AtomUnderflow; -X_API EXTERNAL Term TermUnderflow; -X_API EXTERNAL Atom AtomUnificationStack; -X_API EXTERNAL Term TermUnificationStack; -X_API EXTERNAL Atom AtomUnique; -X_API EXTERNAL Term TermUnique; -X_API EXTERNAL Atom AtomUnsignedByte; -X_API EXTERNAL Term TermUnsignedByte; -X_API EXTERNAL Atom AtomUnsignedChar; -X_API EXTERNAL Term TermUnsignedChar; -X_API EXTERNAL Atom AtomUser; -X_API EXTERNAL Term TermUser; -X_API EXTERNAL Atom AtomUserErr; -X_API EXTERNAL Term TermUserErr; -X_API EXTERNAL Atom AtomUserIn; -X_API EXTERNAL Term TermUserIn; -X_API EXTERNAL Atom AtomUserOut; -X_API EXTERNAL Term TermUserOut; -X_API EXTERNAL Atom AtomDollarVar; -X_API EXTERNAL Term TermDollarVar; -X_API EXTERNAL Atom AtomVBar; -X_API EXTERNAL Term TermVBar; -X_API EXTERNAL Atom AtomVarBranches; -X_API EXTERNAL Term TermVarBranches; -X_API EXTERNAL Atom AtomVariableNames; -X_API EXTERNAL Term TermVariableNames; -X_API EXTERNAL Atom AtomHiddenVar; -X_API EXTERNAL Term TermHiddenVar; -X_API EXTERNAL Atom AtomVariable; -X_API EXTERNAL Term TermVariable; -X_API EXTERNAL Atom AtomVerbose; -X_API EXTERNAL Term TermVerbose; -X_API EXTERNAL Atom AtomVerboseFileSearch; -X_API EXTERNAL Term TermVerboseFileSearch; -X_API EXTERNAL Atom AtomVersionNumber; -X_API EXTERNAL Term TermVersionNumber; -X_API EXTERNAL Atom AtomVeryVerbose; -X_API EXTERNAL Term TermVeryVerbose; -X_API EXTERNAL Atom AtomWakeUpGoal; -X_API EXTERNAL Term TermWakeUpGoal; -X_API EXTERNAL Atom AtomWarning; -X_API EXTERNAL Term TermWarning; -X_API EXTERNAL Atom AtomWhen; -X_API EXTERNAL Term TermWhen; -X_API EXTERNAL Atom AtomWrite; -X_API EXTERNAL Term TermWrite; -X_API EXTERNAL Atom AtomWriteTerm; -X_API EXTERNAL Term TermWriteTerm; -X_API EXTERNAL Atom AtomXml; -X_API EXTERNAL Term TermXml; -X_API EXTERNAL Atom AtomYapHacks; -X_API EXTERNAL Term TermYapHacks; -X_API EXTERNAL Atom AtomZeroDivisor; -X_API EXTERNAL Term TermZeroDivisor; -X_API EXTERNAL Functor FunctorAfInet; - -X_API EXTERNAL Functor FunctorAfLocal; - -X_API EXTERNAL Functor FunctorAfUnix; - -X_API EXTERNAL Functor FunctorAltNot; - -X_API EXTERNAL Functor FunctorArg; - -X_API EXTERNAL Functor FunctorArrayEntry; - -X_API EXTERNAL Functor FunctorArrow; - -X_API EXTERNAL Functor FunctorDoubleArrow; - -X_API EXTERNAL Functor FunctorAssert1; - -X_API EXTERNAL Functor FunctorAssert; - -X_API EXTERNAL Functor FunctorAtFoundOne; - -X_API EXTERNAL Functor FunctorAtom; - -X_API EXTERNAL Functor FunctorAtt1; - -X_API EXTERNAL Functor FunctorAttGoal; - -X_API EXTERNAL Functor FunctorBraces; - -X_API EXTERNAL Functor FunctorCall; - -X_API EXTERNAL Functor FunctorCatch; - -X_API EXTERNAL Functor FunctorChangeModule; - -X_API EXTERNAL Functor FunctorChars; - -X_API EXTERNAL Functor FunctorChars1; - -X_API EXTERNAL Functor FunctorCleanCall; - -X_API EXTERNAL Functor FunctorClist; - -X_API EXTERNAL Functor FunctorCodes; - -X_API EXTERNAL Functor FunctorCodes1; - -X_API EXTERNAL Functor FunctorColon; - -X_API EXTERNAL Functor FunctorComma; - -X_API EXTERNAL Functor FunctorCommentHook; - -X_API EXTERNAL Functor FunctorContext2; - -X_API EXTERNAL Functor FunctorConsistencyError; - -X_API EXTERNAL Functor FunctorCreep; - -X_API EXTERNAL Functor FunctorCsult; - -X_API EXTERNAL Functor FunctorCurrentModule; - -X_API EXTERNAL Functor FunctorCutBy; - -X_API EXTERNAL Functor FunctorDBREF; - -X_API EXTERNAL Functor FunctorDiff; - -X_API EXTERNAL Functor FunctorDoLogUpdClause; - -X_API EXTERNAL Functor FunctorDoLogUpdClause0; - -X_API EXTERNAL Functor FunctorDoLogUpdClauseErase; - -X_API EXTERNAL Functor FunctorDoStaticClause; - -X_API EXTERNAL Functor FunctorDollar; - -X_API EXTERNAL Functor FunctorDollarVar; - -X_API EXTERNAL Functor FunctorDomainError; - -X_API EXTERNAL Functor FunctorDot; - -X_API EXTERNAL Functor FunctorDot10; - -X_API EXTERNAL Functor FunctorDot11; - -X_API EXTERNAL Functor FunctorDot12; - -X_API EXTERNAL Functor FunctorDot2; - -X_API EXTERNAL Functor FunctorDot3; - -X_API EXTERNAL Functor FunctorDot4; - -X_API EXTERNAL Functor FunctorDot5; - -X_API EXTERNAL Functor FunctorDot6; - -X_API EXTERNAL Functor FunctorDot7; - -X_API EXTERNAL Functor FunctorDot8; - -X_API EXTERNAL Functor FunctorDot9; - -X_API EXTERNAL Functor FunctorDoubleArrow; - -X_API EXTERNAL Functor FunctorDoubleSlash; - -X_API EXTERNAL Functor FunctorEmptySquareBrackets; - -X_API EXTERNAL Functor FunctorEq; - -X_API EXTERNAL Functor FunctorError; - -X_API EXTERNAL Functor FunctorEvaluationError; - -X_API EXTERNAL Functor FunctorException; - -X_API EXTERNAL Functor FunctorExecute2InMod; - -X_API EXTERNAL Functor FunctorExecuteInMod; - -X_API EXTERNAL Functor FunctorExecuteWithin; - -X_API EXTERNAL Functor FunctorExistenceError; - -X_API EXTERNAL Functor FunctorExoClause; - -X_API EXTERNAL Functor FunctorFunctor; - -X_API EXTERNAL Functor FunctorGAtom; - -X_API EXTERNAL Functor FunctorGAtomic; - -X_API EXTERNAL Functor FunctorGCompound; - -X_API EXTERNAL Functor FunctorGFloat; - -X_API EXTERNAL Functor FunctorGFormatAt; - -X_API EXTERNAL Functor FunctorGInteger; - -X_API EXTERNAL Functor FunctorGNumber; - -X_API EXTERNAL Functor FunctorGPrimitive; - -X_API EXTERNAL Functor FunctorGVar; - -X_API EXTERNAL Functor FunctorGeneratePredInfo; - -X_API EXTERNAL Functor FunctorGoalExpansion2; - -X_API EXTERNAL Functor FunctorGoalExpansion; - -X_API EXTERNAL Functor FunctorHandleThrow; - -X_API EXTERNAL Functor FunctorHat; - -X_API EXTERNAL Functor FunctorI; - -X_API EXTERNAL Functor FunctorId; - -X_API EXTERNAL Functor FunctorInfo1; - -X_API EXTERNAL Functor FunctorInfo2; - -X_API EXTERNAL Functor FunctorInfo3; - -X_API EXTERNAL Functor FunctorInfo4; - -X_API EXTERNAL Functor FunctorIs; - -X_API EXTERNAL Functor FunctorJ; - -X_API EXTERNAL Functor FunctorLastExecuteWithin; - -X_API EXTERNAL Functor FunctorList; - -X_API EXTERNAL Functor FunctorLOOP; - -X_API EXTERNAL Functor FunctorMegaClause; - -X_API EXTERNAL Functor FunctorMetaCall; - -X_API EXTERNAL Functor FunctorMinus; - -X_API EXTERNAL Functor FunctorModule; - -X_API EXTERNAL Functor FunctorMultiFileClause; - -X_API EXTERNAL Functor FunctorMutable; - -X_API EXTERNAL Functor FunctorMutex; - -X_API EXTERNAL Functor FunctorNotImplemented; - -X_API EXTERNAL Functor FunctorNBQueue; - -X_API EXTERNAL Functor FunctorNot; - -X_API EXTERNAL Functor FunctorObj; - -X_API EXTERNAL Functor FunctorOr; - -X_API EXTERNAL Functor FunctorOutput; - -X_API EXTERNAL Functor FunctorPermissionError; - -X_API EXTERNAL Functor FunctorPlus; - -X_API EXTERNAL Functor FunctorPortray; - -X_API EXTERNAL Functor FunctorPrintMessage; - -X_API EXTERNAL Functor FunctorProcedure; - -X_API EXTERNAL Functor FunctorPriority; - -X_API EXTERNAL Functor FunctorPrologConstraint; - -X_API EXTERNAL Functor FunctorProtectStack; - -X_API EXTERNAL Functor FunctorQuery; - -X_API EXTERNAL Functor FunctorRecordedWithKey; - -X_API EXTERNAL Functor FunctorRDiv; - -X_API EXTERNAL Functor FunctorRedoFreeze; - -X_API EXTERNAL Functor FunctorRepresentationError; - -X_API EXTERNAL Functor FunctorResourceError; - -X_API EXTERNAL Functor FunctorRestoreRegs; - -X_API EXTERNAL Functor FunctorRestoreRegs1; - -X_API EXTERNAL Functor FunctorSafe; - -X_API EXTERNAL Functor FunctorSafeCallCleanup; - -X_API EXTERNAL Functor FunctorSame; - -X_API EXTERNAL Functor FunctorSlash; - -X_API EXTERNAL Functor FunctorStaticClause; - -X_API EXTERNAL Functor FunctorStream; - -X_API EXTERNAL Functor FunctorStreamEOS; - -X_API EXTERNAL Functor FunctorStreamPos; - -X_API EXTERNAL Functor FunctorString1; - -X_API EXTERNAL Functor FunctorStyleCheck; - -X_API EXTERNAL Functor FunctorSyntaxError; - -X_API EXTERNAL Functor FunctorShortSyntaxError; - -X_API EXTERNAL Functor FunctorTermExpansion; - -X_API EXTERNAL Functor FunctorThreadRun; - -X_API EXTERNAL Functor FunctorThrow; - -X_API EXTERNAL Functor FunctorTimeoutError; - -X_API EXTERNAL Functor FunctorTraceMetaCall; - -X_API EXTERNAL Functor FunctorTypeError; - -X_API EXTERNAL Functor FunctorUMinus; - -X_API EXTERNAL Functor FunctorUPlus; - -X_API EXTERNAL Functor FunctorVBar; - -X_API EXTERNAL Functor FunctorWriteTerm; - -X_API EXTERNAL Functor FunctorHiddenVar; + + /* This file, tatoms.h, was generated automatically by "yap -L misc/buildatoms" + {lease do not update, update misc/ATOMS instead */ + +X_API EXTERNAL Atom Atom3Dots; +X_API EXTERNAL Atom AtomAbol; X_API EXTERNAL Term TermAbol; +X_API EXTERNAL Atom AtomAccess; X_API EXTERNAL Term TermAccess; +X_API EXTERNAL Atom AtomAfInet; X_API EXTERNAL Term TermAfInet; +X_API EXTERNAL Atom AtomAfLocal; X_API EXTERNAL Term TermAfLocal; +X_API EXTERNAL Atom AtomAfUnix; X_API EXTERNAL Term TermAfUnix; +X_API EXTERNAL Atom AtomAlarm; X_API EXTERNAL Term TermAlarm; +X_API EXTERNAL Atom AtomAlias; X_API EXTERNAL Term TermAlias; +X_API EXTERNAL Atom AtomAll; X_API EXTERNAL Term TermAll; +X_API EXTERNAL Atom AtomAltNot; X_API EXTERNAL Term TermAltNot; +X_API EXTERNAL Atom AtomAnswer; X_API EXTERNAL Term TermAnswer; +X_API EXTERNAL Atom AtomAny; X_API EXTERNAL Term TermAny; +X_API EXTERNAL Atom AtomAppend; X_API EXTERNAL Term TermAppend; +X_API EXTERNAL Atom AtomArg; X_API EXTERNAL Term TermArg; +X_API EXTERNAL Atom AtomArray; X_API EXTERNAL Term TermArray; +X_API EXTERNAL Atom AtomArrayAccess; X_API EXTERNAL Term TermArrayAccess; +X_API EXTERNAL Atom AtomArrayOverflow; X_API EXTERNAL Term TermArrayOverflow; +X_API EXTERNAL Atom AtomArrayType; X_API EXTERNAL Term TermArrayType; +X_API EXTERNAL Atom AtomArrow; X_API EXTERNAL Term TermArrow; +X_API EXTERNAL Atom AtomAttributedModule; X_API EXTERNAL Term TermAttributedModule; +X_API EXTERNAL Atom AtomDoubleArrow; X_API EXTERNAL Term TermDoubleArrow; +X_API EXTERNAL Atom AtomAssert; X_API EXTERNAL Term TermAssert; +X_API EXTERNAL Atom AtomBeginBracket; X_API EXTERNAL Term TermBeginBracket; +X_API EXTERNAL Atom AtomEndBracket; X_API EXTERNAL Term TermEndBracket; +X_API EXTERNAL Atom AtomBeginSquareBracket; X_API EXTERNAL Term TermBeginSquareBracket; +X_API EXTERNAL Atom AtomEndSquareBracket; X_API EXTERNAL Term TermEndSquareBracket; +X_API EXTERNAL Atom AtomBeginCurlyBracket; X_API EXTERNAL Term TermBeginCurlyBracket; +X_API EXTERNAL Atom AtomEndCurlyBracket; X_API EXTERNAL Term TermEndCurlyBracket; +X_API EXTERNAL Atom AtomEmptyBrackets; X_API EXTERNAL Term TermEmptyBrackets; +X_API EXTERNAL Atom AtomEmptySquareBrackets; X_API EXTERNAL Term TermEmptySquareBrackets; +X_API EXTERNAL Atom AtomAsserta; X_API EXTERNAL Term TermAsserta; +X_API EXTERNAL Atom AtomAssertaStatic; X_API EXTERNAL Term TermAssertaStatic; +X_API EXTERNAL Atom AtomAssertz; X_API EXTERNAL Term TermAssertz; +X_API EXTERNAL Atom AtomAssertzStatic; X_API EXTERNAL Term TermAssertzStatic; +X_API EXTERNAL Atom AtomAt; X_API EXTERNAL Term TermAt; +X_API EXTERNAL Atom AtomAtom; X_API EXTERNAL Term TermAtom; +X_API EXTERNAL Atom AtomAtomic; X_API EXTERNAL Term TermAtomic; +X_API EXTERNAL Atom AtomAtt; X_API EXTERNAL Term TermAtt; +X_API EXTERNAL Atom AtomAtt1; X_API EXTERNAL Term TermAtt1; +X_API EXTERNAL Atom AtomAttDo; X_API EXTERNAL Term TermAttDo; +X_API EXTERNAL Atom AtomAttributes; X_API EXTERNAL Term TermAttributes; +X_API EXTERNAL Atom AtomB; X_API EXTERNAL Term TermB; +X_API EXTERNAL Atom AtomBatched; X_API EXTERNAL Term TermBatched; +X_API EXTERNAL Atom AtomBetween; X_API EXTERNAL Term TermBetween; +X_API EXTERNAL Atom AtomBinary; X_API EXTERNAL Term TermBinary; +X_API EXTERNAL Atom AtomBigNum; X_API EXTERNAL Term TermBigNum; +X_API EXTERNAL Atom AtomBinaryStream; X_API EXTERNAL Term TermBinaryStream; +X_API EXTERNAL Atom AtomBoolean; X_API EXTERNAL Term TermBoolean; +X_API EXTERNAL Atom AtomBraces; X_API EXTERNAL Term TermBraces; +X_API EXTERNAL Atom AtomBreak; X_API EXTERNAL Term TermBreak; +X_API EXTERNAL Atom AtomByte; X_API EXTERNAL Term TermByte; +X_API EXTERNAL Atom AtomCArith; X_API EXTERNAL Term TermCArith; +X_API EXTERNAL Atom AtomCall; X_API EXTERNAL Term TermCall; +X_API EXTERNAL Atom AtomCallAndRetryCounter; X_API EXTERNAL Term TermCallAndRetryCounter; +X_API EXTERNAL Atom AtomCallCounter; X_API EXTERNAL Term TermCallCounter; +X_API EXTERNAL Atom AtomCallable; X_API EXTERNAL Term TermCallable; +X_API EXTERNAL Atom AtomCatch; X_API EXTERNAL Term TermCatch; +X_API EXTERNAL Atom AtomChangeModule; X_API EXTERNAL Term TermChangeModule; +X_API EXTERNAL Atom AtomChar; X_API EXTERNAL Term TermChar; +X_API EXTERNAL Atom AtomCharsio; X_API EXTERNAL Term TermCharsio; +X_API EXTERNAL Atom AtomCharacter; X_API EXTERNAL Term TermCharacter; +X_API EXTERNAL Atom AtomCharacterCode; X_API EXTERNAL Term TermCharacterCode; +X_API EXTERNAL Atom AtomChars; X_API EXTERNAL Term TermChars; +X_API EXTERNAL Atom AtomCharset; X_API EXTERNAL Term TermCharset; +X_API EXTERNAL Atom AtomChType; X_API EXTERNAL Term TermChType; +X_API EXTERNAL Atom AtomCleanCall; X_API EXTERNAL Term TermCleanCall; +X_API EXTERNAL Atom AtomClose; X_API EXTERNAL Term TermClose; +X_API EXTERNAL Atom AtomColon; X_API EXTERNAL Term TermColon; +X_API EXTERNAL Atom AtomCodeSpace; X_API EXTERNAL Term TermCodeSpace; +X_API EXTERNAL Atom AtomCodes; X_API EXTERNAL Term TermCodes; +X_API EXTERNAL Atom AtomCoInductive; X_API EXTERNAL Term TermCoInductive; +X_API EXTERNAL Atom AtomComma; X_API EXTERNAL Term TermComma; +X_API EXTERNAL Atom AtomCommentHook; X_API EXTERNAL Term TermCommentHook; +X_API EXTERNAL Atom AtomCompact; X_API EXTERNAL Term TermCompact; +X_API EXTERNAL Atom AtomCompound; X_API EXTERNAL Term TermCompound; +X_API EXTERNAL Atom AtomConsistencyError; X_API EXTERNAL Term TermConsistencyError; +X_API EXTERNAL Atom AtomConsult; X_API EXTERNAL Term TermConsult; +X_API EXTERNAL Atom AtomConsultOnBoot; X_API EXTERNAL Term TermConsultOnBoot; +X_API EXTERNAL Atom AtomContext; X_API EXTERNAL Term TermContext; +X_API EXTERNAL Atom AtomCputime; X_API EXTERNAL Term TermCputime; +X_API EXTERNAL Atom AtomCreate; X_API EXTERNAL Term TermCreate; +X_API EXTERNAL Atom AtomCreep; X_API EXTERNAL Term TermCreep; +X_API EXTERNAL Atom AtomCryptAtoms; X_API EXTERNAL Term TermCryptAtoms; +X_API EXTERNAL Atom AtomCurly; X_API EXTERNAL Term TermCurly; +X_API EXTERNAL Atom AtomCsult; X_API EXTERNAL Term TermCsult; +X_API EXTERNAL Atom AtomCurrentModule; X_API EXTERNAL Term TermCurrentModule; +X_API EXTERNAL Atom AtomCut; X_API EXTERNAL Term TermCut; +X_API EXTERNAL Atom AtomCutBy; X_API EXTERNAL Term TermCutBy; +X_API EXTERNAL Atom AtomDAbort; X_API EXTERNAL Term TermDAbort; +X_API EXTERNAL Atom AtomDBLoad; X_API EXTERNAL Term TermDBLoad; +X_API EXTERNAL Atom AtomDBREF; X_API EXTERNAL Term TermDBREF; +X_API EXTERNAL Atom AtomDBReference; X_API EXTERNAL Term TermDBReference; +X_API EXTERNAL Atom AtomDBTerm; X_API EXTERNAL Term TermDBTerm; +X_API EXTERNAL Atom AtomDBref; X_API EXTERNAL Term TermDBref; +X_API EXTERNAL Atom AtomDInteger; X_API EXTERNAL Term TermDInteger; +X_API EXTERNAL Atom AtomDebugMeta; X_API EXTERNAL Term TermDebugMeta; +X_API EXTERNAL Atom AtomDebuggerInput; X_API EXTERNAL Term TermDebuggerInput; +X_API EXTERNAL Atom AtomDec10; X_API EXTERNAL Term TermDec10; +X_API EXTERNAL Atom AtomDefault; X_API EXTERNAL Term TermDefault; +X_API EXTERNAL Atom AtomDevNull; X_API EXTERNAL Term TermDevNull; +X_API EXTERNAL Atom AtomDiff; X_API EXTERNAL Term TermDiff; +X_API EXTERNAL Atom AtomDirectory; X_API EXTERNAL Term TermDirectory; +X_API EXTERNAL Atom AtomDiscontiguous; X_API EXTERNAL Term TermDiscontiguous; +X_API EXTERNAL Atom AtomDiscontiguousWarnings; X_API EXTERNAL Term TermDiscontiguousWarnings; +X_API EXTERNAL Atom AtomDollar; X_API EXTERNAL Term TermDollar; +X_API EXTERNAL Atom AtomDoLogUpdClause; X_API EXTERNAL Term TermDoLogUpdClause; +X_API EXTERNAL Atom AtomDoLogUpdClause0; X_API EXTERNAL Term TermDoLogUpdClause0; +X_API EXTERNAL Atom AtomDoLogUpdClauseErase; X_API EXTERNAL Term TermDoLogUpdClauseErase; +X_API EXTERNAL Atom AtomDollarU; X_API EXTERNAL Term TermDollarU; +X_API EXTERNAL Atom AtomDollarUndef; X_API EXTERNAL Term TermDollarUndef; +X_API EXTERNAL Atom AtomDomainError; X_API EXTERNAL Term TermDomainError; +X_API EXTERNAL Atom AtomDoStaticClause; X_API EXTERNAL Term TermDoStaticClause; +X_API EXTERNAL Atom AtomDots; X_API EXTERNAL Term TermDots; +X_API EXTERNAL Atom AtomDOUBLE; X_API EXTERNAL Term TermDOUBLE; +X_API EXTERNAL Atom AtomDoubleSlash; X_API EXTERNAL Term TermDoubleSlash; +X_API EXTERNAL Atom AtomE; X_API EXTERNAL Term TermE; +X_API EXTERNAL Atom AtomEOFBeforeEOT; X_API EXTERNAL Term TermEOFBeforeEOT; +X_API EXTERNAL Atom AtomEQ; X_API EXTERNAL Term TermEQ; +X_API EXTERNAL Atom AtomEmptyAtom; X_API EXTERNAL Term TermEmptyAtom; +X_API EXTERNAL Atom AtomEncoding; X_API EXTERNAL Term TermEncoding; +X_API EXTERNAL Atom AtomEndOfStream; X_API EXTERNAL Term TermEndOfStream; +X_API EXTERNAL Atom AtomEof; X_API EXTERNAL Term TermEof; +X_API EXTERNAL Atom AtomEOfCode; X_API EXTERNAL Term TermEOfCode; +X_API EXTERNAL Atom AtomEq; X_API EXTERNAL Term TermEq; +X_API EXTERNAL Atom AtomError; X_API EXTERNAL Term TermError; +X_API EXTERNAL Atom AtomException; X_API EXTERNAL Term TermException; +X_API EXTERNAL Atom AtomExtensions; X_API EXTERNAL Term TermExtensions; +X_API EXTERNAL Atom AtomEvaluable; X_API EXTERNAL Term TermEvaluable; +X_API EXTERNAL Atom AtomEvaluationError; X_API EXTERNAL Term TermEvaluationError; +X_API EXTERNAL Atom AtomExecutable; X_API EXTERNAL Term TermExecutable; +X_API EXTERNAL Atom AtomExecute; X_API EXTERNAL Term TermExecute; +X_API EXTERNAL Atom AtomExecAnswers; X_API EXTERNAL Term TermExecAnswers; +X_API EXTERNAL Atom AtomExecuteInMod; X_API EXTERNAL Term TermExecuteInMod; +X_API EXTERNAL Atom AtomExecuteWithin; X_API EXTERNAL Term TermExecuteWithin; +X_API EXTERNAL Atom AtomExecuteWoMod; X_API EXTERNAL Term TermExecuteWoMod; +X_API EXTERNAL Atom AtomExist; X_API EXTERNAL Term TermExist; +X_API EXTERNAL Atom AtomExists; X_API EXTERNAL Term TermExists; +X_API EXTERNAL Atom AtomExit; X_API EXTERNAL Term TermExit; +X_API EXTERNAL Atom AtomExistenceError; X_API EXTERNAL Term TermExistenceError; +X_API EXTERNAL Atom AtomExoClause; X_API EXTERNAL Term TermExoClause; +X_API EXTERNAL Atom AtomExpectedNumber; X_API EXTERNAL Term TermExpectedNumber; +X_API EXTERNAL Atom AtomExpand; X_API EXTERNAL Term TermExpand; +X_API EXTERNAL Atom AtomExtendFileSearchPath; X_API EXTERNAL Term TermExtendFileSearchPath; +X_API EXTERNAL Atom AtomExtendsions; X_API EXTERNAL Term TermExtendsions; +X_API EXTERNAL Atom AtomFB; X_API EXTERNAL Term TermFB; +X_API EXTERNAL Atom AtomFail; X_API EXTERNAL Term TermFail; +X_API EXTERNAL Atom AtomFalse; X_API EXTERNAL Term TermFalse; +X_API EXTERNAL Atom AtomFast; X_API EXTERNAL Term TermFast; +X_API EXTERNAL Atom AtomFastFail; X_API EXTERNAL Term TermFastFail; +X_API EXTERNAL Atom AtomFileErrors; X_API EXTERNAL Term TermFileErrors; +X_API EXTERNAL Atom AtomFileerrors; X_API EXTERNAL Term TermFileerrors; +X_API EXTERNAL Atom AtomFileType; X_API EXTERNAL Term TermFileType; +X_API EXTERNAL Atom AtomFirst; X_API EXTERNAL Term TermFirst; +X_API EXTERNAL Atom AtomFloat; X_API EXTERNAL Term TermFloat; +X_API EXTERNAL Atom AtomFloatFormat; X_API EXTERNAL Term TermFloatFormat; +X_API EXTERNAL Atom AtomFloatOverflow; X_API EXTERNAL Term TermFloatOverflow; +X_API EXTERNAL Atom AtomFloatUnderflow; X_API EXTERNAL Term TermFloatUnderflow; +X_API EXTERNAL Atom AtomFormat; X_API EXTERNAL Term TermFormat; +X_API EXTERNAL Atom AtomFormatAt; X_API EXTERNAL Term TermFormatAt; +X_API EXTERNAL Atom AtomFull; X_API EXTERNAL Term TermFull; +X_API EXTERNAL Atom AtomFunctor; X_API EXTERNAL Term TermFunctor; +X_API EXTERNAL Atom AtomGT; X_API EXTERNAL Term TermGT; +X_API EXTERNAL Atom AtomGVar; X_API EXTERNAL Term TermGVar; +X_API EXTERNAL Atom AtomGc; X_API EXTERNAL Term TermGc; +X_API EXTERNAL Atom AtomGcMargin; X_API EXTERNAL Term TermGcMargin; +X_API EXTERNAL Atom AtomGcTrace; X_API EXTERNAL Term TermGcTrace; +X_API EXTERNAL Atom AtomGcVerbose; X_API EXTERNAL Term TermGcVerbose; +X_API EXTERNAL Atom AtomGcVeryVerbose; X_API EXTERNAL Term TermGcVeryVerbose; +X_API EXTERNAL Atom AtomGeneratePredInfo; X_API EXTERNAL Term TermGeneratePredInfo; +X_API EXTERNAL Atom AtomGetwork; X_API EXTERNAL Term TermGetwork; +X_API EXTERNAL Atom AtomGetworkSeq; X_API EXTERNAL Term TermGetworkSeq; +X_API EXTERNAL Atom AtomGlob; X_API EXTERNAL Term TermGlob; +X_API EXTERNAL Atom AtomGlobal; X_API EXTERNAL Term TermGlobal; +X_API EXTERNAL Atom AtomGlobalSp; X_API EXTERNAL Term TermGlobalSp; +X_API EXTERNAL Atom AtomGlobalTrie; X_API EXTERNAL Term TermGlobalTrie; +X_API EXTERNAL Atom AtomGoalExpansion; X_API EXTERNAL Term TermGoalExpansion; +X_API EXTERNAL Atom AtomHat; X_API EXTERNAL Term TermHat; +X_API EXTERNAL Atom AtomHERE; X_API EXTERNAL Term TermHERE; +X_API EXTERNAL Atom AtomHandleThrow; X_API EXTERNAL Term TermHandleThrow; +X_API EXTERNAL Atom AtomHeap; X_API EXTERNAL Term TermHeap; +X_API EXTERNAL Atom AtomHeapUsed; X_API EXTERNAL Term TermHeapUsed; +X_API EXTERNAL Atom AtomHugeInt; X_API EXTERNAL Term TermHugeInt; +X_API EXTERNAL Atom AtomIDB; X_API EXTERNAL Term TermIDB; +X_API EXTERNAL Atom AtomIOMode; X_API EXTERNAL Term TermIOMode; +X_API EXTERNAL Atom AtomI; X_API EXTERNAL Term TermI; +X_API EXTERNAL Atom AtomId; X_API EXTERNAL Term TermId; +X_API EXTERNAL Atom AtomIgnore; X_API EXTERNAL Term TermIgnore; +X_API EXTERNAL Atom AtomInf; X_API EXTERNAL Term TermInf; +X_API EXTERNAL Atom AtomInfinity; X_API EXTERNAL Term TermInfinity; +X_API EXTERNAL Atom AtomInfo; X_API EXTERNAL Term TermInfo; +X_API EXTERNAL Atom AtomInitGoal; X_API EXTERNAL Term TermInitGoal; +X_API EXTERNAL Atom AtomInitProlog; X_API EXTERNAL Term TermInitProlog; +X_API EXTERNAL Atom AtomInStackExpansion; X_API EXTERNAL Term TermInStackExpansion; +X_API EXTERNAL Atom AtomInput; X_API EXTERNAL Term TermInput; +X_API EXTERNAL Atom AtomInstantiationError; X_API EXTERNAL Term TermInstantiationError; +X_API EXTERNAL Atom AtomInt; X_API EXTERNAL Term TermInt; +X_API EXTERNAL Atom AtomIntOverflow; X_API EXTERNAL Term TermIntOverflow; +X_API EXTERNAL Atom AtomInteger; X_API EXTERNAL Term TermInteger; +X_API EXTERNAL Atom AtomInternalCompilerError; X_API EXTERNAL Term TermInternalCompilerError; +X_API EXTERNAL Atom AtomIs; X_API EXTERNAL Term TermIs; +X_API EXTERNAL Atom AtomJ; X_API EXTERNAL Term TermJ; +X_API EXTERNAL Atom Atoml; X_API EXTERNAL Term Terml; +X_API EXTERNAL Atom AtomKey; X_API EXTERNAL Term TermKey; +X_API EXTERNAL Atom AtomLDLibraryPath; X_API EXTERNAL Term TermLDLibraryPath; +X_API EXTERNAL Atom AtomLONGINT; X_API EXTERNAL Term TermLONGINT; +X_API EXTERNAL Atom AtomLOOP; X_API EXTERNAL Term TermLOOP; +X_API EXTERNAL Atom AtomLoopStream; X_API EXTERNAL Term TermLoopStream; +X_API EXTERNAL Atom AtomLT; X_API EXTERNAL Term TermLT; +X_API EXTERNAL Atom AtomLastExecuteWithin; X_API EXTERNAL Term TermLastExecuteWithin; +X_API EXTERNAL Atom AtomLeash; X_API EXTERNAL Term TermLeash; +X_API EXTERNAL Atom AtomLeast; X_API EXTERNAL Term TermLeast; +X_API EXTERNAL Atom AtomLength; X_API EXTERNAL Term TermLength; +X_API EXTERNAL Atom AtomList; X_API EXTERNAL Term TermList; +X_API EXTERNAL Atom AtomLine; X_API EXTERNAL Term TermLine; +X_API EXTERNAL Atom AtomLive; X_API EXTERNAL Term TermLive; +X_API EXTERNAL Atom AtomLoadAnswers; X_API EXTERNAL Term TermLoadAnswers; +X_API EXTERNAL Atom AtomLocal; X_API EXTERNAL Term TermLocal; +X_API EXTERNAL Atom AtomLocalSp; X_API EXTERNAL Term TermLocalSp; +X_API EXTERNAL Atom AtomLocalTrie; X_API EXTERNAL Term TermLocalTrie; +X_API EXTERNAL Atom AtomMax; X_API EXTERNAL Term TermMax; +X_API EXTERNAL Atom AtomMaximum; X_API EXTERNAL Term TermMaximum; +X_API EXTERNAL Atom AtomMaxArity; X_API EXTERNAL Term TermMaxArity; +X_API EXTERNAL Atom AtomMaxFiles; X_API EXTERNAL Term TermMaxFiles; +X_API EXTERNAL Atom AtomMegaClause; X_API EXTERNAL Term TermMegaClause; +X_API EXTERNAL Atom AtomMetaCall; X_API EXTERNAL Term TermMetaCall; +X_API EXTERNAL Atom AtomMfClause; X_API EXTERNAL Term TermMfClause; +X_API EXTERNAL Atom AtomMin; X_API EXTERNAL Term TermMin; +X_API EXTERNAL Atom AtomMinimum; X_API EXTERNAL Term TermMinimum; +X_API EXTERNAL Atom AtomMinus; X_API EXTERNAL Term TermMinus; +X_API EXTERNAL Atom AtomModify; X_API EXTERNAL Term TermModify; +X_API EXTERNAL Atom AtomModule; X_API EXTERNAL Term TermModule; +X_API EXTERNAL Atom AtomMost; X_API EXTERNAL Term TermMost; +X_API EXTERNAL Atom AtomMulti; X_API EXTERNAL Term TermMulti; +X_API EXTERNAL Atom AtomMultiFile; X_API EXTERNAL Term TermMultiFile; +X_API EXTERNAL Atom AtomMultiple; X_API EXTERNAL Term TermMultiple; +X_API EXTERNAL Atom AtomMutable; X_API EXTERNAL Term TermMutable; +X_API EXTERNAL Atom AtomMutableVariable; X_API EXTERNAL Term TermMutableVariable; +X_API EXTERNAL Atom AtomMutex; X_API EXTERNAL Term TermMutex; +X_API EXTERNAL Atom AtomMyddasDB; X_API EXTERNAL Term TermMyddasDB; +X_API EXTERNAL Atom AtomMyddasGoal; X_API EXTERNAL Term TermMyddasGoal; +X_API EXTERNAL Atom AtomMyddasHost; X_API EXTERNAL Term TermMyddasHost; +X_API EXTERNAL Atom AtomMyddasPass; X_API EXTERNAL Term TermMyddasPass; +X_API EXTERNAL Atom AtomMyddasUser; X_API EXTERNAL Term TermMyddasUser; +X_API EXTERNAL Atom AtomMyddasVersionName; X_API EXTERNAL Term TermMyddasVersionName; +X_API EXTERNAL Atom AtomNan; X_API EXTERNAL Term TermNan; +X_API EXTERNAL Atom AtomNb; X_API EXTERNAL Term TermNb; +X_API EXTERNAL Atom AtomNbTerm; X_API EXTERNAL Term TermNbTerm; +X_API EXTERNAL Atom AtomNew; X_API EXTERNAL Term TermNew; +X_API EXTERNAL Atom AtomNewLine; X_API EXTERNAL Term TermNewLine; +X_API EXTERNAL Atom AtomNl; X_API EXTERNAL Term TermNl; +X_API EXTERNAL Atom AtomNoEffect; X_API EXTERNAL Term TermNoEffect; +X_API EXTERNAL Atom AtomNoMemory; X_API EXTERNAL Term TermNoMemory; +X_API EXTERNAL Atom AtomNone; X_API EXTERNAL Term TermNone; +X_API EXTERNAL Atom AtomNonEmptyList; X_API EXTERNAL Term TermNonEmptyList; +X_API EXTERNAL Atom AtomNot; X_API EXTERNAL Term TermNot; +X_API EXTERNAL Atom AtomNotImplemented; X_API EXTERNAL Term TermNotImplemented; +X_API EXTERNAL Atom AtomNotLessThanZero; X_API EXTERNAL Term TermNotLessThanZero; +X_API EXTERNAL Atom AtomNotNewline; X_API EXTERNAL Term TermNotNewline; +X_API EXTERNAL Atom AtomNotZero; X_API EXTERNAL Term TermNotZero; +X_API EXTERNAL Atom AtomNumber; X_API EXTERNAL Term TermNumber; +X_API EXTERNAL Atom AtomObj; X_API EXTERNAL Term TermObj; +X_API EXTERNAL Atom AtomOff; X_API EXTERNAL Term TermOff; +X_API EXTERNAL Atom AtomOffline; X_API EXTERNAL Term TermOffline; +X_API EXTERNAL Atom AtomOn; X_API EXTERNAL Term TermOn; +X_API EXTERNAL Atom AtomOnline; X_API EXTERNAL Term TermOnline; +X_API EXTERNAL Atom AtomOpen; X_API EXTERNAL Term TermOpen; +X_API EXTERNAL Atom AtomOperatingSystemError; X_API EXTERNAL Term TermOperatingSystemError; +X_API EXTERNAL Atom AtomOperatingSystemSupport; X_API EXTERNAL Term TermOperatingSystemSupport; +X_API EXTERNAL Atom AtomOperator; X_API EXTERNAL Term TermOperator; +X_API EXTERNAL Atom AtomOperatorPriority; X_API EXTERNAL Term TermOperatorPriority; +X_API EXTERNAL Atom AtomOperatorSpecifier; X_API EXTERNAL Term TermOperatorSpecifier; +X_API EXTERNAL Atom AtomOpt; X_API EXTERNAL Term TermOpt; +X_API EXTERNAL Atom AtomOtherwise; X_API EXTERNAL Term TermOtherwise; +X_API EXTERNAL Atom AtomOutOfAttvarsError; X_API EXTERNAL Term TermOutOfAttvarsError; +X_API EXTERNAL Atom AtomOutOfAuxspaceError; X_API EXTERNAL Term TermOutOfAuxspaceError; +X_API EXTERNAL Atom AtomOutOfHeapError; X_API EXTERNAL Term TermOutOfHeapError; +X_API EXTERNAL Atom AtomOutOfRange; X_API EXTERNAL Term TermOutOfRange; +X_API EXTERNAL Atom AtomOutOfStackError; X_API EXTERNAL Term TermOutOfStackError; +X_API EXTERNAL Atom AtomOutOfTrailError; X_API EXTERNAL Term TermOutOfTrailError; +X_API EXTERNAL Atom AtomOutput; X_API EXTERNAL Term TermOutput; +X_API EXTERNAL Atom AtomParameter; X_API EXTERNAL Term TermParameter; +X_API EXTERNAL Atom AtomPrologCommonsDir; X_API EXTERNAL Term TermPrologCommonsDir; +X_API EXTERNAL Atom AtomPast; X_API EXTERNAL Term TermPast; +X_API EXTERNAL Atom AtomPastEndOfStream; X_API EXTERNAL Term TermPastEndOfStream; +X_API EXTERNAL Atom AtomPermissionError; X_API EXTERNAL Term TermPermissionError; +X_API EXTERNAL Atom AtomPi; X_API EXTERNAL Term TermPi; +X_API EXTERNAL Atom AtomPipe; X_API EXTERNAL Term TermPipe; +X_API EXTERNAL Atom AtomPriority; X_API EXTERNAL Term TermPriority; +X_API EXTERNAL Atom AtomPlus; X_API EXTERNAL Term TermPlus; +X_API EXTERNAL Atom AtomPointer; X_API EXTERNAL Term TermPointer; +X_API EXTERNAL Atom AtomPortray; X_API EXTERNAL Term TermPortray; +X_API EXTERNAL Atom AtomPredicateIndicator; X_API EXTERNAL Term TermPredicateIndicator; +X_API EXTERNAL Atom AtomPrimitive; X_API EXTERNAL Term TermPrimitive; +X_API EXTERNAL Atom AtomPrintMessage; X_API EXTERNAL Term TermPrintMessage; +X_API EXTERNAL Atom AtomPrivateProcedure; X_API EXTERNAL Term TermPrivateProcedure; +X_API EXTERNAL Atom AtomProcedure; X_API EXTERNAL Term TermProcedure; +X_API EXTERNAL Atom AtomProfile; X_API EXTERNAL Term TermProfile; +X_API EXTERNAL Atom AtomProlog; X_API EXTERNAL Term TermProlog; +X_API EXTERNAL Atom AtomProtectStack; X_API EXTERNAL Term TermProtectStack; +X_API EXTERNAL Atom AtomQly; X_API EXTERNAL Term TermQly; +X_API EXTERNAL Atom AtomQuery; X_API EXTERNAL Term TermQuery; +X_API EXTERNAL Atom AtomQueue; X_API EXTERNAL Term TermQueue; +X_API EXTERNAL Atom AtomQuiet; X_API EXTERNAL Term TermQuiet; +X_API EXTERNAL Atom AtomRadix; X_API EXTERNAL Term TermRadix; +X_API EXTERNAL Atom AtomRandom; X_API EXTERNAL Term TermRandom; +X_API EXTERNAL Atom AtomRange; X_API EXTERNAL Term TermRange; +X_API EXTERNAL Atom AtomRDiv; X_API EXTERNAL Term TermRDiv; +X_API EXTERNAL Atom AtomRead; X_API EXTERNAL Term TermRead; +X_API EXTERNAL Atom AtomReadOnly; X_API EXTERNAL Term TermReadOnly; +X_API EXTERNAL Atom AtomReadWrite; X_API EXTERNAL Term TermReadWrite; +X_API EXTERNAL Atom AtomReadutil; X_API EXTERNAL Term TermReadutil; +X_API EXTERNAL Atom AtomReconsult; X_API EXTERNAL Term TermReconsult; +X_API EXTERNAL Atom AtomRecordedP; X_API EXTERNAL Term TermRecordedP; +X_API EXTERNAL Atom AtomRecordedWithKey; X_API EXTERNAL Term TermRecordedWithKey; +X_API EXTERNAL Atom AtomRedefineWarnings; X_API EXTERNAL Term TermRedefineWarnings; +X_API EXTERNAL Atom AtomRedoFreeze; X_API EXTERNAL Term TermRedoFreeze; +X_API EXTERNAL Atom AtomRefoundVar; X_API EXTERNAL Term TermRefoundVar; +X_API EXTERNAL Atom AtomRelativeTo; X_API EXTERNAL Term TermRelativeTo; +X_API EXTERNAL Atom AtomRepeat; X_API EXTERNAL Term TermRepeat; +X_API EXTERNAL Atom AtomRepeatSpace; X_API EXTERNAL Term TermRepeatSpace; +X_API EXTERNAL Atom AtomReposition; X_API EXTERNAL Term TermReposition; +X_API EXTERNAL Atom AtomRepresentationError; X_API EXTERNAL Term TermRepresentationError; +X_API EXTERNAL Atom AtomReset; X_API EXTERNAL Term TermReset; +X_API EXTERNAL Atom AtomResize; X_API EXTERNAL Term TermResize; +X_API EXTERNAL Atom AtomResourceError; X_API EXTERNAL Term TermResourceError; +X_API EXTERNAL Atom AtomRestoreRegs; X_API EXTERNAL Term TermRestoreRegs; +X_API EXTERNAL Atom AtomRetry; X_API EXTERNAL Term TermRetry; +X_API EXTERNAL Atom AtomRetryCounter; X_API EXTERNAL Term TermRetryCounter; +X_API EXTERNAL Atom AtomRTree; X_API EXTERNAL Term TermRTree; +X_API EXTERNAL Atom AtomSafe; X_API EXTERNAL Term TermSafe; +X_API EXTERNAL Atom AtomSafeCallCleanup; X_API EXTERNAL Term TermSafeCallCleanup; +X_API EXTERNAL Atom AtomSame; X_API EXTERNAL Term TermSame; +X_API EXTERNAL Atom AtomSemic; X_API EXTERNAL Term TermSemic; +X_API EXTERNAL Atom AtomShiftCountOverflow; X_API EXTERNAL Term TermShiftCountOverflow; +X_API EXTERNAL Atom AtomSigAlarm; X_API EXTERNAL Term TermSigAlarm; +X_API EXTERNAL Atom AtomSigBreak; X_API EXTERNAL Term TermSigBreak; +X_API EXTERNAL Atom AtomSigCreep; X_API EXTERNAL Term TermSigCreep; +X_API EXTERNAL Atom AtomSigDebug; X_API EXTERNAL Term TermSigDebug; +X_API EXTERNAL Atom AtomSigDelayCreep; X_API EXTERNAL Term TermSigDelayCreep; +X_API EXTERNAL Atom AtomSigFPE; X_API EXTERNAL Term TermSigFPE; +X_API EXTERNAL Atom AtomSigHup; X_API EXTERNAL Term TermSigHup; +X_API EXTERNAL Atom AtomSigInt; X_API EXTERNAL Term TermSigInt; +X_API EXTERNAL Atom AtomSigIti; X_API EXTERNAL Term TermSigIti; +X_API EXTERNAL Atom AtomSigPending; X_API EXTERNAL Term TermSigPending; +X_API EXTERNAL Atom AtomSigPipe; X_API EXTERNAL Term TermSigPipe; +X_API EXTERNAL Atom AtomSigStackDump; X_API EXTERNAL Term TermSigStackDump; +X_API EXTERNAL Atom AtomSigStatistics; X_API EXTERNAL Term TermSigStatistics; +X_API EXTERNAL Atom AtomSigTrace; X_API EXTERNAL Term TermSigTrace; +X_API EXTERNAL Atom AtomSigUsr1; X_API EXTERNAL Term TermSigUsr1; +X_API EXTERNAL Atom AtomSigUsr2; X_API EXTERNAL Term TermSigUsr2; +X_API EXTERNAL Atom AtomSigVTAlarm; X_API EXTERNAL Term TermSigVTAlarm; +X_API EXTERNAL Atom AtomSigWakeUp; X_API EXTERNAL Term TermSigWakeUp; +X_API EXTERNAL Atom AtomSilent; X_API EXTERNAL Term TermSilent; +X_API EXTERNAL Atom AtomSingle; X_API EXTERNAL Term TermSingle; +X_API EXTERNAL Atom AtomSingleVarWarnings; X_API EXTERNAL Term TermSingleVarWarnings; +X_API EXTERNAL Atom AtomSingleton; X_API EXTERNAL Term TermSingleton; +X_API EXTERNAL Atom AtomSlash; X_API EXTERNAL Term TermSlash; +X_API EXTERNAL Atom AtomSocket; X_API EXTERNAL Term TermSocket; +X_API EXTERNAL Atom AtomSolutions; X_API EXTERNAL Term TermSolutions; +X_API EXTERNAL Atom AtomSource; X_API EXTERNAL Term TermSource; +X_API EXTERNAL Atom AtomSourceSink; X_API EXTERNAL Term TermSourceSink; +X_API EXTERNAL Atom AtomSpy; X_API EXTERNAL Term TermSpy; +X_API EXTERNAL Atom AtomStack; X_API EXTERNAL Term TermStack; +X_API EXTERNAL Atom AtomStackFree; X_API EXTERNAL Term TermStackFree; +X_API EXTERNAL Atom AtomStartupSavedState; X_API EXTERNAL Term TermStartupSavedState; +X_API EXTERNAL Atom AtomStaticClause; X_API EXTERNAL Term TermStaticClause; +X_API EXTERNAL Atom AtomStaticProcedure; X_API EXTERNAL Term TermStaticProcedure; +X_API EXTERNAL Atom AtomStream; X_API EXTERNAL Term TermStream; +X_API EXTERNAL Atom AtomSWIStream; X_API EXTERNAL Term TermSWIStream; +X_API EXTERNAL Atom AtomVStream; X_API EXTERNAL Term TermVStream; +X_API EXTERNAL Atom AtomStreams; X_API EXTERNAL Term TermStreams; +X_API EXTERNAL Atom AtomStreamOrAlias; X_API EXTERNAL Term TermStreamOrAlias; +X_API EXTERNAL Atom AtomStreamPos; X_API EXTERNAL Term TermStreamPos; +X_API EXTERNAL Atom AtomStreamPosition; X_API EXTERNAL Term TermStreamPosition; +X_API EXTERNAL Atom AtomString; X_API EXTERNAL Term TermString; +X_API EXTERNAL Atom AtomStyleCheck; X_API EXTERNAL Term TermStyleCheck; +X_API EXTERNAL Atom AtomSTRING; X_API EXTERNAL Term TermSTRING; +X_API EXTERNAL Atom AtomSwi; X_API EXTERNAL Term TermSwi; +X_API EXTERNAL Atom AtomSymbolChar; X_API EXTERNAL Term TermSymbolChar; +X_API EXTERNAL Atom AtomSyntaxError; X_API EXTERNAL Term TermSyntaxError; +X_API EXTERNAL Atom AtomSyntaxErrors; X_API EXTERNAL Term TermSyntaxErrors; +X_API EXTERNAL Atom AtomSyntaxErrorHandler; X_API EXTERNAL Term TermSyntaxErrorHandler; +X_API EXTERNAL Atom AtomSystem; X_API EXTERNAL Term TermSystem; +X_API EXTERNAL Atom AtomSystemError; X_API EXTERNAL Term TermSystemError; +X_API EXTERNAL Atom AtomSystemLibraryDir; X_API EXTERNAL Term TermSystemLibraryDir; +X_API EXTERNAL Atom AtomT; X_API EXTERNAL Term TermT; +X_API EXTERNAL Atom AtomTerm; X_API EXTERNAL Term TermTerm; +X_API EXTERNAL Atom AtomTermExpansion; X_API EXTERNAL Term TermTermExpansion; +X_API EXTERNAL Atom AtomTerms; X_API EXTERNAL Term TermTerms; +X_API EXTERNAL Atom AtomText; X_API EXTERNAL Term TermText; +X_API EXTERNAL Atom AtomTextStream; X_API EXTERNAL Term TermTextStream; +X_API EXTERNAL Atom AtomThread; X_API EXTERNAL Term TermThread; +X_API EXTERNAL Atom AtomThreads; X_API EXTERNAL Term TermThreads; +X_API EXTERNAL Atom AtomThrow; X_API EXTERNAL Term TermThrow; +X_API EXTERNAL Atom AtomTimeOutSpec; X_API EXTERNAL Term TermTimeOutSpec; +X_API EXTERNAL Atom AtomTimeoutError; X_API EXTERNAL Term TermTimeoutError; +X_API EXTERNAL Atom AtomTopLevelGoal; X_API EXTERNAL Term TermTopLevelGoal; +X_API EXTERNAL Atom AtomTopThreadGoal; X_API EXTERNAL Term TermTopThreadGoal; +X_API EXTERNAL Atom AtomTraceMetaCall; X_API EXTERNAL Term TermTraceMetaCall; +X_API EXTERNAL Atom AtomTrail; +X_API EXTERNAL Atom AtomTrue; X_API EXTERNAL Term TermTrue; +X_API EXTERNAL Atom AtomTty; X_API EXTERNAL Term TermTty; +X_API EXTERNAL Atom AtomTtys; X_API EXTERNAL Term TermTtys; +X_API EXTERNAL Atom AtomTuple; X_API EXTERNAL Term TermTuple; +X_API EXTERNAL Atom AtomTxt; X_API EXTERNAL Term TermTxt; +X_API EXTERNAL Atom AtomTypeError; X_API EXTERNAL Term TermTypeError; +X_API EXTERNAL Atom AtomUndefined; X_API EXTERNAL Term TermUndefined; +X_API EXTERNAL Atom AtomUndefinedQuery; X_API EXTERNAL Term TermUndefinedQuery; +X_API EXTERNAL Atom AtomUndefp; X_API EXTERNAL Term TermUndefp; +X_API EXTERNAL Atom AtomUndefp0; X_API EXTERNAL Term TermUndefp0; +X_API EXTERNAL Atom AtomUnderflow; X_API EXTERNAL Term TermUnderflow; +X_API EXTERNAL Atom AtomUnificationStack; X_API EXTERNAL Term TermUnificationStack; +X_API EXTERNAL Atom AtomUnique; X_API EXTERNAL Term TermUnique; +X_API EXTERNAL Atom AtomUnsignedByte; X_API EXTERNAL Term TermUnsignedByte; +X_API EXTERNAL Atom AtomUnsignedChar; X_API EXTERNAL Term TermUnsignedChar; +X_API EXTERNAL Atom AtomUser; X_API EXTERNAL Term TermUser; +X_API EXTERNAL Atom AtomUserErr; X_API EXTERNAL Term TermUserErr; +X_API EXTERNAL Atom AtomUserIn; X_API EXTERNAL Term TermUserIn; +X_API EXTERNAL Atom AtomUserOut; X_API EXTERNAL Term TermUserOut; +X_API EXTERNAL Atom AtomDollarVar; X_API EXTERNAL Term TermDollarVar; +X_API EXTERNAL Atom AtomVBar; X_API EXTERNAL Term TermVBar; +X_API EXTERNAL Atom AtomVarBranches; X_API EXTERNAL Term TermVarBranches; +X_API EXTERNAL Atom AtomVariableNames; X_API EXTERNAL Term TermVariableNames; +X_API EXTERNAL Atom AtomHiddenVar; X_API EXTERNAL Term TermHiddenVar; +X_API EXTERNAL Atom AtomVariable; X_API EXTERNAL Term TermVariable; +X_API EXTERNAL Atom AtomVerbose; X_API EXTERNAL Term TermVerbose; +X_API EXTERNAL Atom AtomVerboseFileSearch; X_API EXTERNAL Term TermVerboseFileSearch; +X_API EXTERNAL Atom AtomVersionNumber; X_API EXTERNAL Term TermVersionNumber; +X_API EXTERNAL Atom AtomVeryVerbose; X_API EXTERNAL Term TermVeryVerbose; +X_API EXTERNAL Atom AtomWakeUpGoal; X_API EXTERNAL Term TermWakeUpGoal; +X_API EXTERNAL Atom AtomWarning; X_API EXTERNAL Term TermWarning; +X_API EXTERNAL Atom AtomWhen; X_API EXTERNAL Term TermWhen; +X_API EXTERNAL Atom AtomWrite; X_API EXTERNAL Term TermWrite; +X_API EXTERNAL Atom AtomWriteTerm; X_API EXTERNAL Term TermWriteTerm; +X_API EXTERNAL Atom AtomXml; X_API EXTERNAL Term TermXml; +X_API EXTERNAL Atom AtomYapHacks; X_API EXTERNAL Term TermYapHacks; +X_API EXTERNAL Atom AtomZeroDivisor; X_API EXTERNAL Term TermZeroDivisor; +X_API EXTERNAL Functor FunctorAfInet; + +X_API EXTERNAL Functor FunctorAfLocal; + +X_API EXTERNAL Functor FunctorAfUnix; + +X_API EXTERNAL Functor FunctorAltNot; + +X_API EXTERNAL Functor FunctorArg; + +X_API EXTERNAL Functor FunctorArrayEntry; + +X_API EXTERNAL Functor FunctorArrow; + +X_API EXTERNAL Functor FunctorDoubleArrow; + +X_API EXTERNAL Functor FunctorAssert1; + +X_API EXTERNAL Functor FunctorAssert; + +X_API EXTERNAL Functor FunctorAtFoundOne; + +X_API EXTERNAL Functor FunctorAtom; + +X_API EXTERNAL Functor FunctorAtt1; + +X_API EXTERNAL Functor FunctorAttGoal; + +X_API EXTERNAL Functor FunctorBraces; + +X_API EXTERNAL Functor FunctorCall; + +X_API EXTERNAL Functor FunctorCatch; + +X_API EXTERNAL Functor FunctorChangeModule; + +X_API EXTERNAL Functor FunctorChars; + +X_API EXTERNAL Functor FunctorChars1; + +X_API EXTERNAL Functor FunctorCleanCall; + +X_API EXTERNAL Functor FunctorClist; + +X_API EXTERNAL Functor FunctorCodes; + +X_API EXTERNAL Functor FunctorCodes1; + +X_API EXTERNAL Functor FunctorColon; + +X_API EXTERNAL Functor FunctorComma; + +X_API EXTERNAL Functor FunctorCommentHook; + +X_API EXTERNAL Functor FunctorContext2; + +X_API EXTERNAL Functor FunctorConsistencyError; + +X_API EXTERNAL Functor FunctorCreep; + +X_API EXTERNAL Functor FunctorCsult; + +X_API EXTERNAL Functor FunctorCurrentModule; + +X_API EXTERNAL Functor FunctorCutBy; + +X_API EXTERNAL Functor FunctorDBREF; + +X_API EXTERNAL Functor FunctorDiff; + +X_API EXTERNAL Functor FunctorDoLogUpdClause; + +X_API EXTERNAL Functor FunctorDoLogUpdClause0; + +X_API EXTERNAL Functor FunctorDoLogUpdClauseErase; + +X_API EXTERNAL Functor FunctorDoStaticClause; + +X_API EXTERNAL Functor FunctorDollar; + +X_API EXTERNAL Functor FunctorDollarVar; + +X_API EXTERNAL Functor FunctorDomainError; + +X_API EXTERNAL Functor FunctorDot; + +X_API EXTERNAL Functor FunctorDot10; + +X_API EXTERNAL Functor FunctorDot11; + +X_API EXTERNAL Functor FunctorDot12; + +X_API EXTERNAL Functor FunctorDot2; + +X_API EXTERNAL Functor FunctorDot3; + +X_API EXTERNAL Functor FunctorDot4; + +X_API EXTERNAL Functor FunctorDot5; + +X_API EXTERNAL Functor FunctorDot6; + +X_API EXTERNAL Functor FunctorDot7; + +X_API EXTERNAL Functor FunctorDot8; + +X_API EXTERNAL Functor FunctorDot9; + +X_API EXTERNAL Functor FunctorDoubleArrow; + +X_API EXTERNAL Functor FunctorDoubleSlash; + +X_API EXTERNAL Functor FunctorEmptySquareBrackets; + +X_API EXTERNAL Functor FunctorEq; + +X_API EXTERNAL Functor FunctorError; + +X_API EXTERNAL Functor FunctorEvaluationError; + +X_API EXTERNAL Functor FunctorException; + +X_API EXTERNAL Functor FunctorExecute2InMod; + +X_API EXTERNAL Functor FunctorExecuteInMod; + +X_API EXTERNAL Functor FunctorExecuteWithin; + +X_API EXTERNAL Functor FunctorExistenceError; + +X_API EXTERNAL Functor FunctorExoClause; + +X_API EXTERNAL Functor FunctorFunctor; + +X_API EXTERNAL Functor FunctorGAtom; + +X_API EXTERNAL Functor FunctorGAtomic; + +X_API EXTERNAL Functor FunctorGCompound; + +X_API EXTERNAL Functor FunctorGFloat; + +X_API EXTERNAL Functor FunctorGFormatAt; + +X_API EXTERNAL Functor FunctorGInteger; + +X_API EXTERNAL Functor FunctorGNumber; + +X_API EXTERNAL Functor FunctorGPrimitive; + +X_API EXTERNAL Functor FunctorGVar; + +X_API EXTERNAL Functor FunctorGeneratePredInfo; + +X_API EXTERNAL Functor FunctorGoalExpansion2; + +X_API EXTERNAL Functor FunctorGoalExpansion; + +X_API EXTERNAL Functor FunctorHandleThrow; + +X_API EXTERNAL Functor FunctorHat; + +X_API EXTERNAL Functor FunctorI; + +X_API EXTERNAL Functor FunctorId; + +X_API EXTERNAL Functor FunctorInfo1; + +X_API EXTERNAL Functor FunctorInfo2; + +X_API EXTERNAL Functor FunctorInfo3; + +X_API EXTERNAL Functor FunctorInfo4; + +X_API EXTERNAL Functor FunctorIs; + +X_API EXTERNAL Functor FunctorJ; + +X_API EXTERNAL Functor FunctorLastExecuteWithin; + +X_API EXTERNAL Functor FunctorList; + +X_API EXTERNAL Functor FunctorLOOP; + +X_API EXTERNAL Functor FunctorMegaClause; + +X_API EXTERNAL Functor FunctorMetaCall; + +X_API EXTERNAL Functor FunctorMinus; + +X_API EXTERNAL Functor FunctorModule; + +X_API EXTERNAL Functor FunctorMultiFileClause; + +X_API EXTERNAL Functor FunctorMutable; + +X_API EXTERNAL Functor FunctorMutex; + +X_API EXTERNAL Functor FunctorNotImplemented; + +X_API EXTERNAL Functor FunctorNBQueue; + +X_API EXTERNAL Functor FunctorNot; + +X_API EXTERNAL Functor FunctorObj; + +X_API EXTERNAL Functor FunctorOr; + +X_API EXTERNAL Functor FunctorOutput; + +X_API EXTERNAL Functor FunctorPermissionError; + +X_API EXTERNAL Functor FunctorPlus; + +X_API EXTERNAL Functor FunctorPortray; + +X_API EXTERNAL Functor FunctorPrintMessage; + +X_API EXTERNAL Functor FunctorProcedure; + +X_API EXTERNAL Functor FunctorPriority; + +X_API EXTERNAL Functor FunctorPrologConstraint; + +X_API EXTERNAL Functor FunctorProtectStack; + +X_API EXTERNAL Functor FunctorQuery; + +X_API EXTERNAL Functor FunctorRecordedWithKey; + +X_API EXTERNAL Functor FunctorRDiv; + +X_API EXTERNAL Functor FunctorRedoFreeze; + +X_API EXTERNAL Functor FunctorRepresentationError; + +X_API EXTERNAL Functor FunctorResourceError; + +X_API EXTERNAL Functor FunctorRestoreRegs; + +X_API EXTERNAL Functor FunctorRestoreRegs1; + +X_API EXTERNAL Functor FunctorSafe; + +X_API EXTERNAL Functor FunctorSafeCallCleanup; + +X_API EXTERNAL Functor FunctorSame; + +X_API EXTERNAL Functor FunctorSlash; + +X_API EXTERNAL Functor FunctorStaticClause; + +X_API EXTERNAL Functor FunctorStream; + +X_API EXTERNAL Functor FunctorStreamEOS; + +X_API EXTERNAL Functor FunctorStreamPos; + +X_API EXTERNAL Functor FunctorString1; + +X_API EXTERNAL Functor FunctorStyleCheck; + +X_API EXTERNAL Functor FunctorSyntaxError; + +X_API EXTERNAL Functor FunctorShortSyntaxError; + +X_API EXTERNAL Functor FunctorTermExpansion; + +X_API EXTERNAL Functor FunctorThreadRun; + +X_API EXTERNAL Functor FunctorThrow; + +X_API EXTERNAL Functor FunctorTimeoutError; + +X_API EXTERNAL Functor FunctorTraceMetaCall; + +X_API EXTERNAL Functor FunctorTypeError; + +X_API EXTERNAL Functor FunctorUMinus; + +X_API EXTERNAL Functor FunctorUndefinedQuery; + +X_API EXTERNAL Functor FunctorUPlus; + +X_API EXTERNAL Functor FunctorVBar; + +X_API EXTERNAL Functor FunctorWriteTerm; + +X_API EXTERNAL Functor FunctorHiddenVar; + diff --git a/misc/ATOMS b/misc/ATOMS index db0024e0f..c93c00783 100644 --- a/misc/ATOMS +++ b/misc/ATOMS @@ -404,6 +404,7 @@ A Tuple N "tuple" A Txt N "txt" A TypeError N "type_error" A Undefined N "undefined" +A UndefinedQuery N "undefined_query" A Undefp F "$undefp" A Underflow N "underflow" A UnificationStack N "unification_stack" @@ -566,6 +567,7 @@ F TimeoutError TimeoutError 2 F TraceMetaCall TraceMetaCall 3 F TypeError TypeError 2 F UMinus Minus 1 +F UndefinedQuery UndefinedQuery 3 F UPlus Plus 1 F VBar VBar 2 F HiddenVar HiddenVar 1 diff --git a/os/fmem.c b/os/fmem.c index 6362602c7..fd5a32148 100644 --- a/os/fmem.c +++ b/os/fmem.c @@ -114,6 +114,7 @@ bool Yap_set_stream_to_buf(StreamDesc *st, const char *buf, size_t nchars) { // like any file stream. st->file = f = fmemopen((void *)buf, nchars, "r"); st->status = Input_Stream_f | InMemory_Stream_f | Seekable_Stream_f; + st->vfs = NULL; Yap_DefaultStreamOps(st); return true; } @@ -139,7 +140,7 @@ int Yap_open_buf_read_stream(const char *buf, size_t nchars, encoding_t *encp, // like any file stream. f = st->file = fmemopen((void *)buf, nchars, "r"); flags = Input_Stream_f | InMemory_Stream_f | Seekable_Stream_f; - Yap_initStream(sno, f, NULL, TermNil, encoding, flags, AtomRead); + Yap_initStream(sno, f, NULL, TermNil, encoding, flags, AtomRead, NULL); // like any file stream. Yap_DefaultStreamOps(st); UNLOCK(st->streamlock); @@ -181,6 +182,7 @@ int Yap_open_buf_write_stream(encoding_t enc, memBufSource src) { st->charcount = 0; st->linecount = 1; st->encoding = enc; + st->vfs = NULL; Yap_DefaultStreamOps(st); #if HAVE_OPEN_MEMSTREAM st->file = open_memstream(&st->nbuf, &st->nsize); diff --git a/os/iopreds.c b/os/iopreds.c index bd53fc7ea..f4a551948 100644 --- a/os/iopreds.c +++ b/os/iopreds.c @@ -249,8 +249,8 @@ void Yap_DefaultStreamOps(StreamDesc *st) { if (st->vfs) { st->stream_wputc = st->vfs->put_char; st->stream_wgetc = st->vfs->get_char; - st->stream_putc = FilePutc; - st->stream_getc = PlGetc; + st->stream_putc = st->vfs->put_char; + st->stream_wgetc = st->vfs->get_char; return; } st->stream_wputc = put_wchar; @@ -285,13 +285,14 @@ static void InitFileIO(StreamDesc *s) { Yap_DefaultStreamOps(s); } -static void InitStdStream(int sno, SMALLUNSGN flags, FILE *file) { +static void InitStdStream(int sno, SMALLUNSGN flags, FILE *file, void *vfsp) { StreamDesc *s = &GLOBAL_Stream[sno]; s->file = file; s->status = flags; s->linepos = 0; s->linecount = 1; s->charcount = 0.; + s->vfs = vfsp; s->encoding = ENC_ISO_UTF8; INIT_LOCK(s->streamlock); unix_upd_stream_info(s); @@ -339,13 +340,13 @@ Term Yap_StreamUserName(int sno) { static void InitStdStreams(void) { CACHE_REGS if (LOCAL_sockets_io) { - InitStdStream(StdInStream, Input_Stream_f, NULL); - InitStdStream(StdOutStream, Output_Stream_f, NULL); - InitStdStream(StdErrStream, Output_Stream_f, NULL); + InitStdStream(StdInStream, Input_Stream_f, NULL, NULL); + InitStdStream(StdOutStream, Output_Stream_f, NULL, NULL); + InitStdStream(StdErrStream, Output_Stream_f, NULL, NULL); } else { - InitStdStream(StdInStream, Input_Stream_f, stdin); - InitStdStream(StdOutStream, Output_Stream_f, stdout); - InitStdStream(StdErrStream, Output_Stream_f, stderr); + InitStdStream(StdInStream, Input_Stream_f, stdin, NULL); + InitStdStream(StdOutStream, Output_Stream_f, stdout, NULL); + InitStdStream(StdErrStream, Output_Stream_f, stderr, NULL); } GLOBAL_Stream[StdInStream].name = Yap_LookupAtom("user_input"); GLOBAL_Stream[StdOutStream].name = Yap_LookupAtom("user_output"); @@ -1056,10 +1057,11 @@ static void check_bom(int sno, StreamDesc *st) { } bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name, - encoding_t encoding, stream_flags_t flags, Atom open_mode) { + encoding_t encoding, stream_flags_t flags, Atom open_mode, void *vfs) { StreamDesc *st = &GLOBAL_Stream[sno]; st->status = flags; + st->vfs = vfs; st->charcount = 0; st->linecount = 1; if (flags & Binary_Stream_f) { @@ -1288,9 +1290,9 @@ do_open(Term file_name, Term t2, if (st - GLOBAL_Stream < 3) { flags |= RepError_Prolog_f; } - st->vfs = NULL; - if ((st->vfs = vfs_owner(fname)) != NULL) { - st->u.private_data = st->vfs->open(fname, io_mode); + struct vfs *vfsp = NULL; + if ((vfsp = vfs_owner(fname)) != NULL) { + st->u.private_data = vfsp->open(fname, io_mode); fd = NULL; if (st->u.private_data == NULL) return (PlIOError(EXISTENCE_ERROR_SOURCE_SINK, file_name, "%s", fname)); @@ -1317,7 +1319,7 @@ do_open(Term file_name, Term t2, #endif // __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s", fname); flags &= ~(Free_Stream_f); - if (!Yap_initStream(sno, fd, fname, file_name, encoding, flags, open_mode)) + if (!Yap_initStream(sno, fd, fname, file_name, encoding, flags, open_mode, vfsp)) return false; if (open_mode == AtomWrite) { if (needs_bom && !write_bom(sno, st)) @@ -1514,7 +1516,7 @@ int Yap_OpenStream(FILE *fd, char *name, Term file_name, int flags) { at = AtomWrite; } else at = AtomRead; - Yap_initStream(sno, fd, name, file_name, LOCAL_encoding, flags, at); + Yap_initStream(sno, fd, name, file_name, LOCAL_encoding, flags, at, NULL); return sno; } diff --git a/os/iopreds.h b/os/iopreds.h index f377ca109..652453f18 100644 --- a/os/iopreds.h +++ b/os/iopreds.h @@ -33,7 +33,7 @@ INLINE_ONLY EXTERN inline bool IsStreamTerm(Term t) { extern bool Yap_initStream(int sno, FILE *fd, const char *name, Term file_name, encoding_t encoding, stream_flags_t flags, - Atom open_mode); + Atom open_mode, void *vfs); #define Yap_CheckStream(arg, kind, msg) \ Yap_CheckStream__(__FILE__, __FUNCTION__, __LINE__, arg, kind, msg) diff --git a/os/mem.c b/os/mem.c index 2664edf2f..22678ee43 100644 --- a/os/mem.c +++ b/os/mem.c @@ -186,6 +186,7 @@ bool Yap_set_stream_to_buf(StreamDesc *st, const char *buf, size_t nchars) { st->file = f = NULL; flags = Input_Stream_f | InMemory_Stream_f; + st->vfs = NULL; Yap_initStream(st - GLOBAL_Stream, f, NULL, TermNil, LOCAL_encoding, flags, AtomRead); // like any file stream. @@ -220,6 +221,7 @@ int Yap_open_buf_read_stream(const char *buf, size_t nchars, encoding_t *encp, encoding = LOCAL_encoding; st->file = f = NULL; flags = Input_Stream_f | InMemory_Stream_f; + st->vfs = NULL; Yap_initStream(sno, f, NULL, TermNil, encoding, flags, AtomRead); // like any file stream. /* currently these streams are not seekable */ @@ -269,6 +271,7 @@ int Yap_open_buf_write_stream(encoding_t enc, memBufSource src) { st->charcount = 0; st->linecount = 1; st->encoding = enc; + st->vfs = NULL; Yap_DefaultStreamOps(st); st->nbuf = st->u.mem_string.buf = malloc(PLGETC_BUF_SIZE); st->u.mem_string.src = MEM_BUF_MALLOC; diff --git a/os/pipes.c b/os/pipes.c index ef8c8c279..db3d325f7 100644 --- a/os/pipes.c +++ b/os/pipes.c @@ -230,6 +230,7 @@ open_pipe_stream (USES_REGS1) st->linecount = 1; st->stream_putc = PipePutc; st->stream_getc = PipeGetc; + st->vfs = NULL; Yap_DefaultStreamOps( st ); st->u.pipe.fd = filedes[0]; st->file = fdopen( filedes[0], "r"); @@ -242,6 +243,7 @@ open_pipe_stream (USES_REGS1) st->linepos = 0; st->charcount = 0; st->linecount = 1; + st->vfs = NULL; st->stream_putc = PipePutc; st->stream_getc = PipeGetc; Yap_DefaultStreamOps( st ); diff --git a/os/sockets.c b/os/sockets.c index 11509c2c7..02702fc11 100644 --- a/os/sockets.c +++ b/os/sockets.c @@ -242,6 +242,7 @@ Yap_InitSocketStream(int fd, socket_info flags, socket_domain domain) { st = &GLOBAL_Stream[sno]; st->u.socket.domain = domain; st->u.socket.flags = flags; + st->vfs = NULL; if (flags & (client_socket|server_session_socket)) { /* I can read and write from these sockets */ st->status = (Socket_Stream_f|Input_Stream_f|Output_Stream_f); diff --git a/packages/python/swig/CMakeLists.txt b/packages/python/swig/CMakeLists.txt index 509c94323..b76a25be8 100644 --- a/packages/python/swig/CMakeLists.txt +++ b/packages/python/swig/CMakeLists.txt @@ -5,7 +5,7 @@ INCLUDE(NewUseSWIG) include(FindPythonModule) -set (PROLOG_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yapi.yap) +set (PROLOG_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yapi.yap ${CMAKE_CURRENT_SOURCE_DIR}/jupyter.yap) set (PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yapi.py ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/__main__.py) file(RELATIVE_PATH RELATIVE_SOURCE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) @@ -59,28 +59,31 @@ else() ) endif() -file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl ) -file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os ) +set (PL ${pl_library} ${PROLOG_SOURCES} ) -add_custom_target( YAP4PY ALL - COMMAND ${CMAKE_COMMAND} -E copy ${dlls} ${CMAKE_BINARY_DIR}/libYap${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${CMAKE_CURRENT_BINARY_DIR}/yap4py - COMMAND ${CMAKE_COMMAND} -E copy ${pl_library} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog - COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/yapi.yap ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog - COMMAND ${CMAKE_COMMAND} -E copy ${pl_library} ${PROLOG_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog - COMMAND ${CMAKE_COMMAND} -E copy ${pl_boot_library} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl - COMMAND ${CMAKE_COMMAND} -E copy ${pl_os_library} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py sdist bdist_wheel - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +add_custom_target( YAP4PY_SETUP + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py + COMMAND ${CMAKE_COMMAND} -E copy ${dlls} ${CMAKE_BINARY_DIR}/libYap${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog + COMMAND ${CMAKE_COMMAND} -E copy ${PL} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl + COMMAND ${CMAKE_COMMAND} -E copy ${pl_boot_library} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os + COMMAND ${CMAKE_COMMAND} -E copy ${pl_os_library} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os DEPENDS STARTUP ${dlls} ${PYTHON_SOURCES} ${PROLOG_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/setup.py ${SWIG_MODULE_Py2YAP_REAL_NAME} ) +add_custom_target( YAP4PY ALL + COMMAND ${PYTHON_EXECUTABLE} setup.py sdist bdist_wheel + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +DEPENDS YAP4PY_SETUP) + install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --force --no-index -f dist yap4py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})" DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} ) -install(FILES yapi.yap DESTINATION ${libpl}) +install(FILES ${PROLOG_SOURCES} DESTINATION ${libpl}) diff --git a/packages/python/swig/yap4py/prolog/INDEX.pl b/packages/python/swig/yap4py/prolog/INDEX.pl deleted file mode 100644 index aa5aedf58..000000000 --- a/packages/python/swig/yap4py/prolog/INDEX.pl +++ /dev/null @@ -1,406 +0,0 @@ -index(foreach,2,aggretate,library(aggregate)). -index(aggregate,3,aggretate,library(aggregate)). -index(aggregate,4,aggretate,library(aggregate)). -index(aggregate_all,3,aggretate,library(aggregate)). -index(aggregate_all,4,aggretate,library(aggregate)). -index(free_variables,4,aggretate,library(aggregate)). -index(genarg,3,arg,library(arg)). -index(arg0,3,arg,library(arg)). -index(genarg0,3,arg,library(arg)). -index(args,3,arg,library(arg)). -index(args0,3,arg,library(arg)). -index(path_arg,3,arg,library(arg)). -index(empty_assoc,1,assoc,library(assoc)). -index(assoc_to_list,2,assoc,library(assoc)). -index(is_assoc,1,assoc,library(assoc)). -index(min_assoc,3,assoc,library(assoc)). -index(max_assoc,3,assoc,library(assoc)). -index(gen_assoc,3,assoc,library(assoc)). -index(get_assoc,3,assoc,library(assoc)). -index(get_assoc,5,assoc,library(assoc)). -index(get_next_assoc,4,assoc,library(assoc)). -index(get_prev_assoc,4,assoc,library(assoc)). -index(list_to_assoc,2,assoc,library(assoc)). -index(ord_list_to_assoc,2,assoc,library(assoc)). -index(map_assoc,2,assoc,library(assoc)). -index(map_assoc,3,assoc,library(assoc)). -index(put_assoc,4,assoc,library(assoc)). -index(del_assoc,4,assoc,library(assoc)). -index(assoc_to_keys,2,assoc,library(assoc)). -index(del_min_assoc,4,assoc,library(assoc)). -index(del_max_assoc,4,assoc,library(assoc)). -index(avl_new,1,avl,library(avl)). -index(avl_insert,4,avl,library(avl)). -index(avl_lookup,3,avl,library(avl)). -index(b_hash_new,1,b_hash,library(bhash)). -index(b_hash_new,2,b_hash,library(bhash)). -index(b_hash_new,4,b_hash,library(bhash)). -index(b_hash_lookup,3,b_hash,library(bhash)). -index(b_hash_update,3,b_hash,library(bhash)). -index(b_hash_update,4,b_hash,library(bhash)). -index(b_hash_insert_new,4,b_hash,library(bhash)). -index(b_hash_insert,4,b_hash,library(bhash)). -index(format_to_chars,3,charsio,library(charsio)). -index(format_to_chars,4,charsio,library(charsio)). -index(write_to_chars,3,charsio,library(charsio)). -index(write_to_chars,2,charsio,library(charsio)). -index(atom_to_chars,3,charsio,library(charsio)). -index(atom_to_chars,2,charsio,library(charsio)). -index(number_to_chars,3,charsio,library(charsio)). -index(number_to_chars,2,charsio,library(charsio)). -index(read_from_chars,2,charsio,library(charsio)). -index(open_chars_stream,2,charsio,library(charsio)). -index(with_output_to_chars,2,charsio,library(charsio)). -index(with_output_to_chars,3,charsio,library(charsio)). -index(with_output_to_chars,4,charsio,library(charsio)). -index(term_to_atom,2,charsio,library(charsio)). -index(chr_show_store,1,chr,library(chr)). -index(find_chr_constraint,1,chr,library(chr)). -index(chr_trace,0,chr,library(chr)). -index(chr_notrace,0,chr,library(chr)). -index(chr_leash,1,chr,library(chr)). -index(#>,2,clpfd,library(clpfd)). -index(#<,2,clpfd,library(clpfd)). -index(#>=,2,clpfd,library(clpfd)). -index(#=<,2,clpfd,library(clpfd)). -index(#=,2,clpfd,library(clpfd)). -index(#\=,2,clpfd,library(clpfd)). -index(#\,1,clpfd,library(clpfd)). -index(#<==>,2,clpfd,library(clpfd)). -index(#==>,2,clpfd,library(clpfd)). -index(#<==,2,clpfd,library(clpfd)). -index(#\/,2,clpfd,library(clpfd)). -index(#/\,2,clpfd,library(clpfd)). -index(in,2,clpfd,library(clpfd)). -index(ins,2,clpfd,library(clpfd)). -index(all_different,1,clpfd,library(clpfd)). -index(all_distinct,1,clpfd,library(clpfd)). -index(sum,3,clpfd,library(clpfd)). -index(scalar_product,4,clpfd,library(clpfd)). -index(tuples_in,2,clpfd,library(clpfd)). -index(labeling,2,clpfd,library(clpfd)). -index(label,1,clpfd,library(clpfd)). -index(indomain,1,clpfd,library(clpfd)). -index(lex_chain,1,clpfd,library(clpfd)). -index(serialized,2,clpfd,library(clpfd)). -index(global_cardinality,2,clpfd,library(clpfd)). -index(global_cardinality,3,clpfd,library(clpfd)). -index(circuit,1,clpfd,library(clpfd)). -index(element,3,clpfd,library(clpfd)). -index(automaton,3,clpfd,library(clpfd)). -index(automaton,8,clpfd,library(clpfd)). -index(transpose,2,clpfd,library(clpfd)). -index(zcompare,3,clpfd,library(clpfd)). -index(chain,2,clpfd,library(clpfd)). -index(fd_var,1,clpfd,library(clpfd)). -index(fd_inf,2,clpfd,library(clpfd)). -index(fd_sup,2,clpfd,library(clpfd)). -index(fd_size,2,clpfd,library(clpfd)). -index(fd_dom,2,clpfd,library(clpfd)). -index({},1,clpr,library(clpr)). -index(maximize,1,clpr,library(clpr)). -index(minimize,1,clpr,library(clpr)). -index(inf,2,clpr,library(clpr)). -index(inf,4,clpr,library(clpr)). -index(sup,2,clpr,library(clpr)). -index(sup,4,clpr,library(clpr)). -index(bb_inf,3,clpr,library(clpr)). -index(bb_inf,5,clpr,library(clpr)). -index(ordering,1,clpr,library(clpr)). -index(entailed,1,clpr,library(clpr)). -index(clp_type,2,clpr,library(clpr)). -index(dump,3,clpr,library(clpr)). -index(gensym,2,gensym,library(gensym)). -index(reset_gensym,1,gensym,library(gensym)). -index(reset_gensym,0,gensym,library(gensym)). -index(add_to_heap,4,heaps,library(heaps)). -index(get_from_heap,4,heaps,library(heaps)). -index(empty_heap,1,heaps,library(heaps)). -index(heap_size,2,heaps,library(heaps)). -index(heap_to_list,2,heaps,library(heaps)). -index(list_to_heap,2,heaps,library(heaps)). -index(min_of_heap,3,heaps,library(heaps)). -index(min_of_heap,5,heaps,library(heaps)). -index(jpl_get_default_jvm_opts,1,jpl,library(jpl)). -index(jpl_set_default_jvm_opts,1,jpl,library(jpl)). -index(jpl_get_actual_jvm_opts,1,jpl,library(jpl)). -index(jpl_pl_lib_version,1,jpl,library(jpl)). -index(jpl_c_lib_version,1,jpl,library(jpl)). -index(jpl_new,3,jpl,library(jpl)). -index(jpl_call,4,jpl,library(jpl)). -index(jpl_get,3,jpl,library(jpl)). -index(jpl_set,3,jpl,library(jpl)). -index(jpl_servlet_byref,3,jpl,library(jpl)). -index(jpl_servlet_byval,3,jpl,library(jpl)). -index(jpl_class_to_classname,2,jpl,library(jpl)). -index(jpl_class_to_type,2,jpl,library(jpl)). -index(jpl_classname_to_class,2,jpl,library(jpl)). -index(jpl_classname_to_type,2,jpl,library(jpl)). -index(jpl_datum_to_type,2,jpl,library(jpl)). -index(jpl_false,1,jpl,library(jpl)). -index(jpl_is_class,1,jpl,library(jpl)). -index(jpl_is_false,1,jpl,library(jpl)). -index(jpl_is_null,1,jpl,library(jpl)). -index(jpl_is_object,1,jpl,library(jpl)). -index(jpl_is_object_type,1,jpl,library(jpl)). -index(jpl_is_ref,1,jpl,library(jpl)). -index(jpl_is_true,1,jpl,library(jpl)). -index(jpl_is_type,1,jpl,library(jpl)). -index(jpl_is_void,1,jpl,library(jpl)). -index(jpl_null,1,jpl,library(jpl)). -index(jpl_object_to_class,2,jpl,library(jpl)). -index(jpl_object_to_type,2,jpl,library(jpl)). -index(jpl_primitive_type,1,jpl,library(jpl)). -index(jpl_ref_to_type,2,jpl,library(jpl)). -index(jpl_true,1,jpl,library(jpl)). -index(jpl_type_to_class,2,jpl,library(jpl)). -index(jpl_type_to_classname,2,jpl,library(jpl)). -index(jpl_void,1,jpl,library(jpl)). -index(jpl_array_to_length,2,jpl,library(jpl)). -index(jpl_array_to_list,2,jpl,library(jpl)). -index(jpl_datums_to_array,2,jpl,library(jpl)). -index(jpl_enumeration_element,2,jpl,library(jpl)). -index(jpl_enumeration_to_list,2,jpl,library(jpl)). -index(jpl_hashtable_pair,2,jpl,library(jpl)). -index(jpl_iterator_element,2,jpl,library(jpl)). -index(jpl_list_to_array,2,jpl,library(jpl)). -index(jpl_list_to_array,3,jpl,library(jpl)). -index(jpl_terms_to_array,2,jpl,library(jpl)). -index(jpl_map_element,2,jpl,library(jpl)). -index(jpl_set_element,2,jpl,library(jpl)). -index(append,3,lists,library(lists)). -index(append,2,lists,library(lists)). -index(delete,3,lists,library(lists)). -index(intersection,3,lists,library(lists)). -index(flatten,2,lists,library(lists)). -index(last,2,lists,library(lists)). -index(list_concat,2,lists,library(lists)). -index(max_list,2,lists,library(lists)). -index(member,2,lists,library(lists)). -index(memberchk,2,lists,library(lists)). -index(min_list,2,lists,library(lists)). -index(nextto,3,lists,library(lists)). -index(nth,3,lists,library(lists)). -index(nth,4,lists,library(lists)). -index(nth0,3,lists,library(lists)). -index(nth0,4,lists,library(lists)). -index(nth1,3,lists,library(lists)). -index(nth1,4,lists,library(lists)). -index(numlist,3,lists,library(lists)). -index(permutation,2,lists,library(lists)). -index(prefix,2,lists,library(lists)). -index(remove_duplicates,2,lists,library(lists)). -index(reverse,2,lists,library(lists)). -index(same_length,2,lists,library(lists)). -index(select,3,lists,library(lists)). -index(selectchk,3,lists,library(lists)). -index(sublist,2,lists,library(lists)). -index(substitute,4,lists,library(lists)). -index(subtract,3,lists,library(lists)). -index(suffix,2,lists,library(lists)). -index(sum_list,2,lists,library(lists)). -index(sum_list,3,lists,library(lists)). -index(sumlist,2,lists,library(lists)). -index(nb_queue,1,nb,library(nb)). -index(nb_queue,2,nb,library(nb)). -index(nb_queue_close,3,nb,library(nb)). -index(nb_queue_enqueue,2,nb,library(nb)). -index(nb_queue_dequeue,2,nb,library(nb)). -index(nb_queue_peek,2,nb,library(nb)). -index(nb_queue_empty,1,nb,library(nb)). -index(nb_queue_size,2,nb,library(nb)). -index(nb_heap,2,nb,library(nb)). -index(nb_heap_close,1,nb,library(nb)). -index(nb_heap_add,3,nb,library(nb)). -index(nb_heap_del,3,nb,library(nb)). -index(nb_heap_peek,3,nb,library(nb)). -index(nb_heap_empty,1,nb,library(nb)). -index(nb_heap_size,2,nb,library(nb)). -index(nb_beam,2,nb,library(nb)). -index(nb_beam_close,1,nb,library(nb)). -index(nb_beam_add,3,nb,library(nb)). -index(nb_beam_del,3,nb,library(nb)). -index(nb_beam_peek,3,nb,library(nb)). -index(nb_beam_empty,1,nb,library(nb)). -index(nb_beam_size,2,nb,library(nb)). -index(contains_term,2,occurs,library(occurs)). -index(contains_var,2,occurs,library(occurs)). -index(free_of_term,2,occurs,library(occurs)). -index(free_of_var,2,occurs,library(occurs)). -index(occurrences_of_term,3,occurs,library(occurs)). -index(occurrences_of_var,3,occurs,library(occurs)). -index(sub_term,2,occurs,library(occurs)). -index(sub_var,2,occurs,library(occurs)). -index(option,2,swi_option,library(option)). -index(option,3,swi_option,library(option)). -index(select_option,3,swi_option,library(option)). -index(select_option,4,swi_option,library(option)). -index(merge_options,3,swi_option,library(option)). -index(meta_options,3,swi_option,library(option)). -index(list_to_ord_set,2,ordsets,library(ordsets)). -index(merge,3,ordsets,library(ordsets)). -index(ord_add_element,3,ordsets,library(ordsets)). -index(ord_del_element,3,ordsets,library(ordsets)). -index(ord_disjoint,2,ordsets,library(ordsets)). -index(ord_insert,3,ordsets,library(ordsets)). -index(ord_member,2,ordsets,library(ordsets)). -index(ord_intersect,2,ordsets,library(ordsets)). -index(ord_intersect,3,ordsets,library(ordsets)). -index(ord_intersection,3,ordsets,library(ordsets)). -index(ord_intersection,4,ordsets,library(ordsets)). -index(ord_seteq,2,ordsets,library(ordsets)). -index(ord_setproduct,3,ordsets,library(ordsets)). -index(ord_subset,2,ordsets,library(ordsets)). -index(ord_subtract,3,ordsets,library(ordsets)). -index(ord_symdiff,3,ordsets,library(ordsets)). -index(ord_union,2,ordsets,library(ordsets)). -index(ord_union,3,ordsets,library(ordsets)). -index(ord_union,4,ordsets,library(ordsets)). -index(ord_empty,1,ordsets,library(ordsets)). -index(ord_memberchk,2,ordsets,library(ordsets)). -index(pairs_keys_values,3,pairs,library(pairs)). -index(pairs_values,2,pairs,library(pairs)). -index(pairs_keys,2,pairs,library(pairs)). -index(group_pairs_by_key,2,pairs,library(pairs)). -index(transpose_pairs,2,pairs,library(pairs)). -index(map_list_to_pairs,3,pairs,library(pairs)). -index(xref_source,1,prolog_xref,library(prolog_xref)). -index(xref_called,3,prolog_xref,library(prolog_xref)). -index(xref_defined,3,prolog_xref,library(prolog_xref)). -index(xref_definition_line,2,prolog_xref,library(prolog_xref)). -index(xref_exported,2,prolog_xref,library(prolog_xref)). -index(xref_module,2,prolog_xref,library(prolog_xref)). -index(xref_op,2,prolog_xref,library(prolog_xref)). -index(xref_clean,1,prolog_xref,library(prolog_xref)). -index(xref_current_source,1,prolog_xref,library(prolog_xref)). -index(xref_done,2,prolog_xref,library(prolog_xref)). -index(xref_built_in,1,prolog_xref,library(prolog_xref)). -index(xref_expand,2,prolog_xref,library(prolog_xref)). -index(xref_source_file,3,prolog_xref,library(prolog_xref)). -index(xref_source_file,4,prolog_xref,library(prolog_xref)). -index(xref_public_list,4,prolog_xref,library(prolog_xref)). -index(xref_meta,2,prolog_xref,library(prolog_xref)). -index(xref_hook,1,prolog_xref,library(prolog_xref)). -index(xref_used_class,2,prolog_xref,library(prolog_xref)). -index(xref_defined_class,3,prolog_xref,library(prolog_xref)). -index(set_test_options,1,plunit,library(plunit)). -index(begin_tests,1,plunit,library(plunit)). -index(begin_tests,2,plunit,library(plunit)). -index(end_tests,1,plunit,library(plunit)). -index(run_tests,0,plunit,library(plunit)). -index(run_tests,1,plunit,library(plunit)). -index(load_test_files,1,plunit,library(plunit)). -index(running_tests,0,plunit,library(plunit)). -index(test_report,1,plunit,library(plunit)). -index(make_queue,1,queues,library(queues)). -index(join_queue,3,queues,library(queues)). -index(list_join_queue,3,queues,library(queues)). -index(jump_queue,3,queues,library(queues)). -index(list_jump_queue,3,queues,library(queues)). -index(head_queue,2,queues,library(queues)). -index(serve_queue,3,queues,library(queues)). -index(length_queue,2,queues,library(queues)). -index(empty_queue,1,queues,library(queues)). -index(list_to_queue,2,queues,library(queues)). -index(queue_to_list,2,queues,library(queues)). -index(random,1,random,library(random)). -index(random,3,random,library(random)). -index(randseq,3,random,library(random)). -index(randset,3,random,library(random)). -index(getrand,1,random,library(random)). -index(setrand,1,random,library(random)). -index(rb_new,1,rbtrees,library(rbtrees)). -index(rb_empty,1,rbtrees,library(rbtrees)). -index(rb_lookup,3,rbtrees,library(rbtrees)). -index(rb_update,4,rbtrees,library(rbtrees)). -index(rb_update,5,rbtrees,library(rbtrees)). -index(rb_apply,4,rbtrees,library(rbtrees)). -index(rb_lookupall,3,rbtrees,library(rbtrees)). -index(rb_insert,4,rbtrees,library(rbtrees)). -index(rb_insert_new,4,rbtrees,library(rbtrees)). -index(rb_delete,3,rbtrees,library(rbtrees)). -index(rb_delete,4,rbtrees,library(rbtrees)). -index(rb_visit,2,rbtrees,library(rbtrees)). -index(rb_visit,3,rbtrees,library(rbtrees)). -index(rb_keys,2,rbtrees,library(rbtrees)). -index(rb_keys,3,rbtrees,library(rbtrees)). -index(rb_map,2,rbtrees,library(rbtrees)). -index(rb_map,3,rbtrees,library(rbtrees)). -index(rb_partial_map,4,rbtrees,library(rbtrees)). -index(rb_clone,3,rbtrees,library(rbtrees)). -index(rb_clone,4,rbtrees,library(rbtrees)). -index(rb_min,3,rbtrees,library(rbtrees)). -index(rb_max,3,rbtrees,library(rbtrees)). -index(rb_del_min,4,rbtrees,library(rbtrees)). -index(rb_del_max,4,rbtrees,library(rbtrees)). -index(rb_next,4,rbtrees,library(rbtrees)). -index(rb_previous,4,rbtrees,library(rbtrees)). -index(list_to_rbtree,2,rbtrees,library(rbtrees)). -index(ord_list_to_rbtree,2,rbtrees,library(rbtrees)). -index(is_rbtree,1,rbtrees,library(rbtrees)). -index(rb_size,2,rbtrees,library(rbtrees)). -index(rb_in,3,rbtrees,library(rbtrees)). -index(read_line_to_codes,2,read_util,library(readutil)). -index(read_line_to_codes,3,read_util,library(readutil)). -index(read_stream_to_codes,2,read_util,library(readutil)). -index(read_stream_to_codes,3,read_util,library(readutil)). -index(read_file_to_codes,3,read_util,library(readutil)). -index(read_file_to_terms,3,read_util,library(readutil)). -index(regexp,3,regexp,library(regexp)). -index(regexp,4,regexp,library(regexp)). -index(load_foreign_library,1,shlib,library(shlib)). -index(load_foreign_library,2,shlib,library(shlib)). -index(unload_foreign_library,1,shlib,library(shlib)). -index(unload_foreign_library,2,shlib,library(shlib)). -index(current_foreign_library,2,shlib,library(shlib)). -index(reload_foreign_libraries,0,shlib,library(shlib)). -index(use_foreign_library,1,shlib,library(shlib)). -index(use_foreign_library,2,shlib,library(shlib)). -index(datime,1,operating_system_support,library(system)). -index(delete_file,1,operating_system_support,library(system)). -index(delete_file,2,operating_system_support,library(system)). -index(directory_files,2,operating_system_support,library(system)). -index(environ,2,operating_system_support,library(system)). -index(exec,3,operating_system_support,library(system)). -index(file_exists,1,operating_system_support,library(system)). -index(file_exists,2,operating_system_support,library(system)). -index(file_property,2,operating_system_support,library(system)). -index(host_id,1,operating_system_support,library(system)). -index(host_name,1,operating_system_support,library(system)). -index(pid,1,operating_system_support,library(system)). -index(kill,2,operating_system_support,library(system)). -index(mktemp,2,operating_system_support,library(system)). -index(make_directory,1,operating_system_support,library(system)). -index(popen,3,operating_system_support,library(system)). -index(rename_file,2,operating_system_support,library(system)). -index(shell,0,operating_system_support,library(system)). -index(shell,1,operating_system_support,library(system)). -index(shell,2,operating_system_support,library(system)). -index(sleep,1,operating_system_support,library(system)). -index(system,0,operating_system_support,library(system)). -index(system,1,operating_system_support,library(system)). -index(system,2,operating_system_support,library(system)). -index(mktime,2,operating_system_support,library(system)). -index(tmpnam,1,operating_system_support,library(system)). -index(tmp_file,2,operating_system_support,library(system)). -index(tmpdir,1,operating_system_support,library(system)). -index(wait,2,operating_system_support,library(system)). -index(working_directory,2,operating_system_support,library(system)). -index(term_hash,2,terms,library(terms)). -index(term_hash,4,terms,library(terms)). -index(instantiated_term_hash,4,terms,library(terms)). -index(variant,2,terms,library(terms)). -index(unifiable,3,terms,library(terms)). -index(subsumes,2,terms,library(terms)). -index(subsumes_chk,2,terms,library(terms)). -index(cyclic_term,1,terms,library(terms)). -index(variable_in_term,2,terms,library(terms)). -index(variables_within_term,3,terms,library(terms)). -index(new_variables_in_term,3,terms,library(terms)). -index(time_out,3,timeout,library(timeout)). -index(get_label,3,trees,library(trees)). -index(list_to_tree,2,trees,library(trees)). -index(map_tree,3,trees,library(trees)). -index(put_label,4,trees,library(trees)). -index(tree_size,2,trees,library(trees)). -index(tree_to_list,2,trees,library(trees)). diff --git a/packages/python/swig/yap4py/prolog/apply.yap b/packages/python/swig/yap4py/prolog/apply.yap deleted file mode 100644 index 92127969b..000000000 --- a/packages/python/swig/yap4py/prolog/apply.yap +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file apply.yap - * @author VITOR SANTOS COSTA - * @date Mon Nov 16 23:00:08 2015 - * - * @brief Stub for maplist and friends - * - * -*/ - - -:- module(apply_stub,[]). - -/** -* @file apply.yap -* @defgroup apply_stub Apply Predicates -* -* @ingroup library -* -* @{ - -This library provides a SWI-compatible set of utilities for applying a -predicate to all elements of a list. - -The apply library is a _stub_, it just forwards definitions to the -@ref maplist library. The predicates forwarded are: - - - maplist/2, - - maplist/3, - - maplist/4, - - maplist/5, - - include/3, - - exclude/3, - - partition/4, - - partition/5 - - */ - -:- reexport(library(maplist), - [maplist/2, - maplist/3, - maplist/4, - maplist/5, - include/3, - exclude/3, - partition/4, - partition/5 - ]). - - -%% @} - diff --git a/packages/python/swig/yap4py/prolog/apply_macros.yap b/packages/python/swig/yap4py/prolog/apply_macros.yap deleted file mode 100644 index 3302a3849..000000000 --- a/packages/python/swig/yap4py/prolog/apply_macros.yap +++ /dev/null @@ -1,38 +0,0 @@ - -%% @file apply_macros.yap -%% @author E. Alphonse from code by Joachim Schimpf -%% @date 15 June 2002 -%% @nrief Purpose: Macros to apply a predicate to all elements -% of a list or to all sub-terms of a term. - -:- module(apply_macros, []). - -/** - -@defgroup apply_macros Apply Interface to maplist -@ingroup library -@{ - -This library provides a SWI-compatible set of utilities for applying a -predicate to all elements of a list. - -The apply library just forwards -definitions to the @ref maplist library, these include: - - - maplist/2, - - maplist/3, - - maplist/4, - - maplist/5, - - include/3, - - exclude/3, - - partition/4, - - partition/5 - - -*/ - -:- reexport(maplist). - -:- reexport(mapargs). - -%% @} diff --git a/packages/python/swig/yap4py/prolog/arg.yap b/packages/python/swig/yap4py/prolog/arg.yap deleted file mode 100644 index 35424861a..000000000 --- a/packages/python/swig/yap4py/prolog/arg.yap +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @file arg.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 01:08:55 2015 - * - * @brief -*/ - - -/** -* - -@defgroup args Term Argument Manipulation. - -@ingroup @library - -@{ - -Extends arg/3 by including backtracking through arguments and access -to sub-arguments, - - - arg0/3 - - args/3 - - args0/3 - - genarg/3 - - genarg0/3 - - path_arg/3 - - -It is based on the Quintus Prolog arg library. Except for project, all -predicates use the arg/3 argument pattern. -This file has been included in the YAP library by Vitor Santos Costa, 2008. No error checking is actuallly performed within the package: this left to the C-code thaat implements arg``/3 and -genarg/3. -*/ - -:- module(arg, - [ - genarg/3, - arg0/3, - genarg0/3, - args/3, - args0/3, -% project/3 - path_arg/3 - ]). - - - -/** - * @pred arg0( +_Index_, +_Term_ , -_Arg_ ) - * - * Similar to arg/3, but `arg0(0,_T_,_F_)` unifies _F_ with _T_'s principal functor: - -~~~~~~~~~ -?- arg0(0, f(a,b), A). -A = f. -?- arg0(1, f(a,b), A). -A = a. -?- arg0(2, f(a,b), A). -A = b. -~~~~~~~~~ - -*/ -arg0(0,T,A) :- !, - functor(T,A,_). -arg0(I,T,A) :- - arg(I,T,A). - -/** - * @pred genarg0( +_Index_, +_Term_ , -_Arg_ ) - * - * Similar to genarg/3, but `genarg0(0,_T_,_F_)` unifies _F_ with _T_'s principal functor: -~~~~~~~~~ -?- genarg0(I,f(a,b),A). -A = f, -I = 0 ? ; -A = a, -I = 1 ? ; -A = b, -I = 2. -~~~~~~~~~ - -*/ -genarg0(I,T,A) :- - nonvar(I), !, - arg0(I,T,A). -genarg0(0,T,A) :- - functor(T,A,_). -genarg0(I,T,A) :- - genarg(I,T,A). - -/** - * @pred args( +_Index_, +_ListOfTerms_ , -_ListOfArgs_ ) - * - * Succeeds if _ListOfArgs_ unifies with the application of genarg/3 to every element of _ListOfTerms_. - -It corresponds to calling maplist/3 on genarg/3: -~~~~~~~~~ -args( I, Ts, As) :- - maplist( genarg(I), Ts, As). -~~~~~~~~~ - -Notice that unification allows _ListOfArgs_ to be bound, eg: - -~~~~~~~~~ -?- args(1, [X1+Y1,X2-Y2,X3*Y3,X4/Y4], [1,1,1,1]). -X1 = X2 = X3 = X4 = 1. -~~~~~~~~~ - - -*/ -args(_,[],[]). -args(I,[T|List],[A|ArgList]) :- - genarg(I, T, A), - args(I, List, ArgList). - -/** - * @pred args0( +_Index_, +_ListOfTerms_ , -_ListOfArgs_ ) - * - * Succeeds if _ListOfArgs_ unifies with the application of genarg0/3 to every element of _ListOfTerms_. - -It corresponds to calling maplist/3 on genarg0/3: -~~~~~~~~~ -args( I, Ts, As) :- - maplist( genarg0(I), Ts, As). -~~~~~~~~~ - -Notice that unification allows _ListOfArgs_ to be bound, eg: - -~~~~~~~~~ -?- args(1, [X1+Y1,X2-Y2,X3*Y3,X4/Y4], [1,1,1,1]). -X1 = X2 = X3 = X4 = 1. -~~~~~~~~~ - - -*/ -args0(_,[],[]). -args0(I,[T|List],[A|ArgList]) :- - genarg(I, T, A), - args0(I, List, ArgList). - -/** - * @pred args0( +_ListOfTerms_ , +_Index_, -_ListOfArgs_ ) - * - * Succeeds if _ListOfArgs_ unifies with the application of genarg0/3 to every element of _ListOfTerms_. - -It corresponds to calling args0/3 but with a different order. -*/ -project(Terms, Index, Args) :- - args0(Index, Terms, Args). - -% no error checking here! -/** - * @pred path_arg( +_Path_ , +_Term_, -_Arg_ ) - * - * Succeeds if _Path_ is empty and _Arg unifies with _Term_, or if _Path_ is a list with _Head_ and _Tail_, genarg/3 succeeds on the current term, and path_arg/3 succeeds on its argument. - * - * Notice that it can be used to enumerate all possible paths in a term. -*/ -path_arg([], Term, Term). -path_arg([Index|Indices], Term, SubTerm) :- - genarg(Index, Term, Arg), - path_arg(Indices, Arg, SubTerm). - -%%% @} - -/** @} */ diff --git a/packages/python/swig/yap4py/prolog/assoc.yap b/packages/python/swig/yap4py/prolog/assoc.yap deleted file mode 100644 index c06e0dee7..000000000 --- a/packages/python/swig/yap4py/prolog/assoc.yap +++ /dev/null @@ -1,296 +0,0 @@ - -/** - * @file assoc.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 13:53:34 2015 - * - * @brief Red-Black Implementation of Association Lists. - * - * This file has been included as an YAP library by Vitor Santos Costa, 1999 - * - * Note: the keys should be bound, the associated values need not be. -*/ - -:- module(assoc, [ - empty_assoc/1, - assoc_to_list/2, - is_assoc/1, - min_assoc/3, - max_assoc/3, - gen_assoc/3, - get_assoc/3, - get_assoc/5, - get_next_assoc/4, - get_prev_assoc/4, - list_to_assoc/2, - ord_list_to_assoc/2, - map_assoc/2, - map_assoc/3, - put_assoc/4, - del_assoc/4, - assoc_to_keys/2, - del_min_assoc/4, - del_max_assoc/4 - ]). - -/** @defgroup Association_Lists Association Lists -@ingroup library -@{ - -The following association list manipulation predicates are available -once included with the `use_module(library(assoc))` command. The -original library used Richard O'Keefe's implementation, on top of -unbalanced binary trees. The current code utilises code from the -red-black trees library and emulates the SICStus Prolog interface. - -The library exports the following definitions: - -- is/assoc/1 - - -*/ - - - -:- meta_predicate map_assoc(2, +, -), map_assoc(1, +). - -:- use_module(library(rbtrees), [ - rb_empty/1, - rb_visit/2, - is_rbtree/1, - rb_min/3, - rb_max/3, - rb_in/3, - rb_lookup/3, - rb_update/5, - rb_next/4, - rb_previous/4, - list_to_rbtree/2, - ord_list_to_rbtree/2, - rb_map/2, - rb_map/3, - rb_keys/2, - rb_update/4, - rb_insert/4, - rb_delete/4, - rb_del_min/4, - rb_del_max/4 - ]). - -/** @pred empty_assoc(+ _Assoc_) - -Succeeds if association list _Assoc_ is empty. - -*/ -empty_assoc(t). - -/** @pred assoc_to_list(+ _Assoc_,? _List_) - - -Given an association list _Assoc_ unify _List_ with a list of -the form _Key-Val_, where the elements _Key_ are in ascending -order. - - -*/ -assoc_to_list(t, L) :- !, L = []. -assoc_to_list(T, L) :- - rb_visit(T, L). - -/** @pred is_assoc(+ _Assoc_) - -Succeeds if _Assoc_ is an association list, that is, if it is a -red-black tree. -*/ -is_assoc(t) :- !. -is_assoc(T) :- - is_rbtree(T). - -/** @pred min_assoc(+ _Assoc_,- _Key_,? _Value_) - - -Given the association list - _Assoc_, _Key_ in the smallest key in the list, and _Value_ -the associated value. - - -*/ -min_assoc(T,K,V) :- - rb_min(T,K,V). - -/** @pred max_assoc(+ _Assoc_,- _Key_,? _Value_) - - -Given the association list - _Assoc_, _Key_ in the largest key in the list, and _Value_ -the associated value. - - -*/ -max_assoc(T,K,V) :- - rb_max(T,K,V). - -/** @pred gen_assoc( ?Key, +Assoc, ?Valu_) - - -Given the association list _Assoc_, unify _Key_ and _Value_ -with a key-value pair in the list. It can be used to enumerate all elements -in the association list. -*/ -gen_assoc(K, T, V) :- - rb_in(K,V,T). - -/** @pred get_assoc(+ _Key_,+ _Assoc_,? _Value_) - - -If _Key_ is one of the elements in the association list _Assoc_, -return the associated value. -*/ -get_assoc(K,T,V) :- - rb_lookup(K,V,T). - -/** @pred get_assoc(+ _Key_,+ _Assoc_,? _Value_,+ _NAssoc_,? _NValue_) - - -If _Key_ is one of the elements in the association list _Assoc_, -return the associated value _Value_ and a new association list - _NAssoc_ where _Key_ is associated with _NValue_. - - -*/ -get_assoc(K,T,V,NT,NV) :- - rb_update(T,K,V,NV,NT). - -/** @pred get_next_assoc(+ _Key_,+ _Assoc_,? _Next_,? _Value_) - -If _Key_ is one of the elements in the association list _Assoc_, -return the next key, _Next_, and its value, _Value_. - - -*/ -get_next_assoc(K,T,KN,VN) :- - rb_next(T,K,KN,VN). - -/** @pred get_prev_assoc(+ _Key_,+ _Assoc_,? _Next_,? _Value_) - - -If _Key_ is one of the elements in the association list _Assoc_, -return the previous key, _Next_, and its value, _Value_. - - -*/ -get_prev_assoc(K,T,KP,VP) :- - rb_previous(T,K,KP,VP). - -/** @pred list_to_assoc(+ _List_,? _Assoc_) - - -Given a list _List_ such that each element of _List_ is of the -form _Key-Val_, and all the _Keys_ are unique, _Assoc_ is -the corresponding association list. - - -*/ -list_to_assoc(L, T) :- - list_to_rbtree(L, T). - -/** @pred ord_list_to_assoc(+ _List_,? _Assoc_) - - -Given an ordered list _List_ such that each element of _List_ is -of the form _Key-Val_, and all the _Keys_ are unique, _Assoc_ is -the corresponding association list. - -*/ -ord_list_to_assoc(L, T) :- - ord_list_to_rbtree(L, T). - -/** @pred map_assoc(+ _Pred_,+ _Assoc_) - - -Succeeds if the unary predicate name _Pred_( _Val_) holds for every -element in the association list. - - -*/ -map_assoc(t, _) :- !. -map_assoc(P, T) :- - yap_flag(typein_module, M0), - extract_mod(P, M0, M, G), - functor(G, Name, 1), - rb_map(T, M:Name). - -/** @pred map_assoc(+ _Pred_,+ _Assoc_,? _New_) - -Given the binary predicate name _Pred_ and the association list - _Assoc_, _New_ in an association list with keys in _Assoc_, -and such that if _Key-Val_ is in _Assoc_, and _Key-Ans_ is in - _New_, then _Pred_( _Val_, _Ans_) holds.*/ -map_assoc(t, T, T) :- !. -map_assoc(P, T, NT) :- - yap_flag(typein_module, M0), - extract_mod(P, M0, M, G), - functor(G, Name, 2), - rb_map(T, M:Name, NT). - - -extract_mod(G,_,_) :- var(G), !, fail. -extract_mod(M:G, _, FM, FG ) :- !, - extract_mod(G, M, FM, FG ). -extract_mod(G, M, M, G ). - -/** @pred put_assoc(+ _Key_,+ _Assoc_,+ _Val_,+ _New_) - -The association list _New_ includes and element of association - _key_ with _Val_, and all elements of _Assoc_ that did not -have key _Key_. - -*/ -put_assoc(K, T, V, NT) :- - rb_update(T, K, V, NT), !. -put_assoc(K, t, V, NT) :- !, - rbtrees:rb_new(K,V,NT). -put_assoc(K, T, V, NT) :- - rb_insert(T, K, V, NT). - -/** @pred del_assoc(+ _Key_, + _Assoc_, ? _Val_, ? _NewAssoc_) - - -Succeeds if _NewAssoc_ is an association list, obtained by removing -the element with _Key_ and _Val_ from the list _Assoc_. - - -*/ -del_assoc(K, T, V, NT) :- - rb_delete(T, K, V, NT). - -/** @pred del_min_assoc(+ _Assoc_, ? _Key_, ? _Val_, ? _NewAssoc_) - - -Succeeds if _NewAssoc_ is an association list, obtained by removing -the smallest element of the list, with _Key_ and _Val_ -from the list _Assoc_. - -*/ -del_min_assoc(T, K, V, NT) :- - rb_del_min(T, K, V, NT). - -/** @pred del_max_assoc(+ _Assoc_, ? _Key_, ? _Val_, ? _NewAssoc_) - - -Succeeds if _NewAssoc_ is an association list, obtained by removing -the largest element of the list, with _Key_ and _Val_ from the -list _Assoc_. - -*/ -del_max_assoc(T, K, V, NT) :- - rb_del_max(T, K, V, NT). - - -assoc_to_keys(T, Ks) :- - rb_keys(T, Ks). - - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/atts.yap b/packages/python/swig/yap4py/prolog/atts.yap deleted file mode 100644 index de245a6ec..000000000 --- a/packages/python/swig/yap4py/prolog/atts.yap +++ /dev/null @@ -1,280 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: atts.yap * -* Last rev: 8/2/88 * -* mods: * -* comments: attribute support for Prolog * -* * -*************************************************************************/ - -:- module(attributes, [op(1150, fx, attribute)]). - -/** - * - * @defgroup sicsatts SICStus style attribute declarations - * - * @ingroup attributes - * - * @{ - * - - SICStus style attribute declarations are activated through loading the - library atts. The command - - ~~~~~ - | ?- use_module(library(atts)). - ~~~~~ - enables this form of attributed variables. - - The directive - - - attribute/1 - - and the following user defined predicates can be used: - - - Module:get_atts/2 - - - Module:put_atts/2 - - - Module:put_atts/3 - - - Module:woken_att_do/4 - -*/ - - -:- use_module(library(lists), [member/2]). - -:- multifile - user:goal_expansion/3. - :- multifile - user:term_expansion/2. - :- multifile - attributed_module/3. - -:- dynamic existing_attribute/4. -:- dynamic modules_with_attributes/1. -:- dynamic attributed_module/3. - -modules_with_attributes([]). - -% -% defining a new attribute is just a question of establishing a -% Functor, Mod -> INT mappings -% -new_attribute(V) :- var(V), !, - throw(error(instantiation_error,attribute(V))). -new_attribute((At1,At2)) :- - new_attribute(At1), - new_attribute(At2). -new_attribute(Na/Ar) :- - source_module(Mod), - functor(S,Na,Ar), - existing_attribute(S,Mod,_,_) , !. -new_attribute(Na/Ar) :- - source_module(Mod), - functor(S,Na,Ar), - store_new_module(Mod,Ar,Position), - assertz(existing_attribute(S,Mod,Ar,Position)). - -store_new_module(Mod,Ar,ArgPosition) :- - ( - retract(attributed_module(Mod,Position,_)) - -> - true - ; - retract(modules_with_attributes(Mods)), - assert(modules_with_attributes([Mod|Mods])), Position = 2 - ), - ArgPosition is Position+1, - ( Ar == 0 -> NOfAtts is Position+1 ; NOfAtts is Position+Ar), - functor(AccessTerm,Mod,NOfAtts), - assertz(attributed_module(Mod,NOfAtts,AccessTerm)). - -:- user_defined_directive(attribute(G), attributes:new_attribute(G)). - -/** @pred Module:get_atts( _-Var_, _?ListOfAttributes_) - - -Unify the list _?ListOfAttributes_ with the attributes for the unbound -variable _Var_. Each member of the list must be a bound term of the -form `+( _Attribute_)`, `-( _Attribute_)` (the kbd -prefix may be dropped). The meaning of + and - is: - + +( _Attribute_) - Unifies _Attribute_ with a corresponding attribute associated with - _Var_, fails otherwise. - - + -( _Attribute_) - Succeeds if a corresponding attribute is not associated with - _Var_. The arguments of _Attribute_ are ignored. - - -*/ -user:goal_expansion(get_atts(Var,AccessSpec), Mod, Goal) :- - expand_get_attributes(AccessSpec,Mod,Var,Goal). - -/** @pred Module:put_atts( _-Var_, _?ListOfAttributes_) - - -Associate with or remove attributes from a variable _Var_. The -attributes are given in _?ListOfAttributes_, and the action depends -on how they are prefixed: - - + +( _Attribute_ ) - Associate _Var_ with _Attribute_. A previous value for the - attribute is simply replace (like with `set_mutable/2`). - - + -( _Attribute_ ) - Remove the attribute with the same name. If no such attribute existed, - simply succeed. - - */ -user:goal_expansion(put_atts(Var,AccessSpec), Mod, Goal) :- - expand_put_attributes(AccessSpec, Mod, Var, Goal). - - -expand_get_attributes(V,_,_,_) :- var(V), !, fail. -expand_get_attributes([],_,_,true) :- !. -expand_get_attributes([-G1],Mod,V,attributes:free_att(V,Mod,Pos)) :- - existing_attribute(G1,Mod,_,Pos), !. -expand_get_attributes([+G1],Mod,V,attributes:get_att(V,Mod,Pos,A)) :- - existing_attribute(G1,Mod,1,Pos), !, - arg(1,G1,A). -expand_get_attributes([G1],Mod,V,attributes:get_att(V,Mod,Pos,A)) :- - existing_attribute(G1,Mod,1,Pos), !, - arg(1,G1,A). -expand_get_attributes(Atts,Mod,Var,attributes:get_module_atts(Var,AccessTerm)) :- Atts = [_|_], !, - attributed_module(Mod,NOfAtts,AccessTerm), - void_term(Void), - cvt_atts(Atts,Mod,Void,LAtts), - sort(LAtts,SortedLAtts), - free_term(Free), - build_att_term(1,NOfAtts,SortedLAtts,Free,AccessTerm). -expand_get_attributes(Att,Mod,Var,Goal) :- - expand_get_attributes([Att],Mod,Var,Goal). - -build_att_term(NOfAtts,NOfAtts,[],_,_) :- !. -build_att_term(I0,NOfAtts,[I-Info|SortedLAtts],Void,AccessTerm) :- - I is I0+1, !, - copy_att_args(Info,I0,NI,AccessTerm), - build_att_term(NI,NOfAtts,SortedLAtts,Void,AccessTerm). -build_att_term(I0,NOfAtts,SortedLAtts,Void,AccessTerm) :- - I is I0+1, - arg(I,AccessTerm,Void), - build_att_term(I,NOfAtts,SortedLAtts,Void,AccessTerm). - -cvt_atts(V,_,_,_) :- var(V), !, fail. -cvt_atts([],_,_,[]). -cvt_atts([V|_],_,_,_) :- var(V), !, fail. -cvt_atts([+Att|Atts],Mod,Void,[Pos-LAtts|Read]) :- !, - existing_attribute(Att,Mod,_,Pos), - (atom(Att) -> LAtts = [_] ; Att=..[_|LAtts]), - cvt_atts(Atts,Mod,Void,Read). -cvt_atts([-Att|Atts],Mod,Void,[Pos-LVoids|Read]) :- !, - existing_attribute(Att,Mod,_,Pos), - ( - atom(Att) - -> - LVoids = [Void] - ; - Att =..[_|LAtts], - void_vars(LAtts,Void,LVoids) - ), - cvt_atts(Atts,Mod,Void,Read). -cvt_atts([Att|Atts],Mod,Void,[Pos-LAtts|Read]) :- !, - existing_attribute(Att,Mod,_,Pos), - (atom(Att) -> LAtts = [_] ; Att=..[_|LAtts]), - cvt_atts(Atts,Mod,Void,Read). - -copy_att_args([],I,I,_). -copy_att_args([V|Info],I,NI,AccessTerm) :- - I1 is I+1, - arg(I1,AccessTerm,V), - copy_att_args(Info,I1,NI,AccessTerm). - -void_vars([],_,[]). -void_vars([_|LAtts],Void,[Void|LVoids]) :- - void_vars(LAtts,Void,LVoids). - -expand_put_attributes(V,_,_,_) :- var(V), !, fail. -expand_put_attributes([-G1],Mod,V,attributes:rm_att(V,Mod,NOfAtts,Pos)) :- - existing_attribute(G1,Mod,_,Pos), !, - attributed_module(Mod,NOfAtts,_). -expand_put_attributes([+G1],Mod,V,attributes:put_att(V,Mod,NOfAtts,Pos,A)) :- - existing_attribute(G1,Mod,1,Pos), !, - attributed_module(Mod,NOfAtts,_), - arg(1,G1,A). -expand_put_attributes([G1],Mod,V,attributes:put_att(V,Mod,NOfAtts,Pos,A)) :- - existing_attribute(G1,Mod,1,Pos), !, - attributed_module(Mod,NOfAtts,_), - arg(1,G1,A). -expand_put_attributes(Atts,Mod,Var,attributes:put_module_atts(Var,AccessTerm)) :- Atts = [_|_], !, - attributed_module(Mod,NOfAtts,AccessTerm), - void_term(Void), - cvt_atts(Atts,Mod,Void,LAtts), - sort(LAtts,SortedLAtts), - free_term(Free), - build_att_term(1,NOfAtts,SortedLAtts,Free,AccessTerm). -expand_put_attributes(Att,Mod,Var,Goal) :- - expand_put_attributes([Att],Mod,Var,Goal). - -woken_att_do(AttVar, Binding, NGoals, DoNotBind) :- - modules_with_attributes(AttVar,Mods0), - modules_with_attributes(Mods), - find_used(Mods,Mods0,[],ModsI), - do_verify_attributes(ModsI, AttVar, Binding, Goals), - process_goals(Goals, NGoals, DoNotBind). - -% dirty trick to be able to unbind a variable that has been constrained. -process_goals([], [], _). -process_goals((M:do_not_bind_variable(Gs)).Goals, (M:Gs).NGoals, true) :- !, - process_goals(Goals, NGoals, _). -process_goals(G.Goals, G.NGoals, Do) :- - process_goals(Goals, NGoals, Do). - -find_used([],_,L,L). -find_used([M|Mods],Mods0,L0,Lf) :- - member(M,Mods0), !, - find_used(Mods,Mods0,[M|L0],Lf). -find_used([_|Mods],Mods0,L0,Lf) :- - find_used(Mods,Mods0,L0,Lf). - -/** @pred Module:verify_attributes( _-Var_, _+Value_, _-Goals_) - -The predicate is called when trying to unify the attributed variable - _Var_ with the Prolog term _Value_. Note that _Value_ may be -itself an attributed variable, or may contain attributed variables. The -goal verify_attributes/3 is actually called before _Var_ is -unified with _Value_. - -It is up to the user to define which actions may be performed by -verify_attributes/3 but the procedure is expected to return in - _Goals_ a list of goals to be called after _Var_ is -unified with _Value_. If verify_attributes/3 fails, the -unification will fail. - -Notice that the verify_attributes/3 may be called even if _Var_< -has no attributes in module Module. In this case the routine should -simply succeed with _Goals_ unified with the empty list. - - -*/ -do_verify_attributes([], _, _, []). -do_verify_attributes([Mod|Mods], AttVar, Binding, [Mod:Goal|Goals]) :- - current_predicate(verify_attributes,Mod:verify_attributes(_,_,_)), !, - Mod:verify_attributes(AttVar, Binding, Goal), - do_verify_attributes(Mods, AttVar, Binding, Goals). -do_verify_attributes([_|Mods], AttVar, Binding, Goals) :- - do_verify_attributes(Mods, AttVar, Binding, Goals). - -/** - @} -*/ diff --git a/packages/python/swig/yap4py/prolog/autoloader.yap b/packages/python/swig/yap4py/prolog/autoloader.yap deleted file mode 100644 index a8c6bce52..000000000 --- a/packages/python/swig/yap4py/prolog/autoloader.yap +++ /dev/null @@ -1,127 +0,0 @@ - -:- module(autoloader,[make_library_index/0]). - -:- use_module(library(lists),[append/3]). - -:- dynamic exported/3, loaded/1. - -make_library_index :- - scan_library_exports, - scan_swi_exports. - -scan_library_exports :- - % init table file. - open('INDEX.pl', write, W), - close(W), - scan_exports('../GPL/aggregate', library(aggregate)), - scan_exports(apply, library(apply)), - scan_exports(arg, library(arg)), - scan_exports(assoc, library(assoc)), - scan_exports(avl, library(avl)), - scan_exports(bhash, library(bhash)), - scan_exports(charsio, library(charsio)), - scan_exports('../packages/chr/chr_swi', library(chr)), - scan_exports(clp/clpfd, library(clpfd)), - scan_exports('../packages/clpqr/clpr', library(clpr)), - scan_exports(gensym, library(gensym)), - scan_exports(heaps, library(heaps)), - scan_exports('../packages/jpl/jpl', library(jpl)), - scan_exports(lists, library(lists)), - scan_exports(nb, library(nb)), - scan_exports(occurs, library(occurs)), - scan_exports('../LGPL/option', library(option)), - scan_exports(ordsets, library(ordsets)), - scan_exports(pairs, library(pairs)), - scan_exports('../LGPL/prolog_xref', library(prolog_xref)), - scan_exports('../packages/plunit/plunit', library(plunit)), - scan_exports(queues, library(queues)), - scan_exports(random, library(random)), - scan_exports(rbtrees, library(rbtrees)), - scan_exports('../LGPL/readutil', library(readutil)), - scan_exports(regexp, library(regexp)), - scan_exports('../LGPL/shlib', library(shlib)), - scan_exports(system, library(system)), - scan_exports(terms, library(terms)), - scan_exports(timeout, library(timeout)), - scan_exports(trees, library(trees)). - -scan_exports(Library, CallName) :- - absolute_file_name(Library, Path, - [ file_type(prolog), - access(read), - file_errors(fail) - ]), - open(Path, read, O), - !, - get_exports(O, Exports, Module), - close(O), - open('INDEX.pl', append, W), - publish_exports(Exports, W, CallName, Module), - close(W). -scan_exports(Library) :- - format(user_error,'[ warning: library ~w not defined ]~n',[Library]). - -% -% SWI is the only language that uses autoload. -% -scan_swi_exports :- - retractall(exported(_,_,_)), - absolute_file_name(dialect/swi, Path, - [ file_type(prolog), - access(read), - file_errors(fail) - ]), - open(Path, read, O), - get_exports(O, Exports, Module), - get_reexports(O, Reexports, Exports), - close(O), - open('dialect/swi/INDEX.pl', write, W), - publish_exports(Reexports, W, library(dialect/swi), Module), - close(W). - -get_exports(O, Exports, Module) :- - read(O, (:- module(Module,Exports))), !. -get_exports(O, Exports, Module) :- - get_exports(O, Exports, Module). - -get_reexports(O, Exports, ExportsL) :- - read(O, (:- reexport(_File,ExportsI))), !, - get_reexports(O, Exports0, ExportsL), - append(ExportsI, Exports0, Exports). -get_reexports(_, Exports, Exports). - -publish_exports([], _, _, _). -publish_exports([F/A|Exports], W, Path, Module) :- - publish_export(F, A, W, Path, Module), - publish_exports(Exports, W, Path, Module). -publish_exports([F//A0|Exports], W, Path, Module) :- - A is A0+2, - publish_export(F, A, W, Path, Module), - publish_exports(Exports, W, Path, Module). -publish_exports([op(_,_,_)|Exports], W, Path, Module) :- - publish_exports(Exports, W, Path, Module). - -publish_export(F, A, _, _, Module) :- - exported(F, A, M), M \= Module, !, - format(user_error,'[ warning: clash between ~a and ~a over ~a/~d ]~n',[Module,M,F,A]). -publish_export(F, A, W, Path, Module) :- - assert(exported(F, A, Module)), !, - portray_clause(W, index(F, A, Module, Path)). - -find_predicate(G,ExportingModI) :- - nonvar(G), !, - functor(G, Name, Arity), - index(Name,Arity,ExportingModI,File), - ensure_file_loaded(File). -find_predicate(G,ExportingModI) :- - var(G), - index(Name,Arity,ExportingModI,File), - functor(G, Name, Arity), - ensure_file_loaded(File). - -ensure_file_loaded(File) :- - loaded(File), !. -ensure_file_loaded(File) :- - load_files(autoloader:File,[silent(true),if(not_loaded)]), - assert(loaded(File)). - diff --git a/packages/python/swig/yap4py/prolog/avl.yap b/packages/python/swig/yap4py/prolog/avl.yap deleted file mode 100644 index 9b1ba42da..000000000 --- a/packages/python/swig/yap4py/prolog/avl.yap +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: regexp.yap * -* Last rev: 5/15/2000 * -* mods: * -* comments: AVL trees in YAP (from code by M. van Emden, P. Vasey) * -* * -*************************************************************************/ - -/** - * @file avl.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 00:59:28 2015 - * - * @brief Support for constructing AVL trees - * - * -*/ - - - -:- module(avl, [ - avl_new/1, - avl_insert/4, - avl_lookup/3 - ]). - -/** -* @defgroup avl AVL Trees -* @ingroup library -@{ -Supports constructing AVL trees, available through the directive: - -~~~~~~~ -:- use_module(library(avl)). -~~~~~~~ - -It includes the following predicates: - - - avl_insert/4 - - avl_lookup/3 - - avl_new/1 - -AVL trees are balanced search binary trees. They are named after their -inventors, Adelson-Velskii and Landis, and they were the first -dynamically balanced trees to be proposed. The YAP AVL tree manipulation -predicates library uses code originally written by Martin van Emdem and -published in the Logic Programming Newsletter, Autumn 1981. A bug in -this code was fixed by Philip Vasey, in the Logic Programming -Newsletter, Summer 1982. The library currently only includes routines to -insert and lookup elements in the tree. Please try red-black trees if -you need deletion. - - -*/ - - -/** @pred avl_new(+ _T_) - - -Create a new tree. - - -*/ -avl_new([]). - -/** @pred avl_insert(+ _Key_,? _Value_,+ _T0_,- _TF_) - - -Add an element with key _Key_ and _Value_ to the AVL tree - _T0_ creating a new AVL tree _TF_. Duplicated elements are -allowed. - - -*/ -avl_insert(Key, Value, T0, TF) :- - insert(T0, Key, Value, TF, _). - -insert([], Key, Value, avl([],Key,Value,-,[]), yes). -insert(avl(L,Root,RVal,Bl,R), E, Value, NewTree, WhatHasChanged) :- - E @< Root, !, - insert(L, E, Value, NewL, LeftHasChanged), - adjust(avl(NewL,Root,RVal,Bl,R), LeftHasChanged, left, NewTree, WhatHasChanged). -insert(avl(L,Root,RVal,Bl,R), E, Val, NewTree, WhatHasChanged) :- -% E @>= Root, currently we allow duplicated values, although -% lookup will only fetch the first. - insert(R, E, Val,NewR, RightHasChanged), - adjust(avl(L,Root,RVal,Bl,NewR), RightHasChanged, right, NewTree, WhatHasChanged). - -adjust(Oldtree, no, _, Oldtree, no). -adjust(avl(L,Root,RVal,Bl,R), yes, Lor, NewTree, WhatHasChanged) :- - table(Bl, Lor, Bl1, WhatHasChanged, ToBeRebalanced), - rebalance(avl(L, Root, RVal, Bl, R), Bl1, ToBeRebalanced, NewTree). - -% balance where balance whole tree to be -% before inserted after increased rebalanced -table(- , left , < , yes , no ). -table(- , right , > , yes , no ). -table(< , left , - , no , yes ). -table(< , right , - , no , no ). -table(> , left , - , no , no ). -table(> , right , - , no , yes ). - -rebalance(avl(Lst, Root, RVal, _Bl, Rst), Bl1, no, avl(Lst, Root, RVal, Bl1,Rst)). -rebalance(OldTree, _, yes, NewTree) :- - avl_geq(OldTree,NewTree). - -avl_geq(avl(Alpha,A,VA,>,avl(Beta,B,VB,>,Gamma)), - avl(avl(Alpha,A,VA,-,Beta),B,VB,-,Gamma)). -avl_geq(avl(avl(Alpha,A,VA,<,Beta),B,VB,<,Gamma), - avl(Alpha,A,VA,-,avl(Beta,B,VB,-,Gamma))). -avl_geq(avl(Alpha,A,VA,>,avl(avl(Beta,X,VX,Bl1,Gamma),B,VB,<,Delta)), - avl(avl(Alpha,A,VA,Bl2,Beta),X,VX,-,avl(Gamma,B,VB,Bl3,Delta))) :- - table2(Bl1,Bl2,Bl3). -avl_geq(avl(avl(Alpha,A,VA,>,avl(Beta,X,VX,Bl1,Gamma)),B,VB,<,Delta), - avl(avl(Alpha,A,VA,Bl2,Beta),X,VX,-,avl(Gamma,B,VB,Bl3,Delta))) :- - table2(Bl1,Bl2,Bl3). - -table2(< ,- ,> ). -table2(> ,< ,- ). -table2(- ,- ,- ). - -/** @pred avl_lookup(+ _Key_,- _Value_,+ _T_) - - -Lookup an element with key _Key_ in the AVL tree - _T_, returning the value _Value_. - -*/ - -avl_lookup(Key, Value, avl(L,Key0,KVal,_,R)) :- - compare(Cmp, Key, Key0), - avl_lookup(Cmp, Value, L, R, Key, KVal). - -avl_lookup(=, Value, _, _, _, Value). -avl_lookup(<, Value, L, _, Key, _) :- - avl_lookup(Key, Value, L). -avl_lookup(>, Value, _, R, Key, _) :- - avl_lookup(Key, Value, R). - - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/bhash.yap b/packages/python/swig/yap4py/prolog/bhash.yap deleted file mode 100644 index ffee0401b..000000000 --- a/packages/python/swig/yap4py/prolog/bhash.yap +++ /dev/null @@ -1,332 +0,0 @@ -%% -*- Prolog -*- - -/** - * @file bhash.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 01:11:29 2015 - * - * @brief Backtrackable Hash Tables - * - * -*/ - -:- source. -:- yap_flag(unknown,error). -:- style_check(all). - -:- module(b_hash, [ b_hash_new/1, - b_hash_new/2, - b_hash_new/4, - b_hash_lookup/3, - b_hash_update/3, - b_hash_update/4, - b_hash_insert_new/4, - b_hash_insert/4, - b_hash_size/2, - b_hash_code/2, - is_b_hash/1, - b_hash_to_list/2, - b_hash_values_to_list/2, - b_hash_keys_to_list/2 - ]). - -/** - * @defgroup bhash Backtrackable Hash Tables - * @ingroup library - -@{ - -This library implements hash-arrays. -It requires the hash key to be a ground term. The library can -be loaded as - -:- use_module( library( bhash ) ). - -This code relies on backtrackable updates. The default hash key is -generated by term_hash/4. - -*/ - -:- use_module(library(terms), [ term_hash/4 ]). - - -:- meta_predicate(b_hash_new(-,+,3,2)). - -array_default_size(2048). - -/** @pred is_b_hash( +Hash ) - -Term _Hash_ is a hash table. -*/ -is_b_hash(V) :- var(V), !, fail. -is_b_hash(hash(_,_,_,_,_)). - -/** @pred b_hash_new( -NewHash ) - -Create a empty hash table _NewHash_, with size 2048 entries. -*/ -b_hash_new(hash(Keys, Vals, Size, N, _, _)) :- - array_default_size(Size), - array(Keys, Size), - array(Vals, Size), - create_mutable(0, N). - -/** @pred b_hash_new( -_NewHash_, +_Size_ ) - -Create a empty hash table, with size _Size_ entries. -*/ -b_hash_new(hash(Keys, Vals, Size, N, _, _), Size) :- - array(Keys, Size), - array(Vals, Size), - create_mutable(0, N). - -/** @pred b_hash_new( -_NewHash_, +_Size_, :_Hash_, :_Cmp_ ) - -Create a empty hash table, with size _Size_ entries. -_Hash_ defines a partition function, and _Cmp_ defined a comparison function. -*/ -b_hash_new(hash(Keys,Vals, Size, N, HashF, CmpF), Size, HashF, CmpF) :- - array(Keys, Size), - array(Vals, Size), - create_mutable(0, N). - -/** - @pred b_hash_size( +_Hash_, -_Size_ ) - -_Size_ unifies with the size of the hash table _Hash_. -*/ -b_hash_size(hash(_, _, Size, _, _, _), Size). - -/** - @pred b_hash_lookup( +_Key_, ?_Val_, +_Hash_ ) - -Search the ground term _Key_ in table _Hash_ and unify _Val_ with the associated entry. -*/ -b_hash_lookup(Key, Val, hash(Keys, Vals, Size, _, F, CmpF)):- - hash_f(Key, Size, Index, F), - fetch_key(Keys, Index, Size, Key, CmpF, ActualIndex), - array_element(Vals, ActualIndex, Mutable), - get_mutable(Val, Mutable). - -fetch_key(Keys, Index, Size, Key, CmpF, ActualIndex) :- - array_element(Keys, Index, El), - nonvar(El), - ( - cmp_f(CmpF, El, Key) - -> - Index = ActualIndex - ; - I1 is (Index+1) mod Size, - fetch_key(Keys, I1, Size, Key, CmpF, ActualIndex) - ). - -/** - @pred b_hash_update( +_Key_, +_Hash_, +NewVal ) - -Update to the value associated with the ground term _Key_ in table _Hash_ to _NewVal_. -*/ -b_hash_update(Hash, Key, NewVal):- - Hash = hash(Keys, Vals, Size, _, F, CmpF), - hash_f(Key,Size,Index,F), - fetch_key(Keys, Index, Size, Key, CmpF, ActualIndex), - array_element(Vals, ActualIndex, Mutable), - update_mutable(NewVal, Mutable). - -/** - @pred b_hash_update( +_Key_, -_OldVal_, +_Hash_, +NewVal ) - -Update to the value associated with the ground term _Key_ in table _Hash_ to _NewVal_, and unify _OldVal_ with the current value. -*/ -b_hash_update(Hash, Key, OldVal, NewVal):- - Hash = hash(Keys, Vals, Size, _, F, CmpF), - hash_f(Key,Size,Index,F), - fetch_key(Keys, Index, Size, Key, CmpF, ActualIndex), - array_element(Vals, ActualIndex, Mutable), - get_mutable(OldVal, Mutable), - update_mutable(NewVal, Mutable). - -/** b_hash_insert(+_Hash_, +_Key_, _Val_, +_NewHash_ ) - -Insert the term _Key_-_Val_ in table _Hash_ and unify _NewHash_ with the result. If ground term _Key_ exists, update the dictionary. -*/ -b_hash_insert(Hash, Key, NewVal, NewHash):- - Hash = hash(Keys, Vals, Size, N, F, CmpF), - hash_f(Key,Size,Index,F), - find_or_insert(Keys, Index, Size, N, CmpF, Vals, Key, NewVal, Hash, NewHash). - -find_or_insert(Keys, Index, Size, N, CmpF, Vals, Key, NewVal, Hash, NewHash) :- - array_element(Keys, Index, El), - ( - var(El) - -> - add_element(Keys, Index, Size, N, Vals, Key, NewVal, Hash, NewHash) - ; - cmp_f(CmpF, El, Key) - -> - % do rb_update - array_element(Vals, Index, Mutable), - update_mutable(NewVal, Mutable), - Hash = NewHash - ; - I1 is (Index+1) mod Size, - find_or_insert(Keys, I1, Size, N, CmpF, Vals, Key, NewVal, Hash, NewHash) - ). - -/** - @pred b_hash_insert_new(+_Hash_, +_Key_, _Val_, +_NewHash_ ) - -Insert the term _Key_-_Val_ in table _Hash_ and unify _NewHash_ with the result. If ground term _Key_ exists, fail. -*/ -b_hash_insert_new(Hash, Key, NewVal, NewHash):- - Hash = hash(Keys, Vals, Size, N, F, CmpF), - hash_f(Key,Size,Index,F), - find_or_insert_new(Keys, Index, Size, N, CmpF, Vals, Key, NewVal, Hash, NewHash). - -find_or_insert_new(Keys, Index, Size, N, CmpF, Vals, Key, NewVal, Hash, NewHash) :- - array_element(Keys, Index, El), - ( - var(El) - -> - add_element(Keys, Index, Size, N, Vals, Key, NewVal, Hash, NewHash) - ; - cmp_f(CmpF, El, Key) - -> - fail - ; - I1 is (Index+1) mod Size, - find_or_insert_new(Keys, I1, Size, N, CmpF, Vals, Key, NewVal, Hash, NewHash) - ). - -add_element(Keys, Index, Size, N, Vals, Key, NewVal, Hash, NewHash) :- - get_mutable(NEls, N), - NN is NEls+1, - update_mutable(NN, N), - array_element(Keys, Index, Key), - update_mutable(NN, N), - array_element(Vals, Index, Mutable), - create_mutable(NewVal, Mutable), - ( - NN > Size/3 - -> - expand_array(Hash, NewHash) - ; - Hash = NewHash - ). - -expand_array(Hash, NewHash) :- - Hash == NewHash, !, - Hash = hash(Keys, Vals, Size, _X, F, _CmpF), - new_size(Size, NewSize), - array(NewKeys, NewSize), - array(NewVals, NewSize), - copy_hash_table(Size, Keys, Vals, F, NewSize, NewKeys, NewVals), - /* overwrite in place */ - setarg(1, Hash, NewKeys), - setarg(2, Hash, NewVals), - setarg(3, Hash, NewSize). - -expand_array(Hash, hash(NewKeys, NewVals, NewSize, X, F, CmpF)) :- - Hash = hash(Keys, Vals, Size, X, F, CmpF), - new_size(Size, NewSize), - array(NewKeys, NewSize), - array(NewVals, NewSize), - copy_hash_table(Size, Keys, Vals, F, NewSize, NewKeys, NewVals). - -new_size(Size, NewSize) :- - Size > 1048576, !, - NewSize is Size+1048576. -new_size(Size, NewSize) :- - NewSize is Size*2. - -copy_hash_table(0, _, _, _, _, _, _) :- !. -copy_hash_table(I1, Keys, Vals, F, Size, NewKeys, NewVals) :- - I is I1-1, - array_element(Keys, I, Key), - nonvar(Key), !, - array_element(Vals, I, Val), - insert_el(Key, Val, Size, F, NewKeys, NewVals), - copy_hash_table(I, Keys, Vals, F, Size, NewKeys, NewVals). -copy_hash_table(I1, Keys, Vals, F, Size, NewKeys, NewVals) :- - I is I1-1, - copy_hash_table(I, Keys, Vals, F, Size, NewKeys, NewVals). - -insert_el(Key, Val, Size, F, NewKeys, NewVals) :- - hash_f(Key,Size,Index, F), - find_free(Index, Size, NewKeys, TrueIndex), - array_element(NewKeys, TrueIndex, Key), - array_element(NewVals, TrueIndex, Val). - -find_free(Index, Size, Keys, NewIndex) :- - array_element(Keys, Index, El), - ( - var(El) - -> - NewIndex = Index - ; - I1 is (Index+1) mod Size, - find_free(I1, Size, Keys, NewIndex) - ). - -hash_f(Key, Size, Index, F) :- - var(F), !, - term_hash(Key,-1,Size,Index). -hash_f(Key, Size, Index, F) :- - call(F, Key, Size, Index). - -cmp_f(F, A, B) :- - var(F), !, - A == B. -cmp_f(F, A, B) :- - call(F, A, B). - -/** - @pred b_hash_to_list(+_Hash_, -_KeyValList_ ) - -The term _KeyValList_ unifies with a list containing all terms _Key_-_Val_ in the hash table. -*/ -b_hash_to_list(hash(Keys, Vals, _, _, _, _), LKeyVals) :- - Keys =.. (_.LKs), - Vals =.. (_.LVs), - mklistpairs(LKs, LVs, LKeyVals). - -/** - @pred b_key_to_list(+_Hash_, -_KeyList_ ) - -The term _KeyList_ unifies with a list containing all keys in the hash table. -*/ -b_hash_keys_to_list(hash(Keys, _, _, _, _, _), LKeys) :- - Keys =.. (_.LKs), - mklistels(LKs, LKeys). - -/** - @pred b_key_to_list(+_Hash_, -_ValList_ ) - -The term _`valList_ unifies with a list containing all values in the hash table. -*/ -b_hash_values_to_list(hash(_, Vals, _, _, _, _), LVals) :- - Vals =.. (_.LVs), - mklistvals(LVs, LVals). - -mklistpairs([], [], []). -mklistpairs(V.LKs, _.LVs, KeyVals) :- var(V), !, - mklistpairs(LKs, LVs, KeyVals). -mklistpairs(K.LKs, V.LVs, (K-VV).KeyVals) :- - get_mutable(VV, V), - mklistpairs(LKs, LVs, KeyVals). - -mklistels([], []). -mklistels(V.Els, NEls) :- var(V), !, - mklistels(Els, NEls). -mklistels(K.Els, K.NEls) :- - mklistels(Els, NEls). - -mklistvals([], []). -mklistvals(V.Vals, NVals) :- var(V), !, - mklistvals(Vals, NVals). -mklistvals(K.Vals, KK.NVals) :- - get_mutable(KK, K), - mklistvals(Vals, NVals). - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/block_diagram.yap b/packages/python/swig/yap4py/prolog/block_diagram.yap deleted file mode 100644 index 0706fa152..000000000 --- a/packages/python/swig/yap4py/prolog/block_diagram.yap +++ /dev/null @@ -1,477 +0,0 @@ -%%% -*- Mode: Prolog; -*- - -/** - * @file block_diagram.yap - * @author Theofrastos Mantadelis, Sugestions from Paulo Moura - * @date Tue Nov 17 14:12:02 2015 - * - * @brief Graph the program structure. - * - * @{ -*/ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Flags was developed at Katholieke Universiteit Leuven -% -% Copyright 2010 -% Katholieke Universiteit Leuven -% -% Contributions to this file: -% Author: Theofrastos Mantadelis -% Sugestions: Paulo Moura -% Version: 1 -% Date: 19/11/2010 -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Artistic License 2.0 -% -% Copyright (c) 2000-2006, The Perl Foundation. -% -% Everyone is permitted to copy and distribute verbatim copies of this -% license document, but changing it is not allowed. Preamble -% -% This license establishes the terms under which a given free software -% Package may be copied, modified, distributed, and/or -% redistributed. The intent is that the Copyright Holder maintains some -% artistic control over the development of that Package while still -% keeping the Package available as open source and free software. -% -% You are always permitted to make arrangements wholly outside of this -% license directly with the Copyright Holder of a given Package. If the -% terms of this license do not permit the full use that you propose to -% make of the Package, you should contact the Copyright Holder and seek -% a different licensing arrangement. Definitions -% -% "Copyright Holder" means the individual(s) or organization(s) named in -% the copyright notice for the entire Package. -% -% "Contributor" means any party that has contributed code or other -% material to the Package, in accordance with the Copyright Holder's -% procedures. -% -% "You" and "your" means any person who would like to copy, distribute, -% or modify the Package. -% -% "Package" means the collection of files distributed by the Copyright -% Holder, and derivatives of that collection and/or of those files. A -% given Package may consist of either the Standard Version, or a -% Modified Version. -% -% "Distribute" means providing a copy of the Package or making it -% accessible to anyone else, or in the case of a company or -% organization, to others outside of your company or organization. -% -% "Distributor Fee" means any fee that you charge for Distributing this -% Package or providing support for this Package to another party. It -% does not mean licensing fees. -% -% "Standard Version" refers to the Package if it has not been modified, -% or has been modified only in ways explicitly requested by the -% Copyright Holder. -% -% "Modified Version" means the Package, if it has been changed, and such -% changes were not explicitly requested by the Copyright Holder. -% -% "Original License" means this Artistic License as Distributed with the -% Standard Version of the Package, in its current version or as it may -% be modified by The Perl Foundation in the future. -% -% "Source" form means the source code, documentation source, and -% configuration files for the Package. -% -% "Compiled" form means the compiled bytecode, object code, binary, or -% any other form resulting from mechanical transformation or translation -% of the Source form. -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Permission for Use and Modification Without Distribution -% -% (1) You are permitted to use the Standard Version and create and use -% Modified Versions for any purpose without restriction, provided that -% you do not Distribute the Modified Version. -% -% Permissions for Redistribution of the Standard Version -% -% (2) You may Distribute verbatim copies of the Source form of the -% Standard Version of this Package in any medium without restriction, -% either gratis or for a Distributor Fee, provided that you duplicate -% all of the original copyright notices and associated disclaimers. At -% your discretion, such verbatim copies may or may not include a -% Compiled form of the Package. -% -% (3) You may apply any bug fixes, portability changes, and other -% modifications made available from the Copyright Holder. The resulting -% Package will still be considered the Standard Version, and as such -% will be subject to the Original License. -% -% Distribution of Modified Versions of the Package as Source -% -% (4) You may Distribute your Modified Version as Source (either gratis -% or for a Distributor Fee, and with or without a Compiled form of the -% Modified Version) provided that you clearly document how it differs -% from the Standard Version, including, but not limited to, documenting -% any non-standard features, executables, or modules, and provided that -% you do at least ONE of the following: -% -% (a) make the Modified Version available to the Copyright Holder of the -% Standard Version, under the Original License, so that the Copyright -% Holder may include your modifications in the Standard Version. (b) -% ensure that installation of your Modified Version does not prevent the -% user installing or running the Standard Version. In addition, the -% modified Version must bear a name that is different from the name of -% the Standard Version. (c) allow anyone who receives a copy of the -% Modified Version to make the Source form of the Modified Version -% available to others under (i) the Original License or (ii) a license -% that permits the licensee to freely copy, modify and redistribute the -% Modified Version using the same licensing terms that apply to the copy -% that the licensee received, and requires that the Source form of the -% Modified Version, and of any works derived from it, be made freely -% available in that license fees are prohibited but Distributor Fees are -% allowed. -% -% Distribution of Compiled Forms of the Standard Version or -% Modified Versions without the Source -% -% (5) You may Distribute Compiled forms of the Standard Version without -% the Source, provided that you include complete instructions on how to -% get the Source of the Standard Version. Such instructions must be -% valid at the time of your distribution. If these instructions, at any -% time while you are carrying out such distribution, become invalid, you -% must provide new instructions on demand or cease further -% distribution. If you provide valid instructions or cease distribution -% within thirty days after you become aware that the instructions are -% invalid, then you do not forfeit any of your rights under this -% license. -% -% (6) You may Distribute a Modified Version in Compiled form without the -% Source, provided that you comply with Section 4 with respect to the -% Source of the Modified Version. -% -% Aggregating or Linking the Package -% -% (7) You may aggregate the Package (either the Standard Version or -% Modified Version) with other packages and Distribute the resulting -% aggregation provided that you do not charge a licensing fee for the -% Package. Distributor Fees are permitted, and licensing fees for other -% components in the aggregation are permitted. The terms of this license -% apply to the use and Distribution of the Standard or Modified Versions -% as included in the aggregation. -% -% (8) You are permitted to link Modified and Standard Versions with -% other works, to embed the Package in a larger work of your own, or to -% build stand-alone binary or bytecode versions of applications that -% include the Package, and Distribute the result without restriction, -% provided the result does not expose a direct interface to the Package. -% -% Items That are Not Considered Part of a Modified Version -% -% (9) Works (including, but not limited to, modules and scripts) that -% merely extend or make use of the Package, do not, by themselves, cause -% the Package to be a Modified Version. In addition, such works are not -% considered parts of the Package itself, and are not subject to the -% terms of this license. -% -% General Provisions -% -% (10) Any use, modification, and distribution of the Standard or -% Modified Versions is governed by this Artistic License. By using, -% modifying or distributing the Package, you accept this license. Do not -% use, modify, or distribute the Package, if you do not accept this -% license. -% -% (11) If your Modified Version has been derived from a Modified Version -% made by someone other than you, you are nevertheless required to -% ensure that your Modified Version complies with the requirements of -% this license. -% -% (12) This license does not grant you the right to use any trademark, -% service mark, tradename, or logo of the Copyright Holder. -% -% (13) This license includes the non-exclusive, worldwide, -% free-of-charge patent license to make, have made, use, offer to sell, -% sell, import and otherwise transfer the Package with respect to any -% patent claims licensable by the Copyright Holder that are necessarily -% infringed by the Package. If you institute patent litigation -% (including a cross-claim or counterclaim) against any party alleging -% that the Package constitutes direct or contributory patent -% infringement, then this Artistic License to you shall terminate on the -% date that such litigation is filed. -% -% (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT -% HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED -% WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -% PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT -% PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT -% HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, -% INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE -% OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -/** @defgroup block_diagram Block Diagram -@ingroup library -@{ - -This library provides a way of visualizing a prolog program using -modules with blocks. To use it use: -`:-use_module(library(block_diagram))`. - - -*/ - -:- module(block_diagram, [make_diagram/2, make_diagram/5]). - -/* ---------------------------------------------------------------------- *\ -|* Missing stuff: a parameter that bounds the module connection depth *| -|* and a parameter that diseables/limits the text over edges *| -\* ---------------------------------------------------------------------- */ - -:- style_check(all). -:- yap_flag(unknown, error). - - -:- use_module(library(charsio), [term_to_atom/2]). -:- use_module(library(lists), [memberchk/2, member/2, append/3]). -:- use_module(library(system), [working_directory/2]). -:- dynamic([seen_module/1, parameter/1]). - -parameter(texts((+inf))). -parameter(depth((+inf))). -parameter(default_ext('.yap')). - -/** @pred make_diagram(+Inputfilename, +Ouputfilename) - - - -This will crawl the files following the use_module, ensure_loaded directives withing the inputfilename. -The result will be a file in dot format. -You can make a pdf at the shell by asking `dot -Tpdf filename > output.pdf`. - - -*/ -make_diagram(InputFile, OutputFile):- - tell(OutputFile), - write('digraph G {\nrankdir=BT'), nl, - extract_name_file(InputFile, Name, File), - nb_setval(depth, 0), - read_module_file(File, Name), - write_explicit, - write('}'), nl, - told. - -/** @pred make_diagram(+Inputfilename, +Ouputfilename, +Predicate, +Depth, +Extension) - - -The same as make_diagram/2 but you can define how many of the imported/exporeted predicates will be shown with predicate, and how deep the crawler is allowed to go with depth. The extension is used if the file use module directives do not include a file extension. - -*/ -make_diagram(InputFile, OutputFile, Texts, Depth, Ext):- - integer(Texts), - integer(Depth), - retractall(parameter(_)), - assertz(parameter(texts(Texts))), - assertz(parameter(depth(Depth))), - assertz(parameter(default_ext(Ext))), - make_diagram(InputFile, OutputFile), - retractall(parameter(_)), - assertz(parameter(texts((+inf)))), - assertz(parameter(depth((+inf)))), - assertz(parameter(default_ext('.yap'))). - -path_seperator('\\'):- - yap_flag(windows, true), !. -path_seperator('/'). - -split_path_file(PathFile, Path, File):- - path_seperator(PathSeperator), - atom_concat(Path, File, PathFile), - name(PathSeperator, [PathSeperatorName]), - name(File, FileName), - \+ memberchk(PathSeperatorName, FileName), - !. -split_file_ext(FileExt, File, Ext):- - atom_concat(File, Ext, FileExt), - atom_concat('.', _, Ext), - name('.', [DotName]), - name(Ext, ExtName), - findall(A, (member(A, ExtName), A = DotName), L), - length(L, 1), !. - - -parse_module_directive(':-'(module(Name)), _):- - seen_module(node(Name)), !. -parse_module_directive(':-'(module(Name, _Exported)), _):- - seen_module(node(Name)), !. -parse_module_directive(':-'(module(Name, Exported)), Shape):- - !, \+ seen_module(node(Name)), - assertz(seen_module(node(Name))), - list_to_message(Exported, ExportedMessage), - atom_concat([Name, ' [shape=', Shape,',label="', Name, '\\n', ExportedMessage, '"]'], NodeDefinition), - write(NodeDefinition), nl. -parse_module_directive(':-'(module(Name)), Shape):- - \+ seen_module(node(Name)), - assertz(seen_module(node(Name))), - atom_concat([Name, ' [shape=', Shape,',label="', Name, '"]'], NodeDefinition), - write(NodeDefinition), nl. - -extract_name_file(PathFile, Name, FinalFile):- - split_path_file(PathFile, Path, FileName), Path \== '', !, - extract_name_file(FileName, Name, File), - atom_concat(Path, File, FinalFile). -extract_name_file(File, Name, File):- - split_file_ext(File, Name, _), !. -extract_name_file(Name, Name, File):- - parameter(default_ext(Ext)), - atom_concat(Name, Ext, File). - -read_use_module_directive(':-'(ensure_loaded(library(Name))), Name, library(Name), []):- !. -read_use_module_directive(':-'(ensure_loaded(Path)), Name, FinalFile, []):- - extract_name_file(Path, Name, FinalFile), !. -read_use_module_directive(':-'(use_module(library(Name))), Name, library(Name), []):- !. -read_use_module_directive(':-'(use_module(Path)), Name, FinalFile, []):- - extract_name_file(Path, Name, FinalFile), !. -read_use_module_directive(':-'(use_module(library(Name), Import)), Name, library(Name), Import):- !. -read_use_module_directive(':-'(use_module(Path, Import)), Name, FinalFile, Import):- - extract_name_file(Path, Name, FinalFile), !. -read_use_module_directive(':-'(use_module(Name, Path, Import)), Name, FinalFile, Import):- - nonvar(Path), - extract_name_file(Path, _, FinalFile), !. -read_use_module_directive(':-'(use_module(Name, Path, Import)), Name, FinalFile, Import):- - var(Path), - extract_name_file(Name, _, FinalFile), !. - -parse_use_module_directive(Module, Directive):- - read_use_module_directive(Directive, Name, File, Imported), - parse_use_module_directive(Module, Name, File, Imported). -parse_use_module_directive(Module, Name, _File, _Imported):- - seen_module(edge(Module, Name)), !. -parse_use_module_directive(Module, Name, File, Imported):- - \+ seen_module(edge(Module, Name)), - assertz(seen_module(edge(Module, Name))), - read_module_file(File, Name), - list_to_message(Imported, ImportedMessage), - atom_concat([Module, ' -> ', Name, ' [label="', ImportedMessage, '"]'], NodeConnection), - write(NodeConnection), nl. - -list_to_message(List, Message):- - length(List, Len), - parameter(texts(TextCnt)), - (Len > TextCnt + 1 -> - append(FirstCnt, _, List), - length(FirstCnt, TextCnt), - append(FirstCnt, ['...'], First) - ; - First = List - ), - list_to_message(First, '', Message). - -list_to_message([], Message, Message). -list_to_message([H|T], '', FinalMessage):- - term_to_atom(H, HAtom), !, - list_to_message(T, HAtom, FinalMessage). -list_to_message([H|T], AccMessage, FinalMessage):- - term_to_atom(H, HAtom), - atom_concat([AccMessage, '\\n', HAtom], NewMessage), - list_to_message(T, NewMessage, FinalMessage). - -read_module_file(library(Module), Module):- - !, parse_module_directive(':-'(module(Module, [])), component). -read_module_file(File, Module):- - parameter(depth(MaxDepth)), - nb_getval(depth, Depth), - MaxDepth > Depth, - split_path_file(File, Path, FileName), - catch((working_directory(CurDir,Path), open(FileName, read, S)), _, (parse_module_directive(':-'(module(Module, [])), box3d), fail)), - NDepth is Depth + 1, - nb_setval(depth, NDepth), - repeat, - catch(read(S, Next),_,fail), - process(Module, Next), - nb_setval(depth, Depth), - close(S), working_directory(_,CurDir), !. -read_module_file(_, _). - -/** @pred process(+ _StreamInp_, + _Goal_) - - - -For every line _LineIn_ in stream _StreamInp_, call -`call(Goal,LineIn)`. - - -*/ -process(_, end_of_file):-!. -process(_, Term):- - parse_module_directive(Term, box), !, fail. -process(Module, Term):- - parse_use_module_directive(Module, Term), !, fail. -process(Module, Term):- - find_explicit_qualification(Module, Term), fail. - -find_explicit_qualification(OwnerModule, ':-'(Module:Goal)):- - !, explicit_qualification(OwnerModule, Module, Goal). -find_explicit_qualification(OwnerModule, ':-'(_Head, Body)):- - find_explicit_qualification(OwnerModule, Body). -find_explicit_qualification(OwnerModule, (Module:Goal, RestBody)):- - !, explicit_qualification(OwnerModule, Module, Goal), - find_explicit_qualification(OwnerModule, RestBody). -find_explicit_qualification(OwnerModule, (_Goal, RestBody)):- - !, find_explicit_qualification(OwnerModule, RestBody). -find_explicit_qualification(OwnerModule, Module:Goal):- - !, explicit_qualification(OwnerModule, Module, Goal). -find_explicit_qualification(_OwnerModule, _Goal). - -explicit_qualification(InModule, ToModule, Goal):- - nonvar(Goal), nonvar(ToModule), !, - functor(Goal, FunctorName, Arity), - \+ seen_module(explicit(InModule, ToModule, FunctorName/Arity)), - assertz(seen_module(explicit(InModule, ToModule, FunctorName/Arity))). - -explicit_qualification(InModule, ToModule, Goal):- - var(Goal), nonvar(ToModule), !, - \+ seen_module(explicit(InModule, ToModule, 'DYNAMIC')), - assertz(seen_module(explicit(InModule, ToModule, 'DYNAMIC'))). - -explicit_qualification(InModule, ToModule, Goal):- - nonvar(Goal), var(ToModule), !, - functor(Goal, FunctorName, Arity), - \+ seen_module(explicit(InModule, 'DYNAMIC', FunctorName/Arity)), - assertz(seen_module(explicit(InModule, 'DYNAMIC', FunctorName/Arity))). - -explicit_qualification(InModule, ToModule, Goal):- - var(Goal), var(ToModule), - \+ seen_module(explicit(InModule, 'DYNAMIC', 'DYNAMIC')), - assertz(seen_module(explicit(InModule, 'DYNAMIC', 'DYNAMIC'))). - -write_explicit:- - seen_module(explicit(InModule, ToModule, _Goal)), - \+ seen_module(generate_explicit(InModule, ToModule)), - assertz(seen_module(generate_explicit(InModule, ToModule))), - all(Goal, seen_module(explicit(InModule, ToModule, Goal)), Goals), - list_to_message(Goals, Explicit), - atom_concat([InModule, ' -> ', ToModule, ' [label="', Explicit, '",style=dashed]'], NodeConnection), - write(NodeConnection), nl, fail. -write_explicit. - -/* - functor(Goal, FunctorName, Arity), - term_to_atom(FunctorName/Arity, Imported), - atom_concat([InModule, ' -> ', ToModule, ' [label="', Imported, '",style=dashed]'], NodeConnection), - write(NodeConnection), nl. - - atom_concat([InModule, ' -> ', ToModule, ' [label="DYNAMIC",style=dashed]'], NodeConnection), - write(NodeConnection), nl. - - functor(Goal, FunctorName, Arity), - term_to_atom(FunctorName/Arity, Imported), - atom_concat([InModule, ' -> DYNAMIC [label="', Imported, '",style=dashed]'], NodeConnection), - write(NodeConnection), nl. - - atom_concat([InModule, ' -> DYNAMIC [label="DYNAMIC",style=dashed]'], NodeConnection), - write(NodeConnection), nl. - */ - -%% @} @} diff --git a/packages/python/swig/yap4py/prolog/c_alarms.yap b/packages/python/swig/yap4py/prolog/c_alarms.yap deleted file mode 100644 index 89dd7397e..000000000 --- a/packages/python/swig/yap4py/prolog/c_alarms.yap +++ /dev/null @@ -1,422 +0,0 @@ -%%% -*- Mode: Prolog; -*- -/** - * @file c_alarms.yap - * @author Theofrastos Mantadelis - * @date Tue Nov 17 14:50:03 2015 - * - * @brief Concurrent alarms - * - * -*/ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Concurrent alarms was developed at Katholieke Universiteit Leuven -% -% Copyright 2010 -% Katholieke Universiteit Leuven -% -% Contributions to this file: -% Author: Theofrastos Mantadelis -% $Date: 2011-02-04 16:04:49 +0100 (Fri, 04 Feb 2011) $ -% $Revision: 11 $ -% Contributions: The timer implementation is inspired by Bernd Gutmann's timers -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Artistic License 2.0 -% -% Copyright (c) 2000-2006, The Perl Foundation. -% -% Everyone is permitted to copy and distribute verbatim copies of this -% license document, but changing it is not allowed. Preamble -% -% This license establishes the terms under which a given free software -% Package may be copied, modified, distributed, and/or -% redistributed. The intent is that the Copyright Holder maintains some -% artistic control over the development of that Package while still -% keeping the Package available as open source and free software. -% -% You are always permitted to make arrangements wholly outside of this -% license directly with the Copyright Holder of a given Package. If the -% terms of this license do not permit the full use that you propose to -% make of the Package, you should contact the Copyright Holder and seek -% a different licensing arrangement. Definitions -% -% "Copyright Holder" means the individual(s) or organization(s) named in -% the copyright notice for the entire Package. -% -% "Contributor" means any party that has contributed code or other -% material to the Package, in accordance with the Copyright Holder's -% procedures. -% -% "You" and "your" means any person who would like to copy, distribute, -% or modify the Package. -% -% "Package" means the collection of files distributed by the Copyright -% Holder, and derivatives of that collection and/or of those files. A -% given Package may consist of either the Standard Version, or a -% Modified Version. -% -% "Distribute" means providing a copy of the Package or making it -% accessible to anyone else, or in the case of a company or -% organization, to others outside of your company or organization. -% -% "Distributor Fee" means any fee that you charge for Distributing this -% Package or providing support for this Package to another party. It -% does not mean licensing fees. -% -% "Standard Version" refers to the Package if it has not been modified, -% or has been modified only in ways explicitly requested by the -% Copyright Holder. -% -% "Modified Version" means the Package, if it has been changed, and such -% changes were not explicitly requested by the Copyright Holder. -% -% "Original License" means this Artistic License as Distributed with the -% Standard Version of the Package, in its current version or as it may -% be modified by The Perl Foundation in the future. -% -% "Source" form means the source code, documentation source, and -% configuration files for the Package. -% -% "Compiled" form means the compiled bytecode, object code, binary, or -% any other form resulting from mechanical transformation or translation -% of the Source form. -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Permission for Use and Modification Without Distribution -% -% (1) You are permitted to use the Standard Version and create and use -% Modified Versions for any purpose without restriction, provided that -% you do not Distribute the Modified Version. -% -% Permissions for Redistribution of the Standard Version -% -% (2) You may Distribute verbatim copies of the Source form of the -% Standard Version of this Package in any medium without restriction, -% either gratis or for a Distributor Fee, provided that you duplicate -% all of the original copyright notices and associated disclaimers. At -% your discretion, such verbatim copies may or may not include a -% Compiled form of the Package. -% -% (3) You may apply any bug fixes, portability changes, and other -% modifications made available from the Copyright Holder. The resulting -% Package will still be considered the Standard Version, and as such -% will be subject to the Original License. -% -% Distribution of Modified Versions of the Package as Source -% -% (4) You may Distribute your Modified Version as Source (either gratis -% or for a Distributor Fee, and with or without a Compiled form of the -% Modified Version) provided that you clearly document how it differs -% from the Standard Version, including, but not limited to, documenting -% any non-standard features, executables, or modules, and provided that -% you do at least ONE of the following: -% -% (a) make the Modified Version available to the Copyright Holder of the -% Standard Version, under the Original License, so that the Copyright -% Holder may include your modifications in the Standard Version. (b) -% ensure that installation of your Modified Version does not prevent the -% user installing or running the Standard Version. In addition, the -% modified Version must bear a name that is different from the name of -% the Standard Version. (c) allow anyone who receives a copy of the -% Modified Version to make the Source form of the Modified Version -% available to others under (i) the Original License or (ii) a license -% that permits the licensee to freely copy, modify and redistribute the -% Modified Version using the same licensing terms that apply to the copy -% that the licensee received, and requires that the Source form of the -% Modified Version, and of any works derived from it, be made freely -% available in that license fees are prohibited but Distributor Fees are -% allowed. -% -% Distribution of Compiled Forms of the Standard Version or -% Modified Versions without the Source -% -% (5) You may Distribute Compiled forms of the Standard Version without -% the Source, provided that you include complete instructions on how to -% get the Source of the Standard Version. Such instructions must be -% valid at the time of your distribution. If these instructions, at any -% time while you are carrying out such distribution, become invalid, you -% must provide new instructions on demand or cease further -% distribution. If you provide valid instructions or cease distribution -% within thirty days after you become aware that the instructions are -% invalid, then you do not forfeit any of your rights under this -% license. -% -% (6) You may Distribute a Modified Version in Compiled form without the -% Source, provided that you comply with Section 4 with respect to the -% Source of the Modified Version. -% -% Aggregating or Linking the Package -% -% (7) You may aggregate the Package (either the Standard Version or -% Modified Version) with other packages and Distribute the resulting -% aggregation provided that you do not charge a licensing fee for the -% Package. Distributor Fees are permitted, and licensing fees for other -% components in the aggregation are permitted. The terms of this license -% apply to the use and Distribution of the Standard or Modified Versions -% as included in the aggregation. -% -% (8) You are permitted to link Modified and Standard Versions with -% other works, to embed the Package in a larger work of your own, or to -% build stand-alone binary or bytecode versions of applications that -% include the Package, and Distribute the result without restriction, -% provided the result does not expose a direct interface to the Package. -% -% Items That are Not Considered Part of a Modified Version -% -% (9) Works (including, but not limited to, modules and scripts) that -% merely extend or make use of the Package, do not, by themselves, cause -% the Package to be a Modified Version. In addition, such works are not -% considered parts of the Package itself, and are not subject to the -% terms of this license. -% -% General Provisions -% -% (10) Any use, modification, and distribution of the Standard or -% Modified Versions is governed by this Artistic License. By using, -% modifying or distributing the Package, you accept this license. Do not -% use, modify, or distribute the Package, if you do not accept this -% license. -% -% (11) If your Modified Version has been derived from a Modified Version -% made by someone other than you, you are nevertheless required to -% ensure that your Modified Version complies with the requirements of -% this license. -% -% (12) This license does not grant you the right to use any trademark, -% service mark, tradename, or logo of the Copyright Holder. -% -% (13) This license includes the non-exclusive, worldwide, -% free-of-charge patent license to make, have made, use, offer to sell, -% sell, import and otherwise transfer the Package with respect to any -% patent claims licensable by the Copyright Holder that are necessarily -% infringed by the Package. If you institute patent litigation -% (including a cross-claim or counterclaim) against any party alleging -% that the Package constitutes direct or contributory patent -% infringement, then this Artistic License to you shall terminate on the -% date that such litigation is filed. -% -% (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT -% HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED -% WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -% PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT -% PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT -% HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, -% INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE -% OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -:- module(c_alarms, [set_alarm/3, - unset_alarm/1, - time_out_call_once/3, - timer_start/1, - timer_restart/1, - timer_stop/2, - timer_elapsed/2, - timer_pause/2]). - -/** @defgroup c_alarms Concurrent Alarms -@ingroup library -@{ - -This library provides a concurrent signals. To use it use: -`:-use_module(library(c_alarms))`. -*/ - - -:- use_module(library(lists), [member/2, memberchk/2, delete/3]). -:- use_module(library(ordsets), [ord_add_element/3]). -:- use_module(library(apply_macros), [maplist/3]). - -:- dynamic('$timer'/3). - -:- meta_predicate(set_alarm(+, 0, -)). -:- meta_predicate(time_out_call_once(+, 0, -)). -:- meta_predicate(prove_once(0)). - -:- initialization(local_init). - -local_init:- - bb_put(alarms, []), - bb_put(identity, 0). - -get_next_identity(ID):- - bb_get(identity, ID), - NID is ID + 1, - bb_put(identity, NID). - -set_alarm(Seconds, Execute, ID):- - bb_get(alarms, []), - get_next_identity(ID), !, - bb_put(alarms, [alarm(Seconds, ID, Execute)]), - alarm(Seconds, alarm_handler, _). - -%% set_alarm(+Seconds, +Execute, -ID) -% -% calls Executes after a time interval of Seconds -% ID is returned to be able to unset the alarm (the call will not be executed) -% set_alarm/3 supports multiple & nested settings of alarms. -% Known Bug: There is the case that an alarm might trigger +-1 second of the set time. -% -set_alarm(Seconds, Execute, ID):- - get_next_identity(ID), !, - bb_get(alarms, [alarm(CurrentSeconds, CurrentID, CurrentExecute)|Alarms]), - alarm(0, true, Remaining), - Elapsed is CurrentSeconds - Remaining - 1, - maplist(subtract(Elapsed), [alarm(CurrentSeconds, CurrentID, CurrentExecute)|Alarms], RemainingAlarms), - ord_add_element(RemainingAlarms, alarm(Seconds, ID, Execute), [alarm(NewSeconds, NewID, NewToExecute)|NewAlarms]), - bb_put(alarms, [alarm(NewSeconds, NewID, NewToExecute)|NewAlarms]), - alarm(NewSeconds, alarm_handler, _). -set_alarm(Seconds, Execute, ID):- - throw(error(permission_error(create, alarm, set_alarm(Seconds, Execute, ID)), 'Non permitted alarm identifier.')). - -subtract(Elapsed, alarm(Seconds, ID, Execute), alarm(NewSeconds, ID, Execute)):- - NewSeconds is Seconds - Elapsed. - -%% unset_alarm(+ID) -% -% It will unschedule the alarm. -% It will not affect other concurrent alarms. -% -unset_alarm(ID):- - \+ ground(ID), - throw(error(instantiation_error, 'Alarm ID needs to be instantiated.')). -unset_alarm(ID):- - bb_get(alarms, Alarms), - \+ memberchk(alarm(_Seconds, ID, _Execute), Alarms), - throw(error(existence_error(alarm, unset_alarm(ID)), 'Alarm does not exist.')). -unset_alarm(ID):- - alarm(0, true, Remaining), - bb_get(alarms, Alarms), - [alarm(Seconds, _, _)|_] = Alarms, - Elapsed is Seconds - Remaining - 1, - delete_alarm(Alarms, ID, NewAlarms), - bb_put(alarms, NewAlarms), - (NewAlarms = [alarm(NewSeconds, _, _)|_] -> - RemainingSeconds is NewSeconds - Elapsed, - alarm(RemainingSeconds, alarm_handler, _) - ; - true - ). - -delete_alarm(Alarms, ID, NewAlarms):- - memberchk(alarm(Seconds, ID, Execute), Alarms), - delete(Alarms, alarm(Seconds, ID, Execute), NewAlarms). - -alarm_handler:- - bb_get(alarms, [alarm(_, _, CurrentExecute)|[]]), - bb_put(alarms, []), - call(CurrentExecute). -alarm_handler:- - bb_get(alarms, [alarm(Elapsed, CurrentID, CurrentExecute)|Alarms]), - maplist(subtract(Elapsed), Alarms, NewAlarms), - find_zeros(NewAlarms, ZeroAlarms), - findall(alarm(S, ID, E), (member(alarm(S, ID, E), NewAlarms), S > 0), NonZeroAlarms), - bb_put(alarms, NonZeroAlarms), - (NonZeroAlarms = [alarm(NewSeconds, _, _)|_] -> - alarm(NewSeconds, alarm_handler, _) - ; - true - ), - execute([alarm(0, CurrentID, CurrentExecute)|ZeroAlarms]). - -find_zeros([], []). -find_zeros([alarm(0, ID, E)|T], [alarm(0, ID, E)|R]):- - find_zeros(T, R). -find_zeros([alarm(S, _, _)|T], R):- - S > 0, - find_zeros(T, R). - -execute([]). -execute([alarm(_, _, Execute)|R]):- - call(Execute), - execute(R). - -%% time_out_call(+Seconds, +Goal, -Return) -% -% It will will execute the closure Goal and returns its success or failure at Return. -% If the goal times out in Seconds then Return = timeout. -time_out_call_once(Seconds, Goal, Return):- - bb_get(identity, ID), - set_alarm(Seconds, throw(timeout(ID)), ID), - catch(( - prove_once(Goal, Return), - unset_alarm(ID)) - , Exception, ( - (Exception == timeout(ID) -> - Return = timeout - ; - unset_alarm(ID), - throw(Exception) - ))). - -prove_once(Goal, success):- - once(Goal), !. -prove_once(_Goal, failure). - -timer_start(Name):- - \+ ground(Name), - throw(error(instantiation_error, 'Timer name needs to be instantiated.')). -timer_start(Name):- - '$timer'(Name, _, _), - throw(error(permission_error(create, timer, timer_start(Name)), 'Timer already exists.')). -timer_start(Name):- - statistics(walltime, [StartTime, _]), - assertz('$timer'(Name, running, StartTime)). - -timer_restart(Name):- - \+ ground(Name), - throw(error(instantiation_error, 'Timer name needs to be instantiated.')). -timer_restart(Name):- - \+ '$timer'(Name, _, _), !, - statistics(walltime, [StartTime, _]), - assertz('$timer'(Name, running, StartTime)). -timer_restart(Name):- - retract('$timer'(Name, running, _)), !, - statistics(walltime, [StartTime, _]), - assertz('$timer'(Name, running, StartTime)). -timer_restart(Name):- - retract('$timer'(Name, paused, Duration)), - statistics(walltime, [StartTime, _]), - Elapsed is StartTime - Duration, - assertz('$timer'(Name, running, Elapsed)). - -timer_stop(Name, Elapsed):- - \+ '$timer'(Name, _, _), - throw(error(existence_error(timer, timer_stop(Name, Elapsed)), 'Timer does not exist.')). -timer_stop(Name, Elapsed):- - retract('$timer'(Name, running, StartTime)), !, - statistics(walltime, [EndTime, _]), - Elapsed is EndTime - StartTime. -timer_stop(Name, Elapsed):- - retract('$timer'(Name, paused, Elapsed)). - -timer_elapsed(Name, Elapsed):- - \+ '$timer'(Name, _, _), - throw(error(existence_error(timer, timer_elapsed(Name, Elapsed)), 'Timer does not exist.')). -timer_elapsed(Name, Elapsed):- - '$timer'(Name, running, StartTime), !, - statistics(walltime, [EndTime, _]), - Elapsed is EndTime - StartTime. -timer_elapsed(Name, Elapsed):- - '$timer'(Name, paused, Elapsed). - -timer_pause(Name, Elapsed):- - \+ '$timer'(Name, _, _), - throw(error(existence_error(timer, timer_pause(Name, Elapsed)), 'Timer does not exist.')). -timer_pause(Name, Elapsed):- - '$timer'(Name, paused, _), - throw(error(permission_error(timer, timer_pause(Name, Elapsed)), 'Timer already paused.')). -timer_pause(Name, Elapsed):- - retract('$timer'(Name, _, StartTime)), - statistics(walltime, [EndTime, _]), - Elapsed is EndTime - StartTime, - assertz('$timer'(Name, paused, Elapsed)). - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/charsio.yap b/packages/python/swig/yap4py/prolog/charsio.yap deleted file mode 100644 index 20788eea0..000000000 --- a/packages/python/swig/yap4py/prolog/charsio.yap +++ /dev/null @@ -1,230 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: charsio.yap * -* Last rev: 5/12/99 * -* mods: * -* comments: I/O on character strings * -* * -*************************************************************************/ - -/** - * @file charsio.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 01:17:33 2015 - * - * @brief Several operations on text. - * @{ - * -*/ - - -:- module(charsio, [ - format_to_chars/3, - format_to_chars/4, - write_to_chars/3, - write_to_chars/2, - atom_to_chars/3, - atom_to_chars/2, - number_to_chars/3, - number_to_chars/2, - read_from_chars/2, - open_chars_stream/2, - with_output_to_chars/2, - with_output_to_chars/3, - with_output_to_chars/4, - term_to_atom/2 - ]). - -/** @defgroup charsio Operations on Sequences of Codes. -@ingroup library - -Term to sequence of codes conversion, mostly replaced by engine code. -You can use the following directive to load the files. - - -~~~~~~~ -:- use_module(library(avl)). -~~~~~~~ - -It includes the following predicates: - - atom_to_chars/2 - - atom_to_chars/3 - - format_to_chars/3 - - format_to_chars/4 - - number_to_chars/2 - - number_to_chars/3 - - open_chars_stream/2 - - read_from_chars/2 - - term_to_atom/2 - - with_output_to_chars/2 - - with_output_to_chars/3 - - with_output_to_chars/4 - - write_to_chars/2 - - write_to_chars/3 - -*/ - -:- meta_predicate(with_output_to_chars(0,?)). -:- meta_predicate(with_output_to_chars(0,-,?)). -:- meta_predicate(with_output_to_chars(0,-,?,?)). - -/** @pred format_to_chars(+ _Form_, + _Args_, - _Result_) - -Execute the built-in procedure format/2 with form _Form_ and -arguments _Args_ outputting the result to the string of character -codes _Result_. -*/ -format_to_chars(Format, Args, Codes) :- - format(codes(Codes), Format, Args). - -/** @pred format_to_chars(+ _Form_, + _Args_, - _Result_, - _Result0_) - -Execute the built-in procedure format/2 with form _Form_ and -arguments _Args_ outputting the result to the difference list of -character codes _Result-Result0_. - -*/ -format_to_chars(Format, Args, OUT, L0) :- - format(codes(OUT, L0), Format, Args). - -/** @pred write_to_chars(+ _Term_, - _Result_) - -Execute the built-in procedure write/1 with argument _Term_ -outputting the result to the string of character codes _Result_. -*/ -write_to_chars(Term, Codes) :- - format(codes(Codes), '~w', [Term]). - -/** @pred write_to_chars(+ _Term_, - _Result0_, - _Result_) - -Execute the built-in procedure write/1 with argument _Term_ -outputting the result to the difference list of character codes - _Result-Result0_. -*/ -write_to_chars(Term, Out, Tail) :- - format(codes(Out,Tail),'~w',[Term]). - -/** @pred atom_to_chars(+ _Atom_, - _Result_) - -Convert the atom _Atom_ to the string of character codes - _Result_. -*/ -atom_to_chars(Atom, OUT) :- - atom_codes(Atom, OUT). - -/** @pred atom_to_chars(+ _Atom_, - _Result0_, - _Result_) - -Convert the atom _Atom_ to the difference list of character codes - _Result-Result0_. -*/ -atom_to_chars(Atom, L0, OUT) :- - format(codes(L0, OUT), '~a', [Atom]). - -/** @pred number_to_chars(+ _Number_, - _Result_) - -Convert the number _Number_ to the string of character codes - _Result_. -*/ -number_to_chars(Number, OUT) :- - number_codes(Number, OUT). - -/** @pred number_to_chars(+ _Number_, - _Result0_, - _Result_) - -Convert the atom _Number_ to the difference list of character codes - _Result-Result0_. -*/ -number_to_chars(Number, L0, OUT) :- - var(Number), !, - throw(error(instantiation_error,number_to_chars(Number, L0, OUT))). -number_to_chars(Number, L0, OUT) :- - number(Number), !, - format(codes(L0, OUT), '~w', [Number]). -number_to_chars(Number, L0, OUT) :- - throw(error(type_error(number,Number),number_to_chars(Number, L0, OUT))). - -/** @pred open_chars_stream(+ _Chars_, - _Stream_) - -Open the list of character codes _Chars_ as a stream _Stream_. -*/ -open_chars_stream(Codes, Stream) :- - open_chars_stream(Codes, Stream, ''). - -open_chars_stream(Codes, Stream, Postfix) :- - predicate_property(memory_file:open_memory_file(_,_,_),_), !, - memory_file:new_memory_file(MF), - memory_file:open_memory_file(MF, write, Out), - format(Out, '~s~w', [Codes, Postfix]), - close(Out), - memory_file:open_memory_file(MF, read, Stream, - [ free_on_close(true) - ]). -open_chars_stream(Codes, Stream, Postfix) :- - ensure_loaded(library(memfile)), - open_chars_stream(Codes, Stream, Postfix). - -/** @pred with_output_to_chars(? _Goal_, - _Chars_) - -Execute goal _Goal_ such that its standard output will be sent to a -memory buffer. After successful execution the contents of the memory -buffer will be converted to the list of character codes _Chars_. -*/ -with_output_to_chars(Goal, Codes) :- - with_output_to(codes(Codes), Goal). - -/** @pred with_output_to_chars(? _Goal_, ? _Chars0_, - _Chars_) - -Execute goal _Goal_ such that its standard output will be sent to a -memory buffer. After successful execution the contents of the memory -buffer will be converted to the difference list of character codes - _Chars-Chars0_. -*/ -with_output_to_chars(Goal, Codes, L0) :- - with_output_to(codes(Codes, L0), Goal). -%% with_output_to_chars(:Goal, -Stream, -Codes, ?Tail) is det. -% -% As with_output_to_chars/2, but Stream is unified with the -% temporary stream. - -/** @pred with_output_to_chars(? _Goal_, - _Stream_, ? _Chars0_, - _Chars_) - - -Execute goal _Goal_ such that its standard output will be sent to a -memory buffer. After successful execution the contents of the memory -buffer will be converted to the difference list of character codes - _Chars-Chars0_ and _Stream_ receives the stream corresponding to -the memory buffer. - - */ -with_output_to_chars(Goal, Stream, Codes, Tail) :- - with_output_to(codes(Codes, Tail), with_stream(Stream, Goal)). - -with_stream(Stream, Goal) :- - current_output(Stream), - call(Goal). - -/** @pred read_from_chars(+ _Chars_, - _Term_) - -Parse the list of character codes _Chars_ and return the result in -the term _Term_. The character codes to be read must terminate with -a dot character such that either (i) the dot character is followed by -blank characters; or (ii) the dot character is the last character in the -string. - -@compat The SWI-Prolog version does not require Codes to end - in a full-stop. -*/ -read_from_chars("", end_of_file) :- !. -read_from_chars(List, Term) :- - atom_to_term(List, Term, _). -/** -@} -*/ - diff --git a/packages/python/swig/yap4py/prolog/clauses.yap b/packages/python/swig/yap4py/prolog/clauses.yap deleted file mode 100644 index 758d8cb63..000000000 --- a/packages/python/swig/yap4py/prolog/clauses.yap +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @file clauses.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 14:51:30 2015 - * - * @brief Utilities for clause manipulation. - * - * -*/ - -:- module(clauses, - [list2conj/2, - conj2list/2, - clauselength/2]). - -%% @{ - -/** - * @defgroup clauses Clause Manipulation - * @ingroup library - - This library supports a number of useful utilities that come up over and - over again when manipulating Prolog programs. This will include - operations and conversion to other structures. - - @author Vitor Santos Costa -*/ - -/** conj2list( +Conj, -List) is det - Generate a list from a conjunction of literals. - - It is often easier to apply operations on lists than on clauses -*/ -conj2list( M:Conj, List ) :- - conj2list_( Conj, M, List, [] ). - -conj2list( Conj, List ) :- - conj2list_( Conj, List, [] ). - - -conj2list_( C ) --> - { var(C) }, - !, - [C]. -conj2list_( true ) --> !. -conj2list_( (C1, C2) ) --> - !, - conj2list_( C1 ), - conj2list_( C2 ). -conj2list_( C ) --> - [C]. - -conj2list_( C, M ) --> - { var(C) }, - !, - [M: C]. -conj2list_( true , _) --> !. -conj2list_( (C1, C2), M ) --> - !, - conj2list_( C1, M ), - conj2list_( C2, M ). -conj2list_( C, M ) --> - { strip_module(M:C, NM, NC) }, - [NM:NC]. - -/** list2conj( +List, -Conj) is det - Generate a conjunction from a list of literals. - - Notice Mthat this relies on indexing within the list to avoid creating - choice-points. -*/ -list2conj([], true). -list2conj([Last], Last). -list2conj([Head,Next|Tail], (Head,Goals)) :- - list2conj([Next|Tail], Goals). - -/** clauselength( +Clause, -Length) is det - Count the number of literals in a clause (head counts as one). - - Notice that this is 1+length(conj2list), as we ignore disjunctions. -*/ -clauselength( (_Head :- Conj), Length ) :- - clauselength( Conj, Length, 1 ). - - -clauselength( C, I1, I ) :- - { var(C) }, - !, - I1 is I+1. -clauselength( (C1, C2), I2, I ) :- !, - clauselength( C1, I1, I ), - clauselength( C2, I2, I1 ). -clauselength( _C, I1, I ) :- - I1 is I+1. - -%%@} diff --git a/packages/python/swig/yap4py/prolog/coinduction.yap b/packages/python/swig/yap4py/prolog/coinduction.yap deleted file mode 100644 index fe53d7712..000000000 --- a/packages/python/swig/yap4py/prolog/coinduction.yap +++ /dev/null @@ -1,216 +0,0 @@ -/** - * @file coinduction.yap - * @author VITOR SANTOS COSTA , Arvin Bansal, - * - * - * @date Tue Nov 17 14:55:02 2015 - * - * @brief Co-inductive execution - * - * -*/ - - -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: coinduction.yap * -* Last rev: 8/2/88 * -* mods: * -* comments: coinduction support for Prolog * -* * -*************************************************************************/ - -% :- yap_flag(unknown,error). -% :- style_check(all). - -% -% Code originally written by Arvin Bansal and Vitor Santos Costa -% Includes nice extensions from Jan Wielemaker (from the SWI version). -% - -:- module(coinduction, - [ (coinductive)/1, - op(1150, fx, (coinductive)) - ]). - -:- use_module(library(error)). - -/** coinduction Co-Logic Programming - @ingroup library - -This simple module implements the directive coinductive/1 as described -in "Co-Logic Programming: Extending Logic Programming with Coinduction" -by Luke Somin et al. The idea behind coinduction is that a goal succeeds -if it unifies to a parent goal. This enables some interesting programs, -notably on infinite trees (cyclic terms). - -~~~~ - :- use_module(library(coinduction)). - - :- coinductive stream/1. - stream([H|T]) :- i(H), stream(T). - - % inductive - i(0). - i(s(N)) :- i(N). - - ?- X=[s(s(A))|X], stream(X). - X= [s(s(A))|X], stream(X). - A = 0, - X = [s(s(0)),**] -~~~~ - -This predicate is true for any cyclic list containing only 1-s, -regardless of the cycle-length. - -@bug Programs mixing normal predicates and coinductive predicates must - be _stratified_. The theory does not apply to normal Prolog calling - coinductive predicates, calling normal Prolog predicates, etc. - - Stratification is not checked or enforced in any other way and thus - left as a responsibility to the user. -@see "Co-Logic Programming: Extending Logic Programming with Coinduction" - by Luke Somin et al. - -@{ - -*/ - -:- meta_predicate coinductive(:). - -:- dynamic coinductive/3. - - -%----------------------------------------------------- - -coinductive(Spec) :- - var(Spec), - !, - throw(error(instantiation_error,coinductive(Spec))). -coinductive(Module:Spec) :- - coinductive_declaration(Spec, Module, coinductive(Module:Spec)). -coinductive(Spec) :- - prolog_load_context(module, Module), - coinductive_declaration(Spec, Module, coinductive(Spec)). - -coinductive_declaration(Spec, _M, G) :- - var(Spec), - !, - throw(error(instantiation_error,G)). -coinductive_declaration((A,B), M, G) :- !, - coinductive_declaration(A, M, G), - coinductive_declaration(B, M, G). -coinductive_declaration(M:Spec, _, G) :- !, - coinductive_declaration(Spec, M, G). -coinductive_declaration(Spec, M, _G) :- - valid_pi(Spec, F, N), - functor(S,F,N), - atomic_concat(['__coinductive__',F,'/',N],NF), - functor(NS,NF,N), - match_args(N,S,NS), - atomic_concat(['__stack_',M,':',F,'/',N],SF), - nb_setval(SF, _), - assert((M:S :- - b_getval(SF,L), - coinduction:in_stack(S, L, End), - ( - nonvar(End) - -> - true - ; - End = [S|_], - M:NS) - ) - ), - assert(coinduction:coinductive(S,M,NS)). - -valid_pi(Name/Arity, Name, Arity) :- - must_be(atom, Name), - must_be(integer, Arity). - -match_args(0,_,_) :- !. -match_args(I,S1,S2) :- - arg(I,S1,A), - arg(I,S2,A), - I1 is I-1, - match_args(I1,S1,S2). - -%----------------------------------------------------- - -co_term_expansion((M:H :- B), _, (M:NH :- B)) :- !, - co_term_expansion((H :- B), M, (NH :- B)). -co_term_expansion((H :- B), M, (NH :- B)) :- !, - coinductive(H, M, NH), !. -co_term_expansion(H, M, NH) :- - coinductive(H, M, NH), !. - -user:term_expansion(M:Cl,M:NCl ) :- !, - co_term_expansion(Cl, M, NCl). - -user:term_expansion(G, NG) :- - prolog_load_context(module, Module), - co_term_expansion(G, Module, NG). - - -%----------------------------------------------------- - -in_stack(_, V, V) :- var(V), !. -in_stack(G, [G|_], [G|_]) :- !. -in_stack(G, [_|T], End) :- in_stack(G, T, End). - -writeG_val(G_var) :- - b_getval(G_var, G_val), - write(G_var), write(' ==> '), write(G_val), nl. - -%----------------------------------------------------- - -/** - - Some examples from Coinductive Logic Programming and its Applications by Gopal Gupta et al, ICLP 97 - -~~~~ -:- coinductive stream/1. -stream([H|T]) :- i(H), stream(T). - -% inductive -i(0). -i(s(N)) :- i(N). - - % Are there infinitely many "occurrences" of arg1 in arg2? - :- coinductive comember/2. - - comember(X, L) :- - drop(X, L, L1), - comember(X, L1). - - % Drop some prefix of arg2 upto an "occurrence" of arg1 from arg2, - % yielding arg3. - % ("Occurrence" of X = something unifiable with X.) - %:- table(drop/3). % not working; needs tabling supporting cyclic terms! - drop(H, [H| T], T). - drop(H, [_| T], T1) :- - drop(H, T, T1). - - -% X = [1, 2, 3| X], comember(E, X). - - user:p(E) :- - X = [1, 2, 3| X], - comember(E, X), - format('~w~n',[E]), - get_code(_), - fail. - -~~~~ - -@} -*/ - diff --git a/packages/python/swig/yap4py/prolog/dbqueues.yap b/packages/python/swig/yap4py/prolog/dbqueues.yap deleted file mode 100644 index 34bc48580..000000000 --- a/packages/python/swig/yap4py/prolog/dbqueues.yap +++ /dev/null @@ -1,70 +0,0 @@ -s/** - * @file dbqueues.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 15:01:49 2015 - * - * @brief A library to support queues with no-backtrackable queues. - * - * -*/ - - -:- module(nbqueue, [ - nb_enqueue/2, - nb_dequeue/2, - nb_clean_queue/1, - nb_size/2 - ]). - -/** - * @defgroup dbqueues Non-backtrackable queues in YAP. - * @ingroup library - -A library to implement queues of NB Terms - -*/ - - -:- unhide_atom('$init_nb_queue'). -:- unhide_atom('$nb_enqueue'). -:- unhide_atom('$nb_dequeue'). - - -nb_enqueue(Name,El) :- var(Name), - throw(error(instantiation_error(Name),nb_enqueue(Name,El))). -nb_enqueue(Name,El) :- \+ atom(Name), !, - throw(error(type_error_atom(Name),nb_enqueue(Name,El))). -nb_enqueue(Name,El) :- - recorded('$nb_queue',[Name|Ref],_), !, - prolog:'$nb_enqueue'(Ref, El). -nb_enqueue(Name,El) :- - prolog:'$init_nb_queue'(Ref), - recorda('$nb_queue',[Name|Ref],_), - prolog:'$nb_enqueue'(Ref,El). - - -nb_dequeue(Name,El) :- var(Name), - throw(error(instantiation_error(Name),nb_dequeue(Name,El))). -nb_dequeue(Name,El) :- \+ atom(Name), !, - throw(error(type_error_atom(Name),nb_dequeue(Name,El))). -nb_dequeue(Name,El) :- - recorded('$nb_queue',[Name|Ref],R), - ( prolog:'$nb_dequeue'(Ref, El) -> - true - ; - erase(R), - fail - ). - -nb_clean_queue(Name) :- - recorded('$nb_queue',[Name|Ref],R), !, - erase(R), - nb_dequeue_all(Ref). -nb_clean_queue(_). - -nb_dequeue_all(Ref) :- - ( prolog:'$nb_dequeue'(Ref, _) -> nb_dequeue_all(Ref) ; true ). - -nb_dequeue_size(Ref, Size) :- - prolog:'$nb_size'(Ref, Size). - diff --git a/packages/python/swig/yap4py/prolog/dbusage.yap b/packages/python/swig/yap4py/prolog/dbusage.yap deleted file mode 100644 index c2966d773..000000000 --- a/packages/python/swig/yap4py/prolog/dbusage.yap +++ /dev/null @@ -1,208 +0,0 @@ -/** - * @file dbusage.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 15:04:52 2015 - * - * @brief Useful statistics on memory usage - * - * -*/ - -:- module(dbusage, [ - db_usage/0, - db_static/0, - db_static/1, - db_dynamic/0, - db_dynamic/1 - ]). - -/** - * @defgroup dbusage Memory Usage in Prolog Data-Base - * @ingroup library - @{ - - This library provides a set of utilities for studying memory usage in YAP. - The following routines are available once included with the - `use_module(library(dbusage))` command. -*/ - -/** @pred db_usage - Give general overview of data-base usage in the system. -*/ -db_usage :- - statistics(heap,[HeapUsed,HeapFree]), - statistics(local_stack,[GInU,FreeS]), - statistics(global_stack,[SInU,_]), - statistics(trail,[TInU,FreeT]), - HeapUsedK is HeapUsed//1024, - HeapFreeK is HeapFree//1024, - StackSpace is (GInU+SInU+FreeS+TInU+FreeT)//1024, - format(user_error, 'Heap Space = ~D KB (+ ~D KB free)~n',[HeapUsedK,HeapFreeK]), - format(user_error, 'Stack Space = ~D KB~n',[StackSpace]), - findall(p(Cls,CSz,ISz), - (current_module(M), - current_predicate(_,M:P), - predicate_statistics(M:P,Cls,CSz,ISz)),LAll), - sumall(LAll, TCls, TCSz, TISz), - statistics(atoms,[AtomN,AtomS]), - AtomSK is AtomS//1024, - format(user_error, '~D Atoms taking ~D KB~n',[AtomN,AtomSK]), - TSz is TCSz+TISz, - TSzK is TSz//1024, - TCSzK is TCSz//1024, - TISzK is TISz//1024, - format(user_error, 'Total User Code~n ~D clauses taking ~D KB~n ~D KB in clauses + ~D KB in indices~n', - [TCls,TSzK,TCSzK,TISzK]), - statistics(static_code,[SCl,SI,SI1,SI2,SI3]), - SClK is SCl//1024, - SIK is SI//1024, - SI1K is SI1//1024, - SI2K is SI2//1024, - SI3K is SI3//1024, - ST is SCl+SI, - STK is ST//1024, - format(user_error, 'Total Static code=~D KB~n ~D KB in clauses + ~D KB in indices (~D+~D+~D)~n', - [STK,SClK,SIK,SI1K,SI2K,SI3K]), - statistics(dynamic_code,[DCl,DI,DI1,DI2,DI3,DI4]), - DClK is DCl//1024, - DIK is DI//1024, - DI1K is DI1//1024, - DI2K is DI2//1024, - DI3K is DI3//1024, - DI4K is DI4//1024, - DT is DCl+DI, - DTK is DT//1024, - format(user_error, 'Total Dynamic code=~D KB~n ~D KB in clauses + ~D KB in indices (~D+~D+~D+~D)~n', - [DTK,DClK,DIK,DI1K,DI2K,DI3K,DI4K]), - total_erased(DCls,DSZ,ICls,ISZ), - (DCls =:= 0 -> - true - ; - DSZK is DSZ//1024, - format(user_error, ' ~D erased clauses not reclaimed (~D KB)~n',[DCls,DSZK]) - ), - (ICls =:= 0 -> - true - ; - ISZK is ISZ//1024, - format(user_error, ' ~D erased indices not reclaimed (~D KB)~n',[ICls,ISZK]) - ), - !. - -db_usage:- - write(mem_dump_error),nl. - - -/** @pred db_static - - -List memory usage for every static predicate. - - -*/ -db_static :- - db_static(-1). - -/** @pred db_static(+ _Threshold_) - -List memory usage for every static predicate. Predicate must use more -than _Threshold_ bytes. - - -*/ -db_static(Min) :- - setof(p(Sz,M:P,Cls,CSz,ISz), - PN^(current_module(M), - current_predicate(PN,M:P), - \+ predicate_property(M:P,dynamic), - predicate_statistics(M:P,Cls,CSz,ISz), - Sz is (CSz+ISz), - Sz > Min),All), - format(user_error,' Static user code~n===========================~n',[]), - display_preds(All). - -/** @pred db_dynamic - - -List memory usage for every dynamic predicate. - - -*/ -db_dynamic :- - db_dynamic(-1). - -/** @pred db_dynamic(+ _Threshold_) - -List memory usage for every dynamic predicate. Predicate must use more -than _Threshold_ bytes. - - - - - */ -db_dynamic(Min) :- - setof(p(Sz,M:P,Cls,CSz,ISz,ECls,ECSz,EISz), - PN^(current_module(M), - current_predicate(PN,M:P), - predicate_property(M:P,dynamic), - predicate_statistics(M:P,Cls,CSz,ISz), - predicate_erased_statistics(M:P,ECls,ECSz,EISz), - Sz is (CSz+ISz+ECSz+EISz), - Sz > Min), - All), - format(user_error,' Dynamic user code~n===========================~n',[]), - display_dpreds(All). - -display_preds([]). -display_preds([p(Sz,M:P,Cls,CSz,ISz)|_]) :- - functor(P,A,N), - KSz is Sz//1024, - KCSz is CSz//1024, - KISz is ISz//1024, - (M = user -> Name = A/N ; Name = M:A/N), - format(user_error,'~w~t~36+:~t~D~7+ clauses using~|~t~D~8+ KB (~D + ~D)~n',[Name,Cls,KSz,KCSz,KISz]), - fail. -display_preds([_|All]) :- - display_preds(All). - - -display_dpreds([]). -display_dpreds([p(Sz,M:P,Cls,CSz,ISz,ECls,ECSz,EISz)|_]) :- - functor(P,A,N), - KSz is Sz//1024, - KCSz is CSz//1024, - KISz is ISz//1024, - (M = user -> Name = A/N ; Name = M:A/N), - format(user_error,'~w~t~36+:~t~D~7+ clauses using~|~t~D~8+ KB (~D + ~D)~n',[Name,Cls,KSz,KCSz,KISz]), - (ECls =:= 0 - -> - true - ; - ECSzK is ECSz//1024, - format(user_error,' ~D erased clauses: ~D KB~n',[ECls,ECSzK]) - ), - (EISz =:= 0 - -> - true - ; - EISzK is EISz//1024, - format(user_error,' ~D KB erased indices~n',[EISzK]) - ), - fail. -display_dpreds([_|All]) :- - display_dpreds(All). - - -sumall(LEDAll, TEDCls, TEDCSz, TEDISz) :- - sumall(LEDAll, 0, TEDCls, 0, TEDCSz, 0, TEDISz). - -sumall([], TEDCls, TEDCls, TEDCSz, TEDCSz, TEDISz, TEDISz). -sumall([p(Cls,CSz,ISz)|LEDAll], TEDCls0, TEDCls, TEDCSz0, TEDCSz, TEDISz0, TEDISz) :- - TEDClsI is Cls+TEDCls0, - TEDCSzI is CSz+TEDCSz0, - TEDISzI is ISz+TEDISz0, - sumall(LEDAll, TEDClsI, TEDCls, TEDCSzI, TEDCSz, TEDISzI, TEDISz). - -/** - @} -*/ diff --git a/packages/python/swig/yap4py/prolog/dgraphs.yap b/packages/python/swig/yap4py/prolog/dgraphs.yap deleted file mode 100644 index 1e07f5de2..000000000 --- a/packages/python/swig/yap4py/prolog/dgraphs.yap +++ /dev/null @@ -1,708 +0,0 @@ -/** - * @file dgraphs.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 01:23:20 2015 - * - * @brief Directed Graph Processing Utilities. - * - * -*/ - -:- module( dgraphs, - [ - dgraph_vertices/2, - dgraph_edge/3, - dgraph_edges/2, - dgraph_add_vertex/3, - dgraph_add_vertices/3, - dgraph_del_vertex/3, - dgraph_del_vertices/3, - dgraph_add_edge/4, - dgraph_add_edges/3, - dgraph_del_edge/4, - dgraph_del_edges/3, - dgraph_to_ugraph/2, - ugraph_to_dgraph/2, - dgraph_neighbors/3, - dgraph_neighbours/3, - dgraph_complement/2, - dgraph_transpose/2, - dgraph_compose/3, - dgraph_transitive_closure/2, - dgraph_symmetric_closure/2, - dgraph_top_sort/2, - dgraph_top_sort/3, - dgraph_min_path/5, - dgraph_max_path/5, - dgraph_min_paths/3, - dgraph_isomorphic/4, - dgraph_path/3, - dgraph_path/4, - dgraph_leaves/2, - dgraph_reachable/3 - ]). - -/** @defgroup dgraphs Directed Graphs -@ingroup library -@{ - -The following graph manipulation routines use the red-black tree library -to try to avoid linear-time scans of the graph for all graph -operations. Graphs are represented as a red-black tree, where the key is -the vertex, and the associated value is a list of vertices reachable -from that vertex through an edge (ie, a list of edges). - -*/ - - -/** @pred dgraph_new(+ _Graph_) - - -Create a new directed graph. This operation must be performed before -trying to use the graph. - - -*/ -:- reexport(library(rbtrees), - [rb_new/1 as dgraph_new]). - -:- use_module(library(rbtrees), - [rb_new/1, - rb_empty/1, - rb_lookup/3, - rb_apply/4, - rb_insert/4, - rb_visit/2, - rb_keys/2, - rb_delete/3, - rb_map/3, - rb_clone/3, - ord_list_to_rbtree/2]). - -:- use_module(library(ordsets), - [ord_insert/3, - ord_union/3, - ord_subtract/3, - ord_del_element/3, - ord_memberchk/2]). - -:- use_module(library(wdgraphs), - [dgraph_to_wdgraph/2, - wdgraph_min_path/5, - wdgraph_max_path/5, - wdgraph_min_paths/3]). - - -/** @pred dgraph_add_edge(+ _Graph_, + _N1_, + _N2_, - _NewGraph_) - - -Unify _NewGraph_ with a new graph obtained by adding the edge - _N1_- _N2_ to the graph _Graph_. - - -*/ -dgraph_add_edge(Vs0,V1,V2,Vs2) :- - dgraph_new_edge(V1,V2,Vs0,Vs1), - dgraph_add_vertex(Vs1,V2,Vs2). - - -/** @pred dgraph_add_edges(+ _Graph_, + _Edges_, - _NewGraph_) - - -Unify _NewGraph_ with a new graph obtained by adding the list of -edges _Edges_ to the graph _Graph_. - - -*/ -dgraph_add_edges(V0, Edges, VF) :- - rb_empty(V0), !, - sort(Edges,SortedEdges), - all_vertices_in_edges(SortedEdges,Vertices), - sort(Vertices,SortedVertices), - edges2graphl(SortedVertices, SortedEdges, GraphL), - ord_list_to_rbtree(GraphL, VF). -dgraph_add_edges(G0, Edges, GF) :- - sort(Edges,SortedEdges), - all_vertices_in_edges(SortedEdges,Vertices), - sort(Vertices,SortedVertices), - dgraph_add_edges(SortedVertices,SortedEdges, G0, GF). - -all_vertices_in_edges([],[]). -all_vertices_in_edges([V1-V2|Edges],[V1,V2|Vertices]) :- - all_vertices_in_edges(Edges,Vertices). - -edges2graphl([], [], []). -edges2graphl([V|Vertices], [VV-V1|SortedEdges], [V-[V1|Children]|GraphL]) :- - V == VV, !, - get_extra_children(SortedEdges,VV,Children,RemEdges), - edges2graphl(Vertices, RemEdges, GraphL). -edges2graphl([V|Vertices], SortedEdges, [V-[]|GraphL]) :- - edges2graphl(Vertices, SortedEdges, GraphL). - - -dgraph_add_edges([],[]) --> []. -dgraph_add_edges([V|Vs],[V0-V1|Es]) --> { V == V0 }, !, - { get_extra_children(Es,V,Children,REs) }, - dgraph_update_vertex(V,[V1|Children]), - dgraph_add_edges(Vs,REs). -dgraph_add_edges([V|Vs],Es) --> !, - dgraph_update_vertex(V,[]), - dgraph_add_edges(Vs,Es). - -get_extra_children([V-C|Es],VV,[C|Children],REs) :- V == VV, !, - get_extra_children(Es,VV,Children,REs). -get_extra_children(Es,_,[],Es). - -dgraph_update_vertex(V,Children, Vs0, Vs) :- - rb_apply(Vs0, V, add_edges(Children), Vs), !. -dgraph_update_vertex(V,Children, Vs0, Vs) :- - rb_insert(Vs0,V,Children,Vs). - -add_edges(E0,E1,E) :- - ord_union(E0,E1,E). - -dgraph_new_edge(V1,V2,Vs0,Vs) :- - rb_apply(Vs0, V1, insert_edge(V2), Vs), !. -dgraph_new_edge(V1,V2,Vs0,Vs) :- - rb_insert(Vs0,V1,[V2],Vs). - -insert_edge(V2, Children0, Children) :- - ord_insert(Children0,V2,Children). - -/** @pred dgraph_add_vertices(+ _Graph_, + _Vertices_, - _NewGraph_) - - -Unify _NewGraph_ with a new graph obtained by adding the list of -vertices _Vertices_ to the graph _Graph_. - - -*/ -dgraph_add_vertices(G, [], G). -dgraph_add_vertices(G0, [V|Vs], GF) :- - dgraph_add_vertex(G0, V, G1), - dgraph_add_vertices(G1, Vs, GF). - - -/** @pred dgraph_add_vertex(+ _Graph_, + _Vertex_, - _NewGraph_) - -Unify _NewGraph_ with a new graph obtained by adding -vertex _Vertex_ to the graph _Graph_. - - -*/ -dgraph_add_vertex(Vs0, V, Vs0) :- - rb_lookup(V,_,Vs0), !. -dgraph_add_vertex(Vs0, V, Vs) :- - rb_insert(Vs0, V, [], Vs). - - -/** @pred dgraph_edges(+ _Graph_, - _Edges_) - - -Unify _Edges_ with all edges appearing in graph - _Graph_. - - -*/ -dgraph_edges(Vs,Edges) :- - rb_visit(Vs,L0), - cvt2edges(L0,Edges). - -/** @pred dgraph_vertices(+ _Graph_, - _Vertices_) - - -Unify _Vertices_ with all vertices appearing in graph - _Graph_. - -*/ -dgraph_vertices(Vs,Vertices) :- - rb_keys(Vs,Vertices). - -cvt2edges([],[]). -cvt2edges([V-Children|L0],Edges) :- - children2edges(Children,V,Edges,Edges0), - cvt2edges(L0,Edges0). - -children2edges([],_,Edges,Edges). -children2edges([Child|L0],V,[V-Child|EdgesF],Edges0) :- - children2edges(L0,V,EdgesF,Edges0). - -/** @pred dgraph_neighbours(+ _Vertex_, + _Graph_, - _Vertices_) - - -Unify _Vertices_ with the list of neighbours of vertex _Vertex_ -in _Graph_. - - -*/ -dgraph_neighbours(V,Vertices,Children) :- - rb_lookup(V,Children,Vertices). - -/** @pred dgraph_neighbors(+ _Vertex_, + _Graph_, - _Vertices_) - - -Unify _Vertices_ with the list of neighbors of vertex _Vertex_ -in _Graph_. If the vertice is not in the graph fail. - - -*/ -dgraph_neighbors(V,Vertices,Children) :- - rb_lookup(V,Children,Vertices). - -add_vertices(Graph, [], Graph). -add_vertices(Graph, [V|Vertices], NewGraph) :- - rb_insert(Graph, V, [], IntGraph), - add_vertices(IntGraph, Vertices, NewGraph). - -/** @pred dgraph_complement(+ _Graph_, - _NewGraph_) - - -Unify _NewGraph_ with the graph complementary to _Graph_. - - -*/ -dgraph_complement(Vs0,VsF) :- - dgraph_vertices(Vs0,Vertices), - rb_map(Vs0,complement(Vertices),VsF). - -complement(Vs,Children,NewChildren) :- - ord_subtract(Vs,Children,NewChildren). - -/** @pred dgraph_del_edge(+ _Graph_, + _N1_, + _N2_, - _NewGraph_) - - -Succeeds if _NewGraph_ unifies with a new graph obtained by -removing the edge _N1_- _N2_ from the graph _Graph_. Notice -that no vertices are deleted. - - -*/ -dgraph_del_edge(Vs0,V1,V2,Vs1) :- - rb_apply(Vs0, V1, delete_edge(V2), Vs1). - -/** @pred dgraph_del_edges(+ _Graph_, + _Edges_, - _NewGraph_) - - -Unify _NewGraph_ with a new graph obtained by removing the list of -edges _Edges_ from the graph _Graph_. Notice that no vertices -are deleted. - - -*/ -dgraph_del_edges(G0, Edges, Gf) :- - sort(Edges,SortedEdges), - continue_del_edges(SortedEdges, G0, Gf). - -continue_del_edges([]) --> []. -continue_del_edges([V-V1|Es]) --> !, - { get_extra_children(Es,V,Children,REs) }, - contract_vertex(V,[V1|Children]), - continue_del_edges(REs). - -contract_vertex(V,Children, Vs0, Vs) :- - rb_apply(Vs0, V, del_edges(Children), Vs). - -del_edges(ToRemove,E0,E) :- - ord_subtract(E0,ToRemove,E). - -/** @pred dgraph_del_vertex(+ _Graph_, + _Vertex_, - _NewGraph_) - - -Unify _NewGraph_ with a new graph obtained by deleting vertex - _Vertex_ and all the edges that start from or go to _Vertex_ to -the graph _Graph_. - - -*/ -dgraph_del_vertex(Vs0, V, Vsf) :- - rb_delete(Vs0, V, Vs1), - rb_map(Vs1, delete_edge(V), Vsf). - -delete_edge(Edges0, V, Edges) :- - ord_del_element(Edges0, V, Edges). - -/** @pred dgraph_del_vertices(+ _Graph_, + _Vertices_, - _NewGraph_) - - -Unify _NewGraph_ with a new graph obtained by deleting the list of -vertices _Vertices_ and all the edges that start from or go to a -vertex in _Vertices_ to the graph _Graph_. - - -*/ -dgraph_del_vertices(G0, Vs, GF) :- - sort(Vs,SortedVs), - delete_all(SortedVs, G0, G1), - delete_remaining_edges(SortedVs, G1, GF). - -% it would be nice to be able to delete a set of elements from an RB tree -% but I don't how to do it yet. -delete_all([]) --> []. -delete_all([V|Vs],Vs0,Vsf) :- - rb_delete(Vs0, V, Vsi), - delete_all(Vs,Vsi,Vsf). - -delete_remaining_edges(SortedVs,Vs0,Vsf) :- - rb_map(Vs0, del_edges(SortedVs), Vsf). - -/** @pred dgraph_transpose(+ _Graph_, - _Transpose_) - - -Unify _NewGraph_ with a new graph obtained from _Graph_ by -replacing all edges of the form _V1-V2_ by edges of the form - _V2-V1_. - - -*/ -dgraph_transpose(Graph, TGraph) :- - rb_visit(Graph, Edges), - transpose(Edges, Nodes, TEdges, []), - dgraph_new(G0), - % make sure we have all vertices, even if they are unconnected. - dgraph_add_vertices(G0, Nodes, G1), - dgraph_add_edges(G1, TEdges, TGraph). - -transpose([], []) --> []. -transpose([V-Edges|MoreVs], [V|Vs]) --> - transpose_edges(Edges, V), - transpose(MoreVs, Vs). - -transpose_edges([], _V) --> []. -transpose_edges(E.Edges, V) --> - [E-V], - transpose_edges(Edges, V). - -dgraph_compose(T1,T2,CT) :- - rb_visit(T1,Nodes), - compose(Nodes,T2,NewNodes), - dgraph_new(CT0), - dgraph_add_edges(CT0,NewNodes,CT). - -compose([],_,[]). -compose([V-Children|Nodes],T2,NewNodes) :- - compose2(Children,V,T2,NewNodes,NewNodes0), - compose(Nodes,T2,NewNodes0). - -compose2([],_,_,NewNodes,NewNodes). -compose2([C|Children],V,T2,NewNodes,NewNodes0) :- - rb_lookup(C, GrandChildren, T2), - compose3(GrandChildren, V, NewNodes,NewNodesI), - compose2(Children,V,T2,NewNodesI,NewNodes0). - -compose3([], _, NewNodes, NewNodes). -compose3([GC|GrandChildren], V, [V-GC|NewNodes], NewNodes0) :- - compose3(GrandChildren, V, NewNodes, NewNodes0). - -/** @pred dgraph_transitive_closure(+ _Graph_, - _Closure_) - - -Unify _Closure_ with the transitive closure of graph _Graph_. - - -*/ -dgraph_transitive_closure(G,Closure) :- - dgraph_edges(G,Edges), - continue_closure(Edges,G,Closure). - -continue_closure([], Closure, Closure) :- !. -continue_closure(Edges, G, Closure) :- - transit_graph(Edges,G,NewEdges), - dgraph_add_edges(G, NewEdges, GN), - continue_closure(NewEdges, GN, Closure). - -transit_graph([],_,[]). -transit_graph([V-V1|Edges],G,NewEdges) :- - rb_lookup(V1, GrandChildren, G), - transit_graph2(GrandChildren, V, G, NewEdges, MoreEdges), - transit_graph(Edges, G, MoreEdges). - -transit_graph2([], _, _, NewEdges, NewEdges). -transit_graph2([GC|GrandChildren], V, G, NewEdges, MoreEdges) :- - is_edge(V,GC,G), !, - transit_graph2(GrandChildren, V, G, NewEdges, MoreEdges). -transit_graph2([GC|GrandChildren], V, G, [V-GC|NewEdges], MoreEdges) :- - transit_graph2(GrandChildren, V, G, NewEdges, MoreEdges). - -is_edge(V1,V2,G) :- - rb_lookup(V1,Children,G), - ord_memberchk(V2, Children). - -/** @pred dgraph_symmetric_closure(+ _Graph_, - _Closure_) - - -Unify _Closure_ with the symmetric closure of graph _Graph_, -that is, if _Closure_ contains an edge _U-V_ it must also -contain the edge _V-U_. - - -*/ -dgraph_symmetric_closure(G,S) :- - dgraph_edges(G, Edges), - invert_edges(Edges, InvertedEdges), - dgraph_add_edges(G, InvertedEdges, S). - -invert_edges([], []). -invert_edges([V1-V2|Edges], [V2-V1|InvertedEdges]) :- - invert_edges(Edges, InvertedEdges). - -/** @pred dgraph_top_sort(+ _Graph_, - _Vertices_) - - -Unify _Vertices_ with the topological sort of graph _Graph_. - - -*/ -dgraph_top_sort(G, Q) :- - dgraph_top_sort(G, Q, []). - -/** @pred dgraph_top_sort(+ _Graph_, - _Vertices_, ? _Vertices0_) - -Unify the difference list _Vertices_- _Vertices0_ with the -topological sort of graph _Graph_. - - -*/ -dgraph_top_sort(G, Q, RQ0) :- - % O(E) - rb_visit(G, Vs), - % O(E) - invert_and_link(Vs, Links, UnsortedInvertedEdges, AllVs, Q), - % O(V) - rb_clone(G, LinkedG, Links), - % O(Elog(E)) - sort(UnsortedInvertedEdges, InvertedEdges), - % O(E) - dgraph_vertices(G, AllVs), - start_queue(AllVs, InvertedEdges, Q, RQ), - continue_queue(Q, LinkedG, RQ, RQ0). - -invert_and_link([], [], [], [], []). -invert_and_link([V-Vs|Edges], [V-NVs|ExtraEdges], UnsortedInvertedEdges, [V|AllVs],[_|Q]) :- - inv_links(Vs, NVs, V, UnsortedInvertedEdges, UnsortedInvertedEdges0), - invert_and_link(Edges, ExtraEdges, UnsortedInvertedEdges0, AllVs, Q). - -inv_links([],[],_,UnsortedInvertedEdges,UnsortedInvertedEdges). -inv_links([V2|Vs],[l(V2,A,B,S,E)|VLnks],V1,[V2-e(A,B,S,E)|UnsortedInvertedEdges],UnsortedInvertedEdges0) :- - inv_links(Vs,VLnks,V1,UnsortedInvertedEdges,UnsortedInvertedEdges0). - -dup([], []). -dup([_|AllVs], [_|Q]) :- - dup(AllVs, Q). - -start_queue([], [], RQ, RQ). -start_queue([V|AllVs], [VV-e(S,B,S,E)|InvertedEdges], Q, RQ) :- V == VV, !, - link_edges(InvertedEdges, VV, B, S, E, RemainingEdges), - start_queue(AllVs, RemainingEdges, Q, RQ). -start_queue([V|AllVs], InvertedEdges, [V|Q], RQ) :- - start_queue(AllVs, InvertedEdges, Q, RQ). - -link_edges([V-e(A,B,S,E)|InvertedEdges], VV, A, S, E, RemEdges) :- V == VV, !, - link_edges(InvertedEdges, VV, B, S, E, RemEdges). -link_edges(RemEdges, _, A, _, A, RemEdges). - -continue_queue([], _, RQ0, RQ0). -continue_queue([V|Q], LinkedG, RQ, RQ0) :- - rb_lookup(V, Links, LinkedG), - close_links(Links, RQ, RQI), - % not clear whether I should deleted V from LinkedG - continue_queue(Q, LinkedG, RQI, RQ0). - -close_links([], RQ, RQ). -close_links([l(V,A,A,S,E)|Links], RQ, RQ0) :- - ( S == E -> RQ = [V| RQ1] ; RQ = RQ1), - close_links(Links, RQ1, RQ0). - -/** @pred ugraph_to_dgraph( + _UGraph_, - _Graph_) - - -Unify _Graph_ with the directed graph obtain from _UGraph_, -represented in the form used in the _ugraphs_ unweighted graphs -library. - -*/ -ugraph_to_dgraph(UG, DG) :- - ord_list_to_rbtree(UG, DG). - -/** @pred dgraph_to_ugraph(+ _Graph_, - _UGraph_) - - -Unify _UGraph_ with the representation used by the _ugraphs_ -unweighted graphs library, that is, a list of the form - _V-Neighbors_, where _V_ is a node and _Neighbors_ the nodes -children. - -*/ -dgraph_to_ugraph(DG, UG) :- - rb_visit(DG, UG). - -/** @pred dgraph_edge(+ _N1_, + _N2_, + _Graph_) - - -Edge _N1_- _N2_ is an edge in directed graph _Graph_. - - -*/ -dgraph_edge(N1, N2, G) :- - rb_lookup(N1, Ns, G), - ord_memberchk(N2, Ns). - -/** @pred dgraph_min_path(+ _V1_, + _V1_, + _Graph_, - _Path_, ? _Costt_) - - -Unify the list _Path_ with the minimal cost path between nodes - _N1_ and _N2_ in graph _Graph_. Path _Path_ has cost - _Cost_. - - -*/ -dgraph_min_path(V1, V2, Graph, Path, Cost) :- - dgraph_to_wdgraph(Graph, WGraph), - wdgraph_min_path(V1, V2, WGraph, Path, Cost). - -/** @pred dgraph_max_path(+ _V1_, + _V1_, + _Graph_, - _Path_, ? _Costt_) - - -Unify the list _Path_ with the maximal cost path between nodes - _N1_ and _N2_ in graph _Graph_. Path _Path_ has cost - _Cost_. - - -*/ -dgraph_max_path(V1, V2, Graph, Path, Cost) :- - dgraph_to_wdgraph(Graph, WGraph), - wdgraph_max_path(V1, V2, WGraph, Path, Cost). - -/** @pred dgraph_min_paths(+ _V1_, + _Graph_, - _Paths_) - - -Unify the list _Paths_ with the minimal cost paths from node - _N1_ to the nodes in graph _Graph_. - - -*/ -dgraph_min_paths(V1, Graph, Paths) :- - dgraph_to_wdgraph(Graph, WGraph), - wdgraph_min_paths(V1, WGraph, Paths). - -/** @pred dgraph_path(+ _Vertex_, + _Vertex1_, + _Graph_, ? _Path_) - -The path _Path_ is a path starting at vertex _Vertex_ in graph - _Graph_ and ending at path _Vertex2_. - - -*/ -dgraph_path(V1, V2, Graph, Path) :- - rb_new(E0), - rb_lookup(V1, Children, Graph), - dgraph_path_children(Children, V2, E0, Graph, Path). - -dgraph_path_children([V1|_], V2, _E1, _Graph, []) :- V1 == V2. -dgraph_path_children([V1|_], V2, E1, Graph, [V1|Path]) :- - V2 \== V1, - \+ rb_lookup(V1, _, E0), - rb_insert(E0, V2, [], E1), - rb_lookup(V1, Children, Graph), - dgraph_path_children(Children, V2, E1, Graph, Path). -dgraph_path_children([_|Children], V2, E1, Graph, Path) :- - dgraph_path_children(Children, V2, E1, Graph, Path). - - -do_path([], _, _, []). -do_path([C|Children], G, SoFar, Path) :- - do_children([C|Children], G, SoFar, Path). - -do_children([V|_], G, SoFar, [V|Path]) :- - rb_lookup(V, Children, G), - ord_subtract(Children, SoFar, Ch), - ord_insert(SoFar, V, NextSoFar), - do_path(Ch, G, NextSoFar, Path). -do_children([_|Children], G, SoFar, Path) :- - do_children(Children, G, SoFar, Path). - -/** @pred dgraph_path(+ _Vertex_, + _Graph_, ? _Path_) - - -The path _Path_ is a path starting at vertex _Vertex_ in graph - _Graph_. - - -*/ -dgraph_path(V, G, [V|P]) :- - rb_lookup(V, Children, G), - ord_del_element(Children, V, Ch), - do_path(Ch, G, [V], P). - - -/** @pred dgraph_isomorphic(+ _Vs_, + _NewVs_, + _G0_, - _GF_) - - -Unify the list _GF_ with the graph isomorphic to _G0_ where -vertices in _Vs_ map to vertices in _NewVs_. - - -*/ -dgraph_isomorphic(Vs, Vs2, G1, G2) :- - rb_new(Map0), - mapping(Vs,Vs2,Map0,Map), - dgraph_edges(G1,Edges), - translate_edges(Edges,Map,TEdges), - dgraph_new(G20), - dgraph_add_vertices(Vs2,G20,G21), - dgraph_add_edges(G21,TEdges,G2). - -mapping([],[],Map,Map). -mapping([V1|Vs],[V2|Vs2],Map0,Map) :- - rb_insert(Map0,V1,V2,MapI), - mapping(Vs,Vs2,MapI,Map). - - - -translate_edges([],_,[]). -translate_edges([V1-V2|Edges],Map,[NV1-NV2|TEdges]) :- - rb_lookup(V1,NV1,Map), - rb_lookup(V2,NV2,Map), - translate_edges(Edges,Map,TEdges). - -/** @pred dgraph_reachable(+ _Vertex_, + _Graph_, ? _Edges_) - - -The path _Path_ is a path starting at vertex _Vertex_ in graph - _Graph_. - - -*/ -dgraph_reachable(V, G, Edges) :- - rb_lookup(V, Children, G), - ord_list_to_rbtree([V-[]],Done0), - reachable(Children, Done0, _, G, Edges, []). - -reachable([], Done, Done, _, Edges, Edges). -reachable([V|Vertices], Done0, DoneF, G, EdgesF, Edges0) :- - rb_lookup(V,_, Done0), !, - reachable(Vertices, Done0, DoneF, G, EdgesF, Edges0). -reachable([V|Vertices], Done0, DoneF, G, [V|EdgesF], Edges0) :- - rb_lookup(V, Kids, G), - rb_insert(Done0, V, [], Done1), - reachable(Kids, Done1, DoneI, G, EdgesF, EdgesI), - reachable(Vertices, DoneI, DoneF, G, EdgesI, Edges0). - -/** @pred dgraph_leaves(+ _Graph_, ? _Vertices_) - - -The vertices _Vertices_ have no outgoing edge in graph - _Graph_. - - - */ -dgraph_leaves(Graph, Vertices) :- - rb_visit(Graph, Pairs), - vertices_without_children(Pairs, Vertices). - -vertices_without_children([], []). -vertices_without_children((V-[]).Pairs, V.Vertices) :- - vertices_without_children(Pairs, Vertices). -vertices_without_children(_V-[_|_].Pairs, Vertices) :- - vertices_without_children(Pairs, Vertices). - -%% @}/** @} */ - diff --git a/packages/python/swig/yap4py/prolog/exo_interval.yap b/packages/python/swig/yap4py/prolog/exo_interval.yap deleted file mode 100644 index e1a3e30f6..000000000 --- a/packages/python/swig/yap4py/prolog/exo_interval.yap +++ /dev/null @@ -1,242 +0,0 @@ -/** - * @file exo_interval.yap - * @author VITOR SANTOS COSTA - * @date 2013 - * - * @brief This file implements a very simple interval solver - * designed to interact with the exo - * data-base. - * It assumes simple queries and a contiguous interval, - * and does not really expect to do non-trivial - * constraint propagation and solving. - * - * -*/ -:- module(exo_interval, - [max/2, - min/2, - any/2, - max/1, - min/1, - maximum/1, - minimum/1, - any/1, - (#<)/2, - (#>)/2, - (#=<)/2, - (#>=)/2, - (#=)/2, - op(700, xfx, (#>)), - op(700, xfx, (#<)), - op(700, xfx, (#>=)), - op(700, xfx, (#=<)), - op(700, xfx, (#=))]). - - -/** - -@defgroup exo_interval Exo Intervals -@ingroup library -@{ - -This package assumes you use exo-compilation, that is, that you loaded -the pedicate using the `exo` option to load_files/2, In this -case, YAP includes a package for improved search on intervals of -integers. - -The package is activated by `udi` declarations that state what is -the argument of interest: - -~~~~~{.prolog} -:- udi(diagnoses(exo_interval,?,?)). - -:- load_files(db, [consult(exo)]). -~~~~~ -It is designed to optimise the following type of queries: - -~~~~~{.prolog} -?- max(X, diagnoses(X, 9, Y), X). - -?- min(X, diagnoses(X, 9, 36211117), X). - -?- X #< Y, min(X, diagnoses(X, 9, 36211117), X ), diagnoses(Y, 9, _). -~~~~~ -The first argument gives the time, the second the patient, and the -third the condition code. The first query should find the last time -the patient 9 had any code reported, the second looks for the first -report of code 36211117, and the last searches for reports after this -one. All queries run in constant or log(n) time. - - - */ - -/** @pred max( _X_, _Vs_) -First Argument is the greatest element of a list. - -+ lex_order( _Vs_) -All elements must be ordered. - - - -The following predicates control search: - - -*/ -/** @pred max(+ _Expression_) -Maximizes _Expression_ within the current constraint store. This is -the same as computing the supremum and equating the expression to that -supremum. - - -*/ -/** @pred min( _X_, _Vs_) -First Argument is the least element of a list. - - -*/ -/** @pred min(+ _Expression_) -Minimizes _Expression_ within the current constraint store. This is -the same as computing the infimum and equation the expression to that -infimum. - - -*/ -:- meta_predicate max(?,0), min(?,0), any(?,0). - -max(X, G) :- - insert_atts(X, i(_,_,max)), - call(G). - -min(X, G) :- - insert_atts(X, i(_,_,min)), - call(G). - -max(X) :- - insert_atts(X, i(_,_,max)). - -maximum(X) :- - insert_atts(X, i(_,_,maximum)). - -any(X) :- - insert_atts(X, i(_,_,any)). - -min(X) :- - insert_atts(X, i(_,_,min)). - -minimum(X) :- - insert_atts(X, i(_,_,minimum)). - -least(X) :- - insert_atts(X, i(_,_,least)). - -X #> Y :- - ( var(X) -> insert_atts(X, i(Y,_,_)) - ; - ( var(Y) -> insert_atts(Y, i(_,X,_) ) ; - true - ) - ; - var(Y) -> insert_atts(Y, i(_,X,_)) - ; - X > Y - ). - -X #>= Y :- - ( var(X) -> insert_atts(X, i(Y-1,_,_)) - ; - X >= Y - ). - -X #< Y :- - ( var(X) -> insert_atts(X, i(_,Y,_)) - ; - X < Y - ). - -X #=< Y :- - ( var(X) -> insert_atts(X, i(Y+1,_,_)) - ; - X =< Y - ). - -X #= Y :- - ( var(X) -> insert_atts(X, i(Y-1,Y+1,_)) ; - X =:= Y - ). - - -attribute_goals(X) --> - { get_attr(X, exo_interval, Op) }, - ( { Op = max } -> [max(X)] ; - { Op = min } -> [min(X)] ; - { Op = '>'(Y) } -> [X #> Y] ; - { Op = '<'(Y) } -> [X #< Y] ; - { Op = range(A,B,C) } -> - range_min(A,X), - range_max(B,X), - range_op(C, X) - ). - -range_min(Y, _X) --> - { var(Y) }, !, - []. -range_min(Y, X) --> - [X #> Y]. - -range_max(Y, _X) --> - { var(Y) }, !, - []. -range_max(Y, X) --> - [X #< Y]. - -range_op(Y, _X) --> - { var(Y) }, !, - []. -range_op(Y, X) --> - { Op =.. [Y, X] }, - [Op]. - -insert_atts(V, Att) :- - ( nonvar(V) -> - throw( error(uninstantion_error(V), exo_interval) ) - ; attvar(V) -> - get_attr(V, exo_interval, Att0), - expand_atts(Att, Att0, NAtt) - ; - NAtt = Att - ), - put_attr(V, exo_interval, NAtt). - -expand_atts(i(A1, B1, C1), i(A2, B2, C2), i(A3,B3,C3)) :- - expand_min(A1, A2, A3), - expand_max(B1, B2, B3), - expand_op(C1, C2, C3). - -expand_min(A1, A2, A3) :- - (var(A1) -> A3 = A2; - var(A2) -> A3 = A1; - ground(A1), ground(A2) -> A3 is max(A1,A2) ; - A3 = max(A1,A2) - ). - -expand_max(A1, A2, A3) :- - (var(A1) -> A3 = A2; - var(A2) -> A3 = A1; - ground(A1), ground(A2) -> A3 is min(A1,A2) ; - A3 = min(A1,A2) - ). - -expand_op(A1, A2, A3) :- - (var(A1) -> A3 = A2; - var(A2) -> A3 = A1; - A1 == A2 -> A3 = A1; - A1 == unique -> A3 = unique; - A2 == unique -> A3 = unique; - A2 == min, A1 = max -> A3 = unique; - A1 == min, A2 = max -> A3 = unique; - A1 == min -> A3 = min; A2 == min -> A3 = min; - A1 == max -> A3 = max; A2 == max -> A3 = max; - A3 = any - ). -%% @} - diff --git a/packages/python/swig/yap4py/prolog/expand_macros.yap b/packages/python/swig/yap4py/prolog/expand_macros.yap deleted file mode 100644 index e41137724..000000000 --- a/packages/python/swig/yap4py/prolog/expand_macros.yap +++ /dev/null @@ -1,165 +0,0 @@ -/** - * @file expand_macros.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 15:16:12 2015 - * - * @brief utilities that perform macro expansion for maplist/2 and - * friends. - * - * -*/ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% preprocessing for meta-calls -%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -:- module( expand_macros, - [compile_aux/2, - pred_name/4, - transformation_id/1, - allowed_expansion/1, - allowed_module/2] ). - - -:- use_module(library(lists), [append/3]). -:- use_module(library(charsio), [format_to_chars/3, read_from_chars/2]). -:- use_module(library(error), [must_be/2]). -:- use_module(library(occurs), [sub_term/2]). - -:- multifile allowed_module/2. - -:- dynamic number_of_expansions/1. - -number_of_expansions(0). - - - -%%%%%%%%%%%%%%%%%%%% -% utilities -%%%%%%%%%%%%%%%%%%%% - -compile_aux([Clause|Clauses], Module) :- - % compile the predicate declaration if needed - ( - Clause = (Head :- _) - ; - Clause = Head - ), - !, - functor(Head, F, N), - ( current_predicate(Module:F/N) - -> - true - ; - % format'*** Creating auxiliary predicate ~q~n', [F/N]), - % checklist(portray_clause, [Clause|Clauses]), - compile_term([Clause|Clauses], Module) - ). - -compile_term([], _). -compile_term([Clause|Clauses], Module) :- - assert_static(Module:Clause), - compile_term(Clauses, Module). - -append_args(Term, Args, NewTerm) :- - Term =.. [Meta|OldArgs], - append(OldArgs, Args, GoalArgs), - NewTerm =.. [Meta|GoalArgs]. - -aux_preds(Module:Meta, MetaVars, Pred, PredVars, Proto, _, OModule) :- !, - aux_preds(Meta, MetaVars, Pred, PredVars, Proto, Module, OModule). -aux_preds(Meta, MetaVars, Pred, PredVars, Proto, Module, Module) :- - Meta =.. [F|Args], - aux_args(Args, MetaVars, PredArgs, PredVars, ProtoArgs), - Pred =.. [F|PredArgs], - Proto =.. [F|ProtoArgs]. - -aux_args([], [], [], [], []). -aux_args([Arg|Args], MVars, [Arg|PArgs], PVars, [Arg|ProtoArgs]) :- - ground(Arg), !, - aux_args(Args, MVars, PArgs, PVars, ProtoArgs). -aux_args([Arg|Args], [Arg|MVars], [PVar|PArgs], [PVar|PVars], ['_'|ProtoArgs]) :- - aux_args(Args, MVars, PArgs, PVars, ProtoArgs). - -pred_name(Macro, Arity, _ , Name) :- - transformation_id(Id), - atomic_concat(['$$$__Auxiliary_predicate__ for',Macro,'/',Arity,' ',Id], Name). - -transformation_id(Id) :- - retract(number_of_expansions(Id)), - Id1 is Id+1, - assert(number_of_expansions(Id1)). - - -harmless_dcgexception(instantiation_error). % ex: phrase(([1],x:X,[3]),L) -harmless_dcgexception(type_error(callable,_)). % ex: phrase(27,L) - - -allowed_expansion(QExpand) :- - strip_module(QExpand, Mod, Pred), - goal_expansion_allowed(Pred, Mod). - -goal_expansion_allowed(Pred, Mod) :- - allowed_module(Pred,Mod), - once( prolog_load_context(_, _) ), % make sure we are compiling. - - - - -allowed_module(checklist(_,_),expand_macros). -allowed_module(checklist(_,_),apply_macros). -allowed_module(checklist(_,_),maplist). -allowed_module(maplist(_,_),expand_macros). -allowed_module(maplist(_,_),apply_macros). -allowed_module(maplist(_,_),maplist). -allowed_module(maplist(_,_,_),expand_macros). -allowed_module(maplist(_,_,_),apply_macros). -allowed_module(maplist(_,_,_),maplist). -allowed_module(maplist(_,_,_,_),expand_macros). -allowed_module(maplist(_,_,_,_),apply_macros). -allowed_module(maplist(_,_,_,_),maplist). -allowed_module(maplist(_,_,_,_,_),expand_macros). -allowed_module(maplist(_,_,_,_,_),apply_macros). -allowed_module(maplist(_,_,_,_,_),maplist). -allowed_module(maplist(_,_,_,_,_,_),expand_macros). -allowed_module(maplist(_,_,_,_,_,_),apply_macros). -allowed_module(maplist(_,_,_,_,_,_),maplist). -allowed_module(selectlist(_,_,_),expand_macros). -allowed_module(selectlist(_,_,_),apply_macros). -allowed_module(selectlist(_,_,_),maplist). -allowed_module(include(_,_,_),expand_macros). -allowed_module(include(_,_,_),apply_macros). -allowed_module(include(_,_,_),maplist). -allowed_module(exclude(_,_,_),expand_macros). -allowed_module(exclude(_,_,_),apply_macros). -allowed_module(exclude(_,_,_),maplist). -allowed_module(partition(_,_,_,_),expand_macros). -allowed_module(partition(_,_,_,_),apply_macros). -allowed_module(partition(_,_,_,_),maplist). -allowed_module(partition(_,_,_,_,_),expand_macros). -allowed_module(partition(_,_,_,_,_),apply_macros). -allowed_module(partition(_,_,_,_,_),maplist). -allowed_module(convlist(_,_,_),expand_macros). -allowed_module(convlist(_,_,_),apply_macros). -allowed_module(convlist(_,_,_),maplist). -allowed_module(sumlist(_,_,_,_),expand_macros). -allowed_module(sumlist(_,_,_,_),apply_macros). -allowed_module(sumlist(_,_,_,_),maplist). -allowed_module(mapargs(_,_,_),expand_macros). -allowed_module(mapargs(_,_,_),apply_macros). -allowed_module(mapargs(_,_,_),maplist). -allowed_module(sumargs(_,_,_,_),expand_macros). -allowed_module(sumargs(_,_,_,_),apply_macros). -allowed_module(sumargs(_,_,_,_),maplist). -allowed_module(mapnodes(_,_,_),expand_macros). -allowed_module(mapnodes(_,_,_),apply_macros). -allowed_module(mapnodes(_,_,_),maplist). -allowed_module(checknodes(_,_),expand_macros). -allowed_module(checknodes(_,_),apply_macros). -allowed_module(checknodes(_,_),maplist). -allowed_module(sumnodes(_,_,_,_),expand_macros). -allowed_module(sumnodes(_,_,_,_),apply_macros). -allowed_module(sumnodes(_,_,_,_),maplist). diff --git a/packages/python/swig/yap4py/prolog/flags.yap b/packages/python/swig/yap4py/prolog/flags.yap deleted file mode 100644 index 4b3daf33b..000000000 --- a/packages/python/swig/yap4py/prolog/flags.yap +++ /dev/null @@ -1,589 +0,0 @@ -%%% -*- Mode: Prolog; -*- - -/** - * @file library/flags.yap - * @author Theofrastos Mantadelis, Bernd Gutmann, Paulo Moura - * @date Tue Nov 17 15:18:02 2015 - * - * @brief Flag Manipulation in Prolog - * - * -*/ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Flags was developed at Katholieke Universiteit Leuven -% -% Copyright 2010 -% Katholieke Universiteit Leuven -% -% Contributions to this file: -% Author: Theofrastos Mantadelis -% Sugestions: Bernd Gutmann, Paulo Moura -% $Date: 2011-02-15 13:33:01 +0100 (Tue, 15 Feb 2011) $ -% $Revision: 15 $ -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Artistic License 2.0 -% -% Copyright (c) 2000-2006, The Perl Foundation. -% -% Everyone is permitted to copy and distribute verbatim copies of this -% license document, but changing it is not allowed. Preamble -% -% This license establishes the terms under which a given free software -% Package may be copied, modified, distributed, and/or -% redistributed. The intent is that the Copyright Holder maintains some -% artistic control over the development of that Package while still -% keeping the Package available as open source and free software. -% -% You are always permitted to make arrangements wholly outside of this -% license directly with the Copyright Holder of a given Package. If the -% terms of this license do not permit the full use that you propose to -% make of the Package, you should contact the Copyright Holder and seek -% a different licensing arrangement. Definitions -% -% "Copyright Holder" means the individual(s) or organization(s) named in -% the copyright notice for the entire Package. -% -% "Contributor" means any party that has contributed code or other -% material to the Package, in accordance with the Copyright Holder's -% procedures. -% -% "You" and "your" means any person who would like to copy, distribute, -% or modify the Package. -% -% "Package" means the collection of files distributed by the Copyright -% Holder, and derivatives of that collection and/or of those files. A -% given Package may consist of either the Standard Version, or a -% Modified Version. -% -% "Distribute" means providing a copy of the Package or making it -% accessible to anyone else, or in the case of a company or -% organization, to others outside of your company or organization. -% -% "Distributor Fee" means any fee that you charge for Distributing this -% Package or providing support for this Package to another party. It -% does not mean licensing fees. -% -% "Standard Version" refers to the Package if it has not been modified, -% or has been modified only in ways explicitly requested by the -% Copyright Holder. -% -% "Modified Version" means the Package, if it has been changed, and such -% changes were not explicitly requested by the Copyright Holder. -% -% "Original License" means this Artistic License as Distributed with the -% Standard Version of the Package, in its current version or as it may -% be modified by The Perl Foundation in the future. -% -% "Source" form means the source code, documentation source, and -% configuration files for the Package. -% -% "Compiled" form means the compiled bytecode, object code, binary, or -% any other form resulting from mechanical transformation or translation -% of the Source form. -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Permission for Use and Modification Without Distribution -% -% (1) You are permitted to use the Standard Version and create and use -% Modified Versions for any purpose without restriction, provided that -% you do not Distribute the Modified Version. -% -% Permissions for Redistribution of the Standard Version -% -% (2) You may Distribute verbatim copies of the Source form of the -% Standard Version of this Package in any medium without restriction, -% either gratis or for a Distributor Fee, provided that you duplicate -% all of the original copyright notices and associated disclaimers. At -% your discretion, such verbatim copies may or may not include a -% Compiled form of the Package. -% -% (3) You may apply any bug fixes, portability changes, and other -% modifications made available from the Copyright Holder. The resulting -% Package will still be considered the Standard Version, and as such -% will be subject to the Original License. -% -% Distribution of Modified Versions of the Package as Source -% -% (4) You may Distribute your Modified Version as Source (either gratis -% or for a Distributor Fee, and with or without a Compiled form of the -% Modified Version) provided that you clearly document how it differs -% from the Standard Version, including, but not limited to, documenting -% any non-standard features, executables, or modules, and provided that -% you do at least ONE of the following: -% -% (a) make the Modified Version available to the Copyright Holder of the -% Standard Version, under the Original License, so that the Copyright -% Holder may include your modifications in the Standard Version. (b) -% ensure that installation of your Modified Version does not prevent the -% user installing or running the Standard Version. In addition, the -% modified Version must bear a name that is different from the name of -% the Standard Version. (c) allow anyone who receives a copy of the -% Modified Version to make the Source form of the Modified Version -% available to others under (i) the Original License or (ii) a license -% that permits the licensee to freely copy, modify and redistribute the -% Modified Version using the same licensing terms that apply to the copy -% that the licensee received, and requires that the Source form of the -% Modified Version, and of any works derived from it, be made freely -% available in that license fees are prohibited but Distributor Fees are -% allowed. -% -% Distribution of Compiled Forms of the Standard Version or -% Modified Versions without the Source -% -% (5) You may Distribute Compiled forms of the Standard Version without -% the Source, provided that you include complete instructions on how to -% get the Source of the Standard Version. Such instructions must be -% valid at the time of your distribution. If these instructions, at any -% time while you are carrying out such distribution, become invalid, you -% must provide new instructions on demand or cease further -% distribution. If you provide valid instructions or cease distribution -% within thirty days after you become aware that the instructions are -% invalid, then you do not forfeit any of your rights under this -% license. -% -% (6) You may Distribute a Modified Version in Compiled form without the -% Source, provided that you comply with Section 4 with respect to the -% Source of the Modified Version. -% -% Aggregating or Linking the Package -% -% (7) You may aggregate the Package (either the Standard Version or -% Modified Version) with other packages and Distribute the resulting -% aggregation provided that you do not charge a licensing fee for the -% Package. Distributor Fees are permitted, and licensing fees for other -% components in the aggregation are permitted. The terms of this license -% apply to the use and Distribution of the Standard or Modified Versions -% as included in the aggregation. -% -% (8) You are permitted to link Modified and Standard Versions with -% other works, to embed the Package in a larger work of your own, or to -% build stand-alone binary or bytecode versions of applications that -% include the Package, and Distribute the result without restriction, -% provided the result does not expose a direct interface to the Package. -% -% Items That are Not Considered Part of a Modified Version -% -% (9) Works (including, but not limited to, modules and scripts) that -% merely extend or make use of the Package, do not, by themselves, cause -% the Package to be a Modified Version. In addition, such works are not -% considered parts of the Package itself, and are not subject to the -% terms of this license. -% -% General Provisions -% -% (10) Any use, modification, and distribution of the Standard or -% Modified Versions is governed by this Artistic License. By using, -% modifying or distributing the Package, you accept this license. Do not -% use, modify, or distribute the Package, if you do not accept this -% license. -% -% (11) If your Modified Version has been derived from a Modified Version -% made by someone other than you, you are nevertheless required to -% ensure that your Modified Version complies with the requirements of -% this license. -% -% (12) This license does not grant you the right to use any trademark, -% service mark, tradename, or logo of the Copyright Holder. -% -% (13) This license includes the non-exclusive, worldwide, -% free-of-charge patent license to make, have made, use, offer to sell, -% sell, import and otherwise transfer the Package with respect to any -% patent claims licensable by the Copyright Holder that are necessarily -% infringed by the Package. If you institute patent litigation -% (including a cross-claim or counterclaim) against any party alleging -% that the Package constitutes direct or contributory patent -% infringement, then this Artistic License to you shall terminate on the -% date that such litigation is filed. -% -% (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT -% HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED -% WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -% PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT -% PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT -% HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, -% INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE -% OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -:- module(flags, [flag_define/2, - flag_define/5, - flag_define/7, - flag_set/2, - flag_set/3, - flag_unsafe_set/2, - flag_get/2, - flags_reset/0, - flags_reset/1, - flags_save/1, - flags_load/1, - flag_groups/1, - flag_group_chk/1, - flag_help/0, - flags_print/0, - defined_flag/7]). - -/** -* @defgroup flags Flag Manipulation in Prolog -* @ingroup library -* -* Routines to manipulate flags: they allow defining, set, -* resetting. -* @{ -*/ - - -:- use_module(library(lists), [append/3, memberchk/2, member/2]). - -:- style_check(all). -:- yap_flag(unknown, error). - -:- dynamic(['$defined_flag$'/7, '$store_flag_value$'/2]). -:- meta_predicate(flag_define(+, +, +, ?, ?, ?, :)). -:- meta_predicate(flag_define(+, :)). -:- meta_predicate(validate(+, :, ?, +)). -:- multifile(flags_type_definition/3). - -flag_define(FlagName, InputOptions):- - strip_module(InputOptions, Module, UserOptions), - Defaults = [flag_group(general), flag_type(nonvar), default_value(true), description(FlagName), access(read_write), handler(true)], - append(UserOptions, Defaults, Options), - memberchk(flag_group(FlagGroup), Options), - memberchk(flag_type(FlagType), Options), - memberchk(default_value(DefaultValue), Options), - memberchk(description(Description), Options), - memberchk(access(Access), Options), - memberchk(handler(Handler), Options), - flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler). - -flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description):- - flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, read_write, true). - -flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, MHandler):- - strip_module(MHandler, Module, Handler), - nonvar(FlagName), - nonvar(FlagGroup), - nonvar(FlagType), - nonvar(Access), - nonvar(Handler), !, - (\+ atom(FlagName) -> - throw(error(type_error(atom, FlagName), message('Flag name needs to be an atom.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler)))) - ; \+ atom(FlagGroup) -> - throw(error(type_error(atom, FlagGroup), message('Flag group needs to be an atom.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler)))) - ; \+ flag_type(FlagType) -> - throw(error(domain_error(flag_type, FlagType), message('Unknown flag type.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Module:Handler)))) - ; \+ validate_type(FlagType) -> - throw(error(evaluation_error(type_validation), message('Validation of flag type failed, check custom domain.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler)))) - ; '$defined_flag$'(FlagName, _FlagGroup, _FlagType, _DefaultValue, _Description, _Access, _Handler) -> - throw(error(permission_error(create, flag, FlagName), message('Re-defining a flag is not allowed.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler)))) - ; \+ memberchk(Access, [read_write, read_only, hidden, hidden_read_only]), - throw(error(domain_error(access, Access), message('Wrong access attribute, available are: read_write, read_only, hidden, hidden_read_only.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler)))) - ; \+ callable(Handler) -> % the Handler comes from: strip_module(MHandler, Module, Handler) - throw(error(type_error(callable, Handler), message('Flag handler needs to be callable.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler)))) - ; - validate(FlagType, Module:Handler, DefaultValue, FlagName), - assertz('$defined_flag$'(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Module:Handler)), - assertz('$store_flag_value$'(FlagName, DefaultValue)), - (Handler == true -> - true - ; - call(Module:Handler, stored, DefaultValue) - ) - ). -flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler):- - throw(error(instantiation_error, message('Flag name, group, type, access and handler need to be instantiated.', flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler)))). - -flag_groups(FlagGroups):- - all(FlagGroup, ('$defined_flag$'(_FlagName, FlagGroup, _FlagType, _DefaultValue, _Description, Access, _Handler), Access \== hidden, Access \== hidden_read_only), FlagGroups). - -flag_group_chk(FlagGroup):- - nonvar(FlagGroup), - '$defined_flag$'(_FlagName, FlagGroup, _FlagType, _DefaultValue, _Description, _Access, _Handler), !. - -flag_type(Type):- - flags_type_definition(Type, _, _). - -% flags_type_definition(TypeName, TypeHandler, TypeValidator). -flags_type_definition(nonvar, nonvar, true). -flags_type_definition(atom, atom, true). -flags_type_definition(atomic, atomic, true). -flags_type_definition(integer, integer, true). -flags_type_definition(float, float, true). -flags_type_definition(number, number, true). -flags_type_definition(ground, ground, true). -flags_type_definition(compound, compound, true). -flags_type_definition(is_list, is_list, true). -flags_type_definition(callable, callable, true). -flags_type_definition(in_interval(Type, Interval), in_interval(Type, Interval), in_interval(Type, Interval)). -flags_type_definition(integer_in_interval(Interval), in_interval(integer, Interval), in_interval(integer, Interval)). -flags_type_definition(positive_integer, in_interval(integer, (0, (+inf))), true). -flags_type_definition(non_negative_integer, in_interval(integer, ([0], (+inf))), true). -flags_type_definition(negative_integer, in_interval(integer, ((-inf), 0)), true). -flags_type_definition(float_in_interval(Interval), in_interval(float, Interval), in_interval(float, Interval)). -flags_type_definition(positive_float, in_interval(float, (0.0, (+inf))), true). -flags_type_definition(non_negative_float, in_interval(float, ([0.0], (+inf))), true). -flags_type_definition(negative_float, in_interval(float, ((-inf), 0.0)), true). -flags_type_definition(number_in_interval(Interval), in_interval(number, Interval), in_interval(number, Interval)). -flags_type_definition(positive_number, in_interval(number, (0.0, (+inf))), true). -flags_type_definition(non_negative_number, in_interval(number, ([0.0], (+inf))), true). -flags_type_definition(negative_number, in_interval(number, ((-inf), 0.0)), true). -flags_type_definition(in_domain(Domain), in_domain(Domain), in_domain(Domain)). -flags_type_definition(boolean, in_domain([true, false]), true). -flags_type_definition(switch, in_domain([on, off]), true). - -in_domain(Domain):- - ground(Domain), - is_list(Domain). -in_domain(Domain, Value):- - ground(Value), - memberchk(Value, Domain). - -in_interval(Type, Interval):- - is_list(Interval), !, - Interval \== [], - in_interval_conj(Type, Interval). -in_interval(Type, Interval):- - in_interval_single(Type, Interval). - -in_interval_conj(_Type, []). -in_interval_conj(Type, [Interval|Rest]):- - in_interval_single(Type, Interval), - in_interval_conj(Type, Rest). - -in_interval_single(Type, ([Min], [Max])):- - !, call(Type, Min), - call(Type, Max), - Min =< Max. - -in_interval_single(Type, ([Min], Max)):- - !, call(Type, Min), - type_or_inf(Type, Max), - Min < Max. - -in_interval_single(Type, (Min, [Max])):- - !, type_or_inf(Type, Min), - call(Type, Max), - Min < Max. - -in_interval_single(Type, (Min, Max)):- - type_or_inf(Type, Min), - type_or_inf(Type, Max), - Min < Max, - Max - Min > 0.0. - -type_or_inf(Type, Value):- - nonvar(Type), nonvar(Value), - Value == (+inf), !. -type_or_inf(Type, Value):- - nonvar(Type), nonvar(Value), - Value == (-inf), !. -type_or_inf(Type, Value):- call(Type, Value). - -in_interval(Type, [Interval|_Rest], Value):- - in_interval(Type, Interval, Value), !. -in_interval(Type, [_Interval|Rest], Value):- - in_interval(Type, Rest, Value). - -in_interval(Type, ([Min], [Max]), Value):- - !, call(Type, Value), - Value >= Min, - Value =< Max. - -in_interval(Type, ([Min], Max), Value):- - !, call(Type, Value), - Value >= Min, - Value < Max. - -in_interval(Type, (Min, [Max]), Value):- - !, call(Type, Value), - Value > Min, - Value =< Max. - -in_interval(Type, (Min, Max), Value):- - call(Type, Value), - Value > Min, - Value < Max. - -validate_type(Type):- - flags_type_definition(Type, _, TypeValidater), - call(TypeValidater). - -validate(FlagType, Handler, Value, FlagName):- - strip_module(Handler, _Module, true), - !, flags_type_definition(FlagType, FlagValidator, _), - (call(FlagValidator, Value) -> - true - ; - throw(error(validation_error(FlagType, Value), message('Validation of value fails.', validate(FlagType, Value, FlagName)))) - ). -validate(FlagType, Handler, Value, FlagName):- - flags_type_definition(FlagType, FlagValidator, _), - ((call(Handler, validating, Value), (call(FlagValidator, Value); call(Handler, validate, Value))) -> - call(Handler, validated, Value) - ; - throw(error(validation_error(FlagType, Value), message('Validation of value fails.', validate(FlagType, Handler, Value, FlagName)))) - ). - -flag_set(FlagName, FlagValue):- - flag_set(FlagName, _OldValue, FlagValue). -flag_set(FlagName, OldValue, FlagValue):- - atom(FlagName), - '$defined_flag$'(FlagName, _FlagGroup, FlagType, _DefaultValue, _Description, Access, Module:Handler), !, - (Access \== read_only, Access \== hidden_read_only -> - validate(FlagType, Module:Handler, FlagValue, FlagName), - retract('$store_flag_value$'(FlagName, OldValue)), - assertz('$store_flag_value$'(FlagName, FlagValue)), - (Handler == true -> - true - ; - call(Module:Handler, stored, FlagValue) - ) - ; - throw(error(permission_error(set, flag, FlagName), message('Setting the flag value is not allowed.',flag_set(FlagName, OldValue, FlagValue)))) - ). -flag_set(FlagName, OldValue, FlagValue):- - throw(error(existence_error(flag, FlagName), message('The flag is not defined.', flag_set(FlagName, OldValue, FlagValue)))). - -flag_unsafe_set(FlagName, FlagValue):- - retract('$store_flag_value$'(FlagName, _)), - assertz('$store_flag_value$'(FlagName, FlagValue)). - -flag_get(FlagName, FlagValue):- - \+ '$store_flag_value$'(FlagName, _), - throw(error(existence_error(flag, FlagName), message('The flag is not defined.', flag_get(FlagName, FlagValue)))). -flag_get(FlagName, FlagValue):- - '$store_flag_value$'(FlagName, FlagValue). - -flags_reset:- - retractall('$store_flag_value$'(_, _)), - '$defined_flag$'(FlagName, _FlagGroup, _FlagType, DefaultValue, _Description, _Access, Module:Handler), - assertz('$store_flag_value$'(FlagName, DefaultValue)), - (Handler == true -> - true - ; - call(Module:Handler, stored, DefaultValue) - ), - fail. -flags_reset. - -flags_reset(FlagGroup):- - '$defined_flag$'(FlagName, FlagGroup, _FlagType, DefaultValue, _Description, _Access, Module:Handler), - retractall('$store_flag_value$'(FlagName, _)), - assertz('$store_flag_value$'(FlagName, DefaultValue)), - (Handler == true -> - true - ; - call(Module:Handler, stored, DefaultValue) - ), - fail. -flags_reset(_). - -flags_save(FileName):- - tell(FileName), - catch(('$store_flag_value$'(FlagName, Value), - write_canonical('$store_flag_value$'(FlagName, Value)), - write('.'), nl), - Exception, clean_and_throw(told, Exception)), - fail. -flags_save(_FileName):- - told. - -flags_load(FileName):- - see(FileName), - catch((read('$store_flag_value$'(FlagName, Value)), - flag_set(FlagName, Value)), - Exception, clean_and_throw(seen, Exception)), - fail. -flags_load(_FileName):- - seen. - -clean_and_throw(Action, Exception):- - Action, - throw(Exception). - -flag_help:- - format('This is a short tutorial for the flags library.~nExported predicates:~n'), - format(' flag_define/5 : defines a new flag without a handler~n'), - format(' flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description)~n'), - format(' flag_define/6 : defines a new flag with a handler~n'), - format(' flag_define(FlagName, FlagGroup, FlagType, DefaultValue, Description, Handler)~n'), - format(' FlagName : the name of the flag~n'), - format(' FlagGroup : the name of the flag group~n'), - format(' FlagType : the type of the flag available types are:~n'), - flag_help_types, - format(' DefaultValue : the default value for the flag~n'), - format(' Description : a flag description~n'), - format(' Handler : a handler~n'), - flags:flag_help_handler, - format(' flag_groups/1 : returns all the flag groups in a list~n'), - format(' flag_group_chk/1 : checks if a group exists~n'), - format(' flag_set/2 : sets the value of a flag~n'), - format(' flag_get/2 : gets the value of a flag~n'), - format(' flag_store/2 : sets the value of a flag ignoring all tests and handlers~n'), - format(' flag_reset/0 : resets all flags to their default value~n'), - format(' flag_reset/1 : resets all flags of a group to their default value~n'), - format(' flag_help/0 : this screen~n'), - format(' flags_print/0 : shows the current flags/values~n'). -flag_help_types:- - flag_type(FlagType), - format(' ~w~n', [FlagType]), - fail. -flag_help_types. - -flag_help_handler:- - format(' Handler important notes:~n'), - format(' Conjuction: external_handler(validating, Value):-...~n'), - format(' Disjunction: external_handler(validate, Value):-...~n'), - format(' After: external_handler(validated, Value):-...~n'), - format(' After set: external_handler(stored, Value):-...~n'), - format(' this is implemented as (validating,(original;validated))~n'), - format(' validating|original|validate|result~n'), - format(' true | true | true | true~n'), - format(' true | true | fail | true~n'), - format(' true | fail | true | true~n'), - format(' true | fail | fail | fail~n'), - format(' fail | true | true | fail~n'), - format(' fail | true | fail | fail~n'), - format(' fail | fail | true | fail~n'), - format(' fail | fail | fail | fail~n'), - format(' Default behaviour is validating->true, validate->fail~n'), - format(' To completly replace original set validate->true~n'), - format(' To add new values to original set validating->true~n'), - format(' To remove values from original set validate->fail~n'), - format(' Example definition with a handler:~n'), - format(' flag_define(myflag, mygroup, in_interval(integer, [(-5, 5),([15],[25])]), 0, description, my_handler).~n'), - format(' my_handler(validate, Value):-Value is 10.~n'), - format(' my_handler(validating, Value).~n'), - format(' my_handler(validated, Value).~n'), - format(' my_handler(stored, Value).~n'), - format(' This has defined a flag that accepts integers (-5,5)v[15,25].~n'), - format(' The handler adds the value 10 in those.~n'). - -flags_print:- - flag_groups(Groups), - forall(member(Group, Groups), flags_print(Group)). -flags_print(Group):- - format(' ~w:~n~w~38+ ~w~19+ ~w~10+ ~w~10+~n', [Group, 'Description', 'Domain', 'Flag', 'Value']), - fail. -flags_print(FlagGroup):- - '$defined_flag$'(FlagName, FlagGroup, FlagType, _DefaultValue, Description, Access, _Handler), - Access \== hidden, Access \== hidden_read_only, - flag_get(FlagName, Value), - format('~w~38+ ~w~19+ ~w~10+ ~q~10+~n', [Description, FlagType, FlagName, Value]), - fail. -flags_print(_). - -defined_flag(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler):- - '$defined_flag$'(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler), - Access \== hidden, Access \== hidden_read_only. -defined_flag(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler):- - nonvar(FlagName), nonvar(FlagGroup), - '$defined_flag$'(FlagName, FlagGroup, FlagType, DefaultValue, Description, Access, Handler). - -%% @} diff --git a/packages/python/swig/yap4py/prolog/gensym.yap b/packages/python/swig/yap4py/prolog/gensym.yap deleted file mode 100644 index 11c213214..000000000 --- a/packages/python/swig/yap4py/prolog/gensym.yap +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file gensym.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 18:37:13 2015 - * - * @brief Generate a new atom. - * - * -*/ -:- module(gensym, [ - gensym/2, - reset_gensym/1, - reset_gensym/0 - ]). - -/** -* @defgroup gensym Generate a new symbol. -* @ingroup library -* -* Predicates to create new atoms based on the prefix _Atom_. -* They use a counter, stored as a -* dynamic predicate, to construct the atom's suffix. -* -*/ - - -:- dynamic gensym_key/2. - -gensym(Atom, New) :- - retract(gensym_key(Atom,Id)), !, - atomic_concat(Atom,Id,New), - NId is Id+1, - assert(gensym_key(Atom,NId)). -gensym(Atom, New) :- - atomic_concat(Atom,1,New), - assert(gensym_key(Atom,2)). - -reset_gensym(Atom) :- - retract(gensym_key(Atom,_)). - -reset_gensym :- - retractall(gensym_key(_,_)). - - diff --git a/packages/python/swig/yap4py/prolog/hacks.yap b/packages/python/swig/yap4py/prolog/hacks.yap deleted file mode 100644 index 856670b89..000000000 --- a/packages/python/swig/yap4py/prolog/hacks.yap +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file library/hacks.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 19:00:25 2015 - * - * @brief Prolog hacking - * - * -*/ - -:- module(yap_hacks, [ - current_choicepoint/1, - cut_by/1, - cut_at/1, - current_choicepoints/1, - choicepoint/7, - current_continuations/1, - continuation/4, - stack_dump/0, - stack_dump/1, - enable_interrupts/0, - disable_interrupts/0, - virtual_alarm/3, - fully_strip_module/3, - context_variables/1 - ]). - -/** -* @defgroup yap_hacks YAP hacking -* @ingroup library -* -* Manipulate the Prolog stacks, including setting and resetting -* choice-points. -* -*/ - - -stack_dump :- - stack_dump(-1). - -stack_dump(Max) :- - current_choicepoints(CPs), - current_continuations([Env|Envs]), - continuation(Env,_,ContP,_), - length(CPs, LCPs), - length(Envs, LEnvs), - format(user_error,'~n~n~tStack Dump~t~40+~n~nAddress~tChoiceP~16+ Cur/Next Clause Goal~n',[LCPs,LEnvs]), - '$hacks':display_stack_info(CPs, Envs, Max, ContP, StackInfo, []), - run_formats(StackInfo, user_error). - -run_formats([], _). -run_formats([Com-Args|StackInfo], Stream) :- - format(Stream, Com, Args), - run_formats(StackInfo, user_error). - -virtual_alarm(Interval, Goal, Left) :- - Interval == 0, !, - virtual_alarm(0, 0, Left0, _), - on_signal(sig_vtalarm, _, Goal), - Left = Left0. -virtual_alarm(Interval, Goal, Left) :- - integer(Interval), !, - on_signal(sig_vtalarm, _, Goal), - virtual_alarm(Interval, 0, Left, _). -virtual_alarm(Interval.USecs, Goal, Left.LUSecs) :- - on_signal(sig_vtalarm, _, Goal), - virtual_alarm(Interval, USecs, Left, LUSecs). - -fully_strip_module(T,M,S) :- - '$hacks':fully_strip_module(T,M,S). diff --git a/packages/python/swig/yap4py/prolog/heaps.yap b/packages/python/swig/yap4py/prolog/heaps.yap deleted file mode 100644 index 745eb4edf..000000000 --- a/packages/python/swig/yap4py/prolog/heaps.yap +++ /dev/null @@ -1,283 +0,0 @@ -/** - * @file heaps.yap - * @author R.A.O'Keefe, included as an YAP library by Vitor Santos Costa, 1999. - * @date 29 November 1983 - * - * @brief Implement heaps in Prolog. - * - * -*/ - -:- module(heaps,[ - add_to_heap/4, % Heap x Key x Datum -> Heap - get_from_heap/4, % Heap -> Key x Datum x Heap - empty_heap/1, % Heap - heap_size/2, % Heap -> Size - heap_to_list/2, % Heap -> List - list_to_heap/2, % List -> Heap - min_of_heap/3, % Heap -> Key x Datum - min_of_heap/5 % Heap -> (Key x Datum) x (Key x Datum) - ]). - - -/** @defgroup heaps Heaps -@ingroup library -@{ - -A heap is a labelled binary tree where the key of each node is less than -or equal to the keys of its sons. The point of a heap is that we can -keep on adding new elements to the heap and we can keep on taking out -the minimum element. If there are N elements total, the total time is -O(NlgN). If you know all the elements in advance, you are better off -doing a merge-sort, but this file is for when you want to do say a -best-first search, and have no idea when you start how many elements -there will be, let alone what they are. - -The following heap manipulation routines are available once included -with the `use_module(library(heaps))` command. - - - add_to_heap/4 - - empty_heap/1 - - get_from_heap/4 - - heap_size/2 - - heap_to_list/2 - - list_to_heap/2 - - min_of_heap/3 - - min_of_heap/5 - - -A heap is a labelled binary tree where the key of each node is less - than or equal to the keys of its sons. The point of a heap is that - we can keep on adding new elements to the heap and we can keep on - taking out the minimum element. If there are N elements total, the - total time is O(NlgN). If you know all the elements in advance, you - are better off doing a merge-sort, but this file is for when you want - to do say a best-first search, and have no idea when you start how - many elements there will be, let alone what they are. - - A heap is represented as a triple t(N, Free, Tree) where N is the - number of elements in the tree, Free is a list of integers which - specifies unused positions in the tree, and Tree is a tree made of - t terms for empty subtrees and - t(Key,Datum,Lson,Rson) terms for the rest - The nodes of the tree are notionally numbered like this: - 1 - 2 3 - 4 6 5 7 - 8 12 10 14 9 13 11 15 - .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. - The idea is that if the maximum number of elements that have been in - the heap so far is M, and the tree currently has K elements, the tree - is some subtreee of the tree of this form having exactly M elements, - and the Free list is a list of K-M integers saying which of the - positions in the M-element tree are currently unoccupied. This free - list is needed to ensure that the cost of passing N elements through - the heap is O(NlgM) instead of O(NlgN). For M say 100 and N say 10^4 - this means a factor of two. The cost of the free list is slight. - The storage cost of a heap in a copying Prolog (which Dec-10 Prolog is - not) is 2K+3M words. - - - -*/ - -/* -:- mode - add_to_heap(+, +, +, -), - add_to_heap(+, +, +, +, -), - add_to_heap(+, +, +, +, +, +, -, -), - sort2(+, +, +, +, -, -, -, -), - get_from_heap(+, ?, ?, -), - repair_heap(+, +, +, -), - heap_size(+, ?), - heap_to_list(+, -), - heap_tree_to_list(+, -), - heap_tree_to_list(+, +, -), - list_to_heap(+, -), - list_to_heap(+, +, +, -), - min_of_heap(+, ?, ?), - min_of_heap(+, ?, ?, ?, ?), - min_of_heap(+, +, ?, ?). -*/ - - -%% @pred add_to_heap(OldHeap, Key, Datum, NewHeap) -% -% inserts the new Key-Datum pair into the heap. The insertion is -% not stable, that is, if you insert several pairs with the same -% Key it is not defined which of them will come out first, and it -% is possible for any of them to come out first depending on the -% history of the heap. If you need a stable heap, you could add -% a counter to the heap and include the counter at the time of -% insertion in the key. If the free list is empty, the tree will -% be grown, otherwise one of the empty slots will be re-used. (I -% use imperative programming language, but the heap code is as -% pure as the trees code, you can create any number of variants -% starting from the same heap, and they will share what common -% structure they can without interfering with each other.) - -add_to_heap(t(M,[],OldTree), Key, Datum, t(N,[],NewTree)) :- !, - N is M+1, - add_to_heap(N, Key, Datum, OldTree, NewTree). -add_to_heap(t(M,[H|T],OldTree), Key, Datum, t(N,T,NewTree)) :- - N is M+1, - add_to_heap(H, Key, Datum, OldTree, NewTree). - - -add_to_heap(1, Key, Datum, _, t(Key,Datum,t,t)) :- !. -add_to_heap(N, Key, Datum, t(K1,D1,L1,R1), t(K2,D2,L2,R2)) :- - E is N mod 2, - M is N//2, - % M > 0, % only called from list_to_heap/4,add_to_heap/4 - sort2(Key, Datum, K1, D1, K2, D2, K3, D3), - add_to_heap(E, M, K3, D3, L1, R1, L2, R2). - - -add_to_heap(0, N, Key, Datum, L1, R, L2, R) :- !, - add_to_heap(N, Key, Datum, L1, L2). -add_to_heap(1, N, Key, Datum, L, R1, L, R2) :- !, - add_to_heap(N, Key, Datum, R1, R2). - - -sort2(Key1, Datum1, Key2, Datum2, Key1, Datum1, Key2, Datum2) :- - Key1 @< Key2, - !. -sort2(Key1, Datum1, Key2, Datum2, Key2, Datum2, Key1, Datum1). - - - -%% @pred @pred get_from_heap(+ _Heap_,- _key_,- _Datum_,- _Heap_) -% -% returns the Key-Datum pair in OldHeap with the smallest Key, and -% also a New Heap which is the Old Heap with that pair deleted. -% The easy part is picking off the smallest element. The hard part -% is repairing the heap structure. repair_heap/4 takes a pair of -% heaps and returns a new heap built from their elements, and the -% position number of the gap in the new tree. Note that repair_heap -% is *not* tail-recursive. - -get_from_heap(t(N,Free,t(Key,Datum,L,R)), Key, Datum, t(M,[Hole|Free],Tree)) :- - M is N-1, - repair_heap(L, R, Tree, Hole). - - -repair_heap(t(K1,D1,L1,R1), t(K2,D2,L2,R2), t(K2,D2,t(K1,D1,L1,R1),R3), N) :- - K2 @< K1, - !, - repair_heap(L2, R2, R3, M), - N is 2*M+1. -repair_heap(t(K1,D1,L1,R1), t(K2,D2,L2,R2), t(K1,D1,L3,t(K2,D2,L2,R2)), N) :- !, - repair_heap(L1, R1, L3, M), - N is 2*M. -repair_heap(t(K1,D1,L1,R1), t, t(K1,D1,L3,t), N) :- !, - repair_heap(L1, R1, L3, M), - N is 2*M. -repair_heap(t, t(K2,D2,L2,R2), t(K2,D2,t,R3), N) :- !, - repair_heap(L2, R2, R3, M), - N is 2*M+1. -repair_heap(t, t, t, 1) :- !. - - - -%% @pred heap_size(+ _Heap_, - _Size_) -% -% reports the number of elements currently in the heap. - -heap_size(t(Size,_,_), Size). - - - -%% @pred heap_to_list(+ _Heap_, - _List_) -% -% returns the current set of Key-Datum pairs in the Heap as a -% List, sorted into ascending order of Keys. This is included -% simply because I think every data structure foo ought to have -% a foo_to_list and list_to_foo relation (where, of course, it -% makes sense!) so that conversion between arbitrary data -% structures is as easy as possible. This predicate is basically -% just a merge sort, where we can exploit the fact that the tops -% of the subtrees are smaller than their descendants. - -heap_to_list(t(_,_,Tree), List) :- - heap_tree_to_list(Tree, List). - - -heap_tree_to_list(t, []) :- !. -heap_tree_to_list(t(Key,Datum,Lson,Rson), [Key-Datum|Merged]) :- - heap_tree_to_list(Lson, Llist), - heap_tree_to_list(Rson, Rlist), - heap_tree_to_list(Llist, Rlist, Merged). - - -heap_tree_to_list([H1|T1], [H2|T2], [H2|T3]) :- - H2 @< H1, - !, - heap_tree_to_list([H1|T1], T2, T3). -heap_tree_to_list([H1|T1], T2, [H1|T3]) :- !, - heap_tree_to_list(T1, T2, T3). -heap_tree_to_list([], T, T) :- !. -heap_tree_to_list(T, [], T). - - - -%% @pred list_to_heap(+ _List_, - _Heap_) -% -% takes a list of Key-Datum pairs (such as keysort could be used to -% sort) and forms them into a heap. We could do that a wee bit -% faster by keysorting the list and building the tree directly, but -% this algorithm makes it obvious that the result is a heap, and -% could be adapted for use when the ordering predicate is not @< -% and hence keysort is inapplicable. - -list_to_heap(List, Heap) :- - list_to_heap(List, 0, t, Heap). - - -list_to_heap([], N, Tree, t(N,[],Tree)) :- !. -list_to_heap([Key-Datum|Rest], M, OldTree, Heap) :- - N is M+1, - add_to_heap(N, Key, Datum, OldTree, MidTree), - list_to_heap(Rest, N, MidTree, Heap). - - - -%% @pred min_of_heap(Heap, Key, Datum) -% -% returns the Key-Datum pair at the top of the heap (which is of -% course the pair with the smallest Key), but does not remove it -% from the heap. It fails if the heap is empty. - - -/** @pred min_of_heap(+ _Heap_, - _Key_, - _Datum_) - - -Returns the Key-Datum pair at the top of the heap (which is of course -the pair with the smallest Key), but does not remove it from the heap. -*/ -min_of_heap(t(_,_,t(Key,Datum,_,_)), Key, Datum). - - -%% @pred @pred min_of_heap(+ _Heap_, - _Key1_, - _Datum1_, -_Key2_, - _Datum2_) -% -% returns the smallest (Key1) and second smallest (Key2) pairs in -% the heap, without deleting them. It fails if the heap does not -% have at least two elements. -min_of_heap(t(_,_,t(Key1,Datum1,Lson,Rson)), Key1, Datum1, Key2, Datum2) :- - min_of_heap(Lson, Rson, Key2, Datum2). - - -min_of_heap(t(Ka,_Da,_,_), t(Kb,Db,_,_), Kb, Db) :- - Kb @< Ka, !. -min_of_heap(t(Ka,Da,_,_), _, Ka, Da). -min_of_heap(t, t(Kb,Db,_,_), Kb, Db). - -/** @pred empty_heap(? _Heap_) - - -Succeeds if _Heap_ is an empty heap. -*/ -empty_heap(t(0,[],t)). - - -/** @} */ - diff --git a/packages/python/swig/yap4py/prolog/itries.yap b/packages/python/swig/yap4py/prolog/itries.yap deleted file mode 100644 index 0b455c993..000000000 --- a/packages/python/swig/yap4py/prolog/itries.yap +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file itries.yap - * @author Ricardo Rocha - * @date - * - * @brief Tries module for ILP - * - * -*/ - -/********************************* - File: itries.yap - Author: Ricardo Rocha - Comments: Tries module for ILP - version: $ID$ -*********************************/ - -:- module(itries, [ - itrie_open/1, - itrie_close/1, - itrie_close_all/0, - itrie_mode/2, - itrie_timestamp/2, - itrie_put_entry/2, - itrie_update_entry/2, - itrie_check_entry/3, - itrie_get_entry/2, - itrie_get_data/2, - itrie_traverse/2, - itrie_remove_entry/1, - itrie_remove_subtree/1, - itrie_add/2, - itrie_subtract/2, - itrie_join/2, - itrie_intersect/2, - itrie_count_join/3, - itrie_count_intersect/3, - itrie_save/2, - itrie_save_as_trie/2, - itrie_load/2, - itrie_save2stream/2, - itrie_loadFromstream/2, - itrie_stats/4, - itrie_max_stats/4, - itrie_usage/4, - itrie_print/1 - ]). - -:- load_foreign_files([itries], [], init_itries). diff --git a/packages/python/swig/yap4py/prolog/lam_mpi.yap b/packages/python/swig/yap4py/prolog/lam_mpi.yap deleted file mode 100644 index 44297a928..000000000 --- a/packages/python/swig/yap4py/prolog/lam_mpi.yap +++ /dev/null @@ -1,221 +0,0 @@ -% Author: Nuno A. Fonseca -% Date: 2006-06-01 -% $Id: lam_mpi.yap,v 1.1 2006-06-04 18:43:38 nunofonseca Exp $ - - -:- module(lam_mpi, [ - mpi_init/0, - mpi_finalize/0, - mpi_comm_size/1, - mpi_comm_rank/1, - mpi_version/2, - mpi_send/3, - mpi_isend/4, - mpi_recv/3, - mpi_irecv/3, - mpi_wait/2, - mpi_wait_recv/3, - mpi_test/2, - mpi_test_recv/3, - mpi_bcast/2, - mpi_ibcast2/2, - mpi_ibcast2/3, - mpi_bcast2/2, - mpi_bcast2/3, - mpi_barrier/0, - mpi_msg_buffer_size/2, - mpi_msg_size/2, - mpi_gc/0, - mpi_default_buffer_size/2 - ]). - -/** - * @defgroup lam_mpi MPI Interface - * @ingroup library -@{ - -This library provides a set of utilities for interfacing with LAM MPI. -The following routines are available once included with the -`use_module(library(lam_mpi))` command. The yap should be -invoked using the LAM mpiexec or mpirun commands (see LAM manual for -more details). - - -*/ - - -/** @pred mpi_barrier - - -Collective communication predicate. Performs a barrier -synchronization among all processes. Note that a collective -communication means that all processes call the same predicate. To be -able to use a regular `mpi_recv` to receive the messages, one -should use `mpi_bcast2`. -*/ -/** @pred mpi_bcast2(+ _Root_, ? _Data_) - - - -Broadcasts the message _Data_ from the process with rank _Root_ -to all other processes. - - -*/ -/** @pred mpi_comm_rank(- _Rank_) - - -Unifies _Rank_ with the rank of the current process in the MPI environment. - - -*/ -/** @pred mpi_comm_size(- _Size_) - - -Unifies _Size_ with the number of processes in the MPI environment. - - -*/ -/** @pred mpi_finalize - - -Terminates the MPI execution environment. Every process must call this predicate before exiting. - - -*/ -/** @pred mpi_gc - - - -Attempts to perform garbage collection with all the open handles -associated with send and non-blocking broadcasts. For each handle it -tests it and the message has been delivered the handle and the buffer -are released. - - - - - */ -/** @pred mpi_init - - -Sets up the mpi environment. This predicate should be called before any other MPI predicate. - - -*/ -/** @pred mpi_irecv(? _Source_,? _Tag_,- _Handle_) - - - -Non-blocking communication predicate. The predicate returns an - _Handle_ for a message that will be received from processor with -rank _Source_ and tag _Tag_. Note that the predicate succeeds -immediately, even if no message has been received. The predicate -`mpi_wait_recv` should be used to obtain the data associated to -the handle. - - -*/ -/** @pred mpi_isend(+ _Data_,+ _Dest_,+ _Tag_,- _Handle_) - - - -Non blocking communication predicate. The message in _Data_, with -tag _Tag_, is sent whenever possible to the processor with rank - _Dest_. An _Handle_ to the message is returned to be used to -check for the status of the message, using the `mpi_wait` or -`mpi_test` predicates. Until `mpi_wait` is called, the -memory allocated for the buffer containing the message is not -released. - - -*/ -/** @pred mpi_msg_size( _Msg_, - _MsgSize_) - - -Unify _MsgSize_ with the number of bytes YAP would need to send the -message _Msg_. - - -*/ -/** @pred mpi_recv(? _Source_,? _Tag_,- _Data_) - - - -Blocking communication predicate. The predicate blocks until a message -is received from processor with rank _Source_ and tag _Tag_. -The message is placed in _Data_. - - -*/ -/** @pred mpi_send(+ _Data_,+ _Dest_,+ _Tag_) - - - -Blocking communication predicate. The message in _Data_, with tag - _Tag_, is sent immediately to the processor with rank _Dest_. -The predicate succeeds after the message being sent. - - -*/ -/** @pred mpi_test(? _Handle_,- _Status_) - - - -Provides information regarding the handle _Handle_, ie., if a -communication operation has been completed. If the operation -associate with _Hanlde_ has been completed the predicate succeeds -with the completion status in _Status_, otherwise it fails. - - -*/ -/** @pred mpi_test_recv(? _Handle_,- _Status_,- _Data_) - - - -Provides information regarding a handle. If the message associated -with handle _Hanlde_ is buffered then the predicate succeeds -unifying _Status_ with the status of the message and _Data_ -with the message itself. Otherwise, the predicate fails. - - -*/ -/** @pred mpi_version(- _Major_,- _Minor_) - - -Unifies _Major_ and _Minor_ with, respectively, the major and minor version of the MPI. - - -*/ -/** @pred mpi_wait(? _Handle_,- _Status_) - - - -Completes a non-blocking operation. If the operation was a -`mpi_send`, the predicate blocks until the message is buffered -or sent by the runtime system. At this point the send buffer is -released. If the operation was a `mpi_recv`, it waits until the -message is copied to the receive buffer. _Status_ is unified with -the status of the message. - - -*/ -/** @pred mpi_wait_recv(? _Handle_,- _Status_,- _Data_) - - - -Completes a non-blocking receive operation. The predicate blocks until -a message associated with handle _Hanlde_ is buffered. The -predicate succeeds unifying _Status_ with the status of the -message and _Data_ with the message itself. - - -*/ - -:- load_foreign_files([yap_mpi], [], init_mpi). - -mpi_msg_size(Term, Size) :- - terms:export_term(Term, Buf, Size), - terms:kill_exported_term(Buf). -/** @} */ - diff --git a/packages/python/swig/yap4py/prolog/lambda.pl b/packages/python/swig/yap4py/prolog/lambda.pl deleted file mode 100644 index b3ce14125..000000000 --- a/packages/python/swig/yap4py/prolog/lambda.pl +++ /dev/null @@ -1,217 +0,0 @@ -/** - * @file heaps.yap - * @author Ulrich Neumerkel - * @date 2009 - * - * @brief Lambda expressions in Prolog. - * - * -*/ -/* - Author: - E-mail: ulrich@complang.tuwien.ac.at - Copyright (C): 2009 Ulrich Neumerkel. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY Ulrich Neumerkel ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Ulrich Neumerkel OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation -are those of the authors and should not be interpreted as representing -official policies, either expressed or implied, of Ulrich Neumerkel. - - - -*/ - -:- module(lambda, [ - (^)/3, (^)/4, (^)/5, (^)/6, (^)/7, (^)/8, (^)/9, - (\)/1, (\)/2, (\)/3, (\)/4, (\)/5, (\)/6, (\)/7, - (+\)/2, (+\)/3, (+\)/4, (+\)/5, (+\)/6, (+\)/7, - op(201,xfx,+\)]). - -/** - @defgroup Lambda expressions -@ingroup library - -This library provides lambda expressions to simplify higher order -programming based on call/N. - - Lambda expressions are represented by ordinary Prolog terms. - There are two kinds of lambda expressions: - - ~~~~ - Free+\X1^X2^ ..^XN^Goal - - \X1^X2^ ..^XN^Goal - ~~~~ - - The second is a shorthand for t+\X1^X2^..^XN^Goal - - + _Xi_ are the parameters. - - + _Goal_ is a goal or continuation. Syntax note: Operators within Goal -require parentheses due to the low precedence of the ^ operator. - - + _Free_ contains variables that are valid outside the scope of the lambda -expression. They are thus free variables within. - -All other variables of Goal are considered local variables. They must -not appear outside the lambda expression. This restriction is -currently not checked. Violations may lead to unexpected bindings. - -In the following example the parentheses around X>3 are necessary. - -~~~~~ -?- use_module(library(lambda)). -?- use_module(library(apply)). - -?- maplist(\X^(X>3),[4,5,9]). -true. -~~~~~ - -In the following _X_ is a variable that is shared by both instances of -the lambda expression. The second query illustrates the cooperation of -continuations and lambdas. The lambda expression is in this case a -continuation expecting a further argument. - -~~~~~ -?- Xs = [A,B], maplist(X+\Y^dif(X,Y), Xs). -Xs = [A, B], -dif(X, A), -dif(X, B). - -?- Xs = [A,B], maplist(X+\dif(X), Xs). -Xs = [A, B], -dif(X, A), -dif(X, B). -~~~~~ - -The following queries are all equivalent. To see this, use -the fact f(x,y). -~~~~~ -?- call(f,A1,A2). -?- call(\X^f(X),A1,A2). -?- call(\X^Y^f(X,Y), A1,A2). -?- call(\X^(X+\Y^f(X,Y)), A1,A2). -?- call(call(f, A1),A2). -?- call(f(A1),A2). -?- f(A1,A2). -A1 = x, -A2 = y. -~~~~~ - -Further discussions -http://www.complang.tuwien.ac.at/ulrich/Prolog-inedit/ISO-Hiord - -@tbd Static expansion similar to apply_macros. -@author Ulrich Neumerkel -*/ - -:- meta_predicate no_hat_call(0). - -:- meta_predicate - ^(?,0,?), - ^(?,1,?,?), - ^(?,2,?,?,?), - ^(?,3,?,?,?,?), - ^(?,4,?,?,?,?,?). - -^(V1,Goal,V1) :- - no_hat_call(Goal). -^(V1,Goal,V1,V2) :- - call(Goal,V2). -^(V1,Goal,V1,V2,V3) :- - call(Goal,V2,V3). -^(V1,Goal,V1,V2,V3,V4) :- - call(Goal,V2,V3,V4). -^(V1,Goal,V1,V2,V3,V4,V5) :- - call(Goal,V2,V3,V4,V5). -^(V1,Goal,V1,V2,V3,V4,V5,V6) :- - call(Goal,V2,V3,V4,V5,V6). -^(V1,Goal,V1,V2,V3,V4,V5,V6,V7) :- - call(Goal,V2,V3,V4,V5,V6,V7). - -:- meta_predicate - \(0), - \(1,?), - \(2,?,?), - \(3,?,?,?), - \(4,?,?,?,?), - \(5,?,?,?,?,?), - \(6,?,?,?,?,?,?). - -\(FC) :- - copy_term_nat(FC,C),no_hat_call(C). -\(FC,V1) :- - copy_term_nat(FC,C),call(C,V1). -\(FC,V1,V2) :- - copy_term_nat(FC,C),call(C,V1,V2). -\(FC,V1,V2,V3) :- - copy_term_nat(FC,C),call(C,V1,V2,V3). -\(FC,V1,V2,V3,V4) :- - copy_term_nat(FC,C),call(C,V1,V2,V3,V4). -\(FC,V1,V2,V3,V4,V5) :- - copy_term_nat(FC,C),call(C,V1,V2,V3,V4,V5). -\(FC,V1,V2,V3,V4,V5,V6) :- - copy_term_nat(FC,C),call(C,V1,V2,V3,V4,V5,V6). - -:- meta_predicate - +\(?,0), - +\(?,1,?), - +\(?,2,?,?), - +\(?,3,?,?,?), - +\(?,4,?,?,?,?), - +\(?,5,?,?,?,?,?), - +\(?,6,?,?,?,?,?,?). - -+\(GV,FC) :- - copy_term_nat(GV+FC,GV+C),no_hat_call(C). -+\(GV,FC,V1) :- - copy_term_nat(GV+FC,GV+C),call(C,V1). -+\(GV,FC,V1,V2) :- - copy_term_nat(GV+FC,GV+C),call(C,V1,V2). -+\(GV,FC,V1,V2,V3) :- - copy_term_nat(GV+FC,GV+C),call(C,V1,V2,V3). -+\(GV,FC,V1,V2,V3,V4) :- - copy_term_nat(GV+FC,GV+C),call(C,V1,V2,V3,V4). -+\(GV,FC,V1,V2,V3,V4,V5) :- - copy_term_nat(GV+FC,GV+C),call(C,V1,V2,V3,V4,V5). -+\(GV,FC,V1,V2,V3,V4,V5,V6) :- - copy_term_nat(GV+FC,GV+C),call(C,V1,V2,V3,V4,V5,V6). - - -%% no_hat_call(:Goal) -% -% Like call, but issues an error for a goal (^)/2. Such goals are -% likely the result of an insufficient number of arguments. - -no_hat_call(MGoal) :- - strip_module(MGoal, _, Goal), - ( nonvar(Goal), - Goal = (_^_) - -> throw(error(existence_error(lambda_parameters,Goal),_)) - ; call(MGoal) - ). - -% I would like to replace this by: -% V1^Goal :- throw(error(existence_error(lambda_parameters,V1^Goal),_)). diff --git a/packages/python/swig/yap4py/prolog/lineutils.yap b/packages/python/swig/yap4py/prolog/lineutils.yap deleted file mode 100644 index 8119a2f04..000000000 --- a/packages/python/swig/yap4py/prolog/lineutils.yap +++ /dev/null @@ -1,527 +0,0 @@ -/** - * @file lineutils.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 22:02:22 2015 - * - * @brief line text processing. - * - * -*/ - -:- module(lineutils, - [search_for/2, - search_for/3, - scan_natural/3, - scan_integer/3, - natural/3, - integer/3, - blank/3, - split/2, - split/3, - split/4, - split/5, - split_unquoted/3, - fields/2, - fields/3, - glue/3, - copy_line/2, - filter/3, - file_filter/3, - file_select/2, - file_filter_with_initialization/5, - file_filter_with_start_end/5, - file_filter_with_initialization/5 as file_filter_with_init, - process/2 - ]). - -/** @defgroup line_utils Line Manipulation Utilities -@ingroup library -@{ - -This package provides a set of useful predicates to manipulate -sequences of characters codes, usually first read in as a line. It is -available by loading the -~~~~ -:- use_module(library(lineutils)). -~~~~ - - -*/ - -:- meta_predicate - filter(+,+,2), - file_filter(+,+,2), - file_filter_with_initialization(+,+,2,+,:), - file_filter_with_start_end(+,+,2,2,2), - process(+,1). - -:- use_module(library(lists), - [member/2, - append/3]). - -:- use_module(library(readutil), - [read_line_to_codes/2]). - -/** - @pred search_for(+ _Char_,+ _Line_) - Search for a character _Char_ in the list of codes _Line_. -*/ -search_for(C,L) :- - search_for(C, L, []). - -search_for(C) --> [C], !. -search_for(C) --> [_], - search_for(C). - -/** @pred scan_integer(? _Int_,+ _Line_,+ _RestOfLine_) - -Scan the list of codes _Line_ for an integer _Nat_, either a -positive, zero, or negative integer, and unify _RestOfLine_ with -the remainder of the line. -*/ -scan_integer(N) --> - "-", !, - scan_natural(0, N0), - N is -N0. -scan_integer(N) --> - scan_natural(0, N). - -/** @pred integer(? _Int_,+ _Line_,+ _RestOfLine_) - -Scan the list of codes _Line_ for an integer _Nat_, either a -positive, zero, or negative integer, and unify _RestOfLine_ with -the remainder of the line. -*/ -integer(N) --> - "-", !, - natural(0, N0), - N is -N0. -integer(N) --> - natural(0, N). - -/** @pred scan_natural(? _Nat_,+ _Line_,+ _RestOfLine_) - -Scan the list of codes _Line_ for a natural number _Nat_, zero -or a positive integer, and unify _RestOfLine_ with the remainder -of the line. -*/ -scan_natural(N) --> - scan_natural(0, N). - -scan_natural(N0,N) --> - [C], - {C >= 0'0, C =< 0'9 }, !, - { N1 is N0*10+(C-0'0) }, %' - get_natural(N1,N). -scan_natural(N,N) --> []. - -/** @pred natural(? _Nat_,+ _Line_,+ _RestOfLine_) - -Scan the list of codes _Line_ for a natural number _Nat_, zero -or a positive integer, and unify _RestOfLine_ with the remainder -of the line. -*/ -natural(N) --> - natural(0, N). - -natural(N0,N) --> - [C], - {C >= 0'0, C =< 0'9 }, !, - { N1 is N0*10+(C-0'0) }, %' - get_natural(N1,N). -natural(N,N) --> []. - -/** @pred skip_whitespace(+ _Line_,+ _RestOfLine_) - -Scan the list of codes _Line_ for white space, namely for tabbing and space characters. -*/ -skip_whitespace([0' |Blanks]) --> - " ", - skip_whitespace( Blanks ). -skip_whitespace([0' |Blanks]) --> - " ", - skip_whitespace( Blanks ). -skip_whitespace( [] ) --> - !. - -/** @pred blank(+ _Line_,+ _RestOfLine_) - - The list of codes _Line_ is formed by white space, namely by tabbing and space characters. -*/ -blank([0' |Blanks]) --> - " ", - blank( Blanks ). -blank([0' |Blanks]) --> - " ", - blank( Blanks ). -blank( [] ) --> - []. - - -/** @pred split(+ _Line_,- _Split_) - -Unify _Words_ with a set of strings obtained from _Line_ by -using the blank characters as separators. -*/ -split(String, Strings) :- - split_at_blank(" ", Strings, String, []). - -/** @pred split(+ _Line_,+ _Separators_,- _Split_) - - - -Unify _Words_ with a set of strings obtained from _Line_ by -using the character codes in _Separators_ as separators. As an -example, consider: - -~~~~~{.prolog} -?- split("Hello * I am free"," *",S). - -S = ["Hello","I","am","free"] ? - -no -~~~~~ - -*/ -split(String, SplitCodes, Strings) :- - split_at_blank(SplitCodes, Strings, String, []). - -split_at_blank(SplitCodes, More) --> - [C], - { member(C, SplitCodes) }, !, - split_at_blank(SplitCodes, More). -split_at_blank(SplitCodes, [[C|New]| More]) --> - [C], !, - split_(SplitCodes, New, More). -split_at_blank(_, []) --> []. - -split_(SplitCodes, [], More) --> - [C], - { member(C, SplitCodes) }, !, - split_at_blank(SplitCodes, More). -split_(SplitCodes, [C|New], Set) --> - [C], !, - split_(SplitCodes, New, Set). -split_(_, [], []) --> []. - - -split(Text, SplitCodes, DoubleQs, SingleQs, Strings) :- - split_element(SplitCodes, DoubleQs, SingleQs, Strings, Text, []). - -split_element(SplitCodes, DoubleQs, SingleQs, Strings) --> - [C], - !, - split_element(SplitCodes, DoubleQs, SingleQs, Strings, C). -split_element(_SplitCodes, _DoubleQs, _SingleQs, []) --> !. -split_element(_SplitCodes, _DoubleQs, _SingleQs, [[]]) --> []. - -split_element(SplitCodes, DoubleQs, SingleQs, Strings, C) --> - { member( C, SingleQs ) }, - !, - [C2], - { Strings = [[C2|String]|More] }, - split_element(SplitCodes, DoubleQs, SingleQs, [String| More]). -split_element(SplitCodes, DoubleQs, SingleQs, [[]|Strings], C) --> - { member( C, SplitCodes ) }, - !, - split_element(SplitCodes, DoubleQs, SingleQs, Strings). -split_element(SplitCodes, DoubleQs, SingleQs, Strings, C) --> - { member( C, DoubleQs ) } , - !, - split_within(SplitCodes, C-DoubleQs, SingleQs, Strings). -split_element(SplitCodes, DoubleQs, SingleQs, [[C|String]|Strings], C) --> - split_element(SplitCodes, DoubleQs, SingleQs, [String|Strings]). - -split_within(SplitCodes, DoubleQs, SingleQs, Strings) --> - [C], - split_within(SplitCodes, DoubleQs, SingleQs, Strings, C). - -split_within(SplitCodes, DoubleQs, SingleQs, Strings, C) --> - { member( C, SingleQs ) }, - !, - [C2], - { Strings = [[C2|String]|More] }, - split_within(SplitCodes, DoubleQs, SingleQs, [String| More]). -split_within(SplitCodes, DoubleQs, C-SingleQs, Strings, C) --> - !, - split_element(SplitCodes, DoubleQs, SingleQs, Strings). -split_within(SplitCodes, DoubleQs, SingleQs, [[C|String]|Strings], C) --> - split_within(SplitCodes, DoubleQs, SingleQs, [String|Strings]). - -/** @pred split_unquoted(+ _Line_,+ _Separators_,- _Split_) - - - -Unify _Words_ with a set of strings obtained from _Line_ by -using the character codes in _Separators_ as separators, but treat text wi -thin double quotes as a single unit. As an -example, consider: - -~~~~~{.prolog} -?- split("Hello * I \"am free\""," *",S). - -S = ["Hello","I","am free"] ? - -no -~~~~~ - -*/ -split_unquoted(String, SplitCodes, Strings) :- - split_unquoted_at_blank(SplitCodes, Strings, String, []). - -split_unquoted_at_blank(SplitCodes, [[0'"|New]|More]) --> %0'" - "\"", - split_quoted(New, More), - split_unquoted_at_blank(SplitCodes, More). -split_unquoted_at_blank(SplitCodes, More) --> - [C], - { member(C, SplitCodes) }, !, - split_unquoted_at_blank(SplitCodes, More). -split_unquoted_at_blank(SplitCodes, [[C|New]| More]) --> - [C], !, - split_unquoted(SplitCodes, New, More). -split_unquoted_at_blank(_, []) --> []. - -split_unquoted(SplitCodes, [], More) --> - [C], - { member(C, SplitCodes) }, !, - split_unquoted_at_blank(SplitCodes, More). -split_unquoted(SplitCodes, [C|New], Set) --> - [C], !, - split_unquoted(SplitCodes, New, Set). -split_unquoted(_, [], []) --> []. - - -/** @pred split_quoted(+ _Line_,+ _Separators_, GroupQuotes, SingleQuotes, - _Split_) - - - -Unify _Words_ with a set of strings obtained from _Line_ by -using the character codes in _Separators_ as separators, but treat text within quotes as a single unit. As an -example, consider: - -~~~~~{.prolog} -?- split_quoted("Hello * I \"am free\""," *",S). - -S = ["Hello","I","am free"] ? - -no -~~~~~ - -*/ -split_quoted( [0'"], _More) --> %0'" - "\"". -split_quoted( [0'\\ ,C|New], More) --> - %0'" - "\\", - [C], - split_quoted(New, More). -split_quoted( [C|New], More) --> %0'" - [C], - split_quoted(New, More). - -/** @pred fields(+ _Line_,- _Split_) - -Unify _Words_ with a set of strings obtained from _Line_ by -using the blank characters as field separators. - -*/ -fields(String, Strings) :- - fields(" ", Strings, String, []). - -/** @pred fields(+ _Line_,+ _Separators_,- _Split_) - -Unify _Words_ with a set of strings obtained from _Line_ by -using the character codes in _Separators_ as separators for -fields. If two separators occur in a row, the field is considered -empty. As an example, consider: - -~~~~~{.prolog} -?- fields("Hello I am free"," *",S). - - S = ["Hello","","I","am","","free"] ? -~~~~~ -*/ -fields(String, FieldsCodes, Strings) :- - dofields(FieldsCodes, First, More, String, []), - ( - First = [], More = [] - -> - Strings = [] - ; - Strings = [First|More] - ). - -dofields(FieldsCodes, [], New.More) --> - [C], - { member(C, FieldsCodes) }, !, - dofields(FieldsCodes, New, More). -dofields(FieldsCodes, [C|New], Set) --> - [C], !, - dofields(FieldsCodes, New, Set). -dofields(_, [], []) --> []. - -/** @pred glue(+ _Words_,+ _Separator_,- _Line_) - -Unify _Line_ with string obtained by glueing _Words_ with -the character code _Separator_. -*/ -glue([], _, []). -glue([A], _, A) :- !. -glue([H|T], [B|_], Merged) :- - append(H, [B|Rest], Merged), - glue(T, [B], Rest). - -/** @pred copy_line(+ _StreamInput_,+ _StreamOutput_) - -Copy a line from _StreamInput_ to _StreamOutput_. -*/ -copy_line(StreamInp, StreamOut) :- - read_line_to_codes(StreamInp, Line), - format(StreamOut, '~s~n', [Line]). - - -/** @pred filter(+ _StreamInp_, + _StreamOut_, + _Goal_) - -For every line _LineIn_ in stream _StreamInp_, execute -`call(Goal,LineIn,LineOut)`, and output _LineOut_ to -stream _StreamOut_. If `call(Goal,LineIn,LineOut)` fails, -nothing will be output but execution continues with the next -line. As an example, consider a procedure to select the second and -fifth field of a CSV table : -~~~~~{.prolog} -select(Sep, In, Out) :- - fields(In, Sep, [_,F2,_,_,F5|_]), - fields(Out,Sep, [F2,F5]). - -select :- - filter(",", -~~~~~ - -*/ -filter(StreamInp, StreamOut, Command) :- - repeat, - read_line_to_codes(StreamInp, Line), - ( - Line == end_of_file - -> - ! - ; - call(Command, Line, NewLine), - ground(NewLine), - format(StreamOut, '~s~n', [NewLine]), - fail - ). - -/** @pred process(+ _StreamInp_, + _Goal_) is meta - -For every line _LineIn_ in stream _StreamInp_, call -`call(Goal,LineIn)`. -*/ -process(StreamInp, Command) :- - repeat, - read_line_to_codes(StreamInp, Line), - ( - Line == end_of_file - -> - ! - ; - call(Command, Line), - fail - ). - -/** - * @pred file_filter(+ _FileIn_, + _FileOut_, + _Goal_) is meta - * - * @param _FileIn_ File to process - * @param _FileOut_ Output file, often user_error - * @param _Goal_ to be metacalled, receives FileIn and FileOut as - * extra arguments - * - * @return succeeds - - For every line _LineIn_ in file _FileIn_, execute - `call(Goal,LineIn,LineOut)`, and output _LineOut_ to file - _FileOut_. - - The input stream is accessible through the alias `filter_input`, and - the output stream is accessible through `filter_output`. -*/ -file_filter(Inp, Out, Command) :- - open(Inp, read, StreamInp, [alias(filter_input)]), - open(Out, write, StreamOut), - filter(StreamInp, StreamOut, Command), - close(StreamInp), - close(StreamOut). - -/** @pred file_filter_with_initialization(+ _FileIn_, + _FileOut_, + _Goal_, + _FormatCommand_, + _Arguments_) - -Same as file_filter/3, but before starting the filter execute -`format/3` on the output stream, using _FormatCommand_ and - _Arguments_. -*/ -file_filter_with_initialization(Inp, Out, Command, FormatString, Parameters) :- - open(Inp, read, StreamInp, [alias(filter_input)]), - open(Out, write, StreamOut, [alias(filter_output)]), - format(StreamOut, FormatString, Parameters), - filter(StreamInp, StreamOut, Command), - close(StreamInp), - close(StreamOut). - - -/** @pred file_filter_with_start_end(+ FileIn, + FileOut, + Goal, + StartGoal, + EndGoal) - -Same as file_filter/3, but before starting the filter execute -_StartGoal_, and call _ENdGoal_ as an epilog. - -The input stream are always accessible through `filter_output` and `filter_input`. -*/ -file_filter_with_start_end(Inp, Out, Command, StartGoal, EndGoal) :- - open(Inp, read, StreamInp, [alias(filter_input)]), - open(Out, write, StreamOut, [alias(filter_output)]), - call( StartGoal, StreamInp, StreamOut ), - filter(StreamInp, StreamOut, Command), - call( EndGoal, StreamInp, StreamOut ), - close(StreamInp), - close(StreamOut). - - -/** - * @pred file_select(+ _FileIn_, + _Goal_) is meta - * - * @param _FileIn_ File to process - * @param _Goal_ to be metacalled, receives FileIn as - * extra arguments - * - * @return bindings to arguments of _Goal_. - - For every line _LineIn_ in file _FileIn_, execute - `call(`Goal,LineIn)`. - - The input stream is accessible through the alias `filter_input`, and - the output stream is accessible through `filter_output`. -*/ -file_select(Inp, Command) :- - ( retract(alias(F)) -> true ; F = '' ), - atom_concat(filter_input, F, Alias), - open(Inp, read, StreamInp, [Alias]), - atom_concat('_', F, NF), - assert( alias(NF) ), - repeat, - read_line_to_codes(StreamInp, Line), - ( - Line == end_of_file - -> - close(StreamInp), - retract(alias(NF)), - assert(alias(F)), - !, - atom_concat(filter_input, F, Alias), - fail - ; - call(Command, Line) - ). - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/listing.yap b/packages/python/swig/yap4py/prolog/listing.yap deleted file mode 100644 index 7c869a4db..000000000 --- a/packages/python/swig/yap4py/prolog/listing.yap +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: listing.yap * -* Last rev: * -* mods: * -* comments: listing a prolog program * -* * -*************************************************************************/ - -/** - * @file library/listing.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 22:03:59 2015 - * - * @brief Emulate SWI Prolog's listing. - * - * -*/ -:- module(swi_listing, - [ listing/0, - listing/1, - portray_clause/1, % +Clause - portray_clause/2, % +Stream, +Clause - portray_clause/3 % +Stream, +Clause, +Options - ]). - - - -/* - - * @defgroup swi_listing SWI Prolog listing emulation - * @ingroup library - - emulates listing.pl, but just the interface for now. - -*/ - - -:- meta_predicate portray_clause( +, + , : ). - -portray_clause(Stream, Term, M:Options) :- - portray_clause( Stream, Term ). diff --git a/packages/python/swig/yap4py/prolog/lists.yap b/packages/python/swig/yap4py/prolog/lists.yap deleted file mode 100644 index 4fd7c38ba..000000000 --- a/packages/python/swig/yap4py/prolog/lists.yap +++ /dev/null @@ -1,630 +0,0 @@ -/** - * @file library/lists.yap - * @author Bob Welham, Lawrence Byrd, and R. A. O'Keefe. Contributions from Vitor Santos Costa, Jan Wielemaker and others. - * @date 1999 - * - * @addtogroup lists The Prolog Library - * - * @ingroup library - * - * @{ - * - * @brief List Manipulation Predicates - * - * -*/ -% This file has been included as an YAP library by Vitor Santos Costa, 1999 - -:- module(lists, - [ - append/3, - append/2, - delete/3, - intersection/3, - flatten/2, - last/2, - list_concat/2, - max_list/2, - list_to_set/2, - member/2, - memberchk/2, - min_list/2, - nextto/3, - nth/3, - nth/4, - nth0/3, - nth0/4, - nth1/3, - nth1/4, - numlist/3, - permutation/2, - prefix/2, - remove_duplicates/2, - reverse/2, - same_length/2, - select/3, - selectchk/3, - sublist/2, - substitute/4, - subtract/3, - suffix/2, - sum_list/2, - sum_list/3, - sumlist/2 - ]). - - -/** @defgroup lists List Manipulation -@ingroup library -@{ - -The following list manipulation routines are available once included -with the `use_module(library(lists))` command. - -*/ - -/** @pred list_concat(+ _Lists_,? _List_) - - -True when _Lists_ is a list of lists and _List_ is the -concatenation of _Lists_. - - -*/ -/** @pred max_list(? _Numbers_, ? _Max_) - - -True when _Numbers_ is a list of numbers, and _Max_ is the maximum. - - -*/ -/** @pred min_list(? _Numbers_, ? _Min_) - - -True when _Numbers_ is a list of numbers, and _Min_ is the minimum. - - -*/ -/** @pred nth(? _N_, ? _List_, ? _Elem_) - - -The same as nth1/3. - - -*/ -/** @pred nth(? _N_, ? _List_, ? _Elem_, ? _Rest_) - -Same as `nth1/4`. - - -*/ -/** @pred nth0(? _N_, ? _List_, ? _Elem_) - - -True when _Elem_ is the Nth member of _List_, -counting the first as element 0. (That is, throw away the first -N elements and unify _Elem_ with the next.) It can only be used to -select a particular element given the list and index. For that -task it is more efficient than member/2 - - -*/ -/** @pred nth0(? _N_, ? _List_, ? _Elem_, ? _Rest_) - -Unifies _Elem_ with the Nth element of _List_, -counting from 0, and _Rest_ with the other elements. It can be used -to select the Nth element of _List_ (yielding _Elem_ and _Rest_), or to -insert _Elem_ before the Nth (counting from 1) element of _Rest_, when -it yields _List_, e.g. `nth0(2, List, c, [a,b,d,e])` unifies List with -`[a,b,c,d,e]`. `nth/4` is the same except that it counts from 1. `nth0/4` -can be used to insert _Elem_ after the Nth element of _Rest_. - - -*/ -/** @pred nth1(+ _Index_,? _List_,? _Elem_) - - -Succeeds when the _Index_-th element of _List_ unifies with - _Elem_. Counting starts at 1. - -Set environment variable. _Name_ and _Value_ should be -instantiated to atoms or integers. The environment variable will be -passed to `shell/[0-2]` and can be requested using `getenv/2`. -They also influence expand_file_name/2. - - -*/ -/** @pred nth1(? _N_, ? _List_, ? _Elem_) - - -The same as nth0/3, except that it counts from -1, that is `nth(1, [H|_], H)`. - - -*/ -/** @pred nth1(? _N_, ? _List_, ? _Elem_, ? _Rest_) - -Unifies _Elem_ with the Nth element of _List_, counting from 1, -and _Rest_ with the other elements. It can be used to select the -Nth element of _List_ (yielding _Elem_ and _Rest_), or to -insert _Elem_ before the Nth (counting from 1) element of - _Rest_, when it yields _List_, e.g. `nth(3, List, c, [a,b,d,e])` unifies List with `[a,b,c,d,e]`. `nth/4` -can be used to insert _Elem_ after the Nth element of _Rest_. - - -*/ -/** @pred numlist(+ _Low_, + _High_, + _List_) - - -If _Low_ and _High_ are integers with _Low_ =< - _High_, unify _List_ to a list `[Low, Low+1, ...High]`. See -also between/3. - - -*/ -/** @pred permutation(+ _List_,? _Perm_) - - -True when _List_ and _Perm_ are permutations of each other. - - -*/ -/** @pred remove_duplicates(+ _List_, ? _Pruned_) - - -Removes duplicated elements from _List_. Beware: if the _List_ has -non-ground elements, the result may surprise you. - - -*/ -/** @pred same_length(? _List1_, ? _List2_) - - -True when _List1_ and _List2_ are both lists and have the same number -of elements. No relation between the values of their elements is -implied. -Modes `same_length(-,+)` and `same_length(+,-)` generate either list given -the other; mode `same_length(-,-)` generates two lists of the same length, -in which case the arguments will be bound to lists of length 0, 1, 2, ... - - */ - - -%% @pred append(? _Lists_,? _Combined_) -% -% Concatenate a list of lists. Is true if Lists is a list of -% lists, and List is the concatenation of these lists. -% -% @param ListOfLists must be a list of -possibly- partial lists - -append(ListOfLists, List) :- -% must_be(list, ListOfLists), - append_(ListOfLists, List). - -append_([], []). -append_([L], L). -append_([L1,L2], L) :- - append(L1,L2,L). -append_([L1,L2|[L3|LL]], L) :- - append(L1,L2,LI), - append_([LI|[L3|LL]],L). - -/** @pred last(+ _List_,? _Last_) - - -True when _List_ is a list and _Last_ is identical to its last element. -d(_, [X], L). -*/ - -last([H|List], Last) :- - last(List, H, Last). - -last([], Last, Last). -last([H|List], _, Last) :- - last(List, H, Last). - -% nextto(X, Y, List) -% is true when X and Y appear side-by-side in List. It could be written as -% nextto(X, Y, List) :- append(_, [X,Y,_], List). -% It may be used to enumerate successive pairs from the list. - -nextto(X,Y, [X,Y|_]). -nextto(X,Y, [_|List]) :- - nextto(X,Y, List). - -% nth0(?N, +List, ?Elem) is true when Elem is the Nth member of List, -% counting the first as element 0. (That is, throw away the first -% N elements and unify Elem with the next.) It can only be used to -% select a particular element given the list and index. For that -% task it is more efficient than nmember. -% nth(+N, +List, ?Elem) is the same as nth0, except that it counts from -% 1, that is nth(1, [H|_], H). - -nth0(V, In, Element) :- var(V), !, - generate_nth(0, V, In, Element). -nth0(0, [Head|_], Head) :- !. -nth0(N, [_|Tail], Elem) :- - M is N-1, - find_nth0(M, Tail, Elem). - -find_nth0(0, [Head|_], Head) :- !. -find_nth0(N, [_|Tail], Elem) :- - M is N-1, - find_nth0(M, Tail, Elem). - - -nth1(V, In, Element) :- var(V), !, - generate_nth(1, V, In, Element). -nth1(1, [Head|_], Head) :- !. -nth1(N, [_|Tail], Elem) :- - nonvar(N), !, - M is N-1, % should be succ(M, N) - find_nth(M, Tail, Elem). - -nth(V, In, Element) :- var(V), !, - generate_nth(1, V, In, Element). -nth(1, [Head|_], Head) :- !. -nth(N, [_|Tail], Elem) :- - nonvar(N), !, - M is N-1, % should be succ(M, N) - find_nth(M, Tail, Elem). - -find_nth(1, [Head|_], Head) :- !. -find_nth(N, [_|Tail], Elem) :- - M is N-1, - find_nth(M, Tail, Elem). - - -generate_nth(I, I, [Head|_], Head). -generate_nth(I, IN, [_|List], El) :- - I1 is I+1, - generate_nth(I1, IN, List, El). - - - -% nth0(+N, ?List, ?Elem, ?Rest) unifies Elem with the Nth element of List, -% counting from 0, and Rest with the other elements. It can be used -% to select the Nth element of List (yielding Elem and Rest), or to -% insert Elem before the Nth (counting from 1) element of Rest, when -% it yields List, e.g. nth0(2, List, c, [a,b,d,e]) unifies List with -% [a,b,c,d,e]. nth is the same except that it counts from 1. nth -% can be used to insert Elem after the Nth element of Rest. - -nth0(V, In, Element, Tail) :- var(V), !, - generate_nth(0, V, In, Element, Tail). -nth0(0, [Head|Tail], Head, Tail) :- !. -nth0(N, [Head|Tail], Elem, [Head|Rest]) :- - M is N-1, - nth0(M, Tail, Elem, Rest). - -find_nth0(0, [Head|Tail], Head, Tail) :- !. -find_nth0(N, [Head|Tail], Elem, [Head|Rest]) :- - M is N-1, - find_nth0(M, Tail, Elem, Rest). - - - -nth1(V, In, Element, Tail) :- var(V), !, - generate_nth(1, V, In, Element, Tail). -nth1(1, [Head|Tail], Head, Tail) :- !. -nth1(N, [Head|Tail], Elem, [Head|Rest]) :- - M is N-1, - nth1(M, Tail, Elem, Rest). - -nth(V, In, Element, Tail) :- var(V), !, - generate_nth(1, V, In, Element, Tail). -nth(1, [Head|Tail], Head, Tail) :- !. -nth(N, [Head|Tail], Elem, [Head|Rest]) :- - M is N-1, - nth(M, Tail, Elem, Rest). - -find_nth(1, [Head|Tail], Head, Tail) :- !. -find_nth(N, [Head|Tail], Elem, [Head|Rest]) :- - M is N-1, - find_nth(M, Tail, Elem, Rest). - - -generate_nth(I, I, [Head|Tail], Head, Tail). -generate_nth(I, IN, [E|List], El, [E|Tail]) :- - I1 is I+1, - generate_nth(I1, IN, List, El, Tail). - - - -% permutation(List, Perm) -% is true when List and Perm are permutations of each other. Of course, -% if you just want to test that, the best way is to keysort/2 the two -% lists and see if the results are the same. Or you could use list_to_bag -% (from BagUtl.Pl) to see if they convert to the same bag. The point of -% perm is to generate permutations. The arguments may be either way round, -% the only effect will be the order in which the permutations are tried. -% Be careful: this is quite efficient, but the number of permutations of an -% N-element list is N!, even for a 7-element list that is 5040. - -permutation([], []). -permutation(List, [First|Perm]) :- - select(First, List, Rest), % tries each List element in turn - permutation(Rest, Perm). - - -% prefix(Part, Whole) iff Part is a leading substring of Whole - -prefix([], _). -prefix([Elem | Rest_of_part], [Elem | Rest_of_whole]) :- - prefix(Rest_of_part, Rest_of_whole). - -% remove_duplicates(List, Pruned) -% removes duplicated elements from List. Beware: if the List has -% non-ground elements, the result may surprise you. - -remove_duplicates([], []). -remove_duplicates([Elem|L], [Elem|NL]) :- - delete(L, Elem, Temp), - remove_duplicates(Temp, NL). - -% reverse(List, Reversed) -% is true when List and Reversed are lists with the same elements -% but in opposite orders. rev/2 is a synonym for reverse/2. - -reverse(List, Reversed) :- - reverse(List, [], Reversed). - -reverse([], Reversed, Reversed). -reverse([Head|Tail], Sofar, Reversed) :- - reverse(Tail, [Head|Sofar], Reversed). - - -% same_length(?List1, ?List2) -% is true when List1 and List2 are both lists and have the same number -% of elements. No relation between the values of their elements is -% implied. -% Modes same_length(-,+) and same_length(+,-) generate either list given -% the other; mode same_length(-,-) generates two lists of the same length, -% in which case the arguments will be bound to lists of length 0, 1, 2, ... - -same_length([], []). -same_length([_|List1], [_|List2]) :- - same_length(List1, List2). - - -/** @pred selectchk(? _Element_, ? _List_, ? _Residue_) - - -Semi-deterministic selection from a list. Steadfast: defines as - -~~~~~{.prolog} -selectchk(Elem, List, Residue) :- - select(Elem, List, Rest0), !, - Rest = Rest0. -~~~~~ -*/ -selectchk(Elem, List, Rest) :- - select(Elem, List, Rest0), !, - Rest = Rest0. - - - -/** @pred select(? _Element_, ? _List_, ? _Residue_) - - -True when _Set_ is a list, _Element_ occurs in _List_, and - _Residue_ is everything in _List_ except _Element_ (things -stay in the same order). -*/ -select(Element, [Element|Rest], Rest). -select(Element, [Head|Tail], [Head|Rest]) :- - select(Element, Tail, Rest). - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% sublist(?Sub, +List) is nondet. -% -% True if all elements of Sub appear in List in the same order. -% -% ALlo, both `append(_,Sublist,S)` and `append(S,_,List)` hold. -sublist(L, L). -sublist(Sub, [H|T]) :- - '$sublist1'(T, H, Sub). - -'$sublist1'(Sub, _, Sub). -'$sublist1'([H|T], _, Sub) :- - '$sublist1'(T, H, Sub). -'$sublist1'([H|T], X, [X|Sub]) :- - '$sublist1'(T, H, Sub). - -% substitute(X, XList, Y, YList) -% is true when XList and YList only differ in that the elements X in XList -% are replaced by elements Y in the YList. -substitute(X, XList, Y, YList) :- - substitute2(XList, X, Y, YList). - -substitute2([], _, _, []). -substitute2([X0|XList], X, Y, [Y|YList]) :- - X == X0, !, - substitute2(XList, X, Y, YList). -substitute2([X0|XList], X, Y, [X0|YList]) :- - substitute2(XList, X, Y, YList). - -/** @pred suffix(? _Suffix_, ? _List_) - -Holds when `append(_,Suffix,List)` holds. -*/ -suffix(Suffix, Suffix). -suffix(Suffix, [_|List]) :- - suffix(Suffix,List). - -/** @pred sumlist(? _Numbers_, ? _Total_) - - -True when _Numbers_ is a list of integers, and _Total_ is their -sum. The same as sum_list/2, please do use sum_list/2 -instead. - - -*/ -sumlist(Numbers, Total) :- - sumlist(Numbers, 0, Total). - -/** @pred sum_list(? _Numbers_, + _SoFar_, ? _Total_) - -True when _Numbers_ is a list of numbers, and _Total_ is the sum of their total plus _SoFar_. -*/ -sum_list(Numbers, SoFar, Total) :- - sumlist(Numbers, SoFar, Total). - -/** @pred sum_list(? _Numbers_, ? _Total_) - - -True when _Numbers_ is a list of numbers, and _Total_ is their sum. -*/ -sum_list(Numbers, Total) :- - sumlist(Numbers, 0, Total). - -sumlist([], Total, Total). -sumlist([Head|Tail], Sofar, Total) :- - Next is Sofar+Head, - sumlist(Tail, Next, Total). - - -% list_concat(Lists, List) -% is true when Lists is a list of lists, and List is the -% concatenation of these lists. - -list_concat([], []). -list_concat([H|T], L) :- - list_concat(H, L, Li), - list_concat(T, Li). - -list_concat([], L, L). -list_concat([H|T], [H|Lf], Li) :- - list_concat(T, Lf, Li). - - - -/** @pred flatten(+ _List_, ? _FlattenedList_) - - -Flatten a list of lists _List_ into a single list - _FlattenedList_. - -~~~~~{.prolog} -?- flatten([[1],[2,3],[4,[5,6],7,8]],L). - -L = [1,2,3,4,5,6,7,8] ? ; - -no -~~~~~ -*/ -flatten(X,Y) :- flatten_list(X,Y,[]). - -flatten_list(V) --> {var(V)}, !, [V]. -flatten_list([]) --> !. -flatten_list([H|T]) --> !, flatten_list(H),flatten_list(T). -flatten_list(H) --> [H]. - -max_list([H|L],Max) :- - max_list(L,H,Max). - -max_list([],Max,Max). -max_list([H|L],Max0,Max) :- - ( - H > Max0 - -> - max_list(L,H,Max) - ; - max_list(L,Max0,Max) - ). - -min_list([H|L],Max) :- - min_list(L,H,Max). - -min_list([],Max,Max). -min_list([H|L],Max0,Max) :- - ( - H < Max0 - -> - min_list(L, H, Max) - ; - min_list(L, Max0, Max) - ). - -%% numlist(+Low, +High, -List) is semidet. -% -% List is a list [Low, Low+1, ... High]. Fails if High < Low.% -% -% @error type_error(integer, Low) -% @error type_error(integer, High) - -numlist(L, U, Ns) :- - must_be(integer, L), - must_be(integer, U), - L =< U, - numlist_(L, U, Ns). - -numlist_(U, U, OUT) :- !, OUT = [U]. -numlist_(L, U, [L|Ns]) :- - succ(L, L2), - numlist_(L2, U, Ns). - - -/** @pred intersection(+ _Set1_, + _Set2_, + _Set3_) - - -Succeeds if _Set3_ unifies with the intersection of _Set1_ and - _Set2_. _Set1_ and _Set2_ are lists without duplicates. They -need not be ordered. - -The code was copied from SWI-Prolog's list library. - -*/ - -% copied from SWI lists library. -intersection([], _, []) :- !. -intersection([X|T], L, Intersect) :- - memberchk(X, L), !, - Intersect = [X|R], - intersection(T, L, R). -intersection([_|T], L, R) :- - intersection(T, L, R). - -%% subtract(+Set, +Delete, -Result) is det. -% -% Delete all elements from `Set' that occur in `Delete' (a set) -% and unify the result with `Result'. Deletion is based on -% unification using memberchk/2. The complexity is |Delete|*|Set|. -% -% @see ord_subtract/3. - -subtract([], _, []) :- !. -subtract([E|T], D, R) :- - memberchk(E, D), !, - subtract(T, D, R). -subtract([H|T], D, [H|R]) :- - subtract(T, D, R). - -%% list_to_set(+List, ?Set) is det. -% -% True when Set has the same element as List in the same order. -% The left-most copy of the duplicate is retained. The complexity -% of this operation is |List|^2. -% -% @see sort/2. - -list_to_set(List, Set) :- - list_to_set_(List, Set0), - Set = Set0. - -list_to_set_([], R) :- - close_list(R). -list_to_set_([H|T], R) :- - memberchk(H, R), !, - list_to_set_(T, R). - -close_list([]) :- !. -close_list([_|T]) :- - close_list(T). - - -%% @} -/** @} */ diff --git a/packages/python/swig/yap4py/prolog/log2md.yap b/packages/python/swig/yap4py/prolog/log2md.yap deleted file mode 100644 index 6ce685582..000000000 --- a/packages/python/swig/yap4py/prolog/log2md.yap +++ /dev/null @@ -1,188 +0,0 @@ -/** - * @file log2md.yap - * @author Vitor Santos Costa - * - * - */ - -:- op(650,yfx, <-- ), - op(650,yfx, <-* ). - -:- module( log2md, - [open_log/1, - log_title/1, - log_section/1, - log_subsection/1, - log_paragraph/1, - log_unit/2, - (<--)/2, - (<-*)/2, - log_goal/1, - log_goal/1 as log_clause, - out/1, - out/2, - outln/1, - outln/2] ). - -:- use_module( library( maplist) ). - - -/** - * - * - * @defgroup Log2MD Log Output of Tests in Markdown format. - * - * @ingroup Regression System Tests - * - * These primitives support writing a user-specified log of execution to an - * output file. The output file can be used for testing or debugging. - * - * Primitives include the ability to write a title, a Prolog clause or - * goal, and hooks for tracing calls. The log_goal/2 can be used to - * start a goal. Arguments of the form `<--/2` and `*->/2` can be used to - * track calls. - * - * The output format is markdown. - */ - -open_log(F) :- - open( F, write, _Out, [alias(log)]). - - /** - * @pred log_title( +String ) is det - * - * @param [in] S is a Prolog atom or string describing a title. - * - */ - log_title( S ) :- - out( '## Report on ~a~n~n', [S]). - - /** - * @pred log_section( +String ) is det - * - * @param [in] S is a Prolog atom or string describing a title. - * - */ - log_section( S ) :- - out( '### Report on ~a~n~n', [S]). - - /** - * @pred log_section( +String ) is det - * - * @param [in] S is a Prolog atom or string describing a title. - * - */ - log_subsection( S ) :- - out( '#### Report on ~a~n~n', [S]). - - /** - * @pred log_section( +String ) is det - * - * @param [in] S is a Prolog atom or string describing a title. - * - */ - log_paragraph( S ) :- - out( '##### Report on ~a~n~n', [S]). - - /** - * @pred log_unit( +String, + Level ) is det - * - * @param [in] _String_ is a Prolog atom or string describing a title - * @param [in] _Level_ is an integer number larager than 1 (do notice that ) - *large numbers may be ignored ). - * - * - */ - log_unit( S ) :- - out( '## Report on ~a~n~n', [S]). - - /** - * @pred clause( +Term ) is det - * - * @param [in] Term is a Prolog clause or goal that it is going to - * be printed out using portray_clause/2. - * - */ - log_goal( DecoratedClause ) :- - take_decorations(DecoratedClause, Clause), - out( '~~~~~~~~{.prolog}~n'), - portray_clause( user_error , Clause ), - portray_clause( log , Clause ), - out( '~~~~~~~~~n', []). - - take_decorations( G, G ) :- - var(G), - !. - take_decorations(_ <-- G, NG ) :- - !, - take_decorations( G, NG ). - take_decorations(_ <-* G, NG ) :- - !, - take_decorations( G, NG ). - take_decorations(G, NG ) :- - G =.. [F|Args], - maplist( take_decorations, Args, NArgs ), - NG =.. [F|NArgs]. - - :- meta_predicate ( + <-- 0 ), - ( + <-* 0 ). - - /** - * @pred log_goal( +Tag , :Goal ) - * - * @param [in] evaluate goal _Goal_ with output before, - * during and after the goal has been evaluated. - * - */ - A <-* Goal :- - ( - outln(A), - log_goal( Goal ), - call( Goal ) - *-> - out('succeded as~n'), log_goal(Goal) - ; - out( 'failed~n'), - fail - ). - - /** - * @pred `<--`( +Tag , :Goal ) - * - * @param [in] output goal _Goal_ before and after being evaluated, but only - * taking the first solution. The _Tag_ must be an atom or a string. - * - */ - Tag <-- Goal :- - ( - outln(Tag), - log_goal( Goal ), - call( Goal ) - -> - out('succeded as~n'), - log_goal(Goal), - fail - ; - out(failed) - ). - - - /** - * @pred out(+Format, +Args) - * - * @param [in] format the string given Args . The output is sent to - * user_error and to a stream with alias `log`; - * - */ - out(Format, Args) :- - format( log, Format, Args), - format( user_error, Format, Args). - - out(Format) :- - format( log, Format, []), - format( user_error, Format, []). - - outln(Format, Args) :- - out(Format, Args), out('~n'). - outln(Format) :- - out(Format), out('~n'). diff --git a/packages/python/swig/yap4py/prolog/mapargs.yap b/packages/python/swig/yap4py/prolog/mapargs.yap deleted file mode 100644 index 018ae78a0..000000000 --- a/packages/python/swig/yap4py/prolog/mapargs.yap +++ /dev/null @@ -1,384 +0,0 @@ -/** - * @file library/mapargs.yap - * @author Lawrence Byrd + Richard A. O'Keefe, VITOR SANTOS COSTA - * @author : E. Alphonse from code by Joachim Schimpf, Jan Wielemaker, Vitor Santos Costa - * @date 4 August 1984 and Ken Johnson 11-8-87 - * - * @brief Macros to apply a predicate to all sub-terms of a term. - * - * -*/ - - -:- module(mapargs,[ mapargs/2, % :Goal, +S - mapargs/3, % :Goal, +S, -S - mapargs/4, % :Goal, +S, -S1, -S2 - mapargs/5, % :Goal, +S, -S1, -S2, -S3 - mapargs/6, % :Goal, +S, -S1, -S2, -S3, -S4 - sumargs/4, - foldargs/4, % :Pred, +S, ?V0, ?V - foldargs/5, % :Pred, +S, ?S1, ?V0, ?V - foldargs/6, % :Pred, +S, ?S1, ?S2, ?V0, ?V - foldargs/7 % :Pred, +S, ?S1, ?S2, ?S3, ?V0, ?V - ]). - -/** -* @defgroup mapargs Apply a predicate to all arguments of a term -* @ingroup library -*/ - - -:- use_module(library(maputils)). -:- use_module(library(lists), [append/3]). - -:- meta_predicate - mapargs(1,+), - mapargs_args(1,+,+), - mapargs(2,+,-), - mapargs_args(2,+,-,+), - mapargs(3,+,-,-), - mapargs_args(2,+,-,-,+), - mapargs(4,+,-,-,-), - mapargs_args(2,+,-,-,-,+), - mapargs(5,+,-,-,-,-), - mapargs_args(2,+,-,-,-,-,+), - sumargs(3,+,+,-), - sumargs_args(3,+,+,-,+), - foldargs(3, +, +, -), - foldargs(4, +, ?, +, -), - foldargs(5, +, ?, ?, +, -), - foldargs(6, +, ?, ?, ?, +, -). - - -mapargs(Pred, TermIn) :- - functor(TermIn, _F, N), - mapargs_args(Pred, TermIn, 0, N). - -mapargs_args(Pred, TermIn, I, N) :- - ( I == N -> true ; - I1 is I+1, - arg(I1, TermIn, InArg), - call(Pred, InArg), - mapargs_args(Pred, TermIn, I1, N) ). - -mapargs(Pred, TermIn, TermOut) :- - functor(TermIn, F, N), - functor(TermOut, F, N), - mapargs_args(Pred, TermIn, TermOut, 0, N). - -mapargs_args(Pred, TermIn, TermOut, I, N) :- - ( I == N -> true ; - I1 is I+1, - arg(I1, TermIn, InArg), - arg(I1, TermOut, OutArg), - call(Pred, InArg, OutArg), - mapargs_args(Pred, TermIn, TermOut, I1, N) ). - -mapargs(Pred, TermIn, TermOut1, TermOut2) :- - functor(TermIn, F, N), - functor(TermOut1, F, N), - functor(TermOut2, F, N), - mapargs_args(Pred, TermIn, TermOut1, TermOut2, 0, N). - -mapargs_args(Pred, TermIn, TermOut1, TermOut2, I, N) :- - ( I == N -> true ; - I1 is I+1, - arg(I1, TermIn, InArg), - arg(I1, TermOut1, OutArg1), - arg(I1, TermOut2, OutArg2), - call(Pred, InArg, OutArg1, OutArg2), - mapargs_args(Pred, TermIn, TermOut1, TermOut2, I1, N) ). - -mapargs(Pred, TermIn, TermOut1, TermOut2, TermOut3) :- - functor(TermIn, F, N), - functor(TermOut1, F, N), - functor(TermOut2, F, N), - mapargs_args(Pred, TermIn, TermOut1, TermOut2, TermOut3, 0, N). - -mapargs_args(Pred, TermIn, TermOut1, TermOut2, TermOut3, I, N) :- - ( I == N -> true ; - I1 is I+1, - arg(I1, TermIn, InArg), - arg(I1, TermOut1, OutArg1), - arg(I1, TermOut2, OutArg2), - arg(I1, TermOut3, OutArg3), - call(Pred, InArg, OutArg1, OutArg2, OutArg3), - mapargs_args(Pred, TermIn, TermOut1, TermOut2, TermOut3, I1, N) ). - -mapargs(Pred, TermIn, TermOut1, TermOut2, TermOut3, TermOut4) :- - functor(TermIn, F, N), - functor(TermOut1, F, N), - functor(TermOut2, F, N), - functor(TermOut3, F, N), - functor(TermOut4, F, N), - mapargs_args(Pred, TermIn, TermOut1, TermOut2, TermOut3, TermOut4, 0, N). - -mapargs_args(Pred, TermIn, TermOut1, TermOut2, TermOut3, TermOut4, I, N) :- - ( I == 0 -> true ; - I1 is I+1, - arg(I1, TermIn, InArg), - arg(I1, TermOut1, OutArg1), - arg(I1, TermOut2, OutArg2), - arg(I1, TermOut3, OutArg3), - arg(I1, TermOut4, OutArg4), - call(Pred, InArg, OutArg1, OutArg2, OutArg3, OutArg4), - mapargs_args(Pred, TermIn, TermOut1, TermOut2, TermOut3, TermOut4, I1, N) ). - -sumargs(Pred, Term, A0, A1) :- - functor(Term, _, N), - sumargs(Pred, Term, A0, A1, N). - -sumargs_args(_, _, A0, A1, 0) :- - !, - A0 = A1. -sumargs_args(Pred, Term, A1, A3, N) :- - arg(N, Term, Arg), - N1 is N - 1, - call(Pred, Arg, A1, A2), - sumargs_args(Pred, Term, A2, A3, N1). - - -foldargs(Goal, S, V0, V) :- - functor(S, _, Ar), - foldargs_(Goal, S, V0, V, 0, Ar). - -foldargs_(Goal, S, V0, V, I, N) :- - ( I == N -> V0 = V ; - I1 is I+1, - arg(I1, S, A), - call(Goal, A, V0, V1), - foldargs_(Goal, S, V1, V, I1, N) ). - -foldargs(Goal, S, O1, V0, V) :- - functor(S, N, Ar), - functor(O1, N, Ar), - foldargs_(Goal, S, O1, V0, V, 0, Ar). - -foldargs_(Goal, S, O1, V0, V, I, N) :- - ( I == N -> V0 = V ; - I1 is I+1, - arg(I1, S, A), - arg(I1, O1, A1), - call(Goal, A, A1, V0, V1), - foldargs_(Goal, S, O1, V1, V, I1, N) ). - -foldargs(Goal, S, O1, O2, V0, V) :- - functor(S, N, Ar), - functor(O1, N, Ar), - functor(O2, N, Ar), - foldargs_(Goal, S, O1, O2, V0, V, 0, Ar). - -foldargs_(Goal, S, O1, O2, V0, V, I, N) :- - ( I == N -> V0 = V ; - I1 is I+1, - arg(I1, S, A), - arg(I1, O1, A1), - arg(I1, O2, A2), - call(Goal, A, A1, A2, V0, V1), - foldargs_(Goal, S, O1, O2, V1, V, I1, N) ). - -foldargs(Goal, S, O1, O2, O3, V0, V) :- - functor(S, N, Ar), - functor(O1, N, Ar), - functor(O2, N, Ar), - functor(O3, N, Ar), - foldargs_(Goal, S, O1, O2, O3, V0, V, 0, Ar). - -foldargs_(Goal, S, O1, O2, O3, V0, V, I, N) :- - ( I == N -> V0 = V ; - I1 is I+1, - arg(I1, S, A), - arg(I1, O1, A1), - arg(I1, O2, A2), - arg(I1, O3, A3), - call(Goal, A, A1, A2, A3, V0, V1), - foldargs_(Goal, S, O1, O2, O3, V1, V, I1, N) ). - - -goal_expansion(mapargs(Meta, In), (functor(In, _Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(mapargs, 1, Proto, GoalName), - append(MetaVars, [In, 0, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, I, Ar], RecursionHead), - append_args(Pred, [AIn], Apply), - append_args(HeadPrefix, [In, I1, Ar], RecursiveCall), - compile_aux([ - (RecursionHead :- I == 0 -> true ; I1 is I+1, arg(I1, In, AIn), Apply, RecursiveCall ) - ], Mod). - -goal_expansion(mapargs(Meta, In, Out), (functor(In, Name, Ar), functor(Out, Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(mapargs, 2, Proto, GoalName), - append(MetaVars, [In, Out, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, Out, I], RecursionHead), - append_args(Pred, [AIn, AOut], Apply), - append_args(HeadPrefix, [In, Out, I1], RecursiveCall), - compile_aux([ - (RecursionHead :- I == 0 -> true ; arg(I, In, AIn), arg(I, Out, AOut), Apply, I1 is I-1, RecursiveCall ) - ], Mod). - -goal_expansion(mapargs(Meta, In, Out1, Out2), (functor(In, Name, Ar), functor(Out1, Name, Ar), functor(Out2, Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(mapargs, 3, Proto, GoalName), - append(MetaVars, [In, Out1, Out2, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, Out1, Out2, I], RecursionHead), - append_args(Pred, [AIn, AOut1, AOut2], Apply), - append_args(HeadPrefix, [In, Out1, Out2, I1], RecursiveCall), - compile_aux([ - (RecursionHead :- I == 0 -> true ; arg(I, In, AIn), arg(I, Out1, AOut1), arg(I, Out2, AOut2), Apply, I1 is I-1, RecursiveCall ) - ], Mod). - -goal_expansion(mapargs(Meta, In, Out1, Out2, Out3), (functor(In, Name, Ar), functor(Out1, Name, Ar), functor(Out3, Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(mapargs, 4, Proto, GoalName), - append(MetaVars, [In, Out1, Out2, Out3, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, Out1, Out2, Out3, I], RecursionHead), - append_args(Pred, [AIn, AOut1, AOut2, AOut3], Apply), - append_args(HeadPrefix, [In, Out1, Out2, Out3, I1], RecursiveCall), - compile_aux([ - (RecursionHead :- I == 0 -> true ; arg(I, In, AIn), arg(I, Out1, AOut1), arg(I, Out2, AOut2), arg(I, Out3, AOut3), Apply, I1 is I-1, RecursiveCall ) - ], Mod). - -goal_expansion(mapargs(Meta, In, Out1, Out2, Out3, Out4), (functor(In, Name, Ar), functor(Out1, Name, Ar), functor(Out3, Name, Ar), functor(Out4, Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(mapargs, 4, Proto, GoalName), - append(MetaVars, [In, Out1, Out2, Out3, Out4, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, Out1, Out2, Out3, Out4, I], RecursionHead), - append_args(Pred, [AIn, AOut1, AOut2, AOut3, AOut4], Apply), - append_args(HeadPrefix, [In, Out1, Out2, Out3, Out4, I1], RecursiveCall), - compile_aux([ - (RecursionHead :- I == 0 -> true ; arg(I, In, AIn), arg(I, Out1, AOut1), arg(I, Out2, AOut2), arg(I, Out3, AOut3), arg(I, Out4, AOut4), Apply, I1 is I-1, RecursiveCall ) - ], Mod). - -goal_expansion(sumargs(Meta, Term, AccIn, AccOut), Mod:Goal) :- - goal_expansion_allowed, - prolog_load_context(module, Mod), - Goal = ( - Term =.. [_|TermArgs], - sumlist(Meta, TermArgs, AccIn, AccOut) - ). - -goal_expansion(foldargs(Meta, In, Acc0, AccF), (functor(In, _Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldargs, 1, Proto, GoalName), - append(MetaVars, [In, Acc0, AccF, 0, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, VAcc0, VAccF, I, Ar], RecursionHead), - append_args(Pred, [AIn, VAcc0, VAccI], Apply), - append_args(HeadPrefix, [In, VAccI, VAccF, I1, Ar], RecursiveCall), - compile_aux([ - (RecursionHead :- I == Ar -> VAcc0 = VAccF ; I1 is I+1, arg(I1, In, AIn), Apply, RecursiveCall ) - ], Mod). - -goal_expansion(foldargs(Meta, In, Out1, Acc0, AccF), (functor(In, Name, Ar), functor(Out1, Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldargs, 2, Proto, GoalName), - append(MetaVars, [In, Out1, Acc0, AccF, 0, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, Out1, VAcc0, VAccF, I, Ar], RecursionHead), - append_args(Pred, [AIn, AOut1, VAcc0, VAccI], Apply), - append_args(HeadPrefix, [In, Out1, VAccI, VAccF, I1, Ar], RecursiveCall), - compile_aux([ - (RecursionHead :- I == Ar -> VAcc0 = VAccF ; I1 is I+1, arg(I1, In, AIn), arg(I1, Out1, AOut1), Apply, RecursiveCall ) - ], Mod). - -goal_expansion(foldargs(Meta, In, Out1, Out2, Acc0, AccF), (functor(In, Name, Ar), functor(Out1, Name, Ar), functor(Out2, Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldargs, 3, Proto, GoalName), - append(MetaVars, [In, Out1, Out2, Acc0, AccF, 0, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, Out1, Out2, VAcc0, VAccF, I, Ar], RecursionHead), - append_args(Pred, [AIn, AOut1, AOut2, VAcc0, VAccI], Apply), - append_args(HeadPrefix, [In, Out1, Out2, VAccI, VAccF, I1, Ar], RecursiveCall), - compile_aux([ - (RecursionHead :- I == Ar -> VAcc0 = VAccF ; I1 is I+1, arg(I1, In, AIn), arg(I1, Out1, AOut1), arg(I1, Out2, AOut2), Apply, RecursiveCall ) - ], Mod). - -goal_expansion(foldargs(Meta, In, Out1, Out2, Out3, Acc0, AccF), (functor(In, Name, Ar), functor(Out1, Name, Ar), functor(Out2, Name, Ar), functor(Out3, Name, Ar), Mod:Goal)) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldargs, 4, Proto, GoalName), - append(MetaVars, [In, Out1, Out2, Out3, Acc0, AccF, 0, Ar], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - % the new predicate declaration - append_args(HeadPrefix, [In, Out1, Out2, Out3, VAcc0, VAccF, I, Ar], RecursionHead), - append_args(Pred, [AIn, AOut1, AOut2, AOut3, VAcc0, VAccI], Apply), - append_args(HeadPrefix, [In, Out1, Out2, Out3, VAccI, VAccF, I1, Ar], RecursiveCall), - compile_aux([ - (RecursionHead :- I == Ar -> VAcc0 = VAccF ; I1 is I+1, arg(I1, In, AIn), arg(I1, Out1, AOut1), arg(I1, Out2, AOut2), arg(I1, Out3, AOut3), Apply, RecursiveCall ) - ], Mod). diff --git a/packages/python/swig/yap4py/prolog/maplist.yap b/packages/python/swig/yap4py/prolog/maplist.yap deleted file mode 100644 index 289b14176..000000000 --- a/packages/python/swig/yap4py/prolog/maplist.yap +++ /dev/null @@ -1,1295 +0,0 @@ - -/** - * @file maplist.yap - * @author Lawrence Byrd + Richard A. O'Keefe, VITOR SANTOS COSTA - * @author : E. Alphonse from code by Joachim Schimpf, Jan Wielemaker, Vitor Santos Costa - * @date 4 August 1984 and Ken Johnson 11-8-87 - * - * @brief Macros to apply a predicate to all elements of a list. - * - * -*/ - - :- module(maplist, - [maplist/2, - maplist/3, - maplist/4, - maplist/5, - checklist/2, - checknodes/2, - convlist/3, - convlist/4, - foldl/4, - foldl/5, - foldl/6, - foldl/7, - foldl2/6, - foldl2/7, - foldl2/8, - foldl3/8, - foldl4/10, - include/3, - exclude/3, - mapnodes/3, - partition/4, - partition/5, - scanl/4, - scanl/5, - scanl/6, - scanl/7, - selectlist/3, - selectlist/4, - selectlists/5, - sumlist/4, - sumnodes/4 - ]). - -/** - * @defgroup maplist Map List and Term Operations - * @ingroup library - * - * This library provides a set of utilities for applying a predicate to - * all elements of a list. They allow one to easily perform the most common do-loop constructs in Prolog. - * To avoid performance degradation, each call creates an - * equivalent Prolog program, without meta-calls, which is executed by - * the Prolog engine instead. The library was based on code - * by Joachim Schimpf and on code from SWI-Prolog, and it is also inspired by the GHC - * libraries. - * - * The following routines are available once included with the - * `use_module(library(apply_macros))` command. - * @author : Lawrence Byrd - * @author Richard A. O'Keefe - * @author Joachim Schimpf - * @author Jan Wielemaker - * @author E. Alphonse - * @author Vitor Santos Costa - - -Examples: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog} -%given -plus(X,Y,Z) :- Z is X + Y. - -plus_if_pos(X,Y,Z) :- Y > 0, Z is X + Y. - -vars(X, Y, [X|Y]) :- var(X), !. -vars(_, Y, Y). - -trans(TermIn, TermOut) :- - nonvar(TermIn), - TermIn =.. [p|Args], - TermOut =..[q|Args], !. -trans(X,X). - -%success - - ?- maplist(plus(1), [1,2,3,4], [2,3,4,5]). - - ?- checklist(var, [X,Y,Z]). - - ?- selectlist(<(0), [-1,0,1], [1]). - - ?- convlist(plus_if_pos(1), [-1,0,1], [2]). - - ?- sumlist(plus, [1,2,3,4], 1, 11). - - ?- maplist(mapargs(number_atom),[c(1),s(1,2,3)],[c('1'),s('1','2','3')]). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - @{ - - */ - - - -/** @pred maplist(+ _Pred_,+ _List1_,+ _List2_) - -Apply _Pred_ on all successive pairs of elements from - _List1_ and - _List2_. Fails if _Pred_ can not be applied to a -pair. See the example above. - - -*/ -/** @pred maplist(+ _Pred_,+ _List1_,+ _List2_,+ _List4_) - -Apply _Pred_ on all successive triples of elements from _List1_, - _List2_ and _List3_. Fails if _Pred_ can not be applied to a -triple. See the example above. - - */ - -:- meta_predicate - selectlist(2,+,-), - selectlist(3,+,+,-), - checklist(1,+), - maplist(1,+), - maplist(2,+,-), - maplist(3,+,+,-), - maplist(4,+,+,+,-), - convlist(2,+,-), - convlist(3,?,?,?), - mapnodes(2,+,-), - mapnodes_list(2,+,-), - checknodes(1,+), - checknodes_list(1,+), - sumlist(3,+,+,-), - sumnodes(3,+,+,-), - sumnodes_body(3,+,+,-,+,+), - include(1,+,-), - exclude(1,+,-), - partition(2,+,-,-), - partition(2,+,-,-,-), - foldl(3, +, +, -), - foldl2(5, +, +, -, +, -), - foldl2(6, +, ?, +, -, +, -), - foldl2(6, +, ?, ?, +, -, +, -), - foldl3(5, +, +, -, +, -, +, -), - foldl4(7, +, +, -, +, -, +, -, +, -), - foldl(4, +, +, +, -), - foldl(5, +, +, +, +, -), - foldl(6, +, +, +, +, +, -), - scanl(3, +, +, -), - scanl(4, +, +, +, -), - scanl(5, +, +, +, +, -), - scanl(6, +, +, +, +, +, -). - -:- use_module(library(maputils)). -:- use_module(library(lists), [append/3]). -:- use_module(library(charsio), [format_to_chars/3, read_from_chars/2]). -:- use_module(library(occurs), [sub_term/2]). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Definitions for Metacalls -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -/** include(+ _Pred_, + _ListIn_, ? _ListOut_) - Same as selectlist/3. -*/ -include(G,In,Out) :- - selectlist(G, In, Out). - -/** selectlist(: _Pred_, + _ListIn_, ? _ListOut_)) - Creates _ListOut_ of all list elements of _ListIn_ that pass a given test -*/ -selectlist(_, [], []). -selectlist(Pred, [In|ListIn], ListOut) :- - (call(Pred, In) -> - ListOut = [In|NewListOut] - ; - ListOut = NewListOut - ), - selectlist(Pred, ListIn, NewListOut). - -/** selectlist(: _Pred_, + _ListIn_, + _ListInAux_, ? _ListOut_, ? _ListOutAux_) - Creates _ListOut_ and _ListOutAux_ of all list elements of _ListIn_ and _ListInAux_ that - pass the given test _Pred_. -*/ -selectlists(_, [], [], [], []). -selectlists(Pred, [In|ListIn], [In1|ListIn1], ListOut, ListOut1) :- - (call(Pred, In, In1) -> - ListOut = [In|NewListOut], - ListOut1 = [In1|NewListOut1] - ; - ListOut1 = NewListOut1, - ListOut = NewListOut - ), - selectlist(Pred, ListIn, ListIn1, NewListOut, NewListOut1). - -/** selectlist(: _Pred_, + _ListIn_, + _ListInAux_, ? _ListOut_) - Creates _ListOut_ of all list elements of _ListIn_ that - pass the given test _Pred_ using + _ListInAux_ as an - auxiliary element. -*/ -selectlist(_, [], [], []). -selectlist(Pred, [In|ListIn], [In1|ListIn1], ListOut) :- - (call(Pred, In, In1) -> - ListOut = [In|NewListOut] - ; - ListOut = NewListOut - ), - selectlist(Pred, ListIn, ListIn1, NewListOut). - -/** exclude(+ _Goal_, + _List1_, ? _List2_) - Filter elements for which _Goal_ fails. True if _List2_ contains - those elements _Xi_ of _List1_ for which `call(Goal, Xi)` fails. -*/ -exclude(_, [], []). -exclude(Pred, [In|ListIn], ListOut) :- - (call(Pred, In) -> - ListOut = NewListOut - ; - ListOut = [In|NewListOut] - ), - exclude(Pred, ListIn, NewListOut). - -/** partition(+ _Pred_, + _List1_, ? _Included_, ? _Excluded_) - Filter elements of _List_ according to _Pred_. True if - _Included_ contains all elements for which `call(Pred, X)` - succeeds and _Excluded_ contains the remaining elements. -*/ -partition(_, [], [], []). -partition(Pred, [In|ListIn], List1, List2) :- - (call(Pred, In) -> - List1 = [In|RList1], - List2 = RList2 - ; - List1 = RList1, - List2 = [In|RList2] - ), - partition(Pred, ListIn, RList1, RList2). - -/** partition(+ _Pred_, + _List1_, ? _Lesser_, ? _Equal_, ? _Greater_) - - Filter list according to _Pred_ in three sets. For each element - _Xi_ of _List_, its destination is determined by - `call(Pred, Xi, Place)`, where _Place_ must be unified to one - of `\<`, `=` or `\>`. `Pred` must be deterministic. - - -*/ -partition(_, [], [], [], []). -partition(Pred, [In|ListIn], List1, List2, List3) :- - call(Pred, In, Diff), - ( Diff == (<) -> - List1 = [In|RList1], - List2 = RList2, - List3 = RList3 - ; - Diff == (=) -> - List1 = RList1, - List2 = [In|RList2], - List3 = RList3 - ; - Diff == (>) -> - List1 = RList1, - List2 = RList2, - List3 = [In|RList3] - ; - must_be(oneof([<,=,>]), Diff) - ), - partition(Pred, ListIn, RList1, RList2, RList3). - -/** checklist(: _Pred_, + _List_) - Succeeds if the predicate _Pred_ succeeds on all elements of _List_. -*/ -checklist(_, []). -checklist(Pred, [In|ListIn]) :- - call(Pred, In), - checklist(Pred, ListIn). - -/** maplist(: _Pred_, ? _ListIn_) - - Applies predicate _Pred_( _El_ ) to all - elements _El_ of _ListIn_. - -*/ -maplist(_, []). -maplist(Pred, [In|ListIn]) :- - call(Pred, In), - maplist(Pred, ListIn). - - -/** maplist(: _Pred_, ? _L1_, ? _L2_ ) - _L1_ and _L2_ are such that - `call( _Pred_, _A1_, _A2_)` holds for every - corresponding element in lists _L1_, _L2_. - - Comment from Richard O'Keefe: succeeds when _Pred( _Old_, _New_) succeeds for each corresponding - _Gi_ in _Listi_, _New_ in _NewList_. In InterLisp, this is MAPCAR. - It is also MAP2C. Isn't bidirectionality wonderful? -*/ -maplist(_, [], []). -maplist(Pred, [In|ListIn], [Out|ListOut]) :- - call(Pred, In, Out), - maplist(Pred, ListIn, ListOut). - -/** maplist(: _Pred_, ? _L1_, ? _L2_, ? _L3_) - _L1_, _L2_, and _L3_ are such that - `call( _Pred_, _A1_, _A2_, _A3_)` holds for every - corresponding element in lists _L1_, _L2_, and _L3_. - -*/ -maplist(_, [], [], []). -maplist(Pred, [A1|L1], [A2|L2], [A3|L3]) :- - call(Pred, A1, A2, A3), - maplist(Pred, L1, L2, L3). - -/** maplist(: _Pred_, ? _L1_, ? _L2_, ? _L3_, ? _L4_) - _L1_, _L2_, _L3_, and _L4_ are such that - `call( _Pred_, _A1_, _A2_, _A3_, _A4_)` holds - for every corresponding element in lists _L1_, _L2_, _L3_, and - _L4_. -*/ -maplist(_, [], [], [], []). -maplist(Pred, [A1|L1], [A2|L2], [A3|L3], [A4|L4]) :- - call(Pred, A1, A2, A3, A4), - maplist(Pred, L1, L2, L3, L4). - -/** - convlist(: _Pred_, + _ListIn_, ? _ListOut_) @anchor convlist3 - - A combination of maplist/3 and selectlist/3: creates _ListOut_ by - applying the predicate _Pred_ to all list elements on which - _Pred_ succeeds. - - ROK: convlist(Rewrite, OldList, NewList) - is a sort of hybrid of maplist/3 and sublist/3. - Each element of NewList is the image under Rewrite of some - element of OldList, and order is preserved, but elements of - OldList on which Rewrite is undefined (fails) are not represented. - Thus if foo(X,Y) :- integer(X), Y is X+1. - then convlist(foo, [1,a,0,joe(99),101], [2,1,102]). -*/ -convlist(_, [], []). -convlist(Pred, [Old|Olds], NewList) :- - call(Pred, Old, New), - !, - NewList = [New|News], - convlist(Pred, Olds, News). -convlist(Pred, [_|Olds], News) :- - convlist(Pred, Olds, News). - -/** - convlist(: Pred, ? ListIn, ?ExtraList, ? ListOut) @anchor convlist5 - - A combination of maplist/4 and selectlist/3: _ListIn_, _ListExtra_, - and _ListOut_ are the sublists so that the predicate _Pred_ succeeds. - - ROK: convlist(Rewrite, OldList, NewList) - is a sort of hybrid of maplist/3 and sublist/3. - Each element of NewList is the image under Rewrite of some - element of OldList, and order is preserved, but elements of - OldList on which Rewrite is undefined (fails) are not represented. - Thus if foo(X,Y) :- integer(X), Y is X+1. - then convlist(foo, [1,a,0,joe(99),101], [2,1,102]). -*/ -convlist(_, [], []). -convlist(Pred, [Old|Olds], NewList) :- - call(Pred, Old, New), - !, - NewList = [New|News], - convlist(Pred, Olds, News). -convlist(Pred, [_|Olds], News) :- - convlist(Pred, Olds, News). - -/** - mapnodes(+ _Pred_, + _TermIn_, ? _TermOut_) - - Creates _TermOut_ by applying the predicate _Pred_ - to all sub-terms of _TermIn_ (depth-first and left-to-right order). -*/ -mapnodes(Pred, TermIn, TermOut) :- - (atomic(TermIn); var(TermIn)), !, - call(Pred, TermIn, TermOut). -mapnodes(Pred, TermIn, TermOut) :- - call(Pred, TermIn, Temp), - Temp =.. [Func|ArgsIn], - mapnodes_list(Pred, ArgsIn, ArgsOut), - TermOut =.. [Func|ArgsOut]. - -mapnodes_list(_, [], []). -mapnodes_list(Pred, [TermIn|ArgsIn], [TermOut|ArgsOut]) :- - mapnodes(Pred, TermIn, TermOut), - mapnodes_list(Pred, ArgsIn, ArgsOut). - -/** - checknodes(+ _Pred_, + _Term_) @anchor checknodes - - Succeeds if the predicate _Pred_ succeeds on all sub-terms of - _Term_ (depth-first and left-to-right order) -*/ -checknodes(Pred, Term) :- - (atomic(Term); var(Term)), !, - call(Pred, Term). -checknodes(Pred, Term) :- - call(Pred, Term), - Term =.. [_|Args], - checknodes_list(Pred, Args). - -checknodes_list(_, []). -checknodes_list(Pred, [Term|Args]) :- - checknodes_body(Pred, Term), - checknodes_list(Pred, Args). - -/** - sumlist(: _Pred_, + _List_, ? _AccIn_, ? _AccOut_) - - Calls _Pred_ on all elements of List and collects a result in - _Accumulator_. Same as fold/4. -*/ -sumlist(_, [], Acc, Acc). -sumlist(Pred, [H|T], AccIn, AccOut) :- - call(Pred, H, AccIn, A1), - sumlist(Pred, T, A1, AccOut). - -/** - sumnodes(+ _Pred_, + _Term_, ? _AccIn_, ? _AccOut_) @anchor sumnodes - - Calls the predicate _Pred_ on all sub-terms of _Term_ and - collect a result in _Accumulator_ (depth-first and left-to-right - order) -*/ -sumnodes(Pred, Term, A0, A2) :- - call(Pred, Term, A0, A1), - (compound(Term) -> - functor(Term, _, N), - sumnodes_body(Pred, Term, A1, A2, 0, N) - ; % simple term or variable - A1 = A2 - ). - -sumnodes_body(Pred, Term, A1, A3, N0, Ar) :- - N0 < Ar -> - N is N0+1, - arg(N, Term, Arg), - sumnodes(Pred, Arg, A1, A2), - sumnodes_body(Pred, Term, A2, A3, N, Ar) - ; - A1 = A3. - - - /******************************* - * FOLDL * - *******************************/ - -%% foldl(:Goal, +List, +V0, -V, +W0, -WN). -% - -/** - foldl(: _Pred_, + _List1_, + _List2_, ? _AccIn_, ? _AccOut_) - - Calls _Pred_ on all elements of `List1` and collects a result in _Accumulator_. Same as - foldr/3. -*/ -foldl(Goal, List, V0, V) :- - foldl_(List, Goal, V0, V). - -foldl_([], _, V, V). -foldl_([H|T], Goal, V0, V) :- - call(Goal, H, V0, V1), - foldl_(T, Goal, V1, V). - -/** - foldl(: _Pred_, + _List1_, + _List2_, ? _AccIn_, ? _AccOut_) - - Calls _Pred_ on all elements of _List1_ and - _List2_ and collects a result in _Accumulator_. Same as - foldr/4. - - The foldl family of predicates is defined - == - foldl(P, [X11,...,X1n],V0, Vn, W0, WN) :- - P(X11, V0, V1, W0, W1), - ... - P(X1n, Vn1, Vn, Wn1, Wn). - == -*/ -foldl(Goal, List1, List2, V0, V) :- - foldl_(List1, List2, Goal, V0, V). - -foldl_([], [], _, V, V). -foldl_([H1|T1], [H2|T2], Goal, V0, V) :- - call(Goal, H1, H2, V0, V1), - foldl_(T1, T2, Goal, V1, V). - -/** - -*/ -foldl(Goal, List1, List2, List3, V0, V) :- - foldl_(List1, List2, List3, Goal, V0, V). - -foldl_([], [], [], _, V, V). -foldl_([H1|T1], [H2|T2], [H3|T3], Goal, V0, V) :- - call(Goal, H1, H2, H3, V0, V1), - foldl_(T1, T2, T3, Goal, V1, V). - - -/** - -*/ -foldl(Goal, List1, List2, List3, List4, V0, V) :- - foldl_(List1, List2, List3, List4, Goal, V0, V). - -foldl_([], [], [], [], _, V, V). -foldl_([H1|T1], [H2|T2], [H3|T3], [H4|T4], Goal, V0, V) :- - call(Goal, H1, H2, H3, H4, V0, V1), - foldl_(T1, T2, T3, T4, Goal, V1, V). - - -/** - foldl2(: _Pred_, + _List_, ? _X0_, ? _X_, ? _Y0_, ? _Y_) - - Calls _Pred_ on all elements of `List` and collects a result in - _X_ and _Y_. - -*/ -foldl2(Goal, List, V0, V, W0, W) :- - foldl2_(List, Goal, V0, V, W0, W). - -foldl2_([], _, V, V, W, W). -foldl2_([H|T], Goal, V0, V, W0, W) :- - call(Goal, H, V0, V1, W0, W1), - foldl2_(T, Goal, V1, V, W1, W). - -/** - foldl2(: _Pred_, + _List_, ? _List1_, ? _X0_, ? _X_, ? _Y0_, ? _Y_) - - Calls _Pred_ on all elements of _List_ and _List1_ and collects a result in - _X_ and _Y_. -*/ -foldl2(Goal, List1, List2, V0, V, W0, W) :- - foldl2_(List1, List2, Goal, V0, V, W0, W). - -foldl2_([], [], _Goal, V, V, W, W). -foldl2_([H1|T1], [H2|T2], Goal, V0, V, W0, W) :- - call(Goal, H1, H2, V0, V1, W0, W1), - foldl2_(T1, T2, Goal, V1, V, W1, W). - -/** - foldl2(: _Pred_, + _List_, ? _List1_, ? _List2_, ? _X0_, ? _X_, ? _Y0_, ? _Y_) - - Calls _Pred_ on all elements of _List_, _List1_ and _List2_ and collects a result in - _X_ and _Y_. - -*/ -foldl2(Goal, List1, List2, List3, V0, V, W0, W) :- - foldl2_(List1, List2, List3, Goal, V0, V, W0, W). - -foldl2_([], [], [], _Goal, V, V, W, W). -foldl2_([H1|T1], [H2|T2], [H3|T3], Goal, V0, V, W0, W) :- - call(Goal, H1, H2, H3, V0, V1, W0, W1), - foldl2_(T1, T2, T3, Goal, V1, V, W1, W). - - -/** - foldl3(: _Pred_, + _List1_, ? _List2_, ? _X0_, ? _X_, ? _Y0_, ? _Y_, ? _Z0_, ? _Z_) - - - Calls _Pred_ on all elements of `List` and collects a - result in _X_, _Y_ and _Z_. -*/ -foldl3(Goal, List, V0, V, W0, W, X0, X) :- - foldl3_(List, Goal, V0, V, W0, W, X0, X). - -foldl3_([], _, V, V, W, W, X, X). -foldl3_([H|T], Goal, V0, V, W0, W, X0, X) :- - call(Goal, H, V0, V1, W0, W1, X0, X1), - fold3_(T, Goal, V1, V, W1, W, X1, X). - -/** - foldl4(: _Pred_, + _List1_, ? _List2_, ? _X0_, ? _X_, ? _Y0_, ? _Y_, ? _Z0_, ? _Z_, ? _W0_, ? _W_) - - - Calls _Pred_ on all elements of `List` and collects a - result in _X_, _Y_, _Z_ and _W_. -*/ -foldl4(Goal, List, V0, V, W0, W, X0, X, Y0, Y) :- - foldl4_(List, Goal, V0, V, W0, W, X0, X, Y0, Y). - -foldl4_([], _, V, V, W, W, X, X, Y, Y). -foldl4_([H|T], Goal, V0, V, W0, W, X0, X, Y0, Y) :- - call(Goal, H, V0, V1, W0, W1, X0, X1, Y0, Y1), - foldl4_(T, Goal, V1, V, W1, W, X1, X, Y1, Y). - - - - /******************************* - * SCANL * - *******************************/ - -%% scanl(:Goal, +List, +V0, -Values). -%% scanl(:Goal, +List1, +List2, +V0, -Values). -%% scanl(:Goal, +List1, +List2, +List3, +V0, -Values). -%% scanl(:Goal, +List1, +List2, +List3, +List4, +V0, -Values). -% -% Left scan of list. The scanl family of higher order list -% operations is defined by: -% -% == -% scanl(P, [X11,...,X1n], ..., [Xm1,...,Xmn], V0, [V0,V1,...,Vn]) :- -% P(X11, ..., Xmn, V0, V1), -% ... -% P(X1n, ..., Xmn, V', Vn). -% == - -/** - scanl(: _Pred_, + _List_, + _V0_, ? _Values_) - - -Left scan of list. The scanl family of higher order list -operations is defined by: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog} - scanl(P, [X11,...,X1n], ..., [Xm1,...,Xmn], V0, [V0,V1,...,Vn]) :- - P(X11, ..., Xm1, V0, V1), - ... - P(X1n, ..., Xmn, Vn-1, Vn). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -scanl(Goal, List, V0, [V0|Values]) :- - scanl_(List, Goal, V0, Values). - -scanl_([], _, _, []). -scanl_([H|T], Goal, V, [VH|VT]) :- - call(Goal, H, V, VH), - scanl_(T, Goal, VH, VT). - -/** - scanl(: _Pred_, + _List1_, + _List2_, ? _V0_, ? _Vs_) - -Left scan of list. - */ -scanl(Goal, List1, List2, V0, [V0|Values]) :- - scanl_(List1, List2, Goal, V0, Values). - -scanl_([], [], _, _, []). -scanl_([H1|T1], [H2|T2], Goal, V, [VH|VT]) :- - call(Goal, H1, H2, V, VH), - scanl_(T1, T2, Goal, VH, VT). - -/** - scanl(: _Pred_, + _List1_, + _List2_, + _List3_, ? _V0_, ? _Vs_) - -Left scan of list. -*/ -scanl(Goal, List1, List2, List3, V0, [V0|Values]) :- - scanl_(List1, List2, List3, Goal, V0, Values). - -scanl_([], [], [], _, _, []). -scanl_([H1|T1], [H2|T2], [H3|T3], Goal, V, [VH|VT]) :- - call(Goal, H1, H2, H3, V, VH), - scanl_(T1, T2, T3, Goal, VH, VT). - -/** - scanl(: _Pred_, + _List1_, + _List2_, + _List3_, + _List4_, ? _V0_, ? _Vs_) - - Left scan of list. -*/ -scanl(Goal, List1, List2, List3, List4, V0, [V0|Values]) :- - scanl_(List1, List2, List3, List4, Goal, V0, Values). - -scanl_([], [], [], [], _, _, []). -scanl_([H1|T1], [H2|T2], [H3|T3], [H4|T4], Goal, V, [VH|VT]) :- - call(Goal, H1, H2, H3, H4, V, VH), - scanl_(T1, T2, T3, T4, Goal, VH, VT). - - -goal_expansion(checklist(Meta, List), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(checklist, 2, Proto, GoalName), - append(MetaVars, [List], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[]], Base), - append_args(HeadPrefix, [[In|Ins]], RecursionHead), - append_args(Pred, [In], Apply), - append_args(HeadPrefix, [Ins], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(maplist(Meta, List), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(maplist, 2, Proto, GoalName), - append(MetaVars, [List], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[]], Base), - append_args(HeadPrefix, [[In|Ins]], RecursionHead), - append_args(Pred, [In], Apply), - append_args(HeadPrefix, [Ins], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(maplist(Meta, ListIn, ListOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(maplist, 3, Proto, GoalName), - append(MetaVars, [ListIn, ListOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], []], Base), - append_args(HeadPrefix, [[In|Ins], [Out|Outs]], RecursionHead), - append_args(Pred, [In, Out], Apply), - append_args(HeadPrefix, [Ins, Outs], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(maplist(Meta, L1, L2, L3), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(maplist, 4, Proto, GoalName), - append(MetaVars, [L1, L2, L3], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], []], Base), - append_args(HeadPrefix, [[A1|A1s], [A2|A2s], [A3|A3s]], RecursionHead), - append_args(Pred, [A1, A2, A3], Apply), - append_args(HeadPrefix, [A1s, A2s, A3s], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(maplist(Meta, L1, L2, L3, L4), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(maplist, 5, Proto, GoalName), - append(MetaVars, [L1, L2, L3, L4], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], [], []], Base), - append_args(HeadPrefix, [[A1|A1s], [A2|A2s], [A3|A3s], [A4|A4s]], RecursionHead), - append_args(Pred, [A1, A2, A3, A4], Apply), - append_args(HeadPrefix, [A1s, A2s, A3s, A4s], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(selectlist(Meta, ListIn, ListOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(selectlist, 3, Proto, GoalName), - append(MetaVars, [ListIn, ListOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], []], Base), - append_args(HeadPrefix, [[In|Ins], Outs], RecursionHead), - append_args(Pred, [In], Apply), - append_args(HeadPrefix, [Ins, NOuts], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs = [In|NOuts]; Outs = NOuts), - RecursiveCall) - ], Mod). - -goal_expansion(selectlist(Meta, ListIn, ListIn1, ListOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(selectlist, 3, Proto, GoalName), - append(MetaVars, [ListIn, ListIn1, ListOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], []], Base), - append_args(HeadPrefix, [[In|Ins], [In1|Ins1], Outs], RecursionHead), - append_args(Pred, [In, In1], Apply), - append_args(HeadPrefix, [Ins, Ins1, NOuts], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs = [In|NOuts]; Outs = NOuts), - RecursiveCall) - ], Mod). - -goal_expansion(selectlists(Meta, ListIn, ListIn1, ListOut, ListOut1), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(selectlist, 4, Proto, GoalName), - append(MetaVars, [ListIn, ListIn1, ListOut, ListOut1], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], [], []], Base), - append_args(HeadPrefix, [[In|Ins], [In1|Ins1], Outs, Outs1], RecursionHead), - append_args(Pred, [In, In1], Apply), - append_args(HeadPrefix, [Ins, Ins1, NOuts, NOuts1], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs = [In|NOuts], Outs1 = [In1|NOuts1]; Outs = NOuts, Outs1 = NOuts1), - RecursiveCall) - ], Mod). - -% same as selectlist -goal_expansion(include(Meta, ListIn, ListOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(include, 3, Proto, GoalName), - append(MetaVars, [ListIn, ListOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], []], Base), - append_args(HeadPrefix, [[In|Ins], Outs], RecursionHead), - append_args(Pred, [In], Apply), - append_args(HeadPrefix, [Ins, NOuts], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs = [In|NOuts]; Outs = NOuts), - RecursiveCall) - ], Mod). - -goal_expansion(exclude(Meta, ListIn, ListOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(exclude, 3, Proto, GoalName), - append(MetaVars, [ListIn, ListOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], []], Base), - append_args(HeadPrefix, [[In|Ins], Outs], RecursionHead), - append_args(Pred, [In], Apply), - append_args(HeadPrefix, [Ins, NOuts], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs = NOuts; Outs = [In|NOuts]), - RecursiveCall) - ], Mod). - -goal_expansion(partition(Meta, ListIn, List1, List2), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(partition, 4, Proto, GoalName), - append(MetaVars, [ListIn, List1, List2], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], []], Base), - append_args(HeadPrefix, [[In|Ins], Outs1, Outs2], RecursionHead), - append_args(Pred, [In], Apply), - append_args(HeadPrefix, [Ins, NOuts1, NOuts2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs1 = [In|NOuts1], Outs2 = NOuts2; Outs1 = NOuts1, Outs2 = [In|NOuts2]), - RecursiveCall) - ], Mod). - -goal_expansion(partition(Meta, ListIn, List1, List2, List3), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(partition2, 5, Proto, GoalName), - append(MetaVars, [ListIn, List1, List2, List3], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], [], []], Base), - append_args(HeadPrefix, [[In|Ins], Outs1, Outs2, Outs3], RecursionHead), - append_args(Pred, [In,Diff], Apply), - append_args(HeadPrefix, [Ins, NOuts1, NOuts2, NOuts3], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - Apply, - (Diff == (<) -> - Outs1 = [In|NOuts1], - Outs2 = NOuts2, - Outs3 = NOuts3 - ; - Diff == (=) -> - Outs1 = NOuts1, - Outs2 = [In|NOuts2], - Outs3 = NOuts3 - ; - Diff == (>) -> - Outs1 = NOuts1, - Outs2 = NOuts2, - Outs3 = [In|NOuts3] - ; - must_be(oneof([<,=,>]), Diff) - ), - RecursiveCall) - ], Mod). - -goal_expansion(convlist(Meta, ListIn, ListOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(convlist, 3, Proto, GoalName), - append(MetaVars, [ListIn, ListOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], []], Base), - append_args(HeadPrefix, [[In|Ins], Outs], RecursionHead), - append_args(Pred, [In, Out], Apply), - append_args(HeadPrefix, [Ins, NOuts], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs = [Out|NOuts]; Outs = NOuts), - RecursiveCall) - ], Mod). - -goal_expansion(convlist(Meta, ListIn, ListExtra, ListOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(convlist, 4, Proto, GoalName), - append(MetaVars, [ListIn, ListExtra, ListOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], []], Base), - append_args(HeadPrefix, [[In|Ins], [Extra|Extras], Outs], RecursionHead), - append_args(Pred, [In, Extra, Out], Apply), - append_args(HeadPrefix, [Ins, Extras, NOuts], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - (Apply -> Outs = [Out|NOuts]; Outs = NOuts), - RecursiveCall) - ], Mod). - -goal_expansion(sumlist(Meta, List, AccIn, AccOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(sumlist, 4, Proto, GoalName), - append(MetaVars, [List, AccIn, AccOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], Acc, Acc], Base), - append_args(HeadPrefix, [[In|Ins], Acc1, Acc2], RecursionHead), - append_args(Pred, [In, Acc1, Acc3], Apply), - append_args(HeadPrefix, [Ins, Acc3, Acc2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl(Meta, List, AccIn, AccOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl, 4, Proto, GoalName), - append(MetaVars, [List, AccIn, AccOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], Acc, Acc], Base), - append_args(HeadPrefix, [[In|Ins], Acc1, Acc2], RecursionHead), - append_args(Pred, [In, Acc1, Acc3], Apply), - append_args(HeadPrefix, [Ins, Acc3, Acc2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl(Meta, List1, List2, AccIn, AccOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl, 5, Proto, GoalName), - append(MetaVars, [List1, List2, AccIn, AccOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], Acc, Acc], Base), - append_args(HeadPrefix, [[In|Ins], [I2|Is2], Acc1, Acc2], RecursionHead), - append_args(Pred, [In, I2, Acc1, Acc3], Apply), - append_args(HeadPrefix, [Ins, Is2, Acc3, Acc2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl(Meta, List1, List2, List3, AccIn, AccOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl, 6, Proto, GoalName), - append(MetaVars, [List1, List2, List3, AccIn, AccOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], [], Acc, Acc], Base), - append_args(HeadPrefix, [[In|Ins], [I2|I2s], [I3|I3s], Acc1, Acc2], RecursionHead), - append_args(Pred, [In, I2, I3, Acc1, Acc3], Apply), - append_args(HeadPrefix, [Ins, I2s, I3s, Acc3, Acc2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl2(Meta, List, AccIn, AccOut, W0, W), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl2, 6, Proto, GoalName), - append(MetaVars, [List, AccIn, AccOut, W0, W], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], Acc, Acc, W, W], Base), - append_args(HeadPrefix, [[In|Ins], Acc1, Acc2, W1, W2], RecursionHead), - append_args(Pred, [In, Acc1, Acc3, W1, W3], Apply), - append_args(HeadPrefix, [Ins, Acc3, Acc2, W3, W2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl2(Meta, List1, List2, AccIn, AccOut, W0, W), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl2, 7, Proto, GoalName), - append(MetaVars, [List1, List2, AccIn, AccOut, W0, W], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], Acc, Acc, W, W], Base), - append_args(HeadPrefix, [[In1|Ins1], [In2|Ins2], Acc1, Acc2, W1, W2], RecursionHead), - append_args(Pred, [In1, In2, Acc1, Acc3, W1, W3], Apply), - append_args(HeadPrefix, [Ins1, Ins2, Acc3, Acc2, W3, W2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl2(Meta, List1, List2, List3, AccIn, AccOut, W0, W), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl2, 7, Proto, GoalName), - append(MetaVars, [List1, List2, List3, AccIn, AccOut, W0, W], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], [], [], Acc, Acc, W, W], Base), - append_args(HeadPrefix, [[In1|Ins1], [In2|Ins2], [In3|Ins3], Acc1, Acc2, W1, W2], RecursionHead), - append_args(Pred, [In1, In2, In3, Acc1, Acc3, W1, W3], Apply), - append_args(HeadPrefix, [Ins1, Ins2, Ins3, Acc3, Acc2, W3, W2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl3(Meta, List, AccIn, AccOut, W0, W, X0, X), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl3, 8, Proto, GoalName), - append(MetaVars, [List, AccIn, AccOut, W0, W, X0, X], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], Acc, Acc, W, W, X, X], Base), - append_args(HeadPrefix, [[In|Ins], Acc1, Acc2, W1, W2, X1, X2], RecursionHead), - append_args(Pred, [In, Acc1, Acc3, W1, W3, X1, X3], Apply), - append_args(HeadPrefix, [Ins, Acc3, Acc2, W3, W2, X3, X2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(foldl4(Meta, List, AccIn, AccOut, W0, W, X0, X, Y0, Y), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(foldl4, 8, Proto, GoalName), - append(MetaVars, [List, AccIn, AccOut, W0, W, X0, X, Y0, Y], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], Acc, Acc, W, W, X, X, Y, Y], Base), - append_args(HeadPrefix, [[In|Ins], Acc1, Acc2, W1, W2, X1, X2, Y1, Y2], RecursionHead), - append_args(Pred, [In, Acc1, Acc3, W1, W3, X1, X3, Y1, Y3], Apply), - append_args(HeadPrefix, [Ins, Acc3, Acc2, W3, W2, X3, X2, Y3, Y2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- Apply, RecursiveCall) - ], Mod). - -goal_expansion(mapnodes(Meta, InTerm, OutTerm), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(mapnodes, 3, Proto, GoalName), - append(MetaVars, [[InTerm], [OutTerm]], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], []], Base), - append_args(HeadPrefix, [[In|Ins], [Out|Outs]], RecursionHead), - append_args(Pred, [In, Temp], Apply), - append_args(HeadPrefix, [InArgs, OutArgs], SubRecursiveCall), - append_args(HeadPrefix, [Ins, Outs], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - Apply, - (compound(Temp) - -> - Temp =.. [F|InArgs], - SubRecursiveCall, - Out =.. [F|OutArgs] - ; - Out = Temp - ), - RecursiveCall) - ], Mod). - -goal_expansion(checknodes(Meta, Term), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(checknodes, 2, Proto, GoalName), - append(MetaVars, [[Term]], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[]], Base), - append_args(HeadPrefix, [[In|Ins]], RecursionHead), - append_args(Pred, [In], Apply), - append_args(HeadPrefix, [Args], SubRecursiveCall), - append_args(HeadPrefix, [Ins], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - Apply, - (compound(In) - -> - In =.. [_|Args],SubRecursiveCall - ; - true - ), - RecursiveCall) - ], Mod). - -goal_expansion(sumnodes(Meta, Term, AccIn, AccOut), Mod:Goal) :- - goal_expansion_allowed, - callable(Meta), - prolog_load_context(module, Mod), - aux_preds(Meta, MetaVars, Pred, PredVars, Proto), - !, - % the new goal - pred_name(sumnodes, 4, Proto, GoalName), - append(MetaVars, [[Term], AccIn, AccOut], GoalArgs), - Goal =.. [GoalName|GoalArgs], - % the new predicate declaration - HeadPrefix =.. [GoalName|PredVars], - append_args(HeadPrefix, [[], Acc, Acc], Base), - append_args(HeadPrefix, [[In|Ins], Acc1, Acc2], RecursionHead), - append_args(Pred, [In, Acc1, Acc3], Apply), - append_args(HeadPrefix, [Args, Acc3, Acc4], SubRecursiveCall), - append_args(HeadPrefix, [Ins, Acc4, Acc2], RecursiveCall), - compile_aux([ - Base, - (RecursionHead :- - Apply, - (compound(In) - -> - In =.. [_|Args],SubRecursiveCall - ; - Acc3 = Acc4 - ), - RecursiveCall) - ], Mod). - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/maputils.yap b/packages/python/swig/yap4py/prolog/maputils.yap deleted file mode 100644 index ba5cb6bc4..000000000 --- a/packages/python/swig/yap4py/prolog/maputils.yap +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @file maputils.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 22:48:58 2015 - * - * @brief Auxiliary routines for map... libraries - * - * -*/ -%%%%%%%%%%%%%%%%%%%% -% map utilities -%%%%%%%%%%%%%%%%%%%% - -:- module(maputils, - [compile_aux/2, - goal_expansion_allowed/0, - pred_name/4, - aux_preds/5, - append_args/3]). - -/** -* @addtogroup maplist - * - * Auxiliary routines - * - *@{ -*/ -:- use_module(library(lists), [append/3]). - -:- dynamic number_of_expansions/1. - -number_of_expansions(0). - -% -% compile auxiliary routines for term expansion -% -compile_aux([Clause|Clauses], Module) :- - % compile the predicate declaration if needed - ( Clause = (Head :- _) - ; Clause = Head ), - !, - functor(Head, F, N), - ( current_predicate(Module:F/N) - -> - true - ; -% format("*** Creating auxiliary predicate ~q~n", [F/N]), -% checklist(portray_clause, [Clause|Clauses]), - compile_term([Clause|Clauses], Module) - ). - -compile_term([], _). -compile_term([Clause|Clauses], Module) :- - assert_static(Module:Clause), - compile_term(Clauses, Module). - -append_args(Term, Args, NewTerm) :- - Term =.. [Meta|OldArgs], - append(OldArgs, Args, GoalArgs), - NewTerm =.. [Meta|GoalArgs]. - -aux_preds(Meta, _, _, _, _) :- - var(Meta), !, - fail. -aux_preds(_:Meta, MetaVars, Pred, PredVars, Proto) :- !, - aux_preds(Meta, MetaVars, Pred, PredVars, Proto). -aux_preds(Meta, MetaVars, Pred, PredVars, Proto) :- - Meta =.. [F|Args], - aux_args(Args, MetaVars, PredArgs, PredVars, ProtoArgs), - Pred =.. [F|PredArgs], - Proto =.. [F|ProtoArgs]. - -aux_args([], [], [], [], []). -aux_args([Arg|Args], MVars, [Arg|PArgs], PVars, [Arg|ProtoArgs]) :- - ground(Arg), !, - aux_args(Args, MVars, PArgs, PVars, ProtoArgs). -aux_args([Arg|Args], [Arg|MVars], [PVar|PArgs], [PVar|PVars], ['_'|ProtoArgs]) :- - aux_args(Args, MVars, PArgs, PVars, ProtoArgs). - -pred_name(Macro, Arity, _ , Name) :- - prolog_load_context(file, FullFileName), - file_base_name( FullFileName, File ), - prolog_load_context(term_position, Pos), - stream_position_data( line_count, Pos, Line ), !, - transformation_id(Id), - atomic_concat(['$$$ for ',Macro,'/',Arity,', line ',Line,' in ',File,' ',Id], Name). -pred_name(Macro, Arity, _ , Name) :- - transformation_id(Id), - atomic_concat(['$$$__expansion__ for ',Macro,'/',Arity,' ',Id], Name). - -transformation_id(Id) :- - retract(number_of_expansions(Id)), - Id1 is Id+1, - assert(number_of_expansions(Id1)). - -%% goal_expansion_allowed is semidet. -% -% `True` if we can use -% goal-expansion. -goal_expansion_allowed :- - once( prolog_load_context(_, _) ), % make sure we are compiling. - \+ current_prolog_flag(xref, true). - -/** - @} -*/ diff --git a/packages/python/swig/yap4py/prolog/matlab.yap b/packages/python/swig/yap4py/prolog/matlab.yap deleted file mode 100644 index b7a64dcb0..000000000 --- a/packages/python/swig/yap4py/prolog/matlab.yap +++ /dev/null @@ -1,328 +0,0 @@ -/** - * @file matlab.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 22:51:48 2015 - * - * @brief YAP Matlab interface. - * - * -*/ - - -:- module(matlab, - [start_matlab/1, - close_matlab/0, - matlab_on/0, - matlab_eval_string/1, - matlab_eval_string/2, - matlab_cells/2, - matlab_cells/3, - matlab_initialized_cells/4, - matlab_zeros/2, - matlab_zeros/3, - matlab_zeros/4, - matlab_matrix/4, - matlab_vector/2, - matlab_vector/3, - matlab_set/4, - matlab_get_variable/2, - matlab_item/3, - matlab_item/4, - matlab_item1/3, - matlab_item1/4, - matlab_sequence/3, - matlab_call/2]). - -/** @defgroup matlab MATLAB Package Interface -@ingroup library -@{ - -The MathWorks MATLAB is a widely used package for array -processing. YAP now includes a straightforward interface to MATLAB. To -actually use it, you need to install YAP calling `configure` with -the `--with-matlab=DIR` option, and you need to call -`use_module(library(lists))` command. - -Accessing the matlab dynamic libraries can be complicated. In Linux -machines, to use this interface, you may have to set the environment -variable LD_LIBRARY_PATH. Next, follows an example using bash in a -64-bit Linux PC: - -~~~~~ -export LD_LIBRARY_PATH=''$MATLAB_HOME"/sys/os/glnxa64:''$MATLAB_HOME"/bin/glnxa64:''$LD_LIBRARY_PATH" -~~~~~ -where `MATLAB_HOME` is the directory where matlab is installed -at. Please replace `ax64` for `x86` on a 32-bit PC. - -*/ - -/* - - @pred start_matlab(+ _Options_) - - -Start a matlab session. The argument _Options_ may either be the -empty string/atom or the command to call matlab. The command may fail. - - -*/ - -/** @pred close_matlab - - -Stop the current matlab session. - - -*/ -/** @pred matlab_cells(+ _SizeX_, + _SizeY_, ? _Array_) - -MATLAB will create an empty array of cells of size _SizeX_ and - _SizeY_, and if _Array_ is bound to an atom, store the array -in the matlab variable with name _Array_. Corresponds to the -MATLAB command `cells`. - - -*/ -/** @pred matlab_cells(+ _Size_, ? _Array_) - - -MATLAB will create an empty vector of cells of size _Size_, and if - _Array_ is bound to an atom, store the array in the matlab -variable with name _Array_. Corresponds to the MATLAB command `cells`. - - -*/ -/** @pred matlab_eval_string(+ _Command_) - - -Holds if matlab evaluated successfully the command _Command_. - - -*/ -/** @pred matlab_eval_string(+ _Command_, - _Answer_) - -MATLAB will evaluate the command _Command_ and unify _Answer_ -with a string reporting the result. - - -*/ -/** @pred matlab_get_variable(+ _MatVar_, - _List_) - - -Unify MATLAB variable _MatVar_ with the List _List_. - - -*/ -/** @pred matlab_initialized_cells(+ _SizeX_, + _SizeY_, + _List_, ? _Array_) - - -MATLAB will create an array of cells of size _SizeX_ and - _SizeY_, initialized from the list _List_, and if _Array_ -is bound to an atom, store the array in the matlab variable with name - _Array_. - - -*/ -/** @pred matlab_item(+ _MatVar_, + _X_, + _Y_, ? _Val_) - -Read or set MATLAB _MatVar_( _X_, _Y_) from/to _Val_. Use -`C` notation for matrix access (ie, starting from 0). - - -*/ -/** @pred matlab_item(+ _MatVar_, + _X_, ? _Val_) - - -Read or set MATLAB _MatVar_( _X_) from/to _Val_. Use -`C` notation for matrix access (ie, starting from 0). - - -*/ -/** @pred matlab_item1(+ _MatVar_, + _X_, + _Y_, ? _Val_) - -Read or set MATLAB _MatVar_( _X_, _Y_) from/to _Val_. Use -MATLAB notation for matrix access (ie, starting from 1). - - -*/ -/** @pred matlab_item1(+ _MatVar_, + _X_, ? _Val_) - - -Read or set MATLAB _MatVar_( _X_) from/to _Val_. Use -MATLAB notation for matrix access (ie, starting from 1). - - -*/ -/** @pred matlab_matrix(+ _SizeX_, + _SizeY_, + _List_, ? _Array_) - - -MATLAB will create an array of floats of size _SizeX_ and _SizeY_, -initialized from the list _List_, and if _Array_ is bound to -an atom, store the array in the matlab variable with name _Array_. - - -*/ -/** @pred matlab_on - - -Holds if a matlab session is on. - - -*/ -/** @pred matlab_sequence(+ _Min_, + _Max_, ? _Array_) - - -MATLAB will create a sequence going from _Min_ to _Max_, and -if _Array_ is bound to an atom, store the sequence in the matlab -variable with name _Array_. - - -*/ -/** @pred matlab_set(+ _MatVar_, + _X_, + _Y_, + _Value_) - - -Call MATLAB to set element _MatVar_( _X_, _Y_) to - _Value_. Notice that this command uses the MATLAB array access -convention. - - -*/ -/** @pred matlab_vector(+ _Size_, + _List_, ? _Array_) - - -MATLAB will create a vector of floats of size _Size_, initialized -from the list _List_, and if _Array_ is bound to an atom, -store the array in the matlab variable with name _Array_. - - -*/ -/** @pred matlab_zeros(+ _SizeX_, + _SizeY_, + _SizeZ_, ? _Array_) - -MATLAB will create an array of zeros of size _SizeX_, _SizeY_, -and _SizeZ_. If _Array_ is bound to an atom, store the array -in the matlab variable with name _Array_. Corresponds to the -MATLAB command `zeros`. - - - - - */ -/** @pred matlab_zeros(+ _SizeX_, + _SizeY_, ? _Array_) - -MATLAB will create an array of zeros of size _SizeX_ and - _SizeY_, and if _Array_ is bound to an atom, store the array -in the matlab variable with name _Array_. Corresponds to the -MATLAB command `zeros`. - - -*/ -/** @pred matlab_zeros(+ _Size_, ? _Array_) - - -MATLAB will create a vector of zeros of size _Size_, and if - _Array_ is bound to an atom, store the array in the matlab -variable with name _Array_. Corresponds to the MATLAB command -`zeros`. - - -*/ - -:- ensure_loaded(library(lists)). - -tell_warning :- - print_message(warning,functionality(matlab)). - -:- ( catch(load_foreign_files([matlab], ['eng','mx','ut'], init_matlab),_,fail) -> true ; tell_warning). - -matlab_eval_sequence(S) :- - atomic_concat(S,S1), - matlab_eval_string(S1). - -matlab_eval_sequence(S,O) :- - atomic_concat(S,S1), - matlab_eval_string(S1,O). - -matlab_vector( Vec, L) :- - length(Vec, LV), - matlab_vector(LV, Vec, L). - -matlab_sequence(Min,Max,L) :- - mksequence(Min,Max,Vector), - Dim is (Max-Min)+1, - matlab_matrix(1,Dim,Vector,L). - -mksequence(Min,Min,[Min]) :- !. -mksequence(Min,Max,[Min|Vector]) :- - Min1 is Min+1, - mksequence(Min1,Max,Vector). - -matlab_call(S,Out) :- - S=..[Func|Args], - build_args(Args,L0,[]), - process_arg_entry(L0,L), - build_output(Out,Lf,['= ',Func|L]), - atomic_concat(Lf,Command), - matlab_eval_string(Command). - -matlab_call(S,Out,Result) :- - S=..[Func|Args], - build_args(Args,L0,[]), - process_arg_entry(L0,L), - build_output(Out,Lf,[' = ',Func|L]), - atomic_concat(Lf,Command), - matlab_eval_string(Command,Result). - -build_output(Out,['[ '|L],L0) :- - is_list(Out), !, - build_outputs(Out,L,[']'|L0]). -build_output(Out,Lf,L0) :- - build_arg(Out,Lf,L0). - -build_outputs([],L,L). -build_outputs([Out|Outs],[Out,' '|L],L0) :- - build_outputs(Outs,L,L0). - -build_args([],L,L). -build_args([Arg],Lf,L0) :- !, - build_arg(Arg,Lf,[')'|L0]). -build_args([Arg|Args],L,L0) :- - build_arg(Arg,L,[', '|L1]), - build_args(Args,L1,L0). - -build_arg(V,_,_) :- var(V), !, - throw(error(instantiation_error)). -build_arg(Arg,[Arg|L],L) :- atomic(Arg), !. -build_arg(\S0,['\'',S0,'\''|L],L) :- - atom(S0), !. -build_arg([S1|S2],['['|L],L0) :- - is_list(S2), !, - build_arglist([S1|S2],L,L0). -build_arg([S1|S2],L,L0) :- !, - build_arg(S1,L,['.'|L1]), - build_arg(S2,L1,L0). -build_arg(S1:S2,L,L0) :- !, - build_arg(S1,L,[':'|L1]), - build_arg(S2,L1,L0). -build_arg(F,[N,'{'|L],L0) :- %N({A}) = N{A} - F=..[N,{A}], !, - build_arg(A,L,['}'|L0]). -build_arg(F,[N,'('|L],L0) :- - F=..[N|As], - build_args(As,L,L0). - -build_arglist([A],L,L0) :- !, - build_arg(A,L,[' ]'|L0]). -build_arglist([A|As],L,L0) :- - build_arg(A,L,[' ,'|L1]), - build_arglist(As,L1,L0). - -build_string([],['\''|L],L). -build_string([S0|S],[C|Lf],L0) :- - char_code(C,S0), - build_string(S,Lf,L0). - - -process_arg_entry([],[]) :- !. -process_arg_entry(L,['('|L]). -/** @} */ - diff --git a/packages/python/swig/yap4py/prolog/matrix.yap b/packages/python/swig/yap4py/prolog/matrix.yap deleted file mode 100644 index 9de723e8f..000000000 --- a/packages/python/swig/yap4py/prolog/matrix.yap +++ /dev/null @@ -1,1403 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2006 * -* * -************************************************************************** -* * -* File: matrix.yap * -* Last rev: * -* mods: * -* comments: Have some fun with blobs * -* * -*************************************************************************/ -/** - * @file matrix.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 22:53:40 2015 - * - * @brief Vector, Array and Matrix library - * - * -*/ - -:- module( matrix, - [(<==)/2, op(800, xfx, <==), - (+=)/2, op(800, xfx, +=), - (-=)/2, op(800, xfx, -=), - op(700, xfx, in), - op(700, xfx, ins), - op(450, xfx, ..), % should bind more tightly than \/ - op(710, xfx, of), of/2, - matrix_new/3, - matrix_new/4, - matrix_new_set/4, - matrix_dims/2, - matrix_ndims/2, - matrix_size/2, - matrix_type/2, - matrix_to_list/2, - matrix_to_lists/2, - matrix_get/3, - matrix_set/3, - matrix_set_all/2, - matrix_add/3, - matrix_inc/2, - matrix_dec/2, - matrix_mult/2, - matrix_inc/3, - matrix_dec/3, - matrix_arg_to_offset/3, - matrix_offset_to_arg/3, - matrix_max/2, - matrix_maxarg/2, - matrix_min/2, - matrix_minarg/2, - matrix_sum/2, - matrix_sum_out/3, - matrix_sum_out_several/3, - matrix_sum_logs_out/3, - matrix_sum_logs_out_several/3, - matrix_add_to_all/2, - matrix_agg_lines/3, - matrix_agg_cols/3, - matrix_to_logs/1, - matrix_to_exps/1, - matrix_to_exps2/1, - matrix_to_logs/2, - matrix_to_exps/2, - matrix_op/4, - matrix_op_to_all/4, - matrix_op_to_lines/4, - matrix_op_to_cols/4, - matrix_shuffle/3, - matrix_transpose/2, - matrix_set_all_that_disagree/5, - matrix_expand/3, - matrix_select/4, - matrix_column/3, - matrix_get/2, - matrix_set/2, - foreach/2, - foreach/4, - op(50, yf, []), - op(50, yf, '()'), - op(100, xfy, '.'), - op(100, fy, '.') - ]). - -/** @defgroup matrix Matrix Library -@ingroup library -@{ - -This package provides a fast implementation of multi-dimensional -matrices of integers and floats. In contrast to dynamic arrays, these -matrices are multi-dimensional and compact. In contrast to static -arrays. these arrays are allocated in the stack, and disppear in -backtracking. Matrices are available by loading the library -`library(matrix)`. They are multimensional objects of type: - - + terms: Prolog terms - -+ ints: bounded integers, represented as an opaque term. The -maximum integer depends on hardware, but should be obtained from the -natural size of the machine. - -+ floats: floating-point numbers, represented as an opaque term. - -Matrix elements can be accessed through the `matrix_get/2` -predicate or through an R-inspired access notation (that uses the ciao -style extension to `[]`). Examples include: - - - + Access the second row, third column of matrix X. Indices start from -`0`, -~~~~ - _E_ <== _X_[2,3] -~~~~ - -+ Access all the second row, the output is a list ofe elements. -~~~~ - _L_ <== _X_[2,_] -~~~~ - -+ Access all the second, thrd and fourth rows, the output is a list of elements. -~~~~ - _L_ <== _X_[2..4,_] -~~~~ - -+ Access all the fifth, sixth and eight rows, the output is a list of elements. -~~~~ - _L_ <== _X_[2..4+3,_] -~~~~ - -The matrix library also supports a B-Prolog/ECliPSe inspired `foreach`iterator to iterate over -elements of a matrix: - -+ Copy a vector, element by element. - -~~~~ - foreach(I in 0..N1, X[I] <== Y[I]) -~~~~ - -+ The lower-triangular matrix _Z_ is the difference between the -lower-triangular and upper-triangular parts of _X_. - -~~~~ - foreach([I in 0..N1, J in I..N1], Z[I,J] <== X[I,J] - X[I,J]) -~~~~ - -+ Add all elements of a matrix by using _Sum_ as an accumulator. - -~~~~ - foreach([I in 0..N1, J in 0..N1], plus(X[I,J]), 0, Sum) -~~~~ - - Notice that the library does not support all known matrix operations. Please -contact the YAP maintainers if you require extra functionality. - - - -+ _X_ <== array[ _Dim1_,..., _Dimn_] of _Objects_ - The of/2 operator can be used to create a new array of - _Objects_. The objects supported are: - - + `Unbound Variable` - create an array of free variables - + `ints ` - create an array of integers - + `floats ` - create an array of floating-point numbers - + `_I_: _J_` - create an array with integers from _I_ to _J_ - + `[..]` - create an array from the values in a list - -The dimensions can be given as an integer, and the matrix will be -indexed `C`-style from `0..( _Max_-1)`, or can be given -as an interval ` _Base_.. _Limit_`. In the latter case, -matrices of integers and of floating-point numbers should have the same - _Base_ on every dimension. - - -*/ - - -/* - A matrix is an object with integer or floating point numbers. A matrix - may have a number of dimensions. These routines implement a number of - routine manipulation procedures. - - '$matrix'(Type,D1,D2,...,Dn,data(......)) - - Type = int, float - - Operations: - -typedef enum { - MAT_SUM=0, - MAT_SUB=1, - MAT_TIMES=2, - MAT_DIV=3, - MAT_IDIV=4, - MAT_ZDIV=5 -} op_type; - - */ - -/** @pred ?_LHS_ <== ?_RHS_ is semidet - - -General matrix assignment operation. It evaluates the right-hand side - according to the -left-hand side and to the matrix: - -+ if _LHS_ is part of an integer or floating-point matrix, -perform non-backtrackable assignment. -+ other unify left-hand side and right-hand size. - - -The right-hand side supports the following operators: - -+ `[]/2` - - written as _M_[ _Offset_]: obtain an element or list of elements -of matrix _M_ at offset _Offset_. - -+ `matrix/1` - - create a vector from a list - -+ `matrix/2` - - create a matrix from a list. Options are: - + dim= - a list of dimensions - - + type= - integers, floating-point or terms - - + base= - a list of base offsets per dimension (all must be the same for arrays of -integers and floating-points - -+ `matrix/3` - - create matrix giving two options - -+ `dim/1` - list with matrix dimensions - -+ `nrow/1` - number of rows in bi-dimensional matrix - -+ `ncol/1` - number of columns in bi-dimensional matrix - -+ `length/1` - size of a matrix - -+ `size/1` - size of a matrix - -+ `max/1` - - maximum element of a numeric matrix - -+ `maxarg/1` - - argument of maximum element of a numeric matrix - -+ `min/1` - - minimum element of a numeric matrix - -+ `minarg/1` - - argument of minimum element of a numeric matrix - -+ `list/1` - - represent matrix as a list - -+ `lists/2` - - represent matrix as list of embedded lists - -+ `../2` - - _I_.. _J_ generates a list with all integers from _I_ to - _J_, included. - -+ `+/2` - - add two numbers, add two matrices element-by-element, or add a number to -all elements of a matrix or list. - -+ `-/2 ` - - subtract two numbers, subtract two matrices or lists element-by-element, or subtract a number from -all elements of a matrix or list - -+ `* /2` - - multiply two numbers, multiply two matrices or lists - element-by-element, or multiply a number from all elements of a - matrix or list - - + `log/1` - - natural logarithm of a number, matrix or list - -+ `exp/1 ` - - natural exponentiation of a number, matrix or list - -*/ -/** @pred matrix_add(+ _Matrix_,+ _Position_,+ _Operand_) - - - - Add _Operand_ to the element of _Matrix_ at position - _Position_. - - -*/ -/** @pred matrix_agg_cols(+ _Matrix_,+Operator,+ _Aggregate_) - - - -If _Matrix_ is a n-dimensional matrix, unify _Aggregate_ with -the one dimensional matrix where each element is obtained by adding all -Matrix elements with same first index. Currently, only addition is supported. - - -*/ -/** @pred matrix_agg_lines(+ _Matrix_,+Operator,+ _Aggregate_) - - - -If _Matrix_ is a n-dimensional matrix, unify _Aggregate_ with -the n-1 dimensional matrix where each element is obtained by adding all -_Matrix_ elements with same last n-1 index. Currently, only addition is supported. - - -*/ -/** @pred matrix_arg_to_offset(+ _Matrix_,+ _Position_,- _Offset_) - - - -Given matrix _Matrix_ return what is the numerical _Offset_ of -the element at _Position_. - - -*/ -/** @pred matrix_column(+ _Matrix_,+ _Column_,- _NewMatrix_) - - - -Select from _Matrix_ the column matching _Column_ as new matrix _NewMatrix_. _Column_ must have one less dimension than the original matrix. - - - - */ -/** @pred matrix_dec(+ _Matrix_,+ _Position_) - - - -Decrement the element of _Matrix_ at position _Position_. - - -*/ -/** @pred matrix_dec(+ _Matrix_,+ _Position_,- _Element_) - - -Decrement the element of _Matrix_ at position _Position_ and -unify with _Element_. - - -*/ -/** @pred matrix_dims(+ _Matrix_,- _Dims_) - - - -Unify _Dims_ with a list of dimensions for _Matrix_. - - -*/ -/** @pred matrix_expand(+ _Matrix_,+ _NewDimensions_,- _New_) - - - -Expand _Matrix_ to occupy new dimensions. The elements in - _NewDimensions_ are either 0, for an existing dimension, or a -positive integer with the size of the new dimension. - - -*/ -/** @pred matrix_get(+ _Matrix_,+ _Position_,- _Elem_) - - - -Unify _Elem_ with the element of _Matrix_ at position - _Position_. - - -*/ -/** @pred matrix_get(+ _Matrix_[+ _Position_],- _Elem_) - - -Unify _Elem_ with the element _Matrix_[ _Position_]. - - -*/ -/** @pred matrix_inc(+ _Matrix_,+ _Position_) - - - -Increment the element of _Matrix_ at position _Position_. - - -*/ -/** @pred matrix_inc(+ _Matrix_,+ _Position_,- _Element_) - - -Increment the element of _Matrix_ at position _Position_ and -unify with _Element_. - - -*/ -/** @pred matrix_max(+ _Matrix_,+ _Max_) - - - -Unify _Max_ with the maximum in matrix _Matrix_. - - -*/ -/** @pred matrix_maxarg(+ _Matrix_,+ _Maxarg_) - - - -Unify _Max_ with the position of the maximum in matrix _Matrix_. - - -*/ -/** @pred matrix_min(+ _Matrix_,+ _Min_) - - - -Unify _Min_ with the minimum in matrix _Matrix_. - - -*/ -/** @pred matrix_minarg(+ _Matrix_,+ _Minarg_) - - - -Unify _Min_ with the position of the minimum in matrix _Matrix_. - - -*/ -/** @pred matrix_ndims(+ _Matrix_,- _Dims_) - - - -Unify _NDims_ with the number of dimensions for _Matrix_. - - -*/ -/** @pred matrix_new(+ _Type_,+ _Dims_,+ _List_,- _Matrix_) - - -Create a new matrix _Matrix_ of type _Type_, which may be one of -`ints` or `floats`, with dimensions _Dims_, and -initialized from list _List_. - - -*/ -/** @pred matrix_new(+ _Type_,+ _Dims_,- _Matrix_) - - - -Create a new matrix _Matrix_ of type _Type_, which may be one of -`ints` or `floats`, and with a list of dimensions _Dims_. -The matrix will be initialized to zeros. - -~~~~~ -?- matrix_new(ints,[2,3],Matrix). - -Matrix = {..} -~~~~~ -Notice that currently YAP will always write a matrix of numbers as `{..}`. - - -*/ -/** @pred matrix_new_set(? _Dims_,+ _OldMatrix_,+ _Value_,- _NewMatrix_) - - - -Create a new matrix _NewMatrix_ of type _Type_, with dimensions - _Dims_. The elements of _NewMatrix_ are set to _Value_. - - -*/ -/** @pred matrix_offset_to_arg(+ _Matrix_,- _Offset_,+ _Position_) - - - -Given a position _Position _ for matrix _Matrix_ return the -corresponding numerical _Offset_ from the beginning of the matrix. - - -*/ -/** @pred matrix_op(+ _Matrix1_,+ _Matrix2_,+ _Op_,- _Result_) - - - - _Result_ is the result of applying _Op_ to matrix _Matrix1_ -and _Matrix2_. Currently, only addition (`+`) is supported. - - -*/ -/** @pred matrix_op_to_all(+ _Matrix1_,+ _Op_,+ _Operand_,- _Result_) - - - - _Result_ is the result of applying _Op_ to all elements of - _Matrix1_, with _Operand_ as the second argument. Currently, -only addition (`+`), multiplication (`\*`), and division -(`/`) are supported. - - -*/ -/** @pred matrix_op_to_cols(+ _Matrix1_,+ _Cols_,+ _Op_,- _Result_) - - - - _Result_ is the result of applying _Op_ to all elements of - _Matrix1_, with the corresponding element in _Cols_ as the -second argument. Currently, only addition (`+`) is -supported. Notice that _Cols_ will have n-1 dimensions. - - -*/ -/** @pred matrix_op_to_lines(+ _Matrix1_,+ _Lines_,+ _Op_,- _Result_) - - - - _Result_ is the result of applying _Op_ to all elements of - _Matrix1_, with the corresponding element in _Lines_ as the -second argument. Currently, only division (`/`) is supported. - - -*/ -/** @pred matrix_select(+ _Matrix_,+ _Dimension_,+ _Index_,- _New_) - - - -Select from _Matrix_ the elements who have _Index_ at - _Dimension_. - - -*/ -/** @pred matrix_set(+ _Matrix_,+ _Position_,+ _Elem_) - - - -Set the element of _Matrix_ at position - _Position_ to _Elem_. - - -*/ -/** @pred matrix_set(+ _Matrix_[+ _Position_],+ _Elem_) - - -Set the element of _Matrix_[ _Position_] to _Elem_. - - -*/ -/** @pred matrix_set_all(+ _Matrix_,+ _Elem_) - - - -Set all element of _Matrix_ to _Elem_. - - -*/ -/** @pred matrix_shuffle(+ _Matrix_,+ _NewOrder_,- _Shuffle_) - - - -Shuffle the dimensions of matrix _Matrix_ according to - _NewOrder_. The list _NewOrder_ must have all the dimensions of - _Matrix_, starting from 0. - - -*/ -/** @pred matrix_size(+ _Matrix_,- _NElems_) - - - -Unify _NElems_ with the number of elements for _Matrix_. - - -*/ -/** @pred matrix_sum(+ _Matrix_,+ _Sum_) - - - -Unify _Sum_ with the sum of all elements in matrix _Matrix_. - - -*/ -/** @pred matrix_to_list(+ _Matrix_,- _Elems_) - - - -Unify _Elems_ with the list including all the elements in _Matrix_. - - -*/ -/** @pred matrix_transpose(+ _Matrix_,- _Transpose_) - - - -Transpose matrix _Matrix_ to _Transpose_. Equivalent to: - -~~~~~ -matrix_transpose(Matrix,Transpose) :- - matrix_shuffle(Matrix,[1,0],Transpose). -~~~~~ - - -*/ -/** @pred matrix_type(+ _Matrix_,- _Type_) - - - -Unify _NElems_ with the type of the elements in _Matrix_. - - -*/ - -:- load_foreign_files([matrix], [], init_matrix). - -:- multifile rhs_opaque/1, array_extension/2. - -:- meta_predicate foreach(+,0), foreach(+,2, +, -). - -:- use_module(library(maplist)). -:- use_module(library(mapargs)). -:- use_module(library(lists)). - -( X <== '[]'(Dims0, array) of V ) :- - var(V), !, - foldl( norm_dim, Dims0, Dims, Bases, 1, Size ), - length( L, Size ), - X <== matrix( L, [dim=Dims,base=Bases] ). -( X <== '[]'(Dims0, array) of ints ) :- !, - foldl( norm_dim, Dims0, Dims, Bases, 1, _Size ), - matrix_new( ints , Dims, X ), - matrix_base(X, Bases). -( X <== '[]'(Dims0, array) of floats ) :- !, - foldl( norm_dim, Dims0, Dims, Bases, 1, _Size ), - matrix_new( floats , Dims, X ), - matrix_base(X, Bases). -( X <== '[]'(Dims0, array) of (I:J) ) :- !, - foldl( norm_dim, Dims0, Dims, Bases, 1, Size ), - matrix_seq(I, J, Dims, X), - matrixn_size(X, Size), - matrix_base(X, Bases). -( X <== '[]'(Dims0, array) of L ) :- - length( L, Size ), !, - foldl( norm_dim, Dims0, Dims, Bases, 1, Size ), - X <== matrix( L, [dim=Dims,base=Bases] ). -( X <== '[]'(Dims0, array) of Pattern ) :- !, - array_extension(Pattern, Goal), - foldl( norm_dim, Dims0, Dims, Bases, 1, Size ), - call(Goal, Pattern, Dims, Size, L), - X <== matrix( L, [dim=Dims,base=Bases] ). -( LHS <== RHS ) :- - rhs(RHS, R), - set_lhs( LHS, R). - - - -norm_dim( I..J, D, I, P0, P) :- !, - D is J+1-I, - P is P0*D. -norm_dim( I, I, 0, P0, P ) :- - P is P0*I. - - -rhs(RHS, RHS) :- var(RHS), !. -% base case -rhs(A, A) :- atom(A), !. -rhs(RHS, RHS) :- number(RHS), !. -rhs(RHS, RHS) :- opaque(RHS), !. -rhs(RHS, RHS) :- RHS = '$matrix'(_, _, _, _, _), !. -rhs(matrix(List), RHS) :- !, - rhs( List, A1), - new_matrix(A1, [], RHS). -rhs(matrix(List, Opt1), RHS) :- !, - rhs( List, A1), - new_matrix(A1, Opt1, RHS). -rhs(matrix(List, Opt1, Opt2), RHS) :- !, - rhs( List, A1), - new_matrix(A1, [Opt1, Opt2], RHS). -rhs(dim(RHS), Dims) :- !, - rhs(RHS, X1), - matrix_dims( X1, Dims ). -rhs(dims(RHS), Dims) :- !, - rhs(RHS, X1), - matrix_dims( X1, Dims ). -rhs(nrow(RHS), NRow) :- !, - rhs(RHS, X1), - matrix_dims( X1, [NRow,_] ). -rhs(ncol(RHS), NCol) :- !, - rhs(RHS, X1), - matrix_dims( X1, [_,NCol] ). -rhs(length(RHS), Size) :- !, - rhs(RHS, X1), - matrix_size( X1, Size ). -rhs(size(RHS), Size) :- !, - rhs(RHS, X1), - matrix_size( X1, Size ). -rhs(max(RHS), Size) :- !, - rhs(RHS, X1), - matrix_max( X1, Size ). -rhs(min(RHS), Size) :- !, - rhs(RHS, X1), - matrix_min( X1, Size ). -rhs(maxarg(RHS), Size) :- !, - rhs(RHS, X1), - matrix_maxarg( X1, Size ). -rhs(minarg(RHS), Size) :- !, - rhs(RHS, X1), - matrix_minarg( X1, Size ). -rhs(list(RHS), List) :- !, - rhs(RHS, X1), - matrix_to_list( X1, List ). -rhs(lists(RHS), List) :- !, - rhs(RHS, X1), - matrix_to_lists( X1, List ). -rhs('[]'(Args, RHS), Val) :- - !, - rhs(RHS, X1), - matrix_dims( X1, Dims, Bases), - maplist( index(Range), Args, Dims, Bases, NArgs), - ( - var(Range) - -> - matrix_get( X1, NArgs, Val ) - ; - matrix_get_range( X1, NArgs, Val ) - ). -rhs('..'(I, J), [I1|Is]) :- !, - rhs(I, I1), - rhs(J, J1), - once( foldl(inc, Is, I1, J1) ). -rhs([H|T], [NH|NT]) :- !, - rhs(H, NH), - rhs(T, NT). -rhs(log(RHS), Logs ) :- !, - rhs(RHS, X1), - matrix_to_logs( X1, Logs ). -rhs(exp(RHS), Logs ) :- !, - rhs(RHS, X1), - matrix_to_exps( X1, Logs ). -rhs(S, NS) :- - rhs_opaque( S ), !, - S = NS. -rhs(E1+E2, V) :- !, - rhs(E1, R1), - rhs(E2, R2), - mplus(R1, R2, V). -rhs(E1-E2, V) :- !, - rhs(E1, R1), - rhs(E2, R2), - msub(R1, R2, V). -rhs(S, NS) :- - S =.. [N|As], - maplist(rhs, As, Bs), - NS =.. [N|Bs]. - -set_lhs(V, R) :- var(V), !, V = R. -set_lhs(V, R) :- number(V), !, V = R. -set_lhs('[]'(Args, M), Val) :- - matrix_dims( M, Dims, Bases), - maplist( index(Range), Args, Dims, Bases, NArgs), - ( - var(Range) - -> - matrix_set( M, NArgs, Val ) - ; - matrix_set_range( M, NArgs, Val ) - ). - -% -% ranges of arguments -% -index(Range, V, M, Base, Indx) :- var(V), !, - Max is (M-1)+Base, - index(Range, Base..Max, M, Base, Indx). -index(Range, '*', M, Base, Indx) :- !, - Max is (M-1)+Base, - index(Range, Base..Max, M, Base, Indx). -index(Range, Exp, M, _Base, Indx) :- !, - index(Exp, M, Indx0), - ( integer(Indx0) -> Indx = Indx0 ; - Indx0 = [Indx] -> true ; - Indx0 = Indx, Range = range ). - -index(I, _M, I ) :- integer(I), !. -index(I..J, _M, [I|O] ) :- !, - I1 is I, J1 is J, - once( foldl(inc, O, I1, J1) ). -index(I:J, _M, [I|O] ) :- !, - I1 is I, J1 is J, - once( foldl(inc, O, I1, J1) ). -index(I+J, M, O ) :- !, - index(I, M, I1), - index(J, M, J1), - add_index(I1, J1, O). -index(I-J, M, O ) :- !, - index(I, M, I1), - index(J, M, J1), - sub_index(I1, J1, O). -index(I*J, M, O ) :- !, - index(I, M, I1), - index(J, M, J1), - O is I1*J1. -index(I div J, M, O ) :- !, - index(I, M, I1), - index(J, M, J1), - O is I1 div J1. -index(I rem J, M, O ) :- !, - index(I, M, I1), - index(J, M, J1), - O is I1 rem J1. -index(I, M, NI ) :- - maplist(indx(M), I, NI). - -indx(M, I, NI) :- index(I, M, NI). - -add_index(I1, J1, O) :- - integer(I1), - integer(J1), !, - O is I1+J1. -add_index(I1, J1, O) :- - integer(I1), !, - maplist(plus(I1), J1, O). -add_index(I1, J1, O) :- - integer(J1), !, - maplist(plus(J1), I1, O). -add_index(I1, J1, O) :- - ord_union(I1, J1, O). - -sub_index(I1, J1, O) :- - integer(I1), - integer(J1), !, - O is I1-J1. -sub_index(I1, J1, O) :- - integer(I1), !, - maplist(rminus(I1), J1, O). -sub_index(I1, J1, O) :- - integer(J1), !, - maplist(minus(J1), I1, O). -sub_index(I1, J1, O) :- - ord_subtract(I1, J1, O). - -minus(X, Y, Z) :- Z is X-Y. - -rminus(X, Y, Z) :- Z is Y-X. - -times(X, Y, Z) :- Z is Y*X. - -div(X, Y, Z) :- Z is X/Y. - -rdiv(X, Y, Z) :- Z is Y/X. - -zdiv(X, Y, Z) :- (X == 0 -> Z = 0 ; X == 0.0 -> Z = 0.0 ; Z is X / Y ). - -mplus(I1, I2, V) :- - number(I1) -> - ( number(I2) -> V is I1+I2 ; - matrix(I2) -> matrix_op_to_all(I1, +, I2, V) ; - is_list(I2) -> maplist(plus(I1), I2, V) ; - V = I1+I2 ) ; - matrix(I1) -> - ( number(I2) -> matrix_op_to_all(I1, +, I2, V) ; - matrix(I2) -> matrix_op(I1, I2, +, V) ; - V = I1+I2 ) ; - is_list(I1) -> - ( number(I2) -> maplist(plus(I2), I1, V) ; - is_list(I2) -> maplist(plus, I1, I2, V) ; - V = I1+I2 ) ; - V = I1 +I2. - -msub(I1, I2, V) :- - number(I1) -> - ( number(I2) -> V is I1-I2 ; - matrix(I2) -> matrix_op_to_all(I1, -, NI2, V) ; - is_list(I2) -> maplist(minus(I1), I2, V) ; - V = I1-I2 ) ; - matrix(I1) -> - ( number(I2) -> NI2 is -I2, matrix_op_to_all(I1, +, NI2, V) ; - matrix(I2) -> matrix_op(I1, I2, -, V) ; - V = I1-I2 ) ; - is_list(I1) -> - ( number(I2) -> NI2 is -I2, maplist(plus(NI2), I1, V) ; - is_list(I2) -> maplist(minus, I1, I2, V) ; - V = I1-I2 ) ; - V = I1-I2. - - -mtimes(I1, I2, V) :- - number(I1) -> - ( number(I2) -> V is I1*I2 ; - matrix(I2) -> matrix_op_to_all(I1, *, I2, V) ; - is_list(I2) -> maplist(times(I1), I2, V) ; - V = I1*I2 ) ; - matrix(I1) -> - ( number(I2) -> matrix_op_to_all(I1, *, I2, V) ; - matrix(I2) -> matrix_op(I1, I2, *, V) ; - V = I1*I2 ) ; - is_list(I1) -> - ( number(I2) -> maplist(times(I2), I1, V) ; - is_list(I2) -> maplist(times, I1, I2, V) ; - V = I1*I2 ) ; - V = I1 *I2. - - - -% -% three types of matrix: integers, floats and general terms. -% - -matrix_new(terms,Dims, '$matrix'(Dims, NDims, Size, Offsets, Matrix) ) :- - length(Dims,NDims), - foldl(size, Dims, 1, Size), - maplist(zero, Dims, Offsets), - functor( Matrix, c, Size). -matrix_new(ints,Dims,Matrix) :- - length(Dims,NDims), - new_ints_matrix_set(NDims, Dims, 0, Matrix). -matrix_new(floats,Dims,Matrix) :- - length(Dims,NDims), - new_floats_matrix_set(NDims, Dims, 0.0, Matrix). - - -matrix_new(terms, Dims, Data, '$matrix'(Dims, NDims, Size, Offsets, Matrix) ) :- - length(Dims,NDims), - foldl(size, Dims, 1, Size), - maplist(zero, Dims, Offsets), - functor( Matrix, c, Size), - Matrix =.. [c|Data]. -matrix_new(ints,Dims,Data,Matrix) :- - length(Dims,NDims), - new_ints_matrix(NDims, Dims, Data, Matrix). -matrix_new(floats,Dims,Data,Matrix) :- - length(Dims,NDims), - new_floats_matrix(NDims, Dims, Data, Matrix). - - -matrix_dims( Mat, Dims) :- - ( opaque(Mat) -> matrixn_dims( Mat, Dims ) ; - Mat = '$matrix'( Dims, _, _, _, _) ). - -matrix_dims( Mat, Dims, Bases) :- - ( opaque(Mat) -> matrixn_dims( Mat, Dims, Bases ) ; - Mat = '$matrix'( Dims, _, _, Bases, _) ). - -matrix_ndims( Mat, NDims) :- - ( opaque(Mat) -> matrixn_ndims( Mat, NDims ) ; - Mat = '$matrix'( _, NDims, _, _, _) ). - -matrix_size( Mat, Size) :- - ( opaque(Mat) -> matrixn_size( Mat, Size ) ; - Mat = '$matrix'( _, _, Size, _, _) ). - -matrix_to_list( Mat, ToList) :- - ( opaque(Mat) -> matrixn_to_list( Mat, ToList ) ; - Mat = '$matrix'( _, _, _, _, M), M=.. [_|ToList] ). - -matrix_to_lists( Mat, ToList) :- - matrix_dims( Mat, [D|Dims] ), - D1 is D-1, - foreach( I in 0..D1, matrix_slicer( Dims, Mat, [I|L]-L), ToList, [] ). - -matrix_slicer( [_], M, Pos-[_], [O|L0], L0) :- !, - O <== '[]'(Pos,M). -matrix_slicer( [D|Dims], M, Pos-[I|L], [O|L0], L0) :- - D1 is D-1, - foreach( I in 0..D1 , L^matrix_slicer( Dims, M, Pos-L), O, [] ). - -matrix_get( Mat, Pos, El) :- - ( opaque(Mat) -> matrixn_get( Mat, Pos, El ) ; - m_get(Mat, Pos, El) ). - -matrix_get_range( Mat, Pos, Els) :- - slice(Pos, Keys), - maplist( matrix_get(Mat), Keys, Els). - -slice([], [[]]). -slice([[H|T]|Extra], Els) :- !, - slice(Extra, Els0), - foldl(add_index_prefix( Els0 ), [H|T], Els, [] ). -slice([H|Extra], Els) :- !, - slice(Extra, Els0), - add_index_prefix( Els0 , H, Els, [] ). - -add_index_prefix( [] , _H ) --> []. -add_index_prefix( [L|Els0] , H ) --> [[H|L]], - add_index_prefix( Els0 , H ). - - -matrix_set_range( Mat, Pos, Els) :- - slice(Pos, Keys), - maplist( matrix_set(Mat), Keys, Els). - -matrix_set( Mat, Pos, El) :- - ( opaque(Mat) -> matrixn_set( Mat, Pos, El ) ; - m_set(Mat, Pos, El) ). - -matrix_new_set(ints,Dims,Elem,Matrix) :- - length(Dims,NDims), - new_ints_matrix_set(NDims, Dims, Elem, Matrix). -matrix_new_set(floats,Dims,Elem,Matrix) :- - length(Dims,NDims), - new_floats_matrix_set(NDims, Dims, Elem, Matrix). - - -matrix_type(Matrix,Type) :- - ( matrix_type_as_number(Matrix, 0) -> Type = ints ; - opaque( Matrix ) -> Type = floats ; - Type = terms ). - -matrix_base(Matrix, Bases) :- - ( opaque( Matrix ) -> maplist('='(Base), Bases), matrixn_set_base( Matrix, Base ) ; - nb_setarg(4, Matrix, Bases ) ). - -matrix_arg_to_offset(M, Index, Offset) :- - ( opaque(M) -> matrixn_arg_to_offset( M, Index, Offset ) ; - M = '$matrix'(Dims, _, Size, Bases, _) -> foldl2(indx, Index, Dims, Bases, Size, _, 0, Offset) ). - -matrix_offset_to_arg(M, Offset, Index) :- - ( opaque(M) -> matrixn_offset_to_arg( M, Offset, Index ) ; - M = '$matrix'(Dims, _, Size, Bases, _) -> foldl2(offset, Index, Dims, Bases, Size, _, Offset, _) ). - -matrix_max(M, Max) :- - ( opaque(M) -> matrixn_max( M, Max ) ; - M = '$matrix'(_, _, _, _, C) -> - arg(1,C,V0), foldargs(max, M, V0, Max) ; - M = [V0|L], foldl(max, L, V0, Max) ). - -max(New, Old, Max) :- ( New >= Old -> New = Max ; Old = Max ). - -matrix_maxarg(M, MaxArg) :- - ( opaque(M) -> matrixn_maxarg( M, MaxArg ); - M = '$matrix'(_, _, _, _, C) -> - arg(1,C,V0), foldargs(maxarg, M, V0-0-0, _-Offset-_), matrix_offset_to_arg(M, Offset, MaxArg) ; - M = [V0|L], foldl(maxarg, L, V0-0-1, _Max-Off-_ ), MaxArg = [Off] ). - -maxarg(New, Old-OPos-I0, Max-MPos-I) :- I is I0+1, ( New > Old -> New = Max, MPos = I0 ; Old = Max, MPos = OPos ). - -matrix_min(M, Min) :- - ( opaque(M) -> matrixn_min( M, Min ) ; - M = '$matrix'(_, _, _, _, C) -> - arg(1,C,V0), foldargs(min, M, V0, Max) ; - M = [V0|L], foldl(min, L, V0, Max) ). - -min(New, Old, Max) :- ( New =< Old -> New = Max ; Old = Max ). - -matrix_minarg(M, MinArg) :- - ( opaque(M) -> matrixn_minarg( M, MinArg ); - M = '$matrix'(_, _, _, _, C) -> - arg(1,C,V0), foldargs(minarg, M, V0-0-0, _-Offset-_), matrix_offset_to_arg(M, Offset, MinArg) ; - M = [V0|L], foldl(minarg, L, V0-0-1, _Min-Off-_ ), MinArg = [Off] ). - -minarg(New, Old-OPos-I0, Min-MPos-I) :- I is I0+1, ( New < Old -> New = Min, MPos = I0 ; Old = Min, MPos = OPos ). - -matrix_to_logs(M, LogM) :- - ( opaque(M) -> matrixn_to_logs( M, LogM ) ; - M = '$matrix'(A, B, D, E, C) -> - LogM = '$matrix'(A, B, D, E, LogC), - mapargs(log, C, LogC) ; - M = [V0|L] -> maplist(log, [V0|L], LogM ) ; - LogM is log(M) ). - -log(X, Y) :- Y is log(X). - -matrix_to_exps(M, ExpM) :- - ( opaque(M) -> matrixn_to_exps( M, ExpM ) ; - M = '$matrix'(A, B, D, E, C) -> - ExpM = '$matrix'(A, B, D, E, ExpC), - mapargs(exp, C, ExpC) ; - M = [V0|L] -> maplist(exp, [V0|L], ExpM ) ; - ExpM is exp(M) ). - -exp(X, Y) :- Y is exp(X). - -matrix_agg_lines(M1,+,NM) :- - do_matrix_agg_lines(M1,0,NM). -/* other operations: *, logprod */ - -matrix_agg_cols(M1,+,NM) :- - do_matrix_agg_cols(M1,0,NM). -/* other operations: *, logprod */ - -matrix_op(M1,M2,+,NM) :- - ( opaque(M1), opaque(M2) -> - do_matrix_op(M1,M2,0,NM) ; - matrix_m(M1, '$matrix'(A,B,D,E,C1)), - matrix_m(M2, '$matrix'(A,B,D,E,C2)), - mapargs(plus, C1, C2, C), - NM = '$matrix'(A,B,D,E,C) ). -matrix_op(M1,M2,-,NM) :- - ( opaque(M1), opaque(M2) -> - do_matrix_op(M1,M2,1,NM) ; - matrix_m(M1, '$matrix'(A,B,D,E,C1)), - matrix_m(M2, '$matrix'(A,B,D,E,C2)), - mapargs(minus, C1, C2, C), - NM = '$matrix'(A,B,D,E,C) ). -matrix_op(M1,M2,*,NM) :- - ( opaque(M1), opaque(M2) -> - do_matrix_op(M1,M2,2,NM) ; - matrix_m(M1, '$matrix'(A,B,D,E,C1)), - matrix_m(M2, '$matrix'(A,B,D,E,C2)), - mapargs(times, C1, C2, C), - NM = '$matrix'(A,B,D,E,C) ). -matrix_op(M1,M2,/,NM) :- - ( opaque(M1), opaque(M2) -> - do_matrix_op(M1,M2,3,NM) ; - matrix_m(M1, '$matrix'(A,B,D,E,C1)), - matrix_m(M2, '$matrix'(A,B,D,E,C2)), - mapargs(div, C1, C2, C), - NM = '$matrix'(A,B,D,E,C) ). -matrix_op(M1,M2,zdiv,NM) :- - ( opaque(M1), opaque(M2) -> - do_matrix_op(M1,M2,5,NM) ; - matrix_m(M1, '$matrix'(A,B,D,E,C1)), - matrix_m(M2, '$matrix'(A,B,D,E,C2)), - mapargs(zdiv, C1, C2, C), - NM = '$matrix'(A,B,D,E,C) ). - - -matrix_op_to_all(M1,+,Num,NM) :- - ( opaque(M1) -> - do_matrix_op_to_all(M1,0,Num,NM) - ; - M1 = '$matrix'(A,B,D,E,C), - mapargs(plus(Num), C, NC), - NM = '$matrix'(A,B,D,E,NC) - ). -matrix_op_to_all(M1,-,Num,NM) :- - ( opaque(M1) -> - do_matrix_op_to_all(M1,1,Num,NM) - ; - M1 = '$matrix'(A,B,D,E,C), - mapargs(minus(Num), C, NC), - NM = '$matrix'(A,B,D,E,NC) - ). -matrix_op_to_all(M1,*,Num,NM) :- - ( opaque(M1) -> - do_matrix_op_to_all(M1,2,Num,NM) - ; - M1 = '$matrix'(A,B,D,E,C), - mapargs(times(Num), C, NC), - NM = '$matrix'(A,B,D,E,NC) - ). -matrix_op_to_all(M1,/,Num,NM) :- - % can only use floats. - FNum is float(Num), - ( opaque(M1) -> - do_matrix_op_to_all(M1,3,FNum,NM) - ; - M1 = '$matrix'(A,B,D,E,C), - mapargs(div(Num), C, NC), - NM = '$matrix'(A,B,D,E,NC) - ). - -/* other operations: *, logprod */ - -matrix_op_to_lines(M1,M2,/,NM) :- - do_matrix_op_to_lines(M1,M2,3,NM). -/* other operations: *, logprod */ - -matrix_op_to_cols(M1,M2,+,NM) :- - do_matrix_op_to_cols(M1,M2,0,NM). -/* other operations: *, logprod */ - - -matrix_transpose(M1,M2) :- - matrix_shuffle(M1,[1,0],M2). - -size(N0, N1, N2) :- - N2 is N0*N1. - -% use 1 to get access to matrix -m_get('$matrix'(Dims, _, Sz, Bases, M), Indx, V) :- - foldl2(indx, Indx, Dims, Bases, Sz, _, 1, Offset), - arg(Offset, M, V). - -m_set('$matrix'(Dims, _, Sz, Bases, M), Indx, V) :- - foldl2(indx, Indx, Dims, Bases, Sz, _, 1, Offset), - arg(Offset, M, V). - -indx( I, Dim, Base, BlkSz, NBlkSz, I0, IF) :- - NBlkSz is BlkSz div Dim , - IF is (I-Base)*NBlkSz + I0. - -offset( I, Dim, BlkSz, NBlkSz, Base, I0, IF) :- - NBlkSz is BlkSz div Dim, - I is I0 div NBlkSz + Base, - IF is I0 rem NBlkSz. - -inc(I1, I, I1) :- - I1 is I+1. - -new_matrix(M0, Opts0, M) :- - opaque(M), !, - matrix_to_list(M0, L), - new_matrix(L, Opts0, M). -new_matrix('$matrix'(_,_,_,_,C), Opts0, M) :- !, - C =..[_|L], - new_matrix(L, Opts0, M). -new_matrix(C, Opts0, M) :- - functor(C, c, _), !, - C =..[_|L], - new_matrix(L, Opts0, M). -new_matrix(List, Opts0, M) :- - foldl2(el_list(MDims), List, Flat, [], 0, Dim), !, - fix_opts(Opts0, Opts), - foldl2(process_new_opt, Opts, Type, TypeF, [Dim|MDims], Dims, Base), - ( var(TypeF) -> guess_type( Flat, Type ) ; true ), - matrix_new( Type, Dims, Flat, M), - ( nonvar(Base) -> matrix_base(M, Base); true ). -new_matrix([H|List], Opts0, M) :- - length( [H|List], Size), - fix_opts(Opts0, Opts), - foldl2(process_new_opt(Base), Opts, Type, TypeF, [Size], Dims), - ( var(TypeF) -> guess_type( [H|List], Type ) ; true ), - matrix_new( Type, Dims, [H|List], M), - ( nonvar(Base) -> matrix_base(M, Base); true ). - -fix_opts(V, _) :- - var(V), !, - throw(error(instantiation_error, V)). -fix_opts(A=B, [A=B]). -fix_opts(A, A) :- - is_list(A), !. -fix_opts(V, _) :- - var(V), !, - throw(error(domain_error(options=V), new_matrix)). - -guess_type( List, Type ) :- - maplist( integer, List), !, - Type = ints. -guess_type( List, Type ) :- - maplist( number, List), !, - Type = floats. -guess_type( _List, terms ). - -process_new_opt(_Base, dim=Dim, Type, Type, _, Dim) :- !. -process_new_opt(_Base, type=Type, _, Type, Dim, Dim) :- !. -process_new_opt( Base, base=Base, Type, Type, Dim, Dim) :- !. -process_new_opt(_Base, Opt, Type, Type, Dim, Dim) :- - throw(error(domain_error(opt=Opt), new_matrix)). - -el_list(_, V, _Els, _NEls, _I0, _I1) :- - var(V), !, - fail. -el_list([N|Extra], El, Els, NEls, I0, I1) :- - foldl2(el_list(Extra), El, Els, NEls, 0, N), !, - I1 is I0+1. -el_list([N], El, Els, NEls, I0, I1) :- - El = [_|_], - length(El, N), - append(El, NEls, Els), - I1 is I0+1. - -foreach( Domain, Goal) :- - strip_module(Goal, M, Locals^NG), !, - term_variables(Domain+Locals, LocalVarsL), - LocalVars =.. [vs|LocalVarsL], - iterate( Domain, [], LocalVars, M:NG, [], [] ), - terms:reset_variables( LocalVars ). -foreach( Domain, Goal ) :- - strip_module(Goal, M, NG), - term_variables(Domain, LocalVarsL), - LocalVars =.. [vs|LocalVarsL], - iterate( Domain, [], LocalVars, M:NG, [], [] ), - terms:reset_variables( LocalVars ). - -foreach( Domain, Goal, Inp, Out) :- - strip_module(Goal, M, Locals^NG), !, - term_variables(Domain+Locals, LocalVarsL), - LocalVars =.. [vs|LocalVarsL], - iterate( Domain, [], LocalVars, M:NG, [], [], Inp, Out). -foreach( Domain, Goal, Inp, Out ) :- - strip_module(Goal, M, NG), - term_variables(Domain, LocalVarsL), - LocalVars =.. [vs|LocalVarsL], - iterate( Domain, [], LocalVars, M:NG, [], [], Inp, Out ). - -iterate( [], [], LocalVars, Goal, Vs, Bs ) :- - terms:freshen_variables(LocalVars), - Vs = Bs, - MG <== Goal, - once( MG ), - terms:reset_variables(LocalVars). -iterate( [], [H|Cont], LocalVars, Goal, Vs, Bs ) :- - iterate(H, Cont, LocalVars, Goal, Vs, Bs ). -iterate( [H|L], [], LocalVars, Goal, Vs, Bs ) :- !, - iterate(H, L, LocalVars, Goal, Vs, Bs ). -iterate( [H|L], Cont, LocalVars, Goal, Vs, Bs ) :- !, - append(L, Cont, LCont), - iterate(H, LCont, LocalVars, Goal, Vs, Bs ). -iterate( [] ins _A .. _B, [H|L], LocalVars, Goal, Vs, Bs ) :- !, - iterate(H, L, LocalVars, Goal, Vs, Bs ). -iterate( [] ins _A .. _B, [], LocalVars, Goal, Vs, Bs ) :- !, - iterate([], [], LocalVars, Goal, Vs, Bs ). -iterate( [V|Ps] ins A..B, Cont, LocalVars, Goal, Vs, Bs ) :- - eval(A, Vs, Bs, NA), - eval(B, Vs, Bs, NB), - ( NA > NB -> true ; - A1 is NA+1, - iterate( Ps ins NA..NB, Cont, LocalVars, Goal, [V|Vs], [NA|Bs] ), - iterate( [V|Ps] ins A1..NB, Cont, LocalVars, Goal, Vs, Bs ) - ). -iterate( V in A..B, Cont, LocalVars, Goal, Vs, Bs) :- - var(V), - eval(A, Vs, Bs, NA), - eval(B, Vs, Bs, NB), - ( NA > NB -> true ; - A1 is NA+1, - (Cont = [H|L] -> - iterate( H, L, LocalVars, Goal, [V|Vs], [NA|Bs] ) - ; - iterate( [], [], LocalVars, Goal, [V|Vs], [NA|Bs] ) - ), - iterate( V in A1..NB, Cont, LocalVars, Goal, Vs, Bs ) - ). - -iterate( [], [], LocalVars, Goal, Vs, Bs, Inp, Out ) :- - terms:freshen_variables(LocalVars), - Vs = Bs, - MG <== Goal, - once( call(MG, Inp, Out) ), - terms:reset_variables(LocalVars). -iterate( [], [H|Cont], LocalVars, Goal, Vs, Bs, Inp, Out ) :- - iterate(H, Cont, LocalVars, Goal, Vs, Bs, Inp, Out ). -iterate( [H|L], [], LocalVars, Goal, Vs, Bs, Inp, Out ) :- !, - iterate(H, L, LocalVars, Goal, Vs, Bs, Inp, Out ). -iterate( [H|L], Cont, LocalVars, Goal, Vs, Bs, Inp, Out ) :- !, - append(L, Cont, LCont), - iterate(H, LCont, LocalVars, Goal, Vs, Bs, Inp, Out ). -iterate( [] ins _A .. _B, [], LocalVars, Goal, Vs, Bs, Inp, Out ) :- !, - iterate([], [], LocalVars, Goal, Vs, Bs, Inp, Out ). -iterate( [] ins _A .. _B, [H|L], LocalVars, Goal, Vs, Bs, Inp, Out ) :- !, - iterate(H, L, LocalVars, Goal, Vs, Bs, Inp, Out ). -iterate( [V|Ps] ins A..B, Cont, LocalVars, Goal, Vs, Bs, Inp, Out ) :- - eval(A, Vs, Bs, NA), - eval(B, Vs, Bs, NB), - ( NA > NB -> Inp = Out ; - A1 is NA+1, - iterate( Ps ins A..B, Cont, LocalVars, Goal, [V|Vs], [NA|Bs], Inp, Mid ), - iterate( [V|Ps] ins A1..NB, Cont, LocalVars, Goal, Vs, Bs, Mid, Out ) - ). -iterate( V in A..B, Cont, LocalVars, Goal, Vs, Bs, Inp, Out) :- - var(V), - eval(A, Vs, Bs, NA), - eval(B, Vs, Bs, NB), - ( NA > NB -> Inp = Out ; - A1 is NA+1, - (Cont = [H|L] -> - iterate( H, L, LocalVars, Goal, [V|Vs], [NA|Bs], Inp, Mid ) - ; - iterate( [], [], LocalVars, Goal, [V|Vs], [NA|Bs], Inp, Mid ) - ), - iterate( V in A1..NB, Cont, LocalVars, Goal, Vs, Bs, Mid, Out ) - ). - - -eval(I, _Vs, _Bs, I) :- integer(I), !. -eval(I, Vs, Bs, NI) :- - copy_term(I+Vs, IA+Bs), - NI <== IA. - -matrix_seq(A, B, Dims, M) :- - ints(A, B, L), - matrix_new(ints, Dims, L, M). - -ints(A,B,O) :- - ( A > B -> O = [] ; O = [A|L], A1 is A+1, ints(A1,B,L) ). - -zero(_, 0). -/** @} */ - diff --git a/packages/python/swig/yap4py/prolog/nb.yap b/packages/python/swig/yap4py/prolog/nb.yap deleted file mode 100644 index 8e245502b..000000000 --- a/packages/python/swig/yap4py/prolog/nb.yap +++ /dev/null @@ -1,232 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: nb.yap * -* Last rev: 5/12/99 * -* mods: * -* comments: non-backtrackable data-structures * -* * -*************************************************************************/ - -/** - * @file nb.yap - * @author VITOR SANTOS COSTA - * @date Tue Nov 17 23:18:13 2015 - * - * @brief stub for global (non-backtrackable) variables. - * - * -*/ - - -:- module(nb, [ - nb_create_accumulator/2, - nb_add_to_accumulator/2, - nb_accumulator_value/2, - nb_queue/1, - nb_queue/2, - nb_queue_close/3, - nb_queue_enqueue/2, - nb_queue_dequeue/2, - nb_queue_peek/2, - nb_queue_empty/1, - nb_queue_size/2, - nb_queue_replace/3, - nb_heap/2, - nb_heap_close/1, - nb_heap_add/3, - nb_heap_del/3, - nb_heap_peek/3, - nb_heap_empty/1, - nb_heap_size/2, - nb_beam/2, - nb_beam_close/1, - nb_beam_add/3, - nb_beam_del/3, - nb_beam_peek/3, - nb_beam_empty/1, -% nb_beam_check/1, - nb_beam_size/2]). - -/** @defgroup nb Non-Backtrackable Data Structures -@ingroup library -@{ - -The following routines implement well-known data-structures using global -non-backtrackable variables (implemented on the Prolog stack). The -data-structures currently supported are Queues, Heaps, and Beam for Beam -search. They are allowed through `library(nb)`. - - -*/ - -/** @pred nb_beam(+ _DefaultSize_,- _Beam_) - - -Create a _Beam_ with default size _DefaultSize_. Note that size -is fixed throughout. - - -*/ -/** @pred nb_beam_add(+ _Beam_, + _Key_, + _Value_) - - -Add _Key_- _Value_ to the beam _Beam_. The key is sorted on - _Key_ only. - - -*/ -/** @pred nb_beam_close(+ _Beam_) - - -Close the beam _Beam_: no further elements can be added. - - -*/ -/** @pred nb_beam_del(+ _Beam_, - _Key_, - _Value_) - - -Remove element _Key_- _Value_ with smallest _Value_ in beam - _Beam_. Fail if the beam is empty. - - -*/ -/** @pred nb_beam_empty(+ _Beam_) - - -Succeeds if _Beam_ is empty. - - - - - */ -/** @pred nb_beam_peek(+ _Beam_, - _Key_, - _Value_)) - - - _Key_- _Value_ is the element with smallest _Key_ in the beam - _Beam_. Fail if the beam is empty. - - -*/ -/** @pred nb_beam_size(+ _Beam_, - _Size_) - - -Unify _Size_ with the number of elements in the beam _Beam_. - - -*/ -/** @pred nb_heap(+ _DefaultSize_,- _Heap_) - - -Create a _Heap_ with default size _DefaultSize_. Note that size -will expand as needed. - - -*/ -/** @pred nb_heap_add(+ _Heap_, + _Key_, + _Value_) - - -Add _Key_- _Value_ to the heap _Heap_. The key is sorted on - _Key_ only. - - -*/ -/** @pred nb_heap_close(+ _Heap_) - - -Close the heap _Heap_: no further elements can be added. - - -*/ -/** @pred nb_heap_del(+ _Heap_, - _Key_, - _Value_) - - -Remove element _Key_- _Value_ with smallest _Value_ in heap - _Heap_. Fail if the heap is empty. - - -*/ -/** @pred nb_heap_empty(+ _Heap_) - - -Succeeds if _Heap_ is empty. - - -*/ -/** @pred nb_heap_peek(+ _Heap_, - _Key_, - _Value_)) - - - _Key_- _Value_ is the element with smallest _Key_ in the heap - _Heap_. Fail if the heap is empty. - - -*/ -/** @pred nb_heap_size(+ _Heap_, - _Size_) - - -Unify _Size_ with the number of elements in the heap _Heap_. - - -*/ -/** @pred nb_queue(- _Queue_) - - -Create a _Queue_. - - -*/ -/** @pred nb_queue_close(+ _Queue_, - _Head_, ? _Tail_) - - -Unify the queue _Queue_ with a difference list - _Head_- _Tail_. The queue will now be empty and no further -elements can be added. - - -*/ -/** @pred nb_queue_dequeue(+ _Queue_, - _Element_) - - -Remove _Element_ from the front of the queue _Queue_. Fail if -the queue is empty. - - -*/ -/** @pred nb_queue_empty(+ _Queue_) - - -Succeeds if _Queue_ is empty. - - -*/ -/** @pred nb_queue_enqueue(+ _Queue_, + _Element_) - - -Add _Element_ to the front of the queue _Queue_. - - -*/ -/** @pred nb_queue_peek(+ _Queue_, - _Element_) - - - _Element_ is the front of the queue _Queue_. Fail if -the queue is empty. - - -*/ -/** @pred nb_queue_size(+ _Queue_, - _Size_) - - -Unify _Size_ with the number of elements in the queue _Queue_. - - -*/ -/** @} */ - diff --git a/packages/python/swig/yap4py/prolog/ordsets.yap b/packages/python/swig/yap4py/prolog/ordsets.yap deleted file mode 100644 index 81c093893..000000000 --- a/packages/python/swig/yap4py/prolog/ordsets.yap +++ /dev/null @@ -1,501 +0,0 @@ -/** - * @file ordsets.yap - * @author : R.A.O'Keefe - * @date 22 May 1983 - * @author VITOR SANTOS COSTA - * @date 1999 - * @brief - * - * -*/ -% This file has been included as an YAP library by Vitor Santos Costa, 1999 - -:- module(ordsets, [ - list_to_ord_set/2, % List -> Set - merge/3, % OrdList x OrdList -> OrdList - ord_add_element/3, % Set x Elem -> Set - ord_del_element/3, % Set x Elem -> Set - ord_disjoint/2, % Set x Set -> - ord_insert/3, % Set x Elem -> Set - ord_member/2, % Set -> Elem - ord_intersect/2, % Set x Set -> - ord_intersect/3, % Set x Set -> Set - ord_intersection/3, % Set x Set -> Set - ord_intersection/4, % Set x Set -> Set x Set - ord_seteq/2, % Set x Set -> - ord_setproduct/3, % Set x Set -> Set - ord_subset/2, % Set x Set -> - ord_subtract/3, % Set x Set -> Set - ord_symdiff/3, % Set x Set -> Set - ord_union/2, % Set^2 -> Set - ord_union/3, % Set x Set -> Set - ord_union/4, % Set x Set -> Set x Set, - ord_empty/1, % -> Set - ord_memberchk/2 % Element X Set - ]). - -/** @defgroup ordsets Ordered Sets - * @ingroup library - * @{ - -The following ordered set manipulation routines are available once -included with the `use_module(library(ordsets))` command. An -ordered set is represented by a list having unique and ordered -elements. Output arguments are guaranteed to be ordered sets, if the -relevant inputs are. This is a slightly patched version of Richard -O'Keefe's original library. - -In this module, sets are represented by ordered lists with no -duplicates. Thus {c,r,a,f,t} would be [a,c,f,r,t]. The ordering -is defined by the @< family of term comparison predicates, which -is the ordering used by sort/2 and setof/3. - -The benefit of the ordered representation is that the elementary -set operations can be done in time proportional to the Sum of the -argument sizes rather than their Product. Some of the unordered -set routines, such as member/2, length/2, select/3 can be used -unchanged. The main difficulty with the ordered representation is -remembering to use it! - - -*/ - - -/** @pred ord_add_element(+ _Set1_, + _Element_, ? _Set2_) - - -Inserting _Element_ in _Set1_ returns _Set2_. It should give -exactly the same result as `merge(Set1, [Element], Set2)`, but a -bit faster, and certainly more clearly. The same as ord_insert/3. - - -*/ -/** @pred ord_del_element(+ _Set1_, + _Element_, ? _Set2_) - - -Removing _Element_ from _Set1_ returns _Set2_. - - -*/ -/** @pred ord_disjoint(+ _Set1_, + _Set2_) - - -Holds when the two ordered sets have no element in common. - - -*/ -/** @pred ord_insert(+ _Set1_, + _Element_, ? _Set2_) - - -Inserting _Element_ in _Set1_ returns _Set2_. It should give -exactly the same result as `merge(Set1, [Element], Set2)`, but a -bit faster, and certainly more clearly. The same as ord_add_element/3. - - -*/ -/** @pred ord_intersect(+ _Set1_, + _Set2_) - - -Holds when the two ordered sets have at least one element in common. - - -*/ -/** @pred ord_intersection(+ _Set1_, + _Set2_, ? _Intersection_) - -Holds when Intersection is the ordered representation of _Set1_ -and _Set2_. - - -*/ -/** @pred ord_intersection(+ _Set1_, + _Set2_, ? _Intersection_, ? _Diff_) - -Holds when Intersection is the ordered representation of _Set1_ -and _Set2_. _Diff_ is the difference between _Set2_ and _Set1_. - - -*/ -/** @pred ord_member(+ _Element_, + _Set_) - - -Holds when _Element_ is a member of _Set_. - - -*/ -/** @pred ord_seteq(+ _Set1_, + _Set2_) - - -Holds when the two arguments represent the same set. - - -*/ -/** @pred ord_setproduct(+ _Set1_, + _Set2_, - _Set_) - - -If Set1 and Set2 are ordered sets, Product will be an ordered -set of x1-x2 pairs. - - -*/ -/** @pred ord_subset(+ _Set1_, + _Set2_) - - -Holds when every element of the ordered set _Set1_ appears in the -ordered set _Set2_. - - -*/ -/** @pred ord_subtract(+ _Set1_, + _Set2_, ? _Difference_) - - -Holds when _Difference_ contains all and only the elements of _Set1_ -which are not also in _Set2_. - - -*/ -/** @pred ord_symdiff(+ _Set1_, + _Set2_, ? _Difference_) - - -Holds when _Difference_ is the symmetric difference of _Set1_ -and _Set2_. - - -*/ -/** @pred ord_union(+ _Set1_, + _Set2_, ? _Union_) - -Holds when _Union_ is the union of _Set1_ and _Set2_. - - -*/ -/** @pred ord_union(+ _Set1_, + _Set2_, ? _Union_, ? _Diff_) - -Holds when _Union_ is the union of _Set1_ and _Set2_ and - _Diff_ is the difference. - - - - - */ -/** @pred ord_union(+ _Sets_, ? _Union_) - - -Holds when _Union_ is the union of the lists _Sets_. - - -*/ - -/* -:- mode - list_to_ord_set(+, ?), - merge(+, +, -), - ord_disjoint(+, +), - ord_disjoint(+, +, +, +, +), - ord_insert(+, +, ?), - ord_insert(+, +, +, +, ?), - ord_intersect(+, +), - ord_intersect(+, +, +, +, +), - ord_intersect(+, +, ?), - ord_intersect(+, +, +, +, +, ?), - ord_seteq(+, +), - ord_subset(+, +), - ord_subset(+, +, +, +, +), - ord_subtract(+, +, ?), - ord_subtract(+, +, +, +, +, ?), - ord_symdiff(+, +, ?), - ord_symdiff(+, +, +, +, +, ?), - ord_union(+, +, ?), - ord_union(+, +, +, +, +, ?). -*/ - - -%% @pred list_to_ord_set(+List, ?Set) -% is true when Set is the ordered representation of the set represented -% by the unordered representation List. The only reason for giving it -% a name at all is that you may not have realised that sort/2 could be -% used this way. - -list_to_ord_set(List, Set) :- - sort(List, Set). - - -%% @ored merge(+List1, +List2, -Merged) -% is true when Merged is the stable merge of the two given lists. -% If the two lists are not ordered, the merge doesn't mean a great -% deal. Merging is perfectly well defined when the inputs contain -% duplicates, and all copies of an element are preserved in the -% output, e.g. merge("122357", "34568", "12233455678"). Study this -% routine carefully, as it is the basis for all the rest. - -merge([Head1|Tail1], [Head2|Tail2], [Head2|Merged]) :- - Head1 @> Head2, !, - merge([Head1|Tail1], Tail2, Merged). -merge([Head1|Tail1], List2, [Head1|Merged]) :- - List2 \== [], !, - merge(Tail1, List2, Merged). -merge([], List2, List2) :- !. -merge(List1, [], List1). - - - -%% @ored ord_disjoint(+Set1, +Set2) -% is true when the two ordered sets have no element in common. If the -% arguments are not ordered, I have no idea what happens. - -ord_disjoint([], _) :- !. -ord_disjoint(_, []) :- !. -ord_disjoint([Head1|Tail1], [Head2|Tail2]) :- - compare(Order, Head1, Head2), - ord_disjoint(Order, Head1, Tail1, Head2, Tail2). - -ord_disjoint(<, _, Tail1, Head2, Tail2) :- - ord_disjoint(Tail1, [Head2|Tail2]). -ord_disjoint(>, Head1, Tail1, _, Tail2) :- - ord_disjoint([Head1|Tail1], Tail2). - - - -%% @ored ord_insert(+Set1, +Element, ?Set2) -% ord_add_element(+Set1, +Element, ?Set2) -% is the equivalent of add_element for ordered sets. It should give -% exactly the same result as merge(Set1, [Element], Set2), but a bit -% faster, and certainly more clearly. - -ord_add_element([], Element, [Element]). -ord_add_element([Head|Tail], Element, Set) :- - compare(Order, Head, Element), - ord_insert(Order, Head, Tail, Element, Set). - - -ord_insert([], Element, [Element]). -ord_insert([Head|Tail], Element, Set) :- - compare(Order, Head, Element), - ord_insert(Order, Head, Tail, Element, Set). - - -ord_insert(<, Head, Tail, Element, [Head|Set]) :- - ord_insert(Tail, Element, Set). -ord_insert(=, Head, Tail, _, [Head|Tail]). -ord_insert(>, Head, Tail, Element, [Element,Head|Tail]). - - - -%% @pred ord_intersect(+Set1, +Set2) -% is true when the two ordered sets have at least one element in common. -% Note that the test is == rather than = . - -ord_intersect([Head1|Tail1], [Head2|Tail2]) :- - compare(Order, Head1, Head2), - ord_intersect(Order, Head1, Tail1, Head2, Tail2). - -ord_intersect(=, _, _, _, _). -ord_intersect(<, _, Tail1, Head2, Tail2) :- - ord_intersect(Tail1, [Head2|Tail2]). -ord_intersect(>, Head1, Tail1, _, Tail2) :- - ord_intersect([Head1|Tail1], Tail2). - -ord_intersect(L1, L2, L) :- - ord_intersection(L1, L2, L). - - -%% @pred ord_intersection(+Set1, +Set2, ?Intersection) -% is true when Intersection is the ordered representation of Set1 -% and Set2, provided that Set1 and Set2 are ordered sets. - -ord_intersection([], _, []) :- !. -ord_intersection([_|_], [], []) :- !. -ord_intersection([Head1|Tail1], [Head2|Tail2], Intersection) :- - ( Head1 == Head2 -> - Intersection = [Head1|Tail], - ord_intersection(Tail1, Tail2, Tail) - ; - Head1 @< Head2 -> - ord_intersection(Tail1, [Head2|Tail2], Intersection) - ; - ord_intersection([Head1|Tail1], Tail2, Intersection) - ). - -%% @pred ord_intersection(+Set1, +Set2, ?Intersection, ?Difference) -% is true when Intersection is the ordered representation of Set1 -% and Set2, provided that Set1 and Set2 are ordered sets. - -ord_intersection([], L, [], L) :- !. -ord_intersection([_|_], [], [], []) :- !. -ord_intersection([Head1|Tail1], [Head2|Tail2], Intersection, Difference) :- - ( Head1 == Head2 -> - Intersection = [Head1|Tail], - ord_intersection(Tail1, Tail2, Tail, Difference) - ; - Head1 @< Head2 -> - ord_intersection(Tail1, [Head2|Tail2], Intersection, Difference) - ; - Difference = [Head2|HDifference], - ord_intersection([Head1|Tail1], Tail2, Intersection, HDifference) - ). - - -% ord_seteq(+Set1, +Set2) -% is true when the two arguments represent the same set. Since they -% are assumed to be ordered representations, they must be identical. - - -ord_seteq(Set1, Set2) :- - Set1 == Set2. - - - -% ord_subset(+Set1, +Set2) -% is true when every element of the ordered set Set1 appears in the -% ordered set Set2. - -ord_subset([], _) :- !. -ord_subset([Head1|Tail1], [Head2|Tail2]) :- - compare(Order, Head1, Head2), - ord_subset(Order, Head1, Tail1, Head2, Tail2). - -ord_subset(=, _, Tail1, _, Tail2) :- - ord_subset(Tail1, Tail2). -ord_subset(>, Head1, Tail1, _, Tail2) :- - ord_subset([Head1|Tail1], Tail2). - - - -% ord_subtract(+Set1, +Set2, ?Difference) -% is true when Difference contains all and only the elements of Set1 -% which are not also in Set2. - - -ord_subtract(Set1, [], Set1) :- !. -ord_subtract([], _, []) :- !. -ord_subtract([Head1|Tail1], [Head2|Tail2], Difference) :- - compare(Order, Head1, Head2), - ord_subtract(Order, Head1, Tail1, Head2, Tail2, Difference). - -ord_subtract(=, _, Tail1, _, Tail2, Difference) :- - ord_subtract(Tail1, Tail2, Difference). -ord_subtract(<, Head1, Tail1, Head2, Tail2, [Head1|Difference]) :- - ord_subtract(Tail1, [Head2|Tail2], Difference). -ord_subtract(>, Head1, Tail1, _, Tail2, Difference) :- - ord_subtract([Head1|Tail1], Tail2, Difference). - - -% ord_del_element(+Set1, Element, ?Rest) -% is true when Rest contains the elements of Set1 -% except for Set1 - - -ord_del_element([], _, []). -ord_del_element([Head1|Tail1], Head2, Rest) :- - compare(Order, Head1, Head2), - ord_del_element(Order, Head1, Tail1, Head2, Rest). - -ord_del_element(=, _, Tail1, _, Tail1). -ord_del_element(<, Head1, Tail1, Head2, [Head1|Difference]) :- - ord_del_element(Tail1, Head2, Difference). -ord_del_element(>, Head1, Tail1, _, [Head1|Tail1]). - - - -%% @pred ord_symdiff(+Set1, +Set2, ?Difference) -% is true when Difference is the symmetric difference of Set1 and Set2. - -ord_symdiff(Set1, [], Set1) :- !. -ord_symdiff([], Set2, Set2) :- !. -ord_symdiff([Head1|Tail1], [Head2|Tail2], Difference) :- - compare(Order, Head1, Head2), - ord_symdiff(Order, Head1, Tail1, Head2, Tail2, Difference). - -ord_symdiff(=, _, Tail1, _, Tail2, Difference) :- - ord_symdiff(Tail1, Tail2, Difference). -ord_symdiff(<, Head1, Tail1, Head2, Tail2, [Head1|Difference]) :- - ord_symdiff(Tail1, [Head2|Tail2], Difference). -ord_symdiff(>, Head1, Tail1, Head2, Tail2, [Head2|Difference]) :- - ord_symdiff([Head1|Tail1], Tail2, Difference). - - - -% ord_union(+Set1, +Set2, ?Union) -% is true when Union is the union of Set1 and Set2. Note that when -% something occurs in both sets, we want to retain only one copy. - -ord_union([S|Set1], [], [S|Set1]). -ord_union([], Set2, Set2). -ord_union([Head1|Tail1], [Head2|Tail2], Union) :- - compare(Order, Head1, Head2), - ord_union(Order, Head1, Tail1, Head2, Tail2, Union). - -ord_union(=, Head, Tail1, _, Tail2, [Head|Union]) :- - ord_union(Tail1, Tail2, Union). -ord_union(<, Head1, Tail1, Head2, Tail2, [Head1|Union]) :- - ord_union(Tail1, [Head2|Tail2], Union). -ord_union(>, Head1, Tail1, Head2, Tail2, [Head2|Union]) :- - ord_union([Head1|Tail1], Tail2, Union). - - -%% @pred ord_union(+Set1, +Set2, ?Union, ?Difference) -% is true when Union is the union of Set1 and Set2 and Difference is the -% difference between Set2 and Set1. - -ord_union(Set1, [], Set1, []) :- !. -ord_union([], Set2, Set2, Set2) :- !. -ord_union([Head1|Tail1], [Head2|Tail2], Union, Diff) :- - compare(Order, Head1, Head2), - ord_union(Order, Head1, Tail1, Head2, Tail2, Union, Diff). - -ord_union(=, Head, Tail1, _, Tail2, [Head|Union], Diff) :- - ord_union(Tail1, Tail2, Union, Diff). -ord_union(<, Head1, Tail1, Head2, Tail2, [Head1|Union], Diff) :- - ord_union(Tail1, [Head2|Tail2], Union, Diff). -ord_union(>, Head1, Tail1, Head2, Tail2, [Head2|Union], [Head2|Diff]) :- - ord_union([Head1|Tail1], Tail2, Union, Diff). - - - -%% @pred ord_setproduct(+Set1, +Set2, ?Product) -% is in fact identical to setproduct(Set1, Set2, Product). -% If Set1 and Set2 are ordered sets, Product will be an ordered -% set of x1-x2 pairs. Note that we cannot solve for Set1 and -% Set2, because there are infinitely many solutions when -% Product is empty, and may be a large number in other cases. - -ord_setproduct([], _, []). -ord_setproduct([H|T], L, Product) :- - ord_setproduct(L, H, Product, Rest), - ord_setproduct(T, L, Rest). - -ord_setproduct([], _, L, L). -ord_setproduct([H|T], X, [X-H|TX], TL) :- - ord_setproduct(T, X, TX, TL). - - -ord_member(El,[H|T]):- - compare(Op,El,H), - ord_member(Op,El,T). - -ord_member(=,_,_). -ord_member(>,El,[H|T]) :- - compare(Op,El,H), - ord_member(Op,El,T). - -ord_union([], []). -ord_union([Set|Sets], Union) :- - length([Set|Sets], NumberOfSets), - ord_union_all(NumberOfSets, [Set|Sets], Union, []). - -ord_union_all(N,Sets0,Union,Sets) :- - ( N=:=1 -> Sets0=[Union|Sets] - ; N=:=2 -> Sets0=[Set1,Set2|Sets], - ord_union(Set1,Set2,Union) - ; A is N>>1, - Z is N-A, - ord_union_all(A, Sets0, X, Sets1), - ord_union_all(Z, Sets1, Y, Sets), - ord_union(X, Y, Union) - ). - -ord_empty([]). - -ord_memberchk(Element, [E|_]) :- E == Element, !. -ord_memberchk(Element, [_|Set]) :- - ord_memberchk(Element, Set). - -/** @} */ - diff --git a/packages/python/swig/yap4py/prolog/os/chartypes.yap b/packages/python/swig/yap4py/prolog/os/chartypes.yap deleted file mode 100644 index 467b4f97a..000000000 --- a/packages/python/swig/yap4py/prolog/os/chartypes.yap +++ /dev/null @@ -1,1920 +0,0 @@ -:- module('$char_type',[ - op(1150, fx, block) - %dif/2, - %when/2, - %block/1, - %wait/1, - %frozen/2 - ]). - -/** - @defgroup CharacterCodes Character Encoding and Manipulation. - @ingroup InputOutput - @{ - -The Prolog library includes a set of built-in predicates designed to -support manipulation of sequences of text, represented either as -lists, atoms or strings. - -The char_type family of predicates support manipulation of individual characters, represented either as numbers (codes) or atoms (chars). - -YAP supports UNICODE through the library utf8proc for compatibility -across operating systems. The implementation extends the original -(ASCII-based) character classification used by early Prologs, but -supports UNICODE.As usual, YAP tried to follow SWI-Prolog as much as -possible: - - + char_type/2 and code_type/2 support all documented SWI-Prolog flags, -but are strict in argument checking. - - + letters with no case are considered as lower-case. Hence, a - variable can only start with an underscore or a unicode point in - category LU. - - + number letters are consideed numbers. - - + connectors, dashes, are considered solo characters. - - + YAP does currently distinguish opening and closing quotes. - - + Symbols are processed as Prolog symbols, exception are modifiers - that are handled as lower-case letters. - - Predicates are: - - + @ref char_type/2 - + @ref code_type/2 - - - -*/ - -/** @predicate char_type(?_Char_ , ?Type) - -The character _Char_ has type _Type_. The types included here are -based on SWI-Prolog's documentation, and they include several types -from the C-library. It it is possible for a character to have -different types. - - + alnum - Char is a letter (upper- or lowercase) or digit. - - +alpha - Char is a letter (upper- or lowercase). - - + csym - Char is a letter (upper- or lowercase), digit or the underscore (_). These are valid C and Prolog symbol characters. - - + csymf -Char is a letter (upper- or lowercase) or the underscore (_). These are valid first characters for C and Prolog symbols. - - + ascii - Char is a 7-bit ASCII character (0..127). - - + white - Char is a space or tab, i.e. white space inside a line. - - + cntrl - Char is an ASCII control character (0..31). - - + digit - Char is a digit. - - + digit(Weight) - Char is a digit with value Weight. I.e. char_type(X, digit(6) yields X = '6'. Useful for parsing numbers. - -+ xdigit(Weight) - Char is a hexadecimal digit with value Weight. I.e. char_type(a, xdigit(X) yields X = '10'. Useful for parsing numbers. - - + graph - Char produces a visible mark on a page when printed. Note that the space is not included! - - + lower - Char is a lowercase letter. - - + lower(Upper) - Char is a lowercase version of Upper. Only true if Char is lowercase and Upper uppercase. - - + to_lower(Upper) - Char is a lowercase version of Upper. For non-letters, or letter without case, Char and Lower are the same. See also upcase_atom/2 and downcase_atom/2. - - + upper - Char is an uppercase letter. - - + upper(Lower) -Char is an uppercase version of Lower. Only true if Char is uppercase and Lower lowercase. - - + to_upper(Lower) - Char is an uppercase version of Lower. For non-letters, or letter without case, Char and Lower are the same. See also upcase_atom/2 and downcase_atom/2. - - + punct - Char is a punctuation character. This is a graph character that is not a letter or digit. - - + space - Char is some form of layout character (tab, vertical tab, newline, etc.). - - + end_of_file - Char is -1. - - + end_of_line - Char ends a line (ASCII: 10..13). - - + newline - Char is a newline character (10). - - + period - Char counts as the end of a sentence (.,!,?). - - + quote - Char is a quote character (", ', `). - - + paren(Close) - Char is an open parenthesis and Close is the corresponding close parenthesis. - - + prolog_var_start - Char can start a Prolog variable name. - - + prolog_atom_start - Char can start a unquoted Prolog atom that is not a symbol. - - + prolog_identifier_continue - Char can continue a Prolog variable name or atom. - - + prolog_prolog_symbol - Char is a Prolog symbol character. Sequences of Prolog symbol characters glue together to form an unquoted atom. Examples are =.., \=, etc. -*/ - -:- discontiguous digit_weight/2, digit_weight/3. - -prolog:char_type( CH, TYPE) :- - (nonvar( CH ) - -> - true - ; - arg(1,TYPE, A), - atomic(A) - -> - true - ; - between(0,0x10FFFF,I), - atom_codes(CH, [I]) - ), - p_char_type( CH, TYPE). - - -p_char_type( ALNUM, alnum) :- - char_type_alnum( ALNUM ). -p_char_type( ALPHA, alpha) :- - char_type_alpha( ALPHA). -p_char_type( CSYM, csym) :- - char_type_csym( CSYM ). -p_char_type( CSYMF, csymf) :- - char_type_csymf( CSYMF). -p_char_type( ASCII, ascii ) :- - char_type_ascii( ASCII ). -p_char_type( WHITE, white) :- - char_type_white( WHITE ). -p_char_type( CNTRL , cntrl) :- - char_type_cntrl( CNTRL ). -p_char_type( DIGIT , digit) :- - char_type_digit( DIGIT ). -p_char_type( DIGIT, digit(Weight) ) :- - char_type_digit( DIGIT ), - digit_weight( DIGIT, Weight ). -p_char_type( XDIGIT, xdigit(Weight) ) :- - char_type_digit( XDIGIT ), - xdigit_weight( XDIGIT, Weight ). -p_char_type( GRAPH , graph) :- - char_type_graph( GRAPH ). -p_char_type( LOWER , lower) :- - char_type_lower( LOWER ). -p_char_type( LOWER, lower( Upper)) :- - toupper( LOWER, Upper), - char_type_lower( LOWER ). -p_char_type( LOWER, to_lower( Upper)) :- - toupper( LOWER, Upper). -p_char_type( UPPER, upper ) :- - char_type_upper( UPPER ). -p_char_type( UPPER , upper( Lower)) :- - char_type_upper( UPPER ), - tolower( UPPER, Lower). -p_char_type( UPPER, to_upper( Lower) ) :- - tolower( UPPER, Lower). -p_char_type( PUNCT , punct) :- - char_type_punct( PUNCT ). -p_char_type( SPACE , space) :- - char_type_space( SPACE ). -p_char_type( END_OF_FILE , end_of_file) :- - char_type_end_of_file( END_OF_FILE ). -p_char_type( END_OF_LINE , end_of_line) :- - char_type_end_of_line( END_OF_LINE ). -p_char_type( NEWLINE , newline) :- - char_type_newline( NEWLINE ). -p_char_type( PERIOD , period) :- - char_type_period( PERIOD ). -p_char_type( QUOTE , quote) :- - char_type_quote( QUOTE ). -p_char_type( Parent_Open, paren( PAREN_CLOSE) ) :- - paren_paren(Parent_Open, PAREN_CLOSE). -p_char_type( PROLOG_VAR_START , prolog_var_start) :- - char_type_prolog_var_start( PROLOG_VAR_START ). -p_char_type( PROLOG_ATOM_START , prolog_atom_start) :- - char_type_prolog_atom_start( PROLOG_ATOM_START ). -p_char_type( PROLOG_IDENTIFIER_CONTINUE , prolog_identifier_continue) :- - char_type_prolog_identifier_continue( PROLOG_IDENTIFIER_CONTINUE ). -p_char_type( PROLOG_PROLOG_SYMBOL , prolog_prolog_symbol) :- - char_type_prolog_prolog_symbol( PROLOG_PROLOG_SYMBOL ). - -prolog:code_type(CH, TYPE) :- - (nonvar( CH ) - -> - true - ; - arg(1,TYPE, A), - atomic(A) - -> - true - ; - between(0,0x10FFFF,CH) - ), - p_code_type( CH, TYPE). - -p_code_type( ALNUM, alnum) :- - code_type_alnum( ALNUM ). -p_code_type( ALPHA, alpha) :- - code_type_alpha( ALPHA). -p_code_type( CSYM, csym) :- - code_type_csym( CSYM ). -p_code_type( CSYMF, csymf) :- - code_type_csymf( CSYMF). -p_code_type( ASCII, ascii ) :- - code_type_ascii( ASCII ). -p_code_type( WHITE, white) :- - code_type_white( WHITE ). -p_code_type( CNTRL , cntrl) :- - code_type_cntrl( CNTRL ). -p_code_type( DIGIT , digit) :- - code_type_digit( DIGIT ). -p_code_type( DIGIT, digit(Weight) ) :- - code_type_digit( DIGIT ), - digit_weight( DIGIT, Weight ). -p_code_type( XDIGIT, xdigit(Weight) ) :- - code_type_digit( XDIGIT ), - xdigit_weight( XDIGIT, Weight ). -p_code_type( GRAPH , graph) :- - code_type_graph( GRAPH ). -p_code_type( LOWER , lower) :- - code_type_lower( LOWER ). -p_code_type( LOWER, lower( Upper)) :- - toupper( LOWER, Upper), - code_type_lower( LOWER ). -p_code_type( LOWER, to_lower( Upper)) :- - toupper( LOWER, Upper). -p_code_type( UPPER, upper ) :- - code_type_upper( UPPER ). -p_code_type( UPPER , upper( Lower)) :- - tolower( UPPER, Lower). -p_code_type( UPPER, to_upper( Lower) ) :- - tolower( UPPER, Lower), - char_type_upper( UPPER). -p_code_type( PUNCT , punct) :- - code_type_punct( PUNCT ). -p_code_type( SPACE , space) :- - code_type_space( SPACE ). -p_code_type( END_OF_FILE , end_of_file) :- - code_type_end_of_file( END_OF_FILE ). -p_code_type( END_OF_LINE , end_of_line) :- - code_type_end_of_line( END_OF_LINE ). -p_code_type( NEWLINE , newline) :- - code_type_newline( NEWLINE ). -p_code_type( PERIOD , period) :- - code_type_period( PERIOD ). -p_code_type( QUOTE , quote) :- - code_type_quote( QUOTE ). -p_code_type( Parent_Open, paren( PAREN_CLOSE) ) :- - paren_paren(Parent_Open, PAREN_CLOSE). -p_code_type( PROLOG_VAR_START , prolog_var_start) :- - code_type_prolog_var_start( PROLOG_VAR_START ). -p_code_type( PROLOG_ATOM_START , prolog_atom_start) :- - code_type_prolog_atom_start( PROLOG_ATOM_START ). -p_code_type( PROLOG_IDENTIFIER_CONTINUE , prolog_identifier_continue) :- - code_type_prolog_identifier_continue( PROLOG_IDENTIFIER_CONTINUE ). -p_code_type( PROLOG_PROLOG_SYMBOL , prolog_prolog_symbol) :- - code_type_prolog_prolog_symbol( PROLOG_PROLOG_SYMBOL ). - - -/* numeric code sequences, obtained from -http://www.unicode.org/Public/8.0.0/ucd/extracted/DerivedNumericValues.txt - -by using: - - grep '[ \t]\#' DerivedNumericValues.txt | awk '{ print "ch( 0x" $1 ", "$6 ")." }' - -*/ - -digit_weight( 0x0F33, -1/2). -digit_weight( 0x0030, 0). -digit_weight( 0x0660, 0). -digit_weight( 0x06F0, 0). -digit_weight( 0x07C0, 0). -digit_weight( 0x0966, 0). -digit_weight( 0x09E6, 0). -digit_weight( 0x0A66, 0). -digit_weight( 0x0AE6, 0). -digit_weight( 0x0B66, 0). -digit_weight( 0x0BE6, 0). -digit_weight( 0x0C66, 0). -digit_weight( 0x0C78, 0). -digit_weight( 0x0CE6, 0). -digit_weight( 0x0D66, 0). -digit_weight( 0x0DE6, 0). -digit_weight( 0x0E50, 0). -digit_weight( 0x0ED0, 0). -digit_weight( 0x0F20, 0). -digit_weight( 0x1040, 0). -digit_weight( 0x1090, 0). -digit_weight( 0x17E0, 0). -digit_weight( 0x17F0, 0). -digit_weight( 0x1810, 0). -digit_weight( 0x1946, 0). -digit_weight( 0x19D0, 0). -digit_weight( 0x1A80, 0). -digit_weight( 0x1A90, 0). -digit_weight( 0x1B50, 0). -digit_weight( 0x1BB0, 0). -digit_weight( 0x1C40, 0). -digit_weight( 0x1C50, 0). -digit_weight( 0x2070, 0). -digit_weight( 0x2080, 0). -digit_weight( 0x2189, 0). -digit_weight( 0x24EA, 0). -digit_weight( 0x24FF, 0). -digit_weight( 0x3007, 0). -digit_weight( 0x96F6, 0). -digit_weight( 0xA620, 0). -digit_weight( 0xA6EF, 0). -digit_weight( 0xA8D0, 0). -digit_weight( 0xA900, 0). -digit_weight( 0xA9D0, 0). -digit_weight( 0xA9F0, 0). -digit_weight( 0xAA50, 0). -digit_weight( 0xABF0, 0). -digit_weight( 0xF9B2, 0). -digit_weight( 0xFF10, 0). -digit_weight( 0x1018A, 0). -digit_weight( 0x104A0, 0). -digit_weight( 0x11066, 0). -digit_weight( 0x110F0, 0). -digit_weight( 0x11136, 0). -digit_weight( 0x111D0, 0). -digit_weight( 0x112F0, 0). -digit_weight( 0x114D0, 0). -digit_weight( 0x11650, 0). -digit_weight( 0x116C0, 0). -digit_weight( 0x11730, 0). -digit_weight( 0x118E0, 0). -digit_weight( 0x16A60, 0). -digit_weight( 0x16B50, 0). -digit_weight( 0x1D7CE, 0). -digit_weight( 0x1D7D8, 0). -digit_weight( 0x1D7E2, 0). -digit_weight( 0x1D7EC, 0). -vdigit_weight( 0x1D7F6, 0). -digit_weight( 0x1F100, 0x1F101, 0). -digit_weight( 0x1F10B, 0x1F10C, 0). -digit_weight( 0x09F4, 1/16). -digit_weight( 0x0B75, 1/16). -digit_weight( 0xA833, 1/16). -digit_weight( 0x109F6, 1/12). -digit_weight( 0x2152, 1/10). -digit_weight( 0x2151, 1/9). -digit_weight( 0x09F5, 1/8). -digit_weight( 0x0B76, 1/8). -digit_weight( 0x215B, 1/8). -digit_weight( 0xA834, 1/8). -digit_weight( 0x1245F, 1/8). -digit_weight( 0x2150, 1/7). -digit_weight( 0x2159, 1/6). -digit_weight( 0x109F7, 1/6). -digit_weight( 0x12461, 1/6). -digit_weight( 0x09F6, 3/16). -digit_weight( 0x0B77, 3/16). -digit_weight( 0xA835, 3/16). -digit_weight( 0x2155, 1/5). -digit_weight( 0x00BC, 1/4). -digit_weight( 0x09F7, 1/4). -digit_weight( 0x0B72, 1/4). -digit_weight( 0x0D73, 1/4). -digit_weight( 0xA830, 1/4). -digit_weight( 0x10140, 1/4). -digit_weight( 0x1018B, 1/4). -digit_weight( 0x109F8, 1/4). -digit_weight( 0x10E7C, 1/4). -digit_weight( 0x12460, 1/4). -digit_weight( 0x12462, 0x12463, 1/4). -digit_weight( 0x2153, 1/3). -digit_weight( 0x109F9, 1/3). -digit_weight( 0x10E7D, 1/3). -digit_weight( 0x1245A, 1/3). -digit_weight( 0x1245D, 1/3). -digit_weight( 0x12465, 1/3). -digit_weight( 0x215C, 3/8). -digit_weight( 0x2156, 2/5). -digit_weight( 0x109FA, 5/12). -digit_weight( 0x00BD, 1/2). -digit_weight( 0x0B73, 1/2). -digit_weight( 0x0D74, 1/2). -digit_weight( 0x0F2A, 1/2). -digit_weight( 0x2CFD, 1/2). -digit_weight( 0xA831, 1/2). -digit_weight( 0x10141, 1/2). -digit_weight( 0x10175, 0x10176, 1/2). -digit_weight( 0x109BD, 1/2). -digit_weight( 0x109FB, 1/2). -digit_weight( 0x10E7B, 1/2). -digit_weight( 0x12464, 1/2). -digit_weight( 0x109FC, 7/12). -digit_weight( 0x2157, 3/5). -digit_weight( 0x215D, 5/8). -digit_weight( 0x2154, 2/3). -digit_weight( 0x10177, 2/3). -digit_weight( 0x109FD, 2/3). -digit_weight( 0x10E7E, 2/3). -digit_weight( 0x1245B, 2/3). -digit_weight( 0x1245E, 2/3). -digit_weight( 0x12466, 2/3). -digit_weight( 0x00BE, 3/4). -digit_weight( 0x09F8, 3/4). -digit_weight( 0x0B74, 3/4). -digit_weight( 0x0D75, 3/4). -digit_weight( 0xA832, 3/4). -digit_weight( 0x10178, 3/4). -digit_weight( 0x109FE, 3/4). -digit_weight( 0x2158, 4/5). -digit_weight( 0x215A, 5/6). -digit_weight( 0x109FF, 5/6). -digit_weight( 0x1245C, 5/6). -digit_weight( 0x215E, 7/8). -digit_weight( 0x109BC, 11/12). -digit_weight( 0x0031, 1). -digit_weight( 0x00B9, 1). -digit_weight( 0x0661, 1). -digit_weight( 0x06F1, 1). -digit_weight( 0x07C1, 1). -digit_weight( 0x0967, 1). -digit_weight( 0x09E7, 1). -digit_weight( 0x0A67, 1). -digit_weight( 0x0AE7, 1). -digit_weight( 0x0B67, 1). -digit_weight( 0x0BE7, 1). -digit_weight( 0x0C67, 1). -digit_weight( 0x0C79, 1). -digit_weight( 0x0C7C, 1). -digit_weight( 0x0CE7, 1). -digit_weight( 0x0D67, 1). -digit_weight( 0x0DE7, 1). -digit_weight( 0x0E51, 1). -digit_weight( 0x0ED1, 1). -digit_weight( 0x0F21, 1). -digit_weight( 0x1041, 1). -digit_weight( 0x1091, 1). -digit_weight( 0x1369, 1). -digit_weight( 0x17E1, 1). -digit_weight( 0x17F1, 1). -digit_weight( 0x1811, 1). -digit_weight( 0x1947, 1). -digit_weight( 0x19D1, 1). -digit_weight( 0x19DA, 1). -digit_weight( 0x1A81, 1). -digit_weight( 0x1A91, 1). -digit_weight( 0x1B51, 1). -digit_weight( 0x1BB1, 1). -digit_weight( 0x1C41, 1). -digit_weight( 0x1C51, 1). -digit_weight( 0x2081, 1). -digit_weight( 0x215F, 1). -digit_weight( 0x2160, 1). -digit_weight( 0x2170, 1). -digit_weight( 0x2460, 1). -digit_weight( 0x2474, 1). -digit_weight( 0x2488, 1). -digit_weight( 0x24F5, 1). -digit_weight( 0x2776, 1). -digit_weight( 0x2780, 1). -digit_weight( 0x278A, 1). -digit_weight( 0x3021, 1). -digit_weight( 0x3192, 1). -digit_weight( 0x3220, 1). -digit_weight( 0x3280, 1). -digit_weight( 0x4E00, 1). -digit_weight( 0x58F1, 1). -digit_weight( 0x58F9, 1). -digit_weight( 0x5E7A, 1). -digit_weight( 0x5F0C, 1). -digit_weight( 0xA621, 1). -digit_weight( 0xA6E6, 1). -digit_weight( 0xA8D1, 1). -digit_weight( 0xA901, 1). -digit_weight( 0xA9D1, 1). -digit_weight( 0xA9F1, 1). -digit_weight( 0xAA51, 1). -digit_weight( 0xABF1, 1). -digit_weight( 0xFF11, 1). -digit_weight( 0x10107, 1). -digit_weight( 0x10142, 1). -digit_weight( 0x10158, 0x1015A, 1). -digit_weight( 0x102E1, 1). -digit_weight( 0x10320, 1). -digit_weight( 0x103D1, 1). -digit_weight( 0x104A1, 1). -digit_weight( 0x10858, 1). -digit_weight( 0x10879, 1). -digit_weight( 0x108A7, 1). -digit_weight( 0x108FB, 1). -digit_weight( 0x10916, 1). -digit_weight( 0x109C0, 1). -digit_weight( 0x10A40, 1). -digit_weight( 0x10A7D, 1). -digit_weight( 0x10A9D, 1). -digit_weight( 0x10AEB, 1). -digit_weight( 0x10B58, 1). -digit_weight( 0x10B78, 1). -digit_weight( 0x10BA9, 1). -digit_weight( 0x10CFA, 1). -digit_weight( 0x10E60, 1). -digit_weight( 0x11052, 1). -digit_weight( 0x11067, 1). -digit_weight( 0x110F1, 1). -digit_weight( 0x11137, 1). -digit_weight( 0x111D1, 1). -digit_weight( 0x111E1, 1). -digit_weight( 0x112F1, 1). -digit_weight( 0x114D1, 1). -digit_weight( 0x11651, 1). -digit_weight( 0x116C1, 1). -digit_weight( 0x11731, 1). -digit_weight( 0x118E1, 1). -digit_weight( 0x12415, 1). -digit_weight( 0x1241E, 1). -digit_weight( 0x1242C, 1). -digit_weight( 0x12434, 1). -digit_weight( 0x1244F, 1). -digit_weight( 0x12458, 1). -digit_weight( 0x16A61, 1). -digit_weight( 0x16B51, 1). -digit_weight( 0x1D360, 1). -digit_weight( 0x1D7CF, 1). -digit_weight( 0x1D7D9, 1). -digit_weight( 0x1D7E3, 1). -digit_weight( 0x1D7ED, 1). -digit_weight( 0x1D7F7, 1). -digit_weight( 0x1E8C7, 1). -digit_weight( 0x1F102, 1). -digit_weight( 0x2092A, 1). -digit_weight( 0x0F2B, 3/2). -digit_weight( 0x0032, 2). -digit_weight( 0x00B2, 2). -digit_weight( 0x0662, 2). -digit_weight( 0x06F2, 2). -digit_weight( 0x07C2, 2). -digit_weight( 0x0968, 2). -digit_weight( 0x09E8, 2). -digit_weight( 0x0A68, 2). -digit_weight( 0x0AE8, 2). -digit_weight( 0x0B68, 2). -digit_weight( 0x0BE8, 2). -digit_weight( 0x0C68, 2). -digit_weight( 0x0C7A, 2). -digit_weight( 0x0C7D, 2). -digit_weight( 0x0CE8, 2). -digit_weight( 0x0D68, 2). -digit_weight( 0x0DE8, 2). -digit_weight( 0x0E52, 2). -digit_weight( 0x0ED2, 2). -digit_weight( 0x0F22, 2). -digit_weight( 0x1042, 2). -digit_weight( 0x1092, 2). -digit_weight( 0x136A, 2). -digit_weight( 0x17E2, 2). -digit_weight( 0x17F2, 2). -digit_weight( 0x1812, 2). -digit_weight( 0x1948, 2). -digit_weight( 0x19D2, 2). -digit_weight( 0x1A82, 2). -digit_weight( 0x1A92, 2). -digit_weight( 0x1B52, 2). -digit_weight( 0x1BB2, 2). -digit_weight( 0x1C42, 2). -digit_weight( 0x1C52, 2). -digit_weight( 0x2082, 2). -digit_weight( 0x2161, 2). -digit_weight( 0x2171, 2). -digit_weight( 0x2461, 2). -digit_weight( 0x2475, 2). -digit_weight( 0x2489, 2). -digit_weight( 0x24F6, 2). -digit_weight( 0x2777, 2). -digit_weight( 0x2781, 2). -digit_weight( 0x278B, 2). -digit_weight( 0x3022, 2). -digit_weight( 0x3193, 2). -digit_weight( 0x3221, 2). -digit_weight( 0x3281, 2). -digit_weight( 0x3483, 2). -digit_weight( 0x4E8C, 2). -digit_weight( 0x5169, 2). -digit_weight( 0x5F0D, 2). -digit_weight( 0x5F10, 2). -digit_weight( 0x8CAE, 2). -digit_weight( 0x8CB3, 2). -digit_weight( 0x8D30, 2). -digit_weight( 0xA622, 2). -digit_weight( 0xA6E7, 2). -digit_weight( 0xA8D2, 2). -digit_weight( 0xA902, 2). -digit_weight( 0xA9D2, 2). -digit_weight( 0xA9F2, 2). -digit_weight( 0xAA52, 2). -digit_weight( 0xABF2, 2). -digit_weight( 0xF978, 2). -digit_weight( 0xFF12, 2). -digit_weight( 0x10108, 2). -digit_weight( 0x1015B, 0x1015E, 2). -digit_weight( 0x102E2, 2). -digit_weight( 0x103D2, 2). -digit_weight( 0x104A2, 2). -digit_weight( 0x10859, 2). -digit_weight( 0x1087A, 2). -digit_weight( 0x108A8, 2). -digit_weight( 0x1091A, 2). -digit_weight( 0x109C1, 2). -digit_weight( 0x10A41, 2). -digit_weight( 0x10B59, 2). -digit_weight( 0x10B79, 2). -digit_weight( 0x10BAA, 2). -digit_weight( 0x10E61, 2). -digit_weight( 0x11053, 2). -digit_weight( 0x11068, 2). -digit_weight( 0x110F2, 2). -digit_weight( 0x11138, 2). -digit_weight( 0x111D2, 2). -digit_weight( 0x111E2, 2). -digit_weight( 0x112F2, 2). -digit_weight( 0x114D2, 2). -digit_weight( 0x11652, 2). -digit_weight( 0x116C2, 2). -digit_weight( 0x11732, 2). -digit_weight( 0x118E2, 2). -digit_weight( 0x12400, 2). -digit_weight( 0x12416, 2). -digit_weight( 0x1241F, 2). -digit_weight( 0x12423, 2). -digit_weight( 0x1242D, 2). -digit_weight( 0x12435, 2). -digit_weight( 0x1244A, 2). -digit_weight( 0x12450, 2). -digit_weight( 0x12456, 2). -digit_weight( 0x12459, 2). -digit_weight( 0x16A62, 2). -digit_weight( 0x16B52, 2). -digit_weight( 0x1D361, 2). -digit_weight( 0x1D7D0, 2). -digit_weight( 0x1D7DA, 2). -digit_weight( 0x1D7E4, 2). -digit_weight( 0x1D7EE, 2). -digit_weight( 0x1D7F8, 2). -digit_weight( 0x1E8C8, 2). -digit_weight( 0x1F103, 2). -digit_weight( 0x22390, 2). -digit_weight( 0x0F2C, 5/2). -digit_weight( 0x0033, 3). -digit_weight( 0x00B3, 3). -digit_weight( 0x0663, 3). -digit_weight( 0x06F3, 3). -digit_weight( 0x07C3, 3). -digit_weight( 0x0969, 3). -digit_weight( 0x09E9, 3). -digit_weight( 0x0A69, 3). -digit_weight( 0x0AE9, 3). -digit_weight( 0x0B69, 3). -digit_weight( 0x0BE9, 3). -digit_weight( 0x0C69, 3). -digit_weight( 0x0C7B, 3). -digit_weight( 0x0C7E, 3). -digit_weight( 0x0CE9, 3). -digit_weight( 0x0D69, 3). -digit_weight( 0x0DE9, 3). -digit_weight( 0x0E53, 3). -digit_weight( 0x0ED3, 3). -digit_weight( 0x0F23, 3). -digit_weight( 0x1043, 3). -digit_weight( 0x1093, 3). -digit_weight( 0x136B, 3). -digit_weight( 0x17E3, 3). -digit_weight( 0x17F3, 3). -digit_weight( 0x1813, 3). -digit_weight( 0x1949, 3). -digit_weight( 0x19D3, 3). -digit_weight( 0x1A83, 3). -digit_weight( 0x1A93, 3). -digit_weight( 0x1B53, 3). -digit_weight( 0x1BB3, 3). -digit_weight( 0x1C43, 3). -digit_weight( 0x1C53, 3). -digit_weight( 0x2083, 3). -digit_weight( 0x2162, 3). -digit_weight( 0x2172, 3). -digit_weight( 0x2462, 3). -digit_weight( 0x2476, 3). -digit_weight( 0x248A, 3). -digit_weight( 0x24F7, 3). -digit_weight( 0x2778, 3). -digit_weight( 0x2782, 3). -digit_weight( 0x278C, 3). -digit_weight( 0x3023, 3). -digit_weight( 0x3194, 3). -digit_weight( 0x3222, 3). -digit_weight( 0x3282, 3). -digit_weight( 0x4E09, 3). -digit_weight( 0x4EE8, 3). -digit_weight( 0x53C1, 0x53C4, 3). -digit_weight( 0x5F0E, 3). -digit_weight( 0xA623, 3). -digit_weight( 0xA6E8, 3). -digit_weight( 0xA8D3, 3). -digit_weight( 0xA903, 3). -digit_weight( 0xA9D3, 3). -digit_weight( 0xA9F3, 3). -digit_weight( 0xAA53, 3). -digit_weight( 0xABF3, 3). -digit_weight( 0xF96B, 3). -digit_weight( 0xFF13, 3). -digit_weight( 0x10109, 3). -digit_weight( 0x102E3, 3). -digit_weight( 0x104A3, 3). -digit_weight( 0x1085A, 3). -digit_weight( 0x1087B, 3). -digit_weight( 0x108A9, 3). -digit_weight( 0x1091B, 3). -digit_weight( 0x109C2, 3). -digit_weight( 0x10A42, 3). -digit_weight( 0x10B5A, 3). -digit_weight( 0x10B7A, 3). -digit_weight( 0x10BAB, 3). -digit_weight( 0x10E62, 3). -digit_weight( 0x11054, 3). -digit_weight( 0x11069, 3). -digit_weight( 0x110F3, 3). -digit_weight( 0x11139, 3). -digit_weight( 0x111D3, 3). -digit_weight( 0x111E3, 3). -digit_weight( 0x112F3, 3). -digit_weight( 0x114D3, 3). -digit_weight( 0x11653, 3). -digit_weight( 0x116C3, 3). -digit_weight( 0x11733, 3). -digit_weight( 0x118E3, 3). -digit_weight( 0x12401, 3). -digit_weight( 0x12408, 3). -digit_weight( 0x12417, 3). -digit_weight( 0x12420, 3). -digit_weight( 0x12424, 0x12425, 3). -digit_weight( 0x1242E, 0x1242F, 3). -digit_weight( 0x12436, 0x12437, 3). -digit_weight( 0x1243A, 0x1243B, 3). -digit_weight( 0x1244B, 3). -digit_weight( 0x12451, 3). -digit_weight( 0x12457, 3). -digit_weight( 0x16A63, 3). -digit_weight( 0x16B53, 3). -digit_weight( 0x1D362, 3). -digit_weight( 0x1D7D1, 3). -digit_weight( 0x1D7DB, 3). -digit_weight( 0x1D7E5, 3). -digit_weight( 0x1D7EF, 3). -digit_weight( 0x1D7F9, 3). -digit_weight( 0x1E8C9, 3). -digit_weight( 0x1F104, 3). -digit_weight( 0x20AFD, 3). -digit_weight( 0x20B19, 3). -digit_weight( 0x22998, 3). -digit_weight( 0x23B1B, 3). -digit_weight( 0x0F2D, 7/2). -digit_weight( 0x0034, 4). -digit_weight( 0x0664, 4). -digit_weight( 0x06F4, 4). -digit_weight( 0x07C4, 4). -digit_weight( 0x096A, 4). -digit_weight( 0x09EA, 4). -digit_weight( 0x0A6A, 4). -digit_weight( 0x0AEA, 4). -digit_weight( 0x0B6A, 4). -digit_weight( 0x0BEA, 4). -digit_weight( 0x0C6A, 4). -digit_weight( 0x0CEA, 4). -digit_weight( 0x0D6A, 4). -digit_weight( 0x0DEA, 4). -digit_weight( 0x0E54, 4). -digit_weight( 0x0ED4, 4). -digit_weight( 0x0F24, 4). -digit_weight( 0x1044, 4). -digit_weight( 0x1094, 4). -digit_weight( 0x136C, 4). -digit_weight( 0x17E4, 4). -digit_weight( 0x17F4, 4). -digit_weight( 0x1814, 4). -digit_weight( 0x194A, 4). -digit_weight( 0x19D4, 4). -digit_weight( 0x1A84, 4). -digit_weight( 0x1A94, 4). -digit_weight( 0x1B54, 4). -digit_weight( 0x1BB4, 4). -digit_weight( 0x1C44, 4). -digit_weight( 0x1C54, 4). -digit_weight( 0x2074, 4). -digit_weight( 0x2084, 4). -digit_weight( 0x2163, 4). -digit_weight( 0x2173, 4). -digit_weight( 0x2463, 4). -digit_weight( 0x2477, 4). -digit_weight( 0x248B, 4). -digit_weight( 0x24F8, 4). -digit_weight( 0x2779, 4). -digit_weight( 0x2783, 4). -digit_weight( 0x278D, 4). -digit_weight( 0x3024, 4). -digit_weight( 0x3195, 4). -digit_weight( 0x3223, 4). -digit_weight( 0x3283, 4). -digit_weight( 0x4E96, 4). -digit_weight( 0x56DB, 4). -digit_weight( 0x8086, 4). -digit_weight( 0xA624, 4). -digit_weight( 0xA6E9, 4). -digit_weight( 0xA8D4, 4). -digit_weight( 0xA904, 4). -digit_weight( 0xA9D4, 4). -digit_weight( 0xA9F4, 4). -digit_weight( 0xAA54, 4). -digit_weight( 0xABF4, 4). -digit_weight( 0xFF14, 4). -digit_weight( 0x1010A, 4). -digit_weight( 0x102E4, 4). -digit_weight( 0x104A4, 4). -digit_weight( 0x1087C, 4). -digit_weight( 0x108AA, 0x108AB, 4). -digit_weight( 0x109C3, 4). -digit_weight( 0x10A43, 4). -digit_weight( 0x10B5B, 4). -digit_weight( 0x10B7B, 4). -digit_weight( 0x10BAC, 4). -digit_weight( 0x10E63, 4). -digit_weight( 0x11055, 4). -digit_weight( 0x1106A, 4). -digit_weight( 0x110F4, 4). -digit_weight( 0x1113A, 4). -digit_weight( 0x111D4, 4). -digit_weight( 0x111E4, 4). -digit_weight( 0x112F4, 4). -digit_weight( 0x114D4, 4). -digit_weight( 0x11654, 4). -digit_weight( 0x116C4, 4). -digit_weight( 0x11734, 4). -digit_weight( 0x118E4, 4). -digit_weight( 0x12402, 4). -digit_weight( 0x12409, 4). -digit_weight( 0x1240F, 4). -digit_weight( 0x12418, 4). -digit_weight( 0x12421, 4). -digit_weight( 0x12426, 4). -digit_weight( 0x12430, 4). -digit_weight( 0x12438, 4). -digit_weight( 0x1243C, 0x1243F, 4). -digit_weight( 0x1244C, 4). -digit_weight( 0x12452, 0x12453, 4). -digit_weight( 0x12469, 4). -digit_weight( 0x16A64, 4). -digit_weight( 0x16B54, 4). -digit_weight( 0x1D363, 4). -digit_weight( 0x1D7D2, 4). -digit_weight( 0x1D7DC, 4). -digit_weight( 0x1D7E6, 4). -digit_weight( 0x1D7F0, 4). -digit_weight( 0x1D7FA, 4). -digit_weight( 0x1E8CA, 4). -digit_weight( 0x1F105, 4). -digit_weight( 0x20064, 4). -digit_weight( 0x200E2, 4). -digit_weight( 0x2626D, 4). -digit_weight( 0x0F2E, 9/2). -digit_weight( 0x0035, 5). -digit_weight( 0x0665, 5). -digit_weight( 0x06F5, 5). -digit_weight( 0x07C5, 5). -digit_weight( 0x096B, 5). -digit_weight( 0x09EB, 5). -digit_weight( 0x0A6B, 5). -digit_weight( 0x0AEB, 5). -digit_weight( 0x0B6B, 5). -digit_weight( 0x0BEB, 5). -digit_weight( 0x0C6B, 5). -digit_weight( 0x0CEB, 5). -digit_weight( 0x0D6B, 5). -digit_weight( 0x0DEB, 5). -digit_weight( 0x0E55, 5). -digit_weight( 0x0ED5, 5). -digit_weight( 0x0F25, 5). -digit_weight( 0x1045, 5). -digit_weight( 0x1095, 5). -digit_weight( 0x136D, 5). -digit_weight( 0x17E5, 5). -digit_weight( 0x17F5, 5). -digit_weight( 0x1815, 5). -digit_weight( 0x194B, 5). -digit_weight( 0x19D5, 5). -digit_weight( 0x1A85, 5). -digit_weight( 0x1A95, 5). -digit_weight( 0x1B55, 5). -digit_weight( 0x1BB5, 5). -digit_weight( 0x1C45, 5). -digit_weight( 0x1C55, 5). -digit_weight( 0x2075, 5). -digit_weight( 0x2085, 5). -digit_weight( 0x2164, 5). -digit_weight( 0x2174, 5). -digit_weight( 0x2464, 5). -digit_weight( 0x2478, 5). -digit_weight( 0x248C, 5). -digit_weight( 0x24F9, 5). -digit_weight( 0x277A, 5). -digit_weight( 0x2784, 5). -digit_weight( 0x278E, 5). -digit_weight( 0x3025, 5). -digit_weight( 0x3224, 5). -digit_weight( 0x3284, 5). -digit_weight( 0x3405, 5). -digit_weight( 0x382A, 5). -digit_weight( 0x4E94, 5). -digit_weight( 0x4F0D, 5). -digit_weight( 0xA625, 5). -digit_weight( 0xA6EA, 5). -digit_weight( 0xA8D5, 5). -digit_weight( 0xA905, 5). -digit_weight( 0xA9D5, 5). -digit_weight( 0xA9F5, 5). -digit_weight( 0xAA55, 5). -digit_weight( 0xABF5, 5). -digit_weight( 0xFF15, 5). -digit_weight( 0x1010B, 5). -digit_weight( 0x10143, 5). -digit_weight( 0x10148, 5). -digit_weight( 0x1014F, 5). -digit_weight( 0x1015F, 5). -digit_weight( 0x10173, 5). -digit_weight( 0x102E5, 5). -digit_weight( 0x10321, 5). -digit_weight( 0x104A5, 5). -digit_weight( 0x1087D, 5). -digit_weight( 0x108AC, 5). -digit_weight( 0x108FC, 5). -digit_weight( 0x109C4, 5). -digit_weight( 0x10AEC, 5). -digit_weight( 0x10CFB, 5). -digit_weight( 0x10E64, 5). -digit_weight( 0x11056, 5). -digit_weight( 0x1106B, 5). -digit_weight( 0x110F5, 5). -digit_weight( 0x1113B, 5). -digit_weight( 0x111D5, 5). -digit_weight( 0x111E5, 5). -digit_weight( 0x112F5, 5). -digit_weight( 0x114D5, 5). -digit_weight( 0x11655, 5). -digit_weight( 0x116C5, 5). -digit_weight( 0x11735, 5). -digit_weight( 0x118E5, 5). -digit_weight( 0x12403, 5). -digit_weight( 0x1240A, 5). -digit_weight( 0x12410, 5). -digit_weight( 0x12419, 5). -digit_weight( 0x12422, 5). -digit_weight( 0x12427, 5). -digit_weight( 0x12431, 5). -digit_weight( 0x12439, 5). -digit_weight( 0x1244D, 5). -digit_weight( 0x12454, 0x12455, 5). -digit_weight( 0x1246A, 5). -digit_weight( 0x16A65, 5). -digit_weight( 0x16B55, 5). -digit_weight( 0x1D364, 5). -digit_weight( 0x1D7D3, 5). -digit_weight( 0x1D7DD, 5). -digit_weight( 0x1D7E7, 5). -digit_weight( 0x1D7F1, 5). -digit_weight( 0x1D7FB, 5). -digit_weight( 0x1E8CB, 5). -digit_weight( 0x1F106, 5). -digit_weight( 0x20121, 5). -digit_weight( 0x0F2F, 11/2). -digit_weight( 0x0036, 6). -digit_weight( 0x0666, 6). -digit_weight( 0x06F6, 6). -digit_weight( 0x07C6, 6). -digit_weight( 0x096C, 6). -digit_weight( 0x09EC, 6). -digit_weight( 0x0A6C, 6). -digit_weight( 0x0AEC, 6). -digit_weight( 0x0B6C, 6). -digit_weight( 0x0BEC, 6). -digit_weight( 0x0C6C, 6). -digit_weight( 0x0CEC, 6). -digit_weight( 0x0D6C, 6). -digit_weight( 0x0DEC, 6). -digit_weight( 0x0E56, 6). -digit_weight( 0x0ED6, 6). -digit_weight( 0x0F26, 6). -digit_weight( 0x1046, 6). -digit_weight( 0x1096, 6). -digit_weight( 0x136E, 6). -digit_weight( 0x17E6, 6). -digit_weight( 0x17F6, 6). -digit_weight( 0x1816, 6). -digit_weight( 0x194C, 6). -digit_weight( 0x19D6, 6). -digit_weight( 0x1A86, 6). -digit_weight( 0x1A96, 6). -digit_weight( 0x1B56, 6). -digit_weight( 0x1BB6, 6). -digit_weight( 0x1C46, 6). -digit_weight( 0x1C56, 6). -digit_weight( 0x2076, 6). -digit_weight( 0x2086, 6). -digit_weight( 0x2165, 6). -digit_weight( 0x2175, 6). -digit_weight( 0x2185, 6). -digit_weight( 0x2465, 6). -digit_weight( 0x2479, 6). -digit_weight( 0x248D, 6). -digit_weight( 0x24FA, 6). -digit_weight( 0x277B, 6). -digit_weight( 0x2785, 6). -digit_weight( 0x278F, 6). -digit_weight( 0x3026, 6). -digit_weight( 0x3225, 6). -digit_weight( 0x3285, 6). -digit_weight( 0x516D, 6). -digit_weight( 0x9646, 6). -digit_weight( 0x9678, 6). -digit_weight( 0xA626, 6). -digit_weight( 0xA6EB, 6). -digit_weight( 0xA8D6, 6). -digit_weight( 0xA906, 6). -digit_weight( 0xA9D6, 6). -digit_weight( 0xA9F6, 6). -digit_weight( 0xAA56, 6). -digit_weight( 0xABF6, 6). -digit_weight( 0xF9D1, 6). -digit_weight( 0xF9D3, 6). -digit_weight( 0xFF16, 6). -digit_weight( 0x1010C, 6). -digit_weight( 0x102E6, 6). -digit_weight( 0x104A6, 6). -digit_weight( 0x109C5, 6). -digit_weight( 0x10E65, 6). -digit_weight( 0x11057, 6). -digit_weight( 0x1106C, 6). -digit_weight( 0x110F6, 6). -digit_weight( 0x1113C, 6). -digit_weight( 0x111D6, 6). -digit_weight( 0x111E6, 6). -digit_weight( 0x112F6, 6). -digit_weight( 0x114D6, 6). -digit_weight( 0x11656, 6). -digit_weight( 0x116C6, 6). -digit_weight( 0x11736, 6). -digit_weight( 0x118E6, 6). -digit_weight( 0x12404, 6). -digit_weight( 0x1240B, 6). -digit_weight( 0x12411, 6). -digit_weight( 0x1241A, 6). -digit_weight( 0x12428, 6). -digit_weight( 0x12440, 6). -digit_weight( 0x1244E, 6). -digit_weight( 0x1246B, 6). -digit_weight( 0x16A66, 6). -digit_weight( 0x16B56, 6). -digit_weight( 0x1D365, 6). -digit_weight( 0x1D7D4, 6). -digit_weight( 0x1D7DE, 6). -digit_weight( 0x1D7E8, 6). -digit_weight( 0x1D7F2, 6). -digit_weight( 0x1D7FC, 6). -digit_weight( 0x1E8CC, 6). -digit_weight( 0x1F107, 6). -digit_weight( 0x20AEA, 6). -digit_weight( 0x0F30, 13/2). -digit_weight( 0x0037, 7). -digit_weight( 0x0667, 7). -digit_weight( 0x06F7, 7). -digit_weight( 0x07C7, 7). -digit_weight( 0x096D, 7). -digit_weight( 0x09ED, 7). -digit_weight( 0x0A6D, 7). -digit_weight( 0x0AED, 7). -digit_weight( 0x0B6D, 7). -digit_weight( 0x0BED, 7). -digit_weight( 0x0C6D, 7). -digit_weight( 0x0CED, 7). -digit_weight( 0x0D6D, 7). -digit_weight( 0x0DED, 7). -digit_weight( 0x0E57, 7). -digit_weight( 0x0ED7, 7). -digit_weight( 0x0F27, 7). -digit_weight( 0x1047, 7). -digit_weight( 0x1097, 7). -digit_weight( 0x136F, 7). -digit_weight( 0x17E7, 7). -digit_weight( 0x17F7, 7). -digit_weight( 0x1817, 7). -digit_weight( 0x194D, 7). -digit_weight( 0x19D7, 7). -digit_weight( 0x1A87, 7). -digit_weight( 0x1A97, 7). -digit_weight( 0x1B57, 7). -digit_weight( 0x1BB7, 7). -digit_weight( 0x1C47, 7). -digit_weight( 0x1C57, 7). -digit_weight( 0x2077, 7). -digit_weight( 0x2087, 7). -digit_weight( 0x2166, 7). -digit_weight( 0x2176, 7). -digit_weight( 0x2466, 7). -digit_weight( 0x247A, 7). -digit_weight( 0x248E, 7). -digit_weight( 0x24FB, 7). -digit_weight( 0x277C, 7). -digit_weight( 0x2786, 7). -digit_weight( 0x2790, 7). -digit_weight( 0x3027, 7). -digit_weight( 0x3226, 7). -digit_weight( 0x3286, 7). -digit_weight( 0x3B4D, 7). -digit_weight( 0x4E03, 7). -digit_weight( 0x67D2, 7). -digit_weight( 0x6F06, 7). -digit_weight( 0xA627, 7). -digit_weight( 0xA6EC, 7). -digit_weight( 0xA8D7, 7). -digit_weight( 0xA907, 7). -digit_weight( 0xA9D7, 7). -digit_weight( 0xA9F7, 7). -digit_weight( 0xAA57, 7). -digit_weight( 0xABF7, 7). -digit_weight( 0xFF17, 7). -digit_weight( 0x1010D, 7). -digit_weight( 0x102E7, 7). -digit_weight( 0x104A7, 7). -digit_weight( 0x109C6, 7). -digit_weight( 0x10E66, 7). -digit_weight( 0x11058, 7). -digit_weight( 0x1106D, 7). -digit_weight( 0x110F7, 7). -digit_weight( 0x1113D, 7). -digit_weight( 0x111D7, 7). -digit_weight( 0x111E7, 7). -digit_weight( 0x112F7, 7). -digit_weight( 0x114D7, 7). -digit_weight( 0x11657, 7). -digit_weight( 0x116C7, 7). -digit_weight( 0x11737, 7). -digit_weight( 0x118E7, 7). -digit_weight( 0x12405, 7). -digit_weight( 0x1240C, 7). -digit_weight( 0x12412, 7). -digit_weight( 0x1241B, 7). -digit_weight( 0x12429, 7). -digit_weight( 0x12441, 0x12443, 7). -digit_weight( 0x1246C, 7). -digit_weight( 0x16A67, 7). -digit_weight( 0x16B57, 7). -digit_weight( 0x1D366, 7). -digit_weight( 0x1D7D5, 7). -digit_weight( 0x1D7DF, 7). -digit_weight( 0x1D7E9, 7). -digit_weight( 0x1D7F3, 7). -digit_weight( 0x1D7FD, 7). -digit_weight( 0x1E8CD, 7). -digit_weight( 0x1F108, 7). -digit_weight( 0x20001, 7). -digit_weight( 0x0F31, 15/2). -digit_weight( 0x0038, 8). -digit_weight( 0x0668, 8). -digit_weight( 0x06F8, 8). -digit_weight( 0x07C8, 8). -digit_weight( 0x096E, 8). -digit_weight( 0x09EE, 8). -digit_weight( 0x0A6E, 8). -digit_weight( 0x0AEE, 8). -digit_weight( 0x0B6E, 8). -digit_weight( 0x0BEE, 8). -digit_weight( 0x0C6E, 8). -digit_weight( 0x0CEE, 8). -digit_weight( 0x0D6E, 8). -digit_weight( 0x0DEE, 8). -digit_weight( 0x0E58, 8). -digit_weight( 0x0ED8, 8). -digit_weight( 0x0F28, 8). -digit_weight( 0x1048, 8). -digit_weight( 0x1098, 8). -digit_weight( 0x1370, 8). -digit_weight( 0x17E8, 8). -digit_weight( 0x17F8, 8). -digit_weight( 0x1818, 8). -digit_weight( 0x194E, 8). -digit_weight( 0x19D8, 8). -digit_weight( 0x1A88, 8). -digit_weight( 0x1A98, 8). -digit_weight( 0x1B58, 8). -digit_weight( 0x1BB8, 8). -digit_weight( 0x1C48, 8). -digit_weight( 0x1C58, 8). -digit_weight( 0x2078, 8). -digit_weight( 0x2088, 8). -digit_weight( 0x2167, 8). -digit_weight( 0x2177, 8). -digit_weight( 0x2467, 8). -digit_weight( 0x247B, 8). -digit_weight( 0x248F, 8). -digit_weight( 0x24FC, 8). -digit_weight( 0x277D, 8). -digit_weight( 0x2787, 8). -digit_weight( 0x2791, 8). -digit_weight( 0x3028, 8). -digit_weight( 0x3227, 8). -digit_weight( 0x3287, 8). -digit_weight( 0x516B, 8). -digit_weight( 0x634C, 8). -digit_weight( 0xA628, 8). -digit_weight( 0xA6ED, 8). -digit_weight( 0xA8D8, 8). -digit_weight( 0xA908, 8). -digit_weight( 0xA9D8, 8). -digit_weight( 0xA9F8, 8). -digit_weight( 0xAA58, 8). -digit_weight( 0xABF8, 8). -digit_weight( 0xFF18, 8). -digit_weight( 0x1010E, 8). -digit_weight( 0x102E8, 8). -digit_weight( 0x104A8, 8). -digit_weight( 0x109C7, 8). -digit_weight( 0x10E67, 8). -digit_weight( 0x11059, 8). -digit_weight( 0x1106E, 8). -digit_weight( 0x110F8, 8). -digit_weight( 0x1113E, 8). -digit_weight( 0x111D8, 8). -digit_weight( 0x111E8, 8). -digit_weight( 0x112F8, 8). -digit_weight( 0x114D8, 8). -digit_weight( 0x11658, 8). -digit_weight( 0x116C8, 8). -digit_weight( 0x11738, 8). -digit_weight( 0x118E8, 8). -digit_weight( 0x12406, 8). -digit_weight( 0x1240D, 8). -digit_weight( 0x12413, 8). -digit_weight( 0x1241C, 8). -digit_weight( 0x1242A, 8). -digit_weight( 0x12444, 0x12445, 8). -digit_weight( 0x1246D, 8). -digit_weight( 0x16A68, 8). -digit_weight( 0x16B58, 8). -digit_weight( 0x1D367, 8). -digit_weight( 0x1D7D6, 8). -digit_weight( 0x1D7E0, 8). -digit_weight( 0x1D7EA, 8). -digit_weight( 0x1D7F4, 8). -digit_weight( 0x1D7FE, 8). -digit_weight( 0x1E8CE, 8). -digit_weight( 0x1F109, 8). -digit_weight( 0x0F32, 17/2). -digit_weight( 0x0039, 9). -digit_weight( 0x0669, 9). -digit_weight( 0x06F9, 9). -digit_weight( 0x07C9, 9). -digit_weight( 0x096F, 9). -digit_weight( 0x09EF, 9). -digit_weight( 0x0A6F, 9). -digit_weight( 0x0AEF, 9). -digit_weight( 0x0B6F, 9). -digit_weight( 0x0BEF, 9). -digit_weight( 0x0C6F, 9). -digit_weight( 0x0CEF, 9). -digit_weight( 0x0D6F, 9). -digit_weight( 0x0DEF, 9). -digit_weight( 0x0E59, 9). -digit_weight( 0x0ED9, 9). -digit_weight( 0x0F29, 9). -digit_weight( 0x1049, 9). -digit_weight( 0x1099, 9). -digit_weight( 0x1371, 9). -digit_weight( 0x17E9, 9). -digit_weight( 0x17F9, 9). -digit_weight( 0x1819, 9). -digit_weight( 0x194F, 9). -digit_weight( 0x19D9, 9). -digit_weight( 0x1A89, 9). -digit_weight( 0x1A99, 9). -digit_weight( 0x1B59, 9). -digit_weight( 0x1BB9, 9). -digit_weight( 0x1C49, 9). -digit_weight( 0x1C59, 9). -digit_weight( 0x2079, 9). -digit_weight( 0x2089, 9). -digit_weight( 0x2168, 9). -digit_weight( 0x2178, 9). -digit_weight( 0x2468, 9). -digit_weight( 0x247C, 9). -digit_weight( 0x2490, 9). -digit_weight( 0x24FD, 9). -digit_weight( 0x277E, 9). -digit_weight( 0x2788, 9). -digit_weight( 0x2792, 9). -digit_weight( 0x3029, 9). -digit_weight( 0x3228, 9). -digit_weight( 0x3288, 9). -digit_weight( 0x4E5D, 9). -digit_weight( 0x5EFE, 9). -digit_weight( 0x7396, 9). -digit_weight( 0xA629, 9). -digit_weight( 0xA6EE, 9). -digit_weight( 0xA8D9, 9). -digit_weight( 0xA909, 9). -digit_weight( 0xA9D9, 9). -digit_weight( 0xA9F9, 9). -digit_weight( 0xAA59, 9). -digit_weight( 0xABF9, 9). -digit_weight( 0xFF19, 9). -digit_weight( 0x1010F, 9). -digit_weight( 0x102E9, 9). -digit_weight( 0x104A9, 9). -digit_weight( 0x109C8, 9). -digit_weight( 0x10E68, 9). -digit_weight( 0x1105A, 9). -digit_weight( 0x1106F, 9). -digit_weight( 0x110F9, 9). -digit_weight( 0x1113F, 9). -digit_weight( 0x111D9, 9). -digit_weight( 0x111E9, 9). -digit_weight( 0x112F9, 9). -digit_weight( 0x114D9, 9). -digit_weight( 0x11659, 9). -digit_weight( 0x116C9, 9). -digit_weight( 0x11739, 9). -digit_weight( 0x118E9, 9). -digit_weight( 0x12407, 9). -digit_weight( 0x1240E, 9). -digit_weight( 0x12414, 9). -digit_weight( 0x1241D, 9). -digit_weight( 0x1242B, 9). -digit_weight( 0x12446, 0x12449, 9). -digit_weight( 0x1246E, 9). -digit_weight( 0x16A69, 9). -digit_weight( 0x16B59, 9). -digit_weight( 0x1D368, 9). -digit_weight( 0x1D7D7, 9). -digit_weight( 0x1D7E1, 9). -digit_weight( 0x1D7EB, 9). -digit_weight( 0x1D7F5, 9). -digit_weight( 0x1D7FF, 9). -digit_weight( 0x1E8CF, 9). -digit_weight( 0x1F10A, 9). -digit_weight( 0x2F890, 9). -digit_weight( 0x0BF0, 10). -digit_weight( 0x0D70, 10). -digit_weight( 0x1372, 10). -digit_weight( 0x2169, 10). -digit_weight( 0x2179, 10). -digit_weight( 0x2469, 10). -digit_weight( 0x247D, 10). -digit_weight( 0x2491, 10). -digit_weight( 0x24FE, 10). -digit_weight( 0x277F, 10). -digit_weight( 0x2789, 10). -digit_weight( 0x2793, 10). -digit_weight( 0x3038, 10). -digit_weight( 0x3229, 10). -digit_weight( 0x3248, 10). -digit_weight( 0x3289, 10). -digit_weight( 0x4EC0, 10). -digit_weight( 0x5341, 10). -digit_weight( 0x62FE, 10). -digit_weight( 0xF973, 10). -digit_weight( 0xF9FD, 10). -digit_weight( 0x10110, 10). -digit_weight( 0x10149, 10). -digit_weight( 0x10150, 10). -digit_weight( 0x10157, 10). -digit_weight( 0x10160, 0x10164, 10). -digit_weight( 0x102EA, 10). -digit_weight( 0x10322, 10). -digit_weight( 0x103D3, 10). -digit_weight( 0x1085B, 10). -digit_weight( 0x1087E, 10). -digit_weight( 0x108AD, 10). -digit_weight( 0x108FD, 10). -digit_weight( 0x10917, 10). -digit_weight( 0x109C9, 10). -digit_weight( 0x10A44, 10). -digit_weight( 0x10A9E, 10). -digit_weight( 0x10AED, 10). -digit_weight( 0x10B5C, 10). -digit_weight( 0x10B7C, 10). -digit_weight( 0x10BAD, 10). -digit_weight( 0x10CFC, 10). -digit_weight( 0x10E69, 10). -digit_weight( 0x1105B, 10). -digit_weight( 0x111EA, 10). -digit_weight( 0x1173A, 10). -digit_weight( 0x118EA, 10). -digit_weight( 0x16B5B, 10). -digit_weight( 0x1D369, 10). -digit_weight( 0x216A, 11). -digit_weight( 0x217A, 11). -digit_weight( 0x246A, 11). -digit_weight( 0x247E, 11). -digit_weight( 0x2492, 11). -digit_weight( 0x24EB, 11). -digit_weight( 0x216B, 12). -digit_weight( 0x217B, 12). -digit_weight( 0x246B, 12). -digit_weight( 0x247F, 12). -digit_weight( 0x2493, 12). -digit_weight( 0x24EC, 12). -digit_weight( 0x246C, 13). -digit_weight( 0x2480, 13). -digit_weight( 0x2494, 13). -digit_weight( 0x24ED, 13). -digit_weight( 0x246D, 14). -digit_weight( 0x2481, 14). -digit_weight( 0x2495, 14). -digit_weight( 0x24EE, 14). -digit_weight( 0x246E, 15). -digit_weight( 0x2482, 15). -digit_weight( 0x2496, 15). -digit_weight( 0x24EF, 15). -digit_weight( 0x09F9, 16). -digit_weight( 0x246F, 16). -digit_weight( 0x2483, 16). -digit_weight( 0x2497, 16). -digit_weight( 0x24F0, 16). -digit_weight( 0x16EE, 17). -digit_weight( 0x2470, 17). -digit_weight( 0x2484, 17). -digit_weight( 0x2498, 17). -digit_weight( 0x24F1, 17). -digit_weight( 0x16EF, 18). -digit_weight( 0x2471, 18). -digit_weight( 0x2485, 18). -digit_weight( 0x2499, 18). -digit_weight( 0x24F2, 18). -digit_weight( 0x16F0, 19). -digit_weight( 0x2472, 19). -digit_weight( 0x2486, 19). -digit_weight( 0x249A, 19). -digit_weight( 0x24F3, 19). -digit_weight( 0x1373, 20). -digit_weight( 0x2473, 20). -digit_weight( 0x2487, 20). -digit_weight( 0x249B, 20). -digit_weight( 0x24F4, 20). -digit_weight( 0x3039, 20). -digit_weight( 0x3249, 20). -digit_weight( 0x5344, 20). -digit_weight( 0x5EFF, 20). -digit_weight( 0x10111, 20). -digit_weight( 0x102EB, 20). -digit_weight( 0x103D4, 20). -digit_weight( 0x1085C, 20). -digit_weight( 0x1087F, 20). -digit_weight( 0x108AE, 20). -digit_weight( 0x108FE, 20). -digit_weight( 0x10918, 20). -digit_weight( 0x109CA, 20). -digit_weight( 0x10A45, 20). -digit_weight( 0x10A9F, 20). -digit_weight( 0x10AEE, 20). -digit_weight( 0x10B5D, 20). -digit_weight( 0x10B7D, 20). -digit_weight( 0x10BAE, 20). -digit_weight( 0x10E6A, 20). -digit_weight( 0x1105C, 20). -digit_weight( 0x111EB, 20). -digit_weight( 0x1173B, 20). -digit_weight( 0x118EB, 20). -digit_weight( 0x1D36A, 20). -digit_weight( 0x3251, 21). -digit_weight( 0x3252, 22). -digit_weight( 0x3253, 23). -digit_weight( 0x3254, 24). -digit_weight( 0x3255, 25). -digit_weight( 0x3256, 26). -digit_weight( 0x3257, 27). -digit_weight( 0x3258, 28). -digit_weight( 0x3259, 29). -digit_weight( 0x1374, 30). -digit_weight( 0x303A, 30). -digit_weight( 0x324A, 30). -digit_weight( 0x325A, 30). -digit_weight( 0x5345, 30). -digit_weight( 0x10112, 30). -digit_weight( 0x10165, 30). -digit_weight( 0x102EC, 30). -digit_weight( 0x109CB, 30). -digit_weight( 0x10E6B, 30). -digit_weight( 0x1105D, 30). -digit_weight( 0x111EC, 30). -digit_weight( 0x118EC, 30). -digit_weight( 0x1D36B, 30). -digit_weight( 0x20983, 30). -digit_weight( 0x325B, 31). -digit_weight( 0x325C, 32). -digit_weight( 0x325D, 33). -digit_weight( 0x325E, 34). -digit_weight( 0x325F, 35). -digit_weight( 0x32B1, 36). -digit_weight( 0x32B2, 37). -digit_weight( 0x32B3, 38). -digit_weight( 0x32B4, 39). -digit_weight( 0x1375, 40). -digit_weight( 0x324B, 40). -digit_weight( 0x32B5, 40). -digit_weight( 0x534C, 40). -digit_weight( 0x10113, 40). -digit_weight( 0x102ED, 40). -digit_weight( 0x109CC, 40). -digit_weight( 0x10E6C, 40). -digit_weight( 0x1105E, 40). -digit_weight( 0x111ED, 40). -digit_weight( 0x118ED, 40). -digit_weight( 0x12467, 40). -digit_weight( 0x1D36C, 40). -digit_weight( 0x2098C, 40). -digit_weight( 0x2099C, 40). -digit_weight( 0x32B6, 41). -digit_weight( 0x32B7, 42). -digit_weight( 0x32B8, 43). -digit_weight( 0x32B9, 44). -digit_weight( 0x32BA, 45). -digit_weight( 0x32BB, 46). -digit_weight( 0x32BC, 47). -digit_weight( 0x32BD, 48). -digit_weight( 0x32BE, 49). -digit_weight( 0x1376, 50). -digit_weight( 0x216C, 50). -digit_weight( 0x217C, 50). -digit_weight( 0x2186, 50). -digit_weight( 0x324C, 50). -digit_weight( 0x32BF, 50). -digit_weight( 0x10114, 50). -digit_weight( 0x10144, 50). -digit_weight( 0x1014A, 50). -digit_weight( 0x10151, 50). -digit_weight( 0x10166, 0x10169, 50). -digit_weight( 0x10174, 50). -digit_weight( 0x102EE, 50). -digit_weight( 0x10323, 50). -digit_weight( 0x109CD, 50). -digit_weight( 0x10A7E, 50). -digit_weight( 0x10CFD, 50). -digit_weight( 0x10E6D, 50). -digit_weight( 0x1105F, 50). -digit_weight( 0x111EE, 50). -digit_weight( 0x118EE, 50). -digit_weight( 0x12468, 50). -digit_weight( 0x1D36D, 50). -digit_weight( 0x1377, 60). -digit_weight( 0x324D, 60). -digit_weight( 0x10115, 60). -digit_weight( 0x102EF, 60). -digit_weight( 0x109CE, 60). -digit_weight( 0x10E6E, 60). -digit_weight( 0x11060, 60). -digit_weight( 0x111EF, 60). -digit_weight( 0x118EF, 60). -digit_weight( 0x1D36E, 60). -digit_weight( 0x1378, 70). -digit_weight( 0x324E, 70). -digit_weight( 0x10116, 70). -digit_weight( 0x102F0, 70). -digit_weight( 0x109CF, 70). -digit_weight( 0x10E6F, 70). -digit_weight( 0x11061, 70). -digit_weight( 0x111F0, 70). -digit_weight( 0x118F0, 70). -digit_weight( 0x1D36F, 70). -digit_weight( 0x1379, 80). -digit_weight( 0x324F, 80). -digit_weight( 0x10117, 80). -digit_weight( 0x102F1, 80). -digit_weight( 0x10E70, 80). -digit_weight( 0x11062, 80). -digit_weight( 0x111F1, 80). -digit_weight( 0x118F1, 80). -digit_weight( 0x1D370, 80). -digit_weight( 0x137A, 90). -digit_weight( 0x10118, 90). -digit_weight( 0x102F2, 90). -digit_weight( 0x10341, 90). -digit_weight( 0x10E71, 90). -digit_weight( 0x11063, 90). -digit_weight( 0x111F2, 90). -digit_weight( 0x118F2, 90). -digit_weight( 0x1D371, 90). -digit_weight( 0x0BF1, 100). -digit_weight( 0x0D71, 100). -digit_weight( 0x137B, 100). -digit_weight( 0x216D, 100). -digit_weight( 0x217D, 100). -digit_weight( 0x4F70, 100). -digit_weight( 0x767E, 100). -digit_weight( 0x964C, 100). -digit_weight( 0x10119, 100). -digit_weight( 0x1014B, 100). -digit_weight( 0x10152, 100). -digit_weight( 0x1016A, 100). -digit_weight( 0x102F3, 100). -digit_weight( 0x103D5, 100). -digit_weight( 0x1085D, 100). -digit_weight( 0x108AF, 100). -digit_weight( 0x108FF, 100). -digit_weight( 0x10919, 100). -digit_weight( 0x109D2, 100). -digit_weight( 0x10A46, 100). -digit_weight( 0x10AEF, 100). -digit_weight( 0x10B5E, 100). -digit_weight( 0x10B7E, 100). -digit_weight( 0x10BAF, 100). -digit_weight( 0x10CFE, 100). -digit_weight( 0x10E72, 100). -digit_weight( 0x11064, 100). -digit_weight( 0x111F3, 100). -digit_weight( 0x16B5C, 100). -digit_weight( 0x1011A, 200). -digit_weight( 0x102F4, 200). -digit_weight( 0x109D3, 200). -digit_weight( 0x10E73, 200). -digit_weight( 0x1011B, 300). -digit_weight( 0x1016B, 300). -digit_weight( 0x102F5, 300). -digit_weight( 0x109D4, 300). -digit_weight( 0x10E74, 300). -digit_weight( 0x1011C, 400). -digit_weight( 0x102F6, 400). -digit_weight( 0x109D5, 400). -digit_weight( 0x10E75, 400). -digit_weight( 0x216E, 500). -digit_weight( 0x217E, 500). -digit_weight( 0x1011D, 500). -digit_weight( 0x10145, 500). -digit_weight( 0x1014C, 500). -digit_weight( 0x10153, 500). -digit_weight( 0x1016C, 0x10170, 500). -digit_weight( 0x102F7, 500). -digit_weight( 0x109D6, 500). -digit_weight( 0x10E76, 500). -digit_weight( 0x1011E, 600). -digit_weight( 0x102F8, 600). -digit_weight( 0x109D7, 600). -digit_weight( 0x10E77, 600). -digit_weight( 0x1011F, 700). -digit_weight( 0x102F9, 700). -digit_weight( 0x109D8, 700). -digit_weight( 0x10E78, 700). -digit_weight( 0x10120, 800). -digit_weight( 0x102FA, 800). -digit_weight( 0x109D9, 800). -digit_weight( 0x10E79, 800). -digit_weight( 0x10121, 900). -digit_weight( 0x102FB, 900). -digit_weight( 0x1034A, 900). -digit_weight( 0x109DA, 900). -digit_weight( 0x10E7A, 900). -digit_weight( 0x0BF2, 1000). -digit_weight( 0x0D72, 1000). -digit_weight( 0x216F, 1000). -digit_weight( 0x217F, 0x2180, 1000). -digit_weight( 0x4EDF, 1000). -digit_weight( 0x5343, 1000). -digit_weight( 0x9621, 1000). -digit_weight( 0x10122, 1000). -digit_weight( 0x1014D, 1000). -digit_weight( 0x10154, 1000). -digit_weight( 0x10171, 1000). -digit_weight( 0x1085E, 1000). -digit_weight( 0x109DB, 1000). -digit_weight( 0x10A47, 1000). -digit_weight( 0x10B5F, 1000). -digit_weight( 0x10B7F, 1000). -digit_weight( 0x10CFF, 1000). -digit_weight( 0x11065, 1000). -digit_weight( 0x111F4, 1000). -digit_weight( 0x10123, 2000). -digit_weight( 0x109DC, 2000). -digit_weight( 0x10124, 3000). -digit_weight( 0x109DD, 3000). -digit_weight( 0x10125, 4000). -digit_weight( 0x109DE, 4000). -digit_weight( 0x2181, 5000). -digit_weight( 0x10126, 5000). -digit_weight( 0x10146, 5000). -digit_weight( 0x1014E, 5000). -digit_weight( 0x10172, 5000). -digit_weight( 0x109DF, 5000). -digit_weight( 0x10127, 6000). -digit_weight( 0x109E0, 6000). -digit_weight( 0x10128, 7000). -digit_weight( 0x109E1, 7000). -digit_weight( 0x10129, 8000). -digit_weight( 0x109E2, 8000). -digit_weight( 0x1012A, 9000). -digit_weight( 0x109E3, 9000). -digit_weight( 0x137C, 10000). -digit_weight( 0x2182, 10000). -digit_weight( 0x4E07, 10000). -digit_weight( 0x842C, 10000). -digit_weight( 0x1012B, 10000). -digit_weight( 0x10155, 10000). -digit_weight( 0x1085F, 10000). -digit_weight( 0x109E4, 10000). -digit_weight( 0x16B5D, 10000). -digit_weight( 0x1012C, 20000). -digit_weight( 0x109E5, 20000). -digit_weight( 0x1012D, 30000). -digit_weight( 0x109E6, 30000). -digit_weight( 0x1012E, 40000). -digit_weight( 0x109E7, 40000). -digit_weight( 0x2187, 50000). -digit_weight( 0x1012F, 50000). -digit_weight( 0x10147, 50000). -digit_weight( 0x10156, 50000). -digit_weight( 0x109E8, 50000). -digit_weight( 0x10130, 60000). -digit_weight( 0x109E9, 60000). -digit_weight( 0x10131, 70000). -digit_weight( 0x109EA, 70000). -digit_weight( 0x10132, 80000). -digit_weight( 0x109EB, 80000). -digit_weight( 0x10133, 90000). -digit_weight( 0x109EC, 90000). -digit_weight( 0x2188, 100000). -digit_weight( 0x109ED, 100000). -digit_weight( 0x109EE, 200000). -digit_weight( 0x12432, 216000). -digit_weight( 0x109EF, 300000). -digit_weight( 0x109F0, 400000). -digit_weight( 0x12433, 432000). -digit_weight( 0x109F1, 500000). -digit_weight( 0x109F2, 600000). -digit_weight( 0x109F3, 700000). -digit_weight( 0x109F4, 800000). -digit_weight( 0x109F5, 900000). -digit_weight( 0x16B5E, 1000000). -digit_weight( 0x4EBF, 100000000). -digit_weight( 0x5104, 100000000). -digit_weight( 0x16B5F, 100000000). -digit_weight( 0x16B60, 10000000000). -digit_weight( 0x5146, 1000000000000). -digit_weight( 0x16B61, 1000000000000). - -/* brackets and matching characters, obtained from - -http://www.unicode.org/Public/UCD/latest/ucd/BidiBrackets.txt - -by running - - grep '[ \t]\#' BidiBrackets.txt | awk '{ print "brackets( 0x" $1 ", 0x"$2 ")." }' |sed 's/;//g' -*/ - -paren_paren( 0x0028, 0x0029). -paren_paren( 0x0029, 0x0028). -paren_paren( 0x005B, 0x005D). -paren_paren( 0x005D, 0x005B). -paren_paren( 0x007B, 0x007D). -paren_paren( 0x007D, 0x007B). -paren_paren( 0x0F3A, 0x0F3B). -paren_paren( 0x0F3B, 0x0F3A). -paren_paren( 0x0F3C, 0x0F3D). -paren_paren( 0x0F3D, 0x0F3C). -paren_paren( 0x169B, 0x169C). -paren_paren( 0x169C, 0x169B). -paren_paren( 0x2045, 0x2046). -paren_paren( 0x2046, 0x2045). -paren_paren( 0x207D, 0x207E). -paren_paren( 0x207E, 0x207D). -paren_paren( 0x208D, 0x208E). -paren_paren( 0x208E, 0x208D). -paren_paren( 0x2308, 0x2309). -paren_paren( 0x2309, 0x2308). -paren_paren( 0x230A, 0x230B). -paren_paren( 0x230B, 0x230A). -paren_paren( 0x2329, 0x232A). -paren_paren( 0x232A, 0x2329). -paren_paren( 0x2768, 0x2769). -paren_paren( 0x2769, 0x2768). -paren_paren( 0x276A, 0x276B). -paren_paren( 0x276B, 0x276A). -paren_paren( 0x276C, 0x276D). -paren_paren( 0x276D, 0x276C). -paren_paren( 0x276E, 0x276F). -paren_paren( 0x276F, 0x276E). -paren_paren( 0x2770, 0x2771). -paren_paren( 0x2771, 0x2770). -paren_paren( 0x2772, 0x2773). -paren_paren( 0x2773, 0x2772). -paren_paren( 0x2774, 0x2775). -paren_paren( 0x2775, 0x2774). -paren_paren( 0x27C5, 0x27C6). -paren_paren( 0x27C6, 0x27C5). -paren_paren( 0x27E6, 0x27E7). -paren_paren( 0x27E7, 0x27E6). -paren_paren( 0x27E8, 0x27E9). -paren_paren( 0x27E9, 0x27E8). -paren_paren( 0x27EA, 0x27EB). -paren_paren( 0x27EB, 0x27EA). -paren_paren( 0x27EC, 0x27ED). -paren_paren( 0x27ED, 0x27EC). -paren_paren( 0x27EE, 0x27EF). -paren_paren( 0x27EF, 0x27EE). -paren_paren( 0x2983, 0x2984). -paren_paren( 0x2984, 0x2983). -paren_paren( 0x2985, 0x2986). -paren_paren( 0x2986, 0x2985). -paren_paren( 0x2987, 0x2988). -paren_paren( 0x2988, 0x2987). -paren_paren( 0x2989, 0x298A). -paren_paren( 0x298A, 0x2989). -paren_paren( 0x298B, 0x298C). -paren_paren( 0x298C, 0x298B). -paren_paren( 0x298D, 0x2990). -paren_paren( 0x298E, 0x298F). -paren_paren( 0x298F, 0x298E). -paren_paren( 0x2990, 0x298D). -paren_paren( 0x2991, 0x2992). -paren_paren( 0x2992, 0x2991). -paren_paren( 0x2993, 0x2994). -paren_paren( 0x2994, 0x2993). -paren_paren( 0x2995, 0x2996). -paren_paren( 0x2996, 0x2995). -paren_paren( 0x2997, 0x2998). -paren_paren( 0x2998, 0x2997). -paren_paren( 0x29D8, 0x29D9). -paren_paren( 0x29D9, 0x29D8). -paren_paren( 0x29DA, 0x29DB). -paren_paren( 0x29DB, 0x29DA). -paren_paren( 0x29FC, 0x29FD). -paren_paren( 0x29FD, 0x29FC). -paren_paren( 0x2E22, 0x2E23). -paren_paren( 0x2E23, 0x2E22). -paren_paren( 0x2E24, 0x2E25). -paren_paren( 0x2E25, 0x2E24). -paren_paren( 0x2E26, 0x2E27). -paren_paren( 0x2E27, 0x2E26). -paren_paren( 0x2E28, 0x2E29). -paren_paren( 0x2E29, 0x2E28). -paren_paren( 0x3008, 0x3009). -paren_paren( 0x3009, 0x3008). -paren_paren( 0x300A, 0x300B). -paren_paren( 0x300B, 0x300A). -paren_paren( 0x300C, 0x300D). -paren_paren( 0x300D, 0x300C). -paren_paren( 0x300E, 0x300F). -paren_paren( 0x300F, 0x300E). -paren_paren( 0x3010, 0x3011). -paren_paren( 0x3011, 0x3010). -paren_paren( 0x3014, 0x3015). -paren_paren( 0x3015, 0x3014). -paren_paren( 0x3016, 0x3017). -paren_paren( 0x3017, 0x3016). -paren_paren( 0x3018, 0x3019). -paren_paren( 0x3019, 0x3018). -paren_paren( 0x301A, 0x301B). -paren_paren( 0x301B, 0x301A). -paren_paren( 0xFE59, 0xFE5A). -paren_paren( 0xFE5A, 0xFE59). -paren_paren( 0xFE5B, 0xFE5C). -paren_paren( 0xFE5C, 0xFE5B). -paren_paren( 0xFE5D, 0xFE5E). -paren_paren( 0xFE5E, 0xFE5D). -paren_paren( 0xFF08, 0xFF09). -paren_paren( 0xFF09, 0xFF08). -paren_paren( 0xFF3B, 0xFF3D). -paren_paren( 0xFF3D, 0xFF3B). -paren_paren( 0xFF5B, 0xFF5D). -paren_paren( 0xFF5D, 0xFF5B). -paren_paren( 0xFF5F, 0xFF60). -paren_paren( 0xFF60, 0xFF5F). -paren_paren( 0xFF62, 0xFF63). -paren_paren( 0xFF63, 0xFF62). - -/** @} */ diff --git a/packages/python/swig/yap4py/prolog/os/edio.yap b/packages/python/swig/yap4py/prolog/os/edio.yap deleted file mode 100644 index d4953a05a..000000000 --- a/packages/python/swig/yap4py/prolog/os/edio.yap +++ /dev/null @@ -1,173 +0,0 @@ -% -% Edinburgh IO. -/** - * @file edio.yap - * @author VITOR SANTOS COSTA - * @date Wed Jan 20 01:07:02 2016 - * - * @brief Input/Output according to the DEC-10 Prolog. PLease consider using the ISO - * standard predicates for new code. - * - * -*/ - - - % - -/** @pred see(+ _S_) - - -If _S_ is a currently opened input stream then it is assumed to be -the current input stream. If _S_ is an atom it is taken as a -filename. If there is no input stream currently associated with it, then -it is opened for input, and the new input stream thus created becomes -the current input stream. If it is not possible to open the file, an -error occurs. If there is a single opened input stream currently -associated with the file, it becomes the current input stream; if there -are more than one in that condition, then one of them is chosen. - -When _S_ is a stream not currently opened for input, an error may be -reported, depending on the state of the `file_errors` flag. If - _S_ is neither a stream nor an atom the predicates just fails. - - -*/ -see(user) :- !, set_input(user_input). -see(F) :- var(F), !, - '$do_error'(instantiation_error,see(F)). -see(F) :- current_input(Stream), - '$user_file_name'(Stream,F). -see(F) :- current_stream(_,read,Stream), '$user_file_name'(Stream,F), !, - set_input(Stream). -see(Stream) :- '$stream'(Stream), current_stream(_,read,Stream), !, - set_input(Stream). -see(F) :- open(F,read,Stream), set_input(Stream). - -/** @pred seeing(- _S_) - - -The current input stream is unified with _S_. - - -*/ -seeing(File) :- current_input(Stream), - stream_property(Stream,file_name(NFile)), - ( - stream_property(user_input,file_name(NFile)) - -> - File = user - ; - NFile = File - ). - -/** @pred seen - - -Closes the current input stream, as opened by see/1. Standard input -stream goes to the original ùser_input`. - - */ -seen :- current_input(Stream), close(Stream), set_input(user). - -/** @pred tell(+ _S_) - - -If _S_ is a currently opened stream for output, it becomes the -current output stream. If _S_ is an atom it is taken to be a -filename. If there is no output stream currently associated with it, -then it is opened for output, and the new output stream created becomes -the current output stream. Existing files are clobbered, use append/1 to ext end a file. - If it is not possible to open the file, an -error occurs. If there is a single opened output stream currently -associated with the file, then it becomes the current output stream; if -there are more than one in that condition, one of them is chosen. - -Whenever _S_ is a stream not currently opened for output, an error -may be reported, depending on the state of the file_errors flag. The -predicate just fails, if _S_ is neither a stream nor an atom. - - -*/ -tell(user) :- !, set_output(user_output). -tell(F) :- var(F), !, - '$do_error'(instantiation_error,tell(F)). -tell(F) :- - current_output(Stream), - stream_property(Stream,file_name(F)), - !. -tell(F) :- - current_stream(_,write,Stream), - '$user_file_name'(Stream, F), !, - set_output(Stream). -tell(Stream) :- - '$stream'(Stream), - current_stream(_,write,Stream), !, - set_output(Stream). -tell(F) :- - open(F,write,Stream), - set_output(Stream). - - /** @pred append(+ _S_) - - - If _S_ is a currently opened stream for output, it becomes the - current output stream. If _S_ is an atom it is taken to be a - filename. If there is no output stream currently associated with it, - then it is opened for output in *append* mode, that is, by adding new data to the end of the file. - The new output stream created becomes - the current output stream. If it is not possible to open the file, an - error occurs. If there is a single opened output stream currently - associated with the file, then it becomes the current output stream; if - there are more than one in that condition, one of them is chosen. - - Whenever _S_ is a stream not currently opened for output, an error - may be reported, depending on the state of the file_errors flag. The - predicate just fails, if _S_ is neither a stream nor an atom. - - - */ - tell(user) :- !, set_output(user_output). - tell(F) :- var(F), !, - '$do_error'(instantiation_error,tell(F)). - tell(F) :- - current_output(Stream), - stream_property(Stream,file_name(F)), - !. - tell(F) :- - current_stream(_,write,Stream), - '$user_file_name'(Stream, F), !, - set_output(Stream). - tell(Stream) :- - '$stream'(Stream), - current_stream(_,write,Stream), !, - set_output(Stream). - tell(F) :- - open(F,write,Stream), - set_output(Stream). - -/** @pred telling(- _S_) - - -The current output stream is unified with _S_. - - -*/ -telling(File) :- - current_output(Stream), - stream_property(Stream,file_name(NFile)), - ( stream_property(user_output,file_name(NFile)) -> File = user ; File = NFile ). - -/** @pred told - - -Closes the current output stream, and the user's terminal becomes again -the current output stream. It is important to remember to close streams -after having finished using them, as the maximum number of -simultaneously opened streams is 17. - - -*/ -told :- current_output(Stream), - !, - set_output(user_output), - close(Stream). diff --git a/packages/python/swig/yap4py/prolog/pl/absf.yap b/packages/python/swig/yap4py/prolog/pl/absf.yap deleted file mode 100644 index 3c2332844..000000000 --- a/packages/python/swig/yap4py/prolog/pl/absf.yap +++ /dev/null @@ -1,561 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2014 * -* * -*************************************************************************/ - -/** - - @file absf.yap - @author L.Damas, V.S.Costa - - @defgroup AbsoluteFileName File Name Resolution - @ingroup builtins - - Support for file name resolution through absolute_file_name/3 and - friends. These utility built-ins describe a list of directories that - are used by load_files/2 to search. They include pre-compiled paths - plus user-defined directories, directories based on environment - variables and registry information to search for files. - -@{ - -*/ -:- system_module( absf, [absolute_file_name/2, - absolute_file_name/3, - add_to_path/1, - add_to_path/2, - path/1, - remove_from_path/1], ['$full_filename'/3, - '$system_library_directories'/2]). - - -:- use_system_module( '$_boot', ['$system_catch'/4]). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -:- use_system_module( '$_lists', [member/2]). - -/** - -@pred absolute_file_name( -File:atom, +Path:atom, +Options:list) is nondet - -_Options_ is a list of options to guide the conversion: - - - extensions(+ _ListOfExtensions_) - - List of file-name suffixes to add to try adding to the file. The - Default is the empty suffix, `''`. For each extension, - absolute_file_name/3 will first add the extension and then verify - the conditions imposed by the other options. If the condition - fails, the next extension of the list is tried. Extensions may - be specified both with dot, as `.ext`, or without, as plain - `ext`. - - - relative_to(+ _FileOrDir_ ) - - Resolve the path relative to the given directory or directory the - holding the given file. Without this option, paths are resolved - relative to the working directory (see working_directory/2) or, - if _Spec_ is atomic and absolute_file_name/3 is executed - in a directive, it uses the current source-file as reference. - - - access(+ _Mode_ ) - - Imposes the condition access_file( _File_ , _Mode_ ). _Mode_ is one of `read`, `write`, `append`, `exist` or - `none` (default). - - See also access_file/2. - - - file_type(+ _Type_ ) - - Defines suffixes matching one of several pre-specified type of files. Default mapping is as follows: - - 1. `txt` implies `[ '' ]`, - - 2. `prolog` implies `['.yap', '.pl', '.prolog', '']`, - - 3. `executable` implies `['.so', ',dylib', '.dll']` depending on the Operating system, - - 4. `qly` implies `['.qly', '']`, - - 5. `directory` implies `['']`, - - 6. The file-type `source` is an alias for `prolog` designed to support compatibility with SICStus Prolog. See also prolog_file_type/2. - - Notice that this predicate only - returns non-directories, unless the option `file_type(directory)` is - specified, or unless `access(none)`. - - - file_errors(`fail`/`error`) - - If `error` (default), throw `existence_error` exception - if the file cannot be found. If `fail`, stay silent. - - - solutions(`first`/`all`) - - If `first` (default), commit to the first solution. Otherwise - absolute_file_name will enumerate all solutions via backtracking. - - - expand(`true`/`false`) - - If `true` (default is `false`) and _Spec_ is atomic, call - expand_file_name/2 followed by member/2 on _Spec_ before - proceeding. This is originally a SWI-Prolog extension, but - whereas SWI-Prolog implements its own conventions, YAP uses the - shell's `glob` primitive. - - Notice that in `glob` mode YAP will fail if it cannot find a matching file, as `glob` - implicitely tests for existence when checking for patterns. - - - glob(`Pattern`) - - If _Pattern_ is atomic, add the pattern as a suffix to the current expansion, and call - expand_file_name/2 followed by member/2 on the result. This is originally a SICStus Prolog exception. - - Both `glob` and `expand` rely on the same underlying - mechanism. YAP gives preference to `glob`. - - - verbose_file_search(`true`/`false`) - - If `true` (default is `false`) output messages during - search. This is often helpful when debugging. Corresponds to the - SWI-Prolog flag `verbose_file_search` (also available in YAP). - - -Compatibility considerations to common argument-order in ISO as well -as SICStus absolute_file_name/3 forced us to be flexible here. -If the last argument is a list and the second not, the arguments are -swapped, thus the call -~~~~~~~~~~~~ -?- absolute_file_name( 'pl/absf.yap', [], Path) -~~~~~~~~~~~~ - is valid as well. -*/ - -absolute_file_name(File,TrueFileName,Opts) :- - ( var(TrueFileName) -> - true ; - atom(TrueFileName), TrueFileName \= [] - ), - !, - absolute_file_name(File,Opts,TrueFileName). -absolute_file_name(File,Opts,TrueFileName) :- - '$absolute_file_name'(File,Opts,TrueFileName,absolute_file_name(File,Opts,TrueFileName)). - -/** - @pred absolute_file_name(+Name:atom,+Path:atom) is nondet - - Converts the given file specification into an absolute path, using default options. See absolute_file_name/3 for details on the options. -*/ -absolute_file_name(V,Out) :- var(V), - !, % absolute_file_name needs commenting. - '$do_error'(instantiation_error, absolute_file_name(V, Out)). -absolute_file_name(user,user) :- !. -absolute_file_name(File0,File) :- - '$absolute_file_name'(File0,[access(none),file_type(txt),file_errors(fail),solutions(first)],File,absolute_file_name(File0,File)). - -'$full_filename'(F0, F, G) :- - '$absolute_file_name'(F0,[access(read), - file_type(prolog), - file_errors(fail), - solutions(first), - expand(true)],F,G). - -'$absolute_file_name'(File,LOpts,TrueFileName, G) :- - % must_be_of_type( atom, File ), - ( var(File) -> instantiation_error(File) ; true), - abs_file_parameters(LOpts,Opts), - current_prolog_flag(open_expands_filename, OldF), - current_prolog_flag( fileerrors, PreviousFileErrors ), - current_prolog_flag( verbose_file_search, PreviousVerbose ), - get_abs_file_parameter( verbose_file_search, Opts,Verbose ), - get_abs_file_parameter( expand, Opts, Expand ), - set_prolog_flag( verbose_file_search, Verbose ), - get_abs_file_parameter( file_errors, Opts, FErrors ), - get_abs_file_parameter( solutions, Opts, First ), - ( FErrors == fail -> FileErrors = false ; FileErrors = true ), - set_prolog_flag( fileerrors, FileErrors ), - set_prolog_flag(file_name_variables, Expand), - '$absf_trace'(File), - '$absf_trace_options'(LOpts), - HasSol = t(no), - ( - % look for solutions - '$find_in_path'(File, Opts,TrueFileName), - ( (First == first -> ! ; nb_setarg(1, HasSol, yes) ), - set_prolog_flag( fileerrors, PreviousFileErrors ), - set_prolog_flag( open_expands_filename, OldF), - set_prolog_flag( verbose_file_search, PreviousVerbose ), - '$absf_trace'(' |------- found ~a', [TrueFileName]) - ; - set_prolog_flag( fileerrors, FileErrors ), - set_prolog_flag( verbose_file_search, Verbose ), - set_prolog_flag( file_name_variables, Expand ), - '$absf_trace'(' |------- restarted search for ~a', [File]), - fail - ) - ; - % finished - % stop_low_level_trace, - '$absf_trace'(' !------- failed.', []), - set_prolog_flag( fileerrors, PreviousFileErrors ), - set_prolog_flag( verbose_file_search, PreviousVerbose ), - set_prolog_flag(file_name_variables, OldF), - % check if no solution - arg(1,HasSol,no), - FileErrors = error, - '$do_error'(existence_error(file,File),G) - ). - -% This sequence must be followed: -% user and user_input are special; -% library(F) must check library_directories -% T(F) must check file_search_path -% all must try search in path -'$find_in_path'(user,_,user_input) :- !. -'$find_in_path'(user_input,_,user_input) :- !. -'$find_in_path'(user_output,_,user_ouput) :- !. -'$find_in_path'(user_error,_,user_error) :- !. -'$find_in_path'(Name, Opts, File) :- -% ( atom(Name) -> true ; start_low_level_trace ), - get_abs_file_parameter( file_type, Opts, Type ), - get_abs_file_parameter( access, Opts, Access ), - get_abs_file_parameter( expand, Opts, Expand ), - '$absf_trace'('start with ~w', [Name]), - '$core_file_name'(Name, Opts, CorePath, []), - '$absf_trace'(' after name/library unfolding: ~w', [Name]), - '$variable_expansion'(CorePath, Opts,ExpandedPath), - '$absf_trace'(' after environment variable expansion: ~s', [ExpandedPath]), - '$prefix'(ExpandedPath, Opts, Path , []), - '$absf_trace'(' after prefix expansion: ~s', [Path]), - atom_codes( APath, Path ), - ( - Expand = true - -> - expand_file_name( APath, EPaths), - '$absf_trace'(' after shell globbing: ~w', [EPaths]), - lists:member(EPath, EPaths) - ; - EPath = APath - ), - real_path( EPath, File), - '$absf_trace'(' after canonical path name: ~a', [File]), - '$check_file'( File, Type, Access ), - '$absf_trace'(' after testing ~a for ~a and ~a', [File,Type,Access]). - -% allow paths in File Name -'$core_file_name'(Name, Opts) --> - '$file_name'(Name, Opts, E), - '$suffix'(E, Opts), - '$glob'(Opts). - -% -% handle library(lists) or foreign(jpl) -% -'$file_name'(Name, Opts, E) --> - { Name =.. [Lib, P0] }, - !, - { user:file_search_path(Lib, IDirs) }, - { '$paths'(IDirs, Dir ) }, - '$absf_trace'(' ~w first', [Dir]), - '$file_name'(Dir, Opts, _), - '$dir', - { '$absf_trace'(' ~w next', [P0]) }, - '$cat_file_name'(P0, E). -'$file_name'(Name, Opts, E) --> - '$cat_file_name'(Name, E ). - /* - ( - { - get_abs_file_parameter( file_type, Opts, Lib ), - nonvar(Lib) - } - -> - { user:file_search_path(Lib, IDirs) }, - { '$paths'(IDirs, Dir ) }, - '$absf_trace'(' ~w first', [Dir]), - '$file_name'(Dir, Opts, _), - '$dir', - { '$absf_trace'(' ~w next', [P0]) } - ; - [] - ). - */ - - -'$cat_file_name'(A/B, E ) --> - '$cat_file_name'(A, _), - '$dir', - '$cat_file_name'(B, E). -'$cat_file_name'(File, F) --> - { atom(File), atom_codes(File, F) }, - !, - F. -'$cat_file_name'(File, S) --> - {string(File), string_to_codes(File, S) }, - !, - S. - - -'$variable_expansion'( Path, Opts, APath ) :- - get_abs_file_parameter( expand, Opts, true ), - !, - '$expand_file_name'( Path, APath ). -'$variable_expansion'( Path, _, Path ). - - -'$var'(S) --> - "{", !, '$id'(S), "}". -'$var'(S) --> - '$id'(S). - -'$drive'(C) --> - '$id'(C), - ":\\\\". - -'$id'([C|S]) --> [C], - { C >= "a", C =< "z" ; C >= "A", C =< "Z" ; - C >= "0", C =< "9" ; C =:= "_" }, - !, - '$id'(S). -'$id'([]) --> []. - - -% always verify if a directory -'$check_file'(F, directory, _) :- - !, - exists_directory(F). -'$check_file'(_F, _Type, none) :- !. -'$check_file'(F, _Type, exist) :- - '$access_file'(F, exist). % if it has a type cannot be a directory.. -'$check_file'(F, _Type, Access) :- - '$access_file'(F, Access), - \+ exists_directory(F). % if it has a type cannot be a directory.. - -'$suffix'(Last, _Opts) --> - { lists:append(_, [0'.|Alphas], Last), '$id'(Alphas, _, [] ) }, - '$absf_trace'(' suffix in ~s', [Last]), - !. -'$suffix'(_, Opts) --> - { - ( - get_abs_file_parameter( extensions, Opts, Exts ), - Exts \= [] - -> - lists:member(Ext, Exts), - '$absf_trace'(' trying suffix ~a from ~w', [Ext,Exts]) - ; - get_abs_file_parameter( file_type, Opts, Type ), - ( Type == source -> NType = prolog ; NType = Type ), - user:prolog_file_type(Ext, NType) - ), - '$absf_trace'(' trying suffix ~a from type ~a', [Ext, NType]), - atom_codes(Ext, Cs) - }, - '$add_suffix'(Cs). -'$suffix'(_,_Opts) --> - '$absf_trace'(' try no suffix', []). - -'$add_suffix'(Cs) --> - { Cs = [0'. |_Codes] } - -> - Cs - ; - ".", Cs. - -'$glob'(Opts) --> - { - get_abs_file_parameter( glob, Opts, G ), - G \= '', - atom_codes( G, Gs ) - }, - !, - '$dir', - Gs. -'$glob'(_Opts) --> - []. - -'$enumerate_glob'(_File1, [ExpFile], ExpFile) :- - !. -'$enumerate_glob'(_File1, ExpFiles, ExpFile) :- - lists:member(ExpFile, ExpFiles), - file_base_name( ExpFile, Base ), - Base \= '.', - Base \='..'. - -'$prefix'( CorePath, _Opts) --> - { is_absolute_file_name( CorePath ) }, - !, - CorePath. -'$prefix'( CorePath, Opts) --> - { get_abs_file_parameter( relative_to, Opts, Prefix ), - Prefix \= '', - '$absf_trace'(' relative_to ~a', [Prefix]), - sub_atom(Prefix, _, 1, 0, Last), - atom_codes(Prefix, S) - }, - !, - S, - '$dir'(Last), - CorePath. -'$prefix'( CorePath, _) --> - { - recorded('$path',Prefix,_), - '$absf_trace'(' try YAP path database ~a', [Prefix]), - sub_atom(Prefix, _, _, 1, Last), - atom_codes(Prefix, S) }, - S, - '$dir'(Last), - CorePath. -'$prefix'(CorePath, _ ) --> - '$absf_trace'(' empty prefix', []), - CorePath. - - -'$dir' --> { current_prolog_flag(windows, true) }, - "\\", - !. -'$dir' --> "/". - -'$dir'('/') --> !. -'$dir'('\\') --> { current_prolog_flag(windows, true) }, - !. -'$dir'(_) --> '$dir'. - -% -% -% -'$system_library_directories'(library, Dir) :- - user:library_directory( Dir ). -% '$split_by_sep'(0, 0, Dirs, Dir). -'$system_library_directories'(foreign, Dir) :- - user:foreign_directory( Dir ). -% compatibility with old versions -% -% search the current directory first. -'$system_library_directories'(commons, Dir) :- - user:commons_directory( Dir ). - - -% enumerate all paths separated by a path_separator. -'$paths'(Cs, C) :- - - atom(Cs), - ( current_prolog_flag(windows, true) -> Sep = ';' ; Sep = ':' ), - sub_atom(Cs, N0, 1, N, Sep), - !, - ( - sub_atom(Cs,0,N0,_,C) - ; - sub_atom(Cs,_,N,0,RC), - '$paths'(RC, C) - ). -'$paths'(S, S). - -'$absf_trace'(Msg, Args ) --> - { current_prolog_flag( verbose_file_search, true ) }, - { print_message( informational, absolute_file_path( Msg, Args ) ) }, - !. -'$absf_trace'(_Msg, _Args ) --> []. - -'$absf_trace'(Msg, Args ) :- - current_prolog_flag( verbose_file_search, true ), - print_message( informational, absolute_file_path( Msg, Args ) ), - !. -'$absf_trace'(_Msg, _Args ). - -'$absf_trace'( File ) :- - current_prolog_flag( verbose_file_search, true ), - print_message( informational, absolute_file_path( File ) ), - !. -'$absf_trace'( _File ). - -'$absf_trace_options'(Args ) :- - current_prolog_flag( verbose_file_search, true ), - print_message( informational, arguments( Args ) ), - !. -'$absf_trace_options'( _Args ). - -/** @pred prolog_file_name( +File, -PrologFileaNme) - -Unify _PrologFileName_ with the Prolog file associated to _File_. - -*/ -prolog_file_name(File, PrologFileName) :- - var(File), !, - '$do_error'(instantiation_error, prolog_file_name(File, PrologFileName)). -prolog_file_name(user, Out) :- !, Out = user. -prolog_file_name(File, PrologFileName) :- - atom(File), !, - system:true_file_name(File, PrologFileName). -prolog_file_name(File, PrologFileName) :- - '$do_error'(type_error(atom,File), prolog_file_name(File, PrologFileName)). - -/** - @pred path(-Directories:list) is det,deprecated - - YAP specific procedure that returns a list of user-defined directories - in the library search-path.We suggest using user:file_search_path/2 for - compatibility with other Prologs. -*/ -path(Path) :- - findall(X,'$in_path'(X),Path). - -'$in_path'(X) :- - recorded('$path',Path,_), - atom_codes(Path,S), - ( S = "" -> X = '.' ; - atom_codes(X,S) ). - -/** - @pred add_to_path(+Directory:atom) is det,deprecated - - YAP-specific predicate to include directory in library search path. - We suggest using user:file_search_path/2 for - compatibility with other Prologs. -*/ -add_to_path(New) :- - add_to_path(New,last). - -/** - @pred add_to_path(+Directory:atom, +Position:atom) is det,deprecated - - YAP-specific predicate to include directory in front or back of - library search path. We suggest using user:file_search_path/2 for - compatibility with other Prologs and more extensive functionality. -*/ -add_to_path(New,Pos) :- - atom(New), !, - '$check_path'(New,Str), - atom_codes(Path,Str), - '$add_to_path'(Path,Pos). - -'$add_to_path'(New,_) :- - recorded('$path',New,R), - erase(R), - fail. -'$add_to_path'(New,last) :- - !, - recordz('$path',New,_). -'$add_to_path'(New,first) :- - recorda('$path',New,_). - -/** @pred remove_from_path(+Directory:atom) is det,deprecated - -@} - -*/ -remove_from_path(New) :- '$check_path'(New,Path), - recorded('$path',Path,R), erase(R). - -'$check_path'(At,SAt) :- atom(At), !, atom_codes(At,S), '$check_path'(S,SAt). -'$check_path'([],[]). -'$check_path'([Ch],[Ch]) :- '$dir_separator'(Ch), !. -'$check_path'([Ch],[Ch,A]) :- !, integer(Ch), '$dir_separator'(A). -'$check_path'([N|S],[N|SN]) :- integer(N), '$check_path'(S,SN). - diff --git a/packages/python/swig/yap4py/prolog/pl/arith.yap b/packages/python/swig/yap4py/prolog/pl/arith.yap deleted file mode 100644 index e78de29c9..000000000 --- a/packages/python/swig/yap4py/prolog/pl/arith.yap +++ /dev/null @@ -1,364 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: arith.yap * -* Last rev: * -* mods: * -* comments: arithmetical optimization * -* * -*************************************************************************/ - - % the default mode is on - -%% @file arith.yap - -:- system_module( '$_arith', [compile_expressions/0, - expand_exprs/2, - plus/3, - succ/2], ['$c_built_in'/3]). - -:- private( [do_c_built_in/3, - do_c_built_metacall/3, - expand_expr/3, - expand_expr/5, - expand_expr/6] ). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -:- use_system_module( '$_modules', ['$clean_cuts'/2]). - -/** @defgroup CompilerAnalysis Internal Clause Rewriting - @ingroup YAPCompilerSettings - - YAP supports several clause optimisation mechanisms, that - are designed to improve execution of arithmetic - and term construction built-ins. In other words, during the - compilation process a clause is rewritten twice: - - 1. first, perform user-defined goal_expansion as described - in the predicates goal_expansion/1 and goal_expansion/2. - - 2. Perform expansion of some built-ins like: - - + pruning operators, like ->/2 and *->/2 - - + arithmetic, including early evaluation of constant expressions - - + specialise versions for some built-ins, if we are aware of the - run-time execution mode - - The user has some control over this process, through some - built-ins and through execution flsgs. - -*/ - -%% @{ - -/** @pred expand_exprs(- _O_,+ _N_) - Control term expansion during compilation. - -Enables low-level optimizations. It reports the current state by -unifying _O_ with the previous state. It then puts YAP in state _N_ -(`on` or `off`)/ _On_ is equivalent to compile_expressions/0 and `off` -is equivalent to do_not_compile_expressions/0. - -This predicate is useful when debugging, to ensure execution close to the original source. - -*/ -expand_exprs(Old,New) :- - (get_value('$c_arith',true) -> - Old = on ; - Old = off ), - '$set_arith_expan'(New). - -'$set_arith_expan'(on) :- set_value('$c_arith',true). -'$set_arith_expan'(off) :- set_value('$c_arith',[]). - -/** @pred compile_expressions - -After a call to this predicate, arithmetical expressions will be compiled. -(see example below). This is the default behavior. -*/ - -compile_expressions :- set_value('$c_arith',true). - -/** @pred do_not_compile_expressions - - -After a call to this predicate, arithmetical expressions will not be compiled. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -?- source, do_not_compile_expressions. -yes -?- [user]. -| p(X) :- X is 2 * (3 + 8). -| :- end_of_file. -?- compile_expressions. -yes -?- [user]. -| q(X) :- X is 2 * (3 + 8). -| :- end_of_file. -:- listing. - -p(A):- - A is 2 * (3 + 8). - -q(A):- - A is 22. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*/ -do_not_compile_expressions :- set_value('$c_arith',[]). - -'$c_built_in'(IN, M, H, OUT) :- - get_value('$c_arith',true), !, - do_c_built_in(IN, M, H, OUT). -'$c_built_in'(IN, _, _H, IN). - - -do_c_built_in(G, M, H, OUT) :- var(G), !, - do_c_built_metacall(G, M, H, OUT). -do_c_built_in(Mod:G, _, H, OUT) :- - '$yap_strip_module'(Mod:G, M1, G1), - var(G1), !, - do_c_built_metacall(G1, M1, H, OUT). -do_c_built_in('$do_error'( Error, Goal), M, Head, - (clause_location(Call, Caller), - strip_module(M:Goal,M1,NGoal), - throw(error(Error, - [[g|g(M1:NGoal)],[p|Call],[e|Caller],[h|g(Head)]] - ) - ) - ) - ) :- !. -do_c_built_in(X is Y, M, H, P) :- - primitive(X), !, - do_c_built_in(X =:= Y, M, H, P). -do_c_built_in(X is Y, M, H, (P,A=X)) :- - nonvar(X), !, - do_c_built_in(A is Y, M, H, P). -do_c_built_in(X is Y, _, _, P) :- - nonvar(Y), % Don't rewrite variables - !, - ( - number(Y) -> - P = ( X = Y); % This case reduces to an unification - expand_expr(Y, P0, X0), - '$drop_is'(X0, X, P0, P) - ). -do_c_built_in(phrase(NT,Xs), Mod, H, NTXsNil) :- - '$_arith':do_c_built_in(phrase(NT,Xs,[]), Mod, H, NTXsNil). -do_c_built_in(phrase(NT,Xs0,Xs), Mod, _, NewGoal) :- - '$c_built_in_phrase'(NT, Xs0, Xs, Mod, NewGoal ). - -do_c_built_in(Comp0, _, _, R) :- % now, do it for comparisons - '$compop'(Comp0, Op, E, F), - !, - '$compop'(Comp, Op, U, V), - expand_expr(E, P, U), - expand_expr(F, Q, V), - '$do_and'(P, Q, R0), - '$do_and'(R0, Comp, R). -do_c_built_in(P, _M, _H, P). - -do_c_built_metacall(G1, Mod, _, '$execute_wo_mod'(G1,Mod)) :- - var(Mod), !. -do_c_built_metacall(G1, Mod, _, '$execute_in_mod'(G1,Mod)) :- - atom(Mod), !. -do_c_built_metacall(G1, Mod, _, call(Mod:G1)). - -'$do_and'(true, P, P) :- !. -'$do_and'(P, true, P) :- !. -'$do_and'(P, Q, (P,Q)). - -% V is the result of the simplification, -% X the result of the initial expression -% and the last argument is how we are writing this result -'$drop_is'(V, V1, P0, G) :- - var(V), - !, % usual case - V = V1, - P0 = G. -'$drop_is'(V, X, P0, P) :- % atoms - '$do_and'(P0, X is V, P). - -% Table of arithmetic comparisons -'$compop'(X < Y, < , X, Y). -'$compop'(X > Y, > , X, Y). -'$compop'(X=< Y,=< , X, Y). -'$compop'(X >=Y, >=, X, Y). -'$compop'(X=:=Y,=:=, X, Y). -'$compop'(X=\=Y,=\=, X, Y). - -'$composed_built_in'(V) :- var(V), !, - fail. -'$composed_built_in'(('$current_choice_point'(_),NG,'$$cut_by'(_))) :- !, - '$composed_built_in'(NG). -'$composed_built_in'((_,_)). -'$composed_built_in'((_;_)). -'$composed_built_in'((_|_)). -'$composed_built_in'((_->_)). -'$composed_built_in'(_:G) :- - '$composed_built_in'(G). -'$composed_built_in'(\+G) :- - '$composed_built_in'(G). -'$composed_built_in'(not(G)) :- - '$composed_built_in'(G). - -% expanding an expression: -% first argument is the expression not expanded, -% second argument the expanded expression -% third argument unifies with the result from the expression -expand_expr(V, true, V) :- - var(V), !. -expand_expr([T], E, V) :- !, - expand_expr(T, E, V). -expand_expr(String, _E, V) :- - string( String ), !, - string_codes(String, [V]). -expand_expr(A, true, A) :- - atomic(A), !. -expand_expr(T, E, V) :- - T =.. [O, A], !, - expand_expr(A, Q, X), - expand_expr(O, X, V, Q, E). -expand_expr(T, E, V) :- - T =.. [O, A, B], !, - expand_expr(A, Q, X), - expand_expr(B, R, Y), - expand_expr(O, X, Y, V, Q, S), - '$do_and'(R, S, E). - -% expanding an expression of the form: -% O is Op(X), -% after having expanded into Q -% and giving as result P (the last argument) -expand_expr(Op, X, O, Q, Q) :- - number(X), - catch(is( O, Op, X),_,fail), !. % do not do error handling at compile time -expand_expr(Op, X, O, Q, P) :- - '$unary_op_as_integer'(Op,IOp), - '$do_and'(Q, is( O, IOp, X), P). - -% expanding an expression of the form: -% O is Op(X,Y), -% after having expanded into Q -% and giving as result P (the last argument) -% included is some optimization for: -% incrementing and decrementing, -% the elementar arithmetic operations [+,-,*,//] -expand_expr(Op, X, Y, O, Q, Q) :- - number(X), number(Y), - catch(is( O, Op, X, Y),_,fail), !. -expand_expr(+, X, Y, O, Q, P) :- !, - '$preprocess_args_for_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$plus'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(-, X, Y, O, Q, P) :- - var(X), number(Y), - Z is -Y, !, - expand_expr(+, Z, X, O, Q, P). -expand_expr(-, X, Y, O, Q, P) :- !, - '$preprocess_args_for_non_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$minus'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(*, X, Y, O, Q, P) :- !, - '$preprocess_args_for_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$times'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(//, X, Y, O, Q, P) :- - nonvar(Y), Y == 0, !, - '$binary_op_as_integer'(//,IOp), - '$do_and'(Q, is(O,IOp,X,Y), P). -expand_expr(//, X, Y, O, Q, P) :- !, - '$preprocess_args_for_non_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$div'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(/\, X, Y, O, Q, P) :- !, - '$preprocess_args_for_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$and'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(\/, X, Y, O, Q, P) :- !, - '$preprocess_args_for_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$or'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(<<, X, Y, O, Q, P) :- - var(X), number(Y), Y < 0, - Z is -Y, !, - expand_expr(>>, X, Z, O, Q, P). -expand_expr(<<, X, Y, O, Q, P) :- !, - '$preprocess_args_for_non_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$sll'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(>>, X, Y, O, Q, P) :- - var(X), number(Y), Y < 0, - Z is -Y, !, - expand_expr(<<, X, Z, O, Q, P). -expand_expr(>>, X, Y, O, Q, P) :- !, - '$preprocess_args_for_non_commutative'(X, Y, X1, Y1, E), - '$do_and'(E, '$slr'(X1,Y1,O), F), - '$do_and'(Q, F, P). -expand_expr(Op, X, Y, O, Q, P) :- - '$binary_op_as_integer'(Op,IOp), - '$do_and'(Q, is(O,IOp,X,Y), P). - -'$preprocess_args_for_commutative'(X, Y, X, Y, true) :- - var(X), var(Y), !. -'$preprocess_args_for_commutative'(X, Y, X, Y, true) :- - var(X), integer(Y), \+ '$bignum'(Y), !. -'$preprocess_args_for_commutative'(X, Y, X, Z, Z = Y) :- - var(X), !. -'$preprocess_args_for_commutative'(X, Y, Y, X, true) :- - integer(X), \+ '$bignum'(X), var(Y), !. -'$preprocess_args_for_commutative'(X, Y, Z, X, Z = Y) :- - integer(X), \+ '$bignum'(X), !. -'$preprocess_args_for_commutative'(X, Y, Z, W, E) :- - '$do_and'(Z = X, Y = W, E). - -'$preprocess_args_for_non_commutative'(X, Y, X, Y, true) :- - var(X), var(Y), !. -'$preprocess_args_for_non_commutative'(X, Y, X, Y, true) :- - var(X), integer(Y), \+ '$bignum'(Y), !. -'$preprocess_args_for_non_commutative'(X, Y, X, Z, Z = Y) :- - var(X), !. -'$preprocess_args_for_non_commutative'(X, Y, X, Y, true) :- - integer(X), \+ '$bignum'(X), var(Y), !. -'$preprocess_args_for_non_commutative'(X, Y, X, Z, Z = Y) :- - integer(X), \+ '$bignum'(X), !. -'$preprocess_args_for_non_commutative'(X, Y, Z, W, E) :- - '$do_and'(Z = X, Y = W, E). - - -'$goal_expansion_allowed'(phrase(NT,_Xs0,_Xs), Mod) :- - callable(NT), - atom(Mod). - -%% contains_illegal_dcgnt(+Term) is semidet. -% -% True if Term contains a non-terminal we cannot deal with using -% goal-expansion. The test is too general approximation, but safe. - -'$contains_illegal_dcgnt'(NT) :- - functor(NT, _, A), - between(1, A, I), - arg(I, NT, AI), - nonvar(AI), - ( AI = ! ; AI = phrase(_,_,_) ), !. -% write(contains_illegal_nt(NT)), % JW: we do not want to write -% nl. - -'$harmless_dcgexception'(instantiation_error). % ex: phrase(([1],x:X,[3]),L) -'$harmless_dcgexception'(type_error(callable,_)). % ex: phrase(27,L) - - -:- set_value('$c_arith',true). -/** - @} -*/ diff --git a/packages/python/swig/yap4py/prolog/pl/arithpreds.yap b/packages/python/swig/yap4py/prolog/pl/arithpreds.yap deleted file mode 100644 index d06964a82..000000000 --- a/packages/python/swig/yap4py/prolog/pl/arithpreds.yap +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * - * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: arithpreds.yap * -* Last rev: * -* mods: * -* comments: arithmetical predicates * -* * -*************************************************************************/ - -%% @{ - -/** - @file arithpreds.yap - - @addtogroup arithmetic_preds - - -*/ - -:- system_module(arithmetic_predicates, [ - plus/3, - succ/2], []). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -/** @pred succ(? _Int1_:int, ? _Int2_:int) is det - * - - True if _Int2_ = _Int1_ + 1 and _Int1_ \>= 0. At least - one of the arguments must be instantiated to a natural number. This - predicate raises the domain-error not_less_than_zero if called with - a negative integer. E.g. `succ(X, 0)` fails silently and `succ(X, -1)` - raises a domain-error. The behaviour to deal with natural numbers - only was defined by Richard O'Keefe to support the common - count-down-to-zero in a natural way. - - */ - -% M and N nonnegative integers, N is the successor of M -succ(M,N) :- - ( - var(M) - -> - ( - integer(N), - N > 0 - -> - '$plus'(N,-1,M) - ; - '$succ_error'(M,N) - ) - ; - integer(M), - M >= 0 - -> - ( - var(N) - -> - '$plus'(M,1,N) - ; - integer(N), - N > 0 - -> - '$plus'(M,1,N) - ; - '$succ_error'(M,N) - ) - ; - '$succ_error'(M,N) - ). - -'$succ_error'(M,N) :- - var(M), - var(N), !, - '$do_error'(instantiation_error,succ(M,N)). -'$succ_error'(M,N) :- - nonvar(M), - \+ integer(M), - '$do_error'(type_error(integer, M),succ(M,N)). -'$succ_error'(M,N) :- - nonvar(M), - M < 0, - '$do_error'(domain_error(not_less_than_zero, M),succ(M,N)). -'$succ_error'(M,N) :- - nonvar(N), - \+ integer(N), - '$do_error'(type_error(integer, N),succ(M,N)). -'$succ_error'(M,N) :- - nonvar(N), - N < 0, - '$do_error'(domain_error(not_less_than_zero, N),succ(M,N)). - -/** @pred plus(? _Int1_:int, ? _Int2_:int, ? _Int3_:int) is det - - True if _Int3_ = _Int1_ + _Int2_. At least two of the - three arguments must be instantiated to integers. - - @} - - */ - -plus(X, Y, Z) :- - ( - var(X) - -> - ( - integer(Y), integer(Z) - -> - '$minus'(Z,Y,X) - ; - '$plus_error'(X,Y,Z) - ) - ; - integer(X) - -> - ( - var(Y) - -> - ( - integer(Z) - -> - '$minus'(Z,X,Y) - ; - '$plus_error'(X,Y,Z) - ) - ; - integer(Y) - -> - ( - integer(Z) - -> - '$minus'(Z,Y,X) - ; - var(Z) - -> - '$plus'(X,Y,Z) - ; - '$plus_error'(X,Y,Z) - ) - ; - '$plus_error'(X,Y,Z) - ) - ; - '$plus_error'(X,Y,Z) - ). - -'$plus_error'(X,Y,Z) :- - nonvar(X), - \+ integer(X), - '$do_error'(type_error(integer, X),plus(X,Y,Z)). -'$plus_error'(X,Y,Z) :- - nonvar(Y), - \+ integer(Y), - '$do_error'(type_error(integer, Y),plus(X,Y,Z)). -'$plus_error'(X,Y,Z) :- - nonvar(Z), - \+ integer(Z), - '$do_error'(type_error(integer, Z),plus(X,Y,Z)). -'$plus_error'(X,Y,Z) :- - '$do_error'(instantiation_error,plus(X,Y,Z)). diff --git a/packages/python/swig/yap4py/prolog/pl/arrays.yap b/packages/python/swig/yap4py/prolog/pl/arrays.yap deleted file mode 100644 index f6f2bd359..000000000 --- a/packages/python/swig/yap4py/prolog/pl/arrays.yap +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: arrays.yap * -* Last rev: * -* mods: * -* comments: Array Manipulation * -* * -*************************************************************************/ - -%% @{ - -/** -@addtogroup YAPArrays -*/ -% -% These are the array built-in predicates. They will only work if -% YAP_ARRAYS is defined in Yap.h -% - -/** @pred array(+ _Name_, + _Size_) - - -Creates a new dynamic array. The _Size_ must evaluate to an -integer. The _Name_ may be either an atom (named array) or an -unbound variable (anonymous array). - -Dynamic arrays work as standard compound terms, hence space for the -array is recovered automatically on backtracking. - - -*/ -array(Obj, Size) :- - '$create_array'(Obj, Size). - - -% arithmetical optimization -'$c_arrays'((P:-Q),(NP:-QF)) :- !, - '$c_arrays_body'(Q, QI), - '$c_arrays_head'(P, NP, QI, QF). -'$c_arrays'(P, NP) :- - '$c_arrays_fact'(P, NP). - -'$c_arrays_body'(P, P) :- - var(P), !. -'$c_arrays_body'((P0,Q0), (P,Q)) :- !, - '$c_arrays_body'(P0, P), - '$c_arrays_body'(Q0, Q). -'$c_arrays_body'((P0;Q0), (P;Q)) :- !, - '$c_arrays_body'(P0, P), - '$c_arrays_body'(Q0, Q). -'$c_arrays_body'((P0->Q0), (P->Q)) :- !, - '$c_arrays_body'(P0, P), - '$c_arrays_body'(Q0, Q). -'$c_arrays_body'(P, NP) :- '$c_arrays_lit'(P, NP). - -% -% replace references to arrays to references to built-ins. -% -'$c_arrays_lit'(G, GL) :- - '$array_references'(G, NG, VL), - '$add_array_entries'(VL, NG, GL). - -'$c_arrays_head'(G, NG, B, NB) :- - '$array_references'(G, NG, VL), - '$add_array_entries'(VL, B, NB). - -'$c_arrays_fact'(G, NG) :- - '$array_references'(G, IG, VL), - (VL = [] -> NG = G; - NG = (IG :- NB), '$add_array_entries'(VL, true, NB)). - -'$add_array_entries'([], NG, NG). -'$add_array_entries'([Head|Tail], G, (Head, NG)) :- - '$add_array_entries'(Tail, G, NG). - - -/** @pred static_array_properties(? _Name_, ? _Size_, ? _Type_) - - -Show the properties size and type of a static array with name - _Name_. Can also be used to enumerate all current -static arrays. - -This built-in will silently fail if the there is no static array with -that name. - - -*/ -static_array_properties(Name, Size, Type) :- - atom(Name), !, - '$static_array_properties'(Name, Size, Type). -static_array_properties(Name, Size, Type) :- - var(Name), !, - current_atom(Name), - '$static_array_properties'(Name, Size, Type). -static_array_properties(Name, Size, Type) :- - '$do_error'(type_error(atom,Name),static_array_properties(Name,Size,Type)). - -%% @} diff --git a/packages/python/swig/yap4py/prolog/pl/atoms.yap b/packages/python/swig/yap4py/prolog/pl/atoms.yap deleted file mode 100644 index 3f74f89aa..000000000 --- a/packages/python/swig/yap4py/prolog/pl/atoms.yap +++ /dev/null @@ -1,211 +0,0 @@ - /************************************************************************* - * * - * YAP Prolog * - * * - * Yap Prolog was developed at NCCUP - Universidade do Porto * - * * - * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2014 * - * * - *************************************************************************/ - -/** - * @file atoms.yap - * - */ - -:- system_module( '$_atoms', [ - atom_concat/2, - string_concat/2, - atomic_list_concat/2, - atomic_list_concat/3, - current_atom/1], []). - -:- use_system_module( '$_errors', ['$do_error'/2]). - - -/** - * @addtogroup Predicates_on_Atoms - * -*/ - -/** @pred atom_concat(+ As, ? A) - - -The predicate holds when the first argument is a list of atoms, and the -second unifies with the atom obtained by concatenating all the atoms in -the first list. - - -*/ -atom_concat(Xs,At) :- - ( var(At) -> - '$atom_concat'(Xs, At ) - ; - '$atom_concat_constraints'(Xs, 0, At, Unbound), - '$process_atom_holes'(Unbound) - ). - -% the constraints are of the form hole: HoleAtom, Begin, Atom, End -'$atom_concat_constraints'([At], 0, At, []) :- !. -'$atom_concat_constraints'([At0], mid(Next, At), At, [hole(At0, Next, At, end)]) :- !. -% just slice first atom -'$atom_concat_constraints'([At0|Xs], 0, At, Unbound) :- - atom(At0), !, - sub_atom(At0, 0, _Sz, L, _Ata ), - sub_atom(At, _, L, 0, Atr ), %remainder - '$atom_concat_constraints'(Xs, 0, Atr, Unbound). -% first hole: Follow says whether we have two holes in a row, At1 will be our atom -'$atom_concat_constraints'([At0|Xs], 0, At, [hole(At0, 0, At, Next)|Unbound]) :- - '$atom_concat_constraints'(Xs, mid(Next,_At1), At, Unbound). -% end of a run -'$atom_concat_constraints'([At0|Xs], mid(end, At1), At, Unbound) :- - atom(At0), !, - sub_atom(At, Next, _Sz, L, At0), - sub_atom(At, 0, Next, Next, At1), - sub_atom(At, _, L, 0, Atr), %remainder - '$atom_concat_constraints'(Xs, 0, Atr, Unbound). -'$atom_concat_constraints'([At0|Xs], mid(Next,At1), At, Next, [hole(At0, Next, At, Follow)|Unbound]) :- - '$atom_concat_constraints'(Xs, mid(Follow, At1), At, Unbound). - -'$process_atom_holes'([]). -'$process_atom_holes'([hole(At0, Next, At1, End)|Unbound]) :- End == end, !, - sub_atom(At1, Next, _, 0, At0), - '$process_atom_holes'(Unbound). -'$process_atom_holes'([hole(At0, Next, At1, Follow)|Unbound]) :- - sub_atom(At1, Next, Sz, _Left, At0), - Follow is Next+Sz, - '$process_atom_holes'(Unbound). - - -/** @pred atomic_list_concat(+ _As_,? _A_) - - -The predicate holds when the first argument is a list of atomic terms, and -the second unifies with the atom obtained by concatenating all the -atomic terms in the first list. The first argument thus may contain -atoms or numbers. - - -*/ -atomic_list_concat(L,At) :- - atomic_concat(L, At). - -/** @pred atomic_list_concat(? _As_,+ _Separator_,? _A_) - -Creates an atom just like atomic_list_concat/2, but inserts - _Separator_ between each pair of atoms. For example: - -~~~~~{.prolog} -?- atomic_list_concat([gnu, gnat], `, `, A). - -A = `gnu, gnat` -~~~~~ - -YAP emulates the SWI-Prolog version of this predicate that can also be -used to split atoms by instantiating _Separator_ and _Atom_ as -shown below. - -~~~~~{.prolog} -?- atomic_list_concat(L, -, 'gnu-gnat'). - -L = [gnu, gnat] -~~~~~ - - -*/ -atomic_list_concat(L, El, At) :- - var(El), !, - '$do_error'(instantiation_error,atomic_list_concat(L,El,At)). -atomic_list_concat(L, El, At) :- - ground(L), !, - '$add_els'(L,El,LEl), - atomic_concat(LEl, At). -atomic_list_concat(L, El, At) :- - nonvar(At), !, - '$atomic_list_concat_all'( At, El, L). - -'$atomic_list_concat_all'( At, El, [A|L]) :- - sub_atom(At, Pos, 1, Left, El), !, - sub_atom(At, 0, Pos, _, A), - sub_atom(At, _, Left, 0, At1), - '$atomic_list_concat_all'( At1, El, L). -'$atomic_list_concat_all'( At, _El, [At]). - -'$add_els'([A,B|L],El,[A,El|NL]) :- !, - '$add_els'([B|L],El,NL). -'$add_els'(L,_,L). - - -% -% small compatibility hack - -'$singletons_in_term'(T,VL) :- - '$variables_in_term'(T,[],V10), - '$sort'(V10, V1), - '$non_singletons_in_term'(T,[],V20), - '$sort'(V20, V2), - '$subtract_lists_of_variables'(V2,V1,VL). - -'$subtract_lists_of_variables'([],VL,VL). -'$subtract_lists_of_variables'([_|_],[],[]) :- !. -'$subtract_lists_of_variables'([V1|VL1],[V2|VL2],VL) :- - V1 == V2, !, - '$subtract_lists_of_variables'(VL1,VL2,VL). -'$subtract_lists_of_variables'([V1|VL1],[V2|VL2],[V2|VL]) :- - '$subtract_lists_of_variables'([V1|VL1],VL2,VL). - -/** @pred current_atom( _A_) - - -Checks whether _A_ is a currently defined atom. It is used to find all -currently defined atoms by backtracking. - - -*/ -current_atom(A) :- % check - atom(A), !. -current_atom(A) :- % generate - '$current_atom'(A). - -string_concat(Xs,At) :- - ( var(At) -> - '$string_concat'(Xs, At ) - ; - '$string_concat_constraints'(Xs, 0, At, Unbound), - '$process_string_holes'(Unbound) - ). - -% the constraints are of the form hole: HoleString, Begin, String, End -'$string_concat_constraints'([At], 0, At, []) :- !. -'$string_concat_constraints'([At0], mid(Next, At), At, [hole(At0, Next, At, end)]) :- !. -% just slice first string -'$string_concat_constraints'([At0|Xs], 0, At, Unbound) :- - string(At0), !, - sub_string(At, 0, _Sz, L, At0 ), - sub_string(At, _, L, 0, Atr ), %remainder - '$string_concat_constraints'(Xs, 0, Atr, Unbound). -% first hole: Follow says whether we have two holes in a row, At1 will be our string -'$string_concat_constraints'([At0|Xs], 0, At, [hole(At0, 0, At, Next)|Unbound]) :- - '$string_concat_constraints'(Xs, mid(Next,_At1), At, Unbound). -% end of a run -'$string_concat_constraints'([At0|Xs], mid(end, At1), At, Unbound) :- - string(At0), !, - sub_string(At, Next, _Sz, L, At0), - sub_string(At, 0, Next, Next, At1), - sub_string(At, _, L, 0, Atr), %remainder - '$string_concat_constraints'(Xs, 0, Atr, Unbound). -'$string_concat_constraints'([At0|Xs], mid(Next,At1), At, Next, [hole(At0, Next, At, Follow)|Unbound]) :- - '$string_concat_constraints'(Xs, mid(Follow, At1), At, Unbound). - -'$process_string_holes'([]). -'$process_string_holes'([hole(At0, Next, At1, End)|Unbound]) :- End == end, !, - sub_string(At1, Next, _, 0, At0), - '$process_string_holes'(Unbound). -'$process_string_holes'([hole(At0, Next, At1, Follow)|Unbound]) :- - sub_string(At1, Next, Sz, _Left, At0), - Follow is Next+Sz, - '$process_string_holes'(Unbound). - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/pl/attributes.yap b/packages/python/swig/yap4py/prolog/pl/attributes.yap deleted file mode 100644 index 8251010d9..000000000 --- a/packages/python/swig/yap4py/prolog/pl/attributes.yap +++ /dev/null @@ -1,515 +0,0 @@ -pattr/************************************************************************* -* * - * YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: atts.yap * -* Last rev: 8/2/88 * -* mods: * -* comments: attribute support for Prolog * -* * -*************************************************************************/ - -/** - @file attributes.yap - -@defgroup New_Style_Attribute_Declarations SWI Compatible attributes -@{ -@ingroup attributes - -*/ - -:- module('attributes', [delayed_goals/4]). - -:- use_system_module( '$_boot', ['$undefp'/1]). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -:- use_system_module( '$coroutining', [attr_unify_hook/2]). - -:- use_system_module( attributes, [all_attvars/1, - bind_attvar/1, - del_all_atts/1, - del_all_module_atts/2, - get_all_swi_atts/2, - get_module_atts/2, - modules_with_attributes/1, - put_att_term/2, - put_module_atts/2, - unbind_attvar/1, - woken_att_do/4]). - -:- dynamic attributes:existing_attribute/4. -:- dynamic attributes:modules_with_attributes/1. -:- dynamic attributes:attributed_module/3. - - :- multifile - attributes:attributed_module/3. - -:- dynamic existing_attribute/4. -:- dynamic modules_with_attributes/1. -:- dynamic attributed_module/3. - - -/** @pred get_attr(+ _Var_,+ _Module_,- _Value_) - -Request the current _value_ for the attribute named _Module_. If - _Var_ is not an attributed variable or the named attribute is not -associated to _Var_ this predicate fails silently. If _Module_ -is not an atom, a type error is raised. - - -*/ -prolog:get_attr(Var, Mod, Att) :- - functor(AttTerm, Mod, 2), - arg(2, AttTerm, Att), - attributes:get_module_atts(Var, AttTerm). - -/** - @pred put_attr(+ _Var_,+ _Module_,+ _Value_) - -If _Var_ is a variable or attributed variable, set the value for the -attribute named _Module_ to _Value_. If an attribute with this -name is already associated with _Var_, the old value is replaced. -Backtracking will restore the old value (i.e., an attribute is a mutable -term. See also `setarg/3`). This predicate raises a representation error if - _Var_ is not a variable and a type error if _Module_ is not an atom. - - -*/ -prolog:put_attr(Var, Mod, Att) :- - functor(AttTerm, Mod, 2), - arg(2, AttTerm, Att), - attributes:put_module_atts(Var, AttTerm). - -/** @pred del_attr(+ _Var_,+ _Module_) - - -Delete the named attribute. If _Var_ loses its last attribute it -is transformed back into a traditional Prolog variable. If _Module_ -is not an atom, a type error is raised. In all other cases this -predicate succeeds regardless whether or not the named attribute is -present. - - -*/ -prolog:del_attr(Var, Mod) :- - functor(AttTerm, Mod, 2), - attributes:del_all_module_atts(Var, AttTerm). - -/** @pred del_attrs(+ _Var_) - - -If _Var_ is an attributed variable, delete all its -attributes. In all other cases, this predicate succeeds without -side-effects. - - -*/ -prolog:del_attrs(Var) :- - attributes:del_all_atts(Var). - -/** - @pred get_attrs(+ _Var_,- _Attributes_) - -Get all attributes of _Var_. _Attributes_ is a term of the form -`att( _Module_, _Value_, _MoreAttributes_)`, where _MoreAttributes_ is -`[]` for the last attribute. - -*/ -prolog:get_attrs(AttVar, SWIAtts) :- - attributes:get_all_swi_atts(AttVar,SWIAtts). - -/** @pred put_attrs(+ _Var_,+ _Attributes_) - - -Set all attributes of _Var_. See get_attrs/2 for a description of - _Attributes_. - - -*/ -prolog:put_attrs(_, []). -prolog:put_attrs(V, Atts) :- - cvt_to_swi_atts(Atts, YapAtts), - attributes:put_att_term(V, YapAtts). - -cvt_to_swi_atts([], _). -cvt_to_swi_atts(att(Mod,Attribute,Atts), ModAttribute) :- - ModAttribute =.. [Mod, YapAtts, Attribute], - cvt_to_swi_atts(Atts, YapAtts). - -/** @pred copy_term(? _TI_,- _TF_,- _Goals_) - -Term _TF_ is a variant of the original term _TI_, such that for -each variable _V_ in the term _TI_ there is a new variable _V'_ -in term _TF_ without any attributes attached. Attributed -variables are thus converted to standard variables. _Goals_ is -unified with a list that represents the attributes. The goal -`maplist(call, _Goals_)` can be called to recreate the -attributes. - -Before the actual copying, `copy_term/3` calls -`attribute_goals/1` in the module where the attribute is -defined. - - -*/ -prolog:copy_term(Term, Copy, Gs) :- - term_attvars(Term, Vs), - ( Vs == [] - -> Gs = [], - copy_term(Term, Copy) - ; findall(Term-Gs, - '$attributes':residuals_and_delete_attributes(Vs, Gs, Term), - [Copy-Gs]) - ). - -residuals_and_delete_attributes(Vs, Gs, Term) :- - attvars_residuals(Vs, Gs, []), - delete_attributes(Term). - -attvars_residuals([]) --> []. -attvars_residuals([V|Vs]) --> - { nonvar(V) }, !, - attvars_residuals(Vs). -attvars_residuals([V|Vs]) --> - ( { get_attrs(V, As) } - -> attvar_residuals(As, V) - ; [] - ), - attvars_residuals(Vs). - -% -% wake_up_goal is called by the system whenever a suspended goal -% resumes. -% - -/* The first case may happen if this variable was used for dif. - In this case, we need a way to keep the original - suspended goal around -*/ -%'$wake_up_goal'([Module1|Continuation],G) :- -% '$write'(4,vsc_woke:G+[Module1|Continuation]:' -%'), fail. -prolog:'$wake_up_goal'([Module1|Continuation], LG) :- -% writeln( [Module1|Continuation]:LG), - execute_woken_system_goals(LG), - do_continuation(Continuation, Module1). - - -% -% in the first two cases restore register immediately and proceed -% to continuation. In the last case take care with modules, but do -% not act as if a meta-call. -% -% -do_continuation('$cut_by'(X), _) :- !, - '$$cut_by'(X). -do_continuation('$restore_regs'(X), _) :- !, -% yap_flag(gc_trace,verbose), -% garbage_collect, - '$restore_regs'(X). -do_continuation('$restore_regs'(X,Y), _) :- !, -% yap_flag(gc_trace,verbose), -% garbage_collect, - '$restore_regs'(X,Y). -do_continuation(Continuation, Module1) :- - execute_continuation(Continuation,Module1). - -execute_continuation(Continuation, Module1) :- - '$undefined'(Continuation, Module1), !, - '$current_module'( M ), - current_prolog_flag( M:unknown, Default ), - '$undefp'([Module1|Continuation] , Default ). -execute_continuation(Continuation, Mod) :- - % do not do meta-expansion nor any fancy stuff. - '$execute0'(Continuation, Mod). - - -execute_woken_system_goals([]). -execute_woken_system_goals(['$att_do'(V,New)|LG]) :- - execute_woken_system_goals(LG), - call_atts(V,New). - -% -% what to do when an attribute gets bound -% -call_atts(V,_) :- - nonvar(V), !. -call_atts(V,_) :- - '$att_bound'(V), !. -call_atts(V,New) :- - attributes:get_all_swi_atts(V,SWIAtts), - ( - '$undefined'(woken_att_do(V, New, LGoals, DoNotBind), attributes) - -> - LGoals = [], - DoNotBind = false - ; - attributes:woken_att_do(V, New, LGoals, DoNotBind) - ), - ( DoNotBind == true - -> - attributes:unbind_attvar(V) - ; - attributes:bind_attvar(V) - ), - do_hook_attributes(SWIAtts, New), - lcall(LGoals). - -do_hook_attributes([], _). -do_hook_attributes(att(Mod,Att,Atts), Binding) :- - ('$undefined'(attr_unify_hook(Att,Binding), Mod) - -> - true - ; - Mod:attr_unify_hook(Att, Binding) - ), - do_hook_attributes(Atts, Binding). - - -lcall([]). -lcall([Mod:Gls|Goals]) :- - lcall2(Gls,Mod), - lcall(Goals). - -lcall2([], _). -lcall2([Goal|Goals], Mod) :- - call(Mod:Goal), - lcall2(Goals, Mod). - - - -/** @pred call_residue_vars(: _G_, _L_) - - - -Call goal _G_ and unify _L_ with a list of all constrained variables created during execution of _G_: - -~~~~~ - ?- dif(X,Z), call_residue_vars(dif(X,Y),L). -dif(X,Z), call_residue_vars(dif(X,Y),L). -L = [Y], -dif(X,Z), -dif(X,Y) ? ; - -no -~~~~~ - */ -prolog:call_residue_vars(Goal,Residue) :- - attributes:all_attvars(Vs0), - call(Goal), - attributes:all_attvars(Vs), - % this should not be actually strictly necessary right now. - % but it makes it a safe bet. - sort(Vs, Vss), - sort(Vs0, Vs0s), - '$ord_remove'(Vss, Vs0s, Residue). - -'$ord_remove'([], _, []). -'$ord_remove'([V|Vs], [], [V|Vs]). -'$ord_remove'([V1|Vss], [V2|Vs0s], Residue) :- - ( V1 == V2 -> - '$ord_remove'(Vss, Vs0s, Residue) - ; - V1 @< V2 -> - Residue = [V1|ResidueF], - '$ord_remove'(Vss, [V2|Vs0s], ResidueF) - ; - '$ord_remove'([V1|Vss], Vs0s, Residue) - ). - -/** @pred attribute_goals(+ _Var_,- _Gs_,+ _GsRest_) - - - -This nonterminal, if it is defined in a module, is used by _copy_term/3_ -to project attributes of that module to residual goals. It is also -used by the toplevel to obtain residual goals after executing a query. - - -Normal user code should deal with put_attr/3, get_attr/3 and del_attr/2. -The routines in this section fetch or set the entire attribute list of a -variables. Use of these predicates is anticipated to be restricted to -printing and other special purpose operations. - -*/ - -/** @pred _Module_:attribute_goal( _-Var_, _-Goal_) - -User-defined procedure, called to convert the attributes in _Var_ to -a _Goal_. Should fail when no interpretation is available. - */ -attvar_residuals(att(Module,Value,As), V) --> - ( { nonvar(V) } - -> % a previous projection predicate could have instantiated - % this variable, for example, to avoid redundant goals - [] - ; generate_goals( V, As, Value, Module) - ). - - generate_goals( V, _, Value, Module) --> - { attributes:module_has_attributes(Module) }, - % like run, put attributes back first - { Value =.. [Name,_|Vs], - NValue =.. [Name,_|Vs], - attributes:put_module_atts(V,NValue) - }, - { current_predicate(Module:attribute_goal/2) }, - { call(Module:attribute_goal(V, Goal)) }, - dot_list(Goal), - [put_attr(V, Module, Value)]. - generate_goals( V, _, _Value , Module) --> - { '$pred_exists'(attribute_goals(_,_,_), Module) }, - call(Module:attribute_goals(V) ). - - - attributes:module_has_attributes(Mod) :- - attributes:attributed_module(Mod, _, _), !. - - -list([]) --> []. -list([L|Ls]) --> [L], list(Ls). - -dot_list((A,B)) --> !, dot_list(A), dot_list(B). -dot_list(A) --> [A]. - -delete_attributes(Term) :- - term_attvars(Term, Vs), - delete_attributes_(Vs). - -delete_attributes_([]). -delete_attributes_([V|Vs]) :- - del_attrs(V), - delete_attributes_(Vs). - - - -/** @pred call_residue(: _G_, _L_) - - - -Call goal _G_. If subgoals of _G_ are still blocked, return -a list containing these goals and the variables they are blocked in. The -goals are then considered as unblocked. The next example shows a case -where dif/2 suspends twice, once outside call_residue/2, -and the other inside: - -~~~~~ -?- dif(X,Y), - call_residue((dif(X,Y),(X = f(Z) ; Y = f(Z))), L). - -X = f(Z), -L = [[Y]-dif(f(Z),Y)], -dif(f(Z),Y) ? ; - -Y = f(Z), -L = [[X]-dif(X,f(Z))], -dif(X,f(Z)) ? ; - -no -~~~~~ -The system only reports one invocation of dif/2 as having -suspended. - - -*/ -prolog:call_residue(Goal,Residue) :- - var(Goal), !, - '$do_error'(instantiation_error,call_residue(Goal,Residue)). -prolog:call_residue(Module:Goal,Residue) :- - atom(Module), !, - call_residue(Goal,Module,Residue). -prolog:call_residue(Goal,Residue) :- - '$current_module'(Module), - call_residue(Goal,Module,Residue). - -call_residue(Goal,Module,Residue) :- - prolog:call_residue_vars(Module:Goal,NewAttVars), - ( - attributes:modules_with_attributes([_|_]) - -> - project_attributes(NewAttVars, Module:Goal) - ; - true - ), - copy_term(Goal, Goal, Residue). - -attributes:delayed_goals(G, Vs, NVs, Gs) :- - project_delayed_goals(G), -% term_factorized([G|Vs], [_|NVs], Gs). - copy_term([G|Vs], [_|NVs], Gs). - -project_delayed_goals(G) :- -% SICStus compatible step, -% just try to simplify store by projecting constraints -% over query variables. -% called by top_level to find out about delayed goals - attributes:modules_with_attributes([_|_]), !, - attributes:all_attvars(LAV), - LAV = [_|_], - project_attributes(LAV, G), !. -project_delayed_goals(_). - - -attributed(G, Vs) :- - term_variables(G, LAV), - att_vars(LAV, Vs). - -att_vars([], []). -att_vars([V|LGs], [V|AttVars]) :- attvar(V), !, - att_vars(LGs, AttVars). -att_vars([_|LGs], AttVars) :- - att_vars(LGs, AttVars). - -% make sure we set the suspended goal list to its previous state! -% make sure we have installed a SICStus like constraint solver. - -/** @pred _Module_:project_attributes(+AttrVars, +Goal) - - - -Given a goal _Goa]l_ with variables _QueryVars_ and list of attributed -variables _AttrVars_, project all attributes in _AttrVars_ to - _QueryVars_. Although projection is constraint system dependent, -typically this will involve expressing all constraints in terms of - _QueryVars_ and considering all remaining variables as existentially -quantified. - -Projection interacts with attribute_goal/2 at the Prolog top -level. When the query succeeds, the system first calls -project_attributes/2. The system then calls -attribute_goal/2 to get a user-level representation of the -constraints. Typically, project_attributes/2 will convert from the -original constraints into a set of new constraints on the projection, -and these constraints are the ones that will have an -attribute_goal/2 handler. - */ -project_attributes(AllVs, G) :- - attributes:modules_with_attributes(LMods), - LMods = [_|_], - term_variables(G, InputVs), - pick_att_vars(InputVs, AttIVs), - project_module(LMods, AttIVs, AllVs). - -pick_att_vars([],[]). -pick_att_vars([V|L],[V|NL]) :- attvar(V), !, - pick_att_vars(L,NL). -pick_att_vars([_|L],NL) :- - pick_att_vars(L,NL). - -project_module([], _, _). -project_module([Mod|LMods], LIV, LAV) :- - '$pred_exists'(project_attributes(LIV, LAV),Mod), - call(Mod:project_attributes(LIV, LAV)), !, - attributes:all_attvars(NLAV), - project_module(LMods,LIV,NLAV). -project_module([_|LMods], LIV, LAV) :- - project_module(LMods,LIV,LAV). - -%% @} diff --git a/packages/python/swig/yap4py/prolog/pl/boot.yap b/packages/python/swig/yap4py/prolog/pl/boot.yap deleted file mode 100644 index b00a086b9..000000000 --- a/packages/python/swig/yap4py/prolog/pl/boot.yap +++ /dev/null @@ -1,1661 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-2014 * -* * -************************************************************************** -* * -* File: boot.yap * -* Last rev: 8/2/88 * -* mods: * -* commen ts: boot file for Prolog * -* * -*************************************************************************/ - -/** -@file boot.yap -@brief YAP bootstrap - -@defgroup YAPControl Control Predicates - - -@{ - - -*/ - - -/** @pred :_P_ ; :_Q_ is iso -Disjunction of goals (or). - -Example: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - p(X) :- q(X); r(X). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -should be read as "p( _X_) if q( _X_) or r( _X_)". - - -*/ - -/** @pred \+ :_P_ is iso -Negation by failure. - -Goal _P_ is not provable. The execution of this predicate fails if -and only if the goal _P_ finitely succeeds. It is not a true logical -negation, which is impossible in standard Prolog, but -"negation-by-failure". - -This predicate might be defined as: - -~~~~~~~~~~~~ - \+(P) :- P, !, fail. - \+(_). -~~~~~~~~~~~~ -if _P_ did not include "cuts". - -If _P_ includes cuts, the cuts are defined to be scoped by _P_: they cannot cut over the calling prredicate. - - ~~~~~~~~~~~~ - go(P). - -:- \+ P, !, fail. - \+(_). - ~~~~~~~~~~~~ - -*/ - -/** @pred :_Condition__ -> :_Action_ is iso - - -@short If _Condition__ has a solution, call _Action_; - -@long -Read as "if-then-else" or "commit". This operator is similar to the -conditional operator of imperative languages and can be used alone or -with an else part as follows: - - -~~~~~ - +P -> +Q -~~~~~ - -"if P then Q". - - -~~~~~ - +P -> +Q; +R -~~~~~ - -"if P then Q else R". - -These two predicates could be defined respectively in Prolog as: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - (P -> Q) :- P, !, Q. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -and - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - (P -> Q; R) :- P, !, Q. - (P -> Q; R) :- R. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if there were no "cuts" in _P_, _Q_ and _R_. - -Note that the commit operator works by "cutting" any alternative -solutions of _P_. - -Note also that you can use chains of commit operators like: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - P -> Q ; R -> S ; T. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Note that `(->)/2` does not affect the scope of cuts in its -arguments. - - -*/ - -/** @pred :_Condition_ *-> :_Action_ is iso - -This construct implements the so-called soft-cut. The control is -defined as follows: - + If _Condition_ succeeds at least once, the -semantics is the same as ( _Condition_, _Action_). - - + If - _Condition_ does not succeed, the semantics is that of (\\+ - _Condition_, _Else_). - - In other words, if _Condition_ -succeeds at least once, simply behave as the conjunction of - _Condition_ and _Action_, otherwise execute _Else_. - -The construct _A *-> B_, i.e. without an _Else_ branch, is -translated as the normal conjunction _A_, _B_. - - -*/ - -/** @pred ! is iso - - -Read as "cut". Cuts any choices taken in the current procedure. -When first found "cut" succeeds as a goal, but if backtracking should -later return to it, the parent goal (the one which matches the head of -the clause containing the "cut", causing the clause activation) will -fail. This is an extra-logical predicate and cannot be explained in -terms of the declarative semantics of Prolog. - -example: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - member(X,[X|_]). - member(X,[_|L]) :- member(X,L). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -With the above definition - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ?- member(X,[1,2,3]). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -will return each element of the list by backtracking. With the following -definition: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - member(X,[X|_]) :- !. - member(X,[_|L]) :- member(X,L). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -the same query would return only the first element of the -list, since backtracking could not "pass through" the cut. - -*/ - -system_module(_Mod, _SysExps, _Decls). -% new_system_module(Mod). - -use_system_module(_Module, _SysExps). - -private(_). - -% -% boootstrap predicates. -% -:- system_module( '$_boot', [ - bootstrap/1, - call/1, - catch/3, - catch_ball/2, - expand_term/2, - import_system_module/2, - incore/1, - (not)/1, - repeat/0, - throw/1, - true/0], ['$$compile'/4, - '$call'/4, - '$catch'/3, - '$check_callable'/2, - '$check_head_and_body'/4, - '$check_if_reconsulted'/2, - '$clear_reconsulting'/0, - '$command'/4, - '$cut_by'/1, - '$disable_debugging'/0, - '$do_live'/0, - '$'/0, - '$find_goal_definition'/4, - '$head_and_body'/3, - '$inform_as_reconsulted'/2, - '$init_system'/0, - '$init_win_graphics'/0, - '$live'/0, - '$loop'/2, - '$meta_call'/2, - '$prompt_alternatives_on'/1, - '$run_at_thread_start'/0, - '$system_catch'/4, - '$undefp'/1, - '$version'/0]). - -:- use_system_module( '$_absf', ['$system_library_directories'/2]). - -:- use_system_module( '$_checker', ['$check_term'/5, - '$sv_warning'/2]). - -:- use_system_module( '$_consult', ['$csult'/2]). - -:- use_system_module( '$_control', ['$run_atom_goal'/1]). - -:- use_system_module( '$_directives', ['$all_directives'/1, - '$exec_directives'/5]). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -:- use_system_module( '$_grammar', ['$translate_rule'/2]). - -:- use_system_module( '$_modules', ['$get_undefined_pred'/4, - '$meta_expansion'/6, - '$module_expansion'/6]). - -:- use_system_module( '$_preddecls', ['$dynamic'/2]). - -:- use_system_module( '$_preds', ['$assert_static'/5, - '$assertz_dynamic'/4, - '$init_preds'/0, - '$unknown_error'/1, - '$unknown_warning'/1]). - -:- use_system_module( '$_qly', ['$init_state'/0]). - -:- use_system_module( '$_strict_iso', ['$check_iso_strict_clause'/1, - '$iso_check_goal'/2]). - - -'$early_print_message'(Level, Msg) :- - '$pred_exists'(print_message(_,_), prolog), !, - print_message( Level, Msg). -'$early_print_message'(informational, _) :- - yap_flag( verbose, S), - S == silent, - !. -'$early_print_message'(_, absolute_file_path(X, Y)) :- !, - format(user_error, X, Y), nl(user_error). -'$early_print_message'(_, loading( C, F)) :- !, - (yap_flag( verbose_load , silent ) -> true; - format(user_error, '~*|% ~a ~w...~n', [2,C,F]) ). -'$early_print_message'(_, loaded(F,C,M,T,H)) :- !, - (yap_flag( verbose_load , silent ) -> true; - format(user_error, '~*|% ~a:~w ~a ~d bytes in ~d seconds...~n', [2, M, F ,C, H, T]) ). -'$early_print_message'(Level, Msg) :- - source_location(F0, L), - !, - format(user_error, '~a:~d:0: unprocessed ~a ~w ~n', [F0, L,Level,Msg]). -'$early_print_message'(Level, Msg) :- - format(user_error, 'unprocessed ~a ~w ~n', [Level,Msg]). - -'$bootstrap_predicate'('$expand_a_clause'(_,_,_,_), _M, _) :- !, - fail. -'$bootstrap_predicate'('$imported_predicate'(_,_,_,_), _M, _) :- !, - fail. -'$bootstrap_predicate'('$process_directive'(Gs, _Mode, M, _VL, _Pos) , _M, _) :- !, - '$execute'( M:Gs ). - '$bootstrap_predicate'('$LoopError'( Error, _), _M, _) :- !, - source_location(F0, L), - format('~a:~d:0: error in bootstrap:~n ~w~n', [F0,L,Error]), - fail. -'$bootstrap_predicate'(delayed_goals(_, _, _ , _), _M, _) :- !, - fail. -'$bootstrap_predicate'(sort(L, S), _M, _) :- !, - '$sort'(L, S). -'$bootstrap_predicate'(print_message(Context, Msg), _M, _) :- !, - '$early_print_message'(Context, Msg). -'$bootstrap_predicate'(print_message(Context, Msg), _M, _) :- !, - '$early_print_message'(Context, Msg). -'$bootstrap_predicate'(prolog_file_type(A,prolog), _, _) :- !, - ( A = yap ; A = pl ; A = prolog ). -'$bootstrap_predicate'(file_search_path(_A,_B), _, _ ) :- !, fail. -'$bootstrap_predicate'(meta_predicate(G), M, _) :- !, - strip_module(M:G, M1, G1), - '$meta_predicate'(M1:G1). -'$bootstrap_predicate'(G, ImportingMod, _) :- - recorded('$import','$import'(ExportingModI,ImportingMod,G,G0I,_,_),_), !, - % writeln('$execute0'(G0I, ExportingModI)), - '$execute0'(G0I, ExportingModI). - % undef handler -'$bootstrap_predicate'(G0, M0, Action) :- - % make sure we do not loop on undefined predicates - yap_flag( unknown, Action, fail), - clause_location(Call, Caller), - format(user_error,'undefined directive ~w', [M0:G0]), - strip_module(M0:G0,M1,NGoal), - throw(error(evaluation(undefined,M0:G0), - [[g|g(M1:NGoal)],[p|Call],[e|Caller],[h|g(M0:G0)]])). -% -% -% -'$undefp0'([M|G], Action) :- - '$bootstrap_predicate'(G, M, Action). - -/** @pred true is iso -Succeed. - -Succeeds once. -*/ -true :- true. - -live :- - '$live'. - -'$live' :- - '$init_system', - '$do_live'. - -'$init_prolog' :- - '$init_system'. - -'$do_live' :- - repeat, - '$current_module'(Module), - ( Module==user -> - true % '$compile_mode'(_,0) - ; - format(user_error,'[~w]~n', [Module]) - ), - '$system_catch'('$enter_top_level',Module,Error,'$Error'(Error)). - - -'$init_system' :- - get_value('$yap_inited', true), !. -'$init_system' :- - % start_low_level_trace, - % do catch as early as possible - ( - % \+ '$uncaught_throw' - current_prolog_flag(halt_after_consult, false), - current_prolog_flag(verbose, normal) - -> - '$version' - ; - true - ), - current_prolog_flag(file_name_variables, OldF), - set_prolog_flag(file_name_variables, true), - '$init_consult', - set_prolog_flag(file_name_variables, OldF), - '$init_globals', - set_prolog_flag(fileerrors, true), - set_value('$gc',on), - ('$exit_undefp' -> true ; true), - prompt1(' ?- '), - set_prolog_flag(debug, false), - % simple trick to find out if this is we are booting from Prolog. - % boot from a saved state - ( - current_prolog_flag(saved_program, false) - -> - prolog_flag(verbose_load, OldVL, silent), - prolog_flag(verbose, OldV, silent), - prolog_flag(resource_database, RootPath), - file_directory_name( RootPath, Dir ), - atom_concat( Dir, '/init.yap' , Init), - bootstrap(Init), - prolog_flag(verbose, OldV, silent), - set_prolog_flag(verbose_load, OldVL), - module( user ), - '$make_saved_state' - ; - % use saved state - - '$init_state' - ), - '$db_clean_queues'(0), - % this must be executed from C-code. - % '$startup_saved_state', - set_input(user_input), - set_output(user_output), - '$init_or_threads', - '$run_at_thread_start', - set_value('$yap_inited', true). - -'$make_saved_state' :- - current_prolog_flag(os_argv, Args), - ( - lists:member( Arg, Args ), - atom_concat( '-B', _, Arg ) - -> - qsave_program( 'startup.yss'), - halt(0) - ; - true - ). - - -'$init_globals' :- - % set_prolog_flag(break_level, 0), - % '$set_read_error_handler'(error), let the user do that - nb_setval('$chr_toplevel_show_store',false). - -'$init_consult' :- - set_value('$open_expands_filename',true), - nb_setval('$assert_all',off), - nb_setval('$if_level',0), - nb_setval('$endif',off), - nb_setval('$initialization_goals',off), - nb_setval('$included_file',[]), - nb_setval('$loop_streams',[]), - \+ '$undefined'('$init_preds',prolog), - '$init_preds', - fail. -'$init_consult'. - -'$init_win_graphics' :- - '$undefined'(window_title(_,_), system), !. -'$init_win_graphics' :- - load_files([library(win_menu)], [silent(true),if(not_loaded)]), - fail. -'$init_win_graphics'. - -'$init_or_threads' :- - '$c_yapor_workers'(W), !, - '$start_orp_threads'(W). -'$init_or_threads'. - -'$start_orp_threads'(1) :- !. -'$start_orp_threads'(W) :- - thread_create('$c_worker',_,[detached(true)]), - W1 is W-1, - '$start_orp_threads'(W1). - -% Start file for yap - -/* I/O predicates */ - -/* meaning of flags for '$write' is - 1 quote illegal atoms - 2 ignore operator declarations - 4 output '$VAR'(N) terms as A, B, C, ... - 8 use portray(_) -*/ - -/* main execution loop */ -'$read_toplevel'(Goal, Bindings) :- - '$prompt', - catch(read_term(user_input, - Goal, - [variable_names(Bindings), syntax_errors(dec10)]), - E, '$handle_toplevel_error'( E) ). - -'$handle_toplevel_error'( syntax_error(_)) :- - !, - fail. -'$handle_toplevel_error'( error(io_error(read,user_input),_)) :- - !. -'$handle_toplevel_error'(_, E) :- - throw(E). - - -/** @pred stream_property( _Stream_, _Prop_) - -*/ - -% reset alarms when entering top-level. -'$enter_top_level' :- - '$alarm'(0, 0, _, _), - fail. -'$enter_top_level' :- - '$clean_up_dead_clauses', - fail. -'$enter_top_level' :- - get_value('$top_level_goal',GA), GA \= [], !, - set_value('$top_level_goal',[]), - '$run_atom_goal'(GA), - current_prolog_flag(break_level, BreakLevel), - ( - BreakLevel \= 0 - -> - true - ; - '$pred_exists'(halt(_), user) - -> - halt(0) - ; - '$halt'(0) - ). -'$enter_top_level' :- - flush_output, - '$run_toplevel_hooks', - prompt1(' ?- '), - '$read_toplevel'(Command,Varnames), - nb_setval('$spy_gn',1), - % stop at spy-points if debugging is on. - nb_setval('$debug_run',off), - nb_setval('$debug_jump',off), - '$command'(Command,Varnames,_Pos,top), - current_prolog_flag(break_level, BreakLevel), - ( - BreakLevel \= 0 - -> - true - ; - '$pred_exists'(halt(_), user) - -> halt(0) - ; - '$halt'(0) - ). - - -'$erase_sets' :- - eraseall('$'), - eraseall('$$set'), - eraseall('$$one'), - eraseall('$reconsulted'), fail. -'$erase_sets' :- \+ recorded('$path',_,_), recorda('$path',"",_). -'$erase_sets'. - -'$version' :- - current_prolog_flag(version_git,VersionGit), - current_prolog_flag(compiled_at,AT), - current_prolog_flag(version_data, yap(Mj, Mi, Patch, _) ), - sub_atom( VersionGit, 0, 8, _, VERSIONGIT ), - format(user_error, '% YAP ~d.~d.~d-~a (compiled ~a)~n', [Mj,Mi, Patch, VERSIONGIT, AT]), - fail. -'$version'. - -/** @pred repeat is iso -Succeeds repeatedly. - -In the next example, `repeat` is used as an efficient way to implement -a loop. The next example reads all terms in a file: -~~~~~~~~~~~~~{.prolog} - a :- repeat, read(X), write(X), nl, X=end_of_file, !. -~~~~~~~~~~~~~ -the loop is effectively terminated by the cut-goal, when the test-goal -`X=end` succeeds. While the test fails, the goals `read(X)`, -`write(X)`, and `nl` are executed repeatedly, because -backtracking is caught by the `repeat` goal. - -The built-in `repeat/0` could be defined in Prolog by: - -~~~~~{.prolog} - repeat. - repeat :- repeat. -~~~~~ - -The predicate between/3 can be used to iterate for a pre-defined -number of steps. - -*/ - repeat :- '$repeat'. - - '$repeat'. - '$repeat'. - '$repeat'. - '$repeat'. - '$repeat'. - '$repeat'. - '$repeat'. - '$repeat'. - '$repeat'. - '$repeat' :- '$repeat'. - -'$start_corouts' :- - eraseall('$corout'), - eraseall('$result'), - eraseall('$actual'), - fail. -'$start_corouts' :- recorda('$actual',main,_), - recordz('$corout','$corout'(main,main,'$corout'([],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[])),_Ref), - recorda('$result',going,_). - -'$command'(C,VL,Pos,Con) :- - current_prolog_flag(strict_iso, true), !, /* strict_iso on */ - '$execute_command'(C,VL,Pos,Con,_Source). -'$command'(C,VL,Pos,Con) :- - ( (Con = top ; var(C) ; C = [_|_]) -> - '$execute_command'(C,VL,Pos,Con,C), ! ; - % do term expansion - expand_term(C, EC), - % execute a list of commands - '$execute_commands'(EC,VL,Pos,Con,_Source), - % succeed only if the *original* was at end of file. - C == end_of_file - ). - - % - % Hack in case expand_term has created a list of commands. - % - '$execute_commands'(V,_,_,_,Source) :- var(V), !, - '$do_error'(instantiation_error,meta_call(Source)). - '$execute_commands'([],_,_,_,_) :- !. - '$execute_commands'([C|Cs],VL,Pos,Con,Source) :- !, - ( - '$system_catch'('$execute_command'(C,VL,Pos,Con,Source),prolog,Error,'$LoopError'(Error, Con)), - fail - ; - '$execute_commands'(Cs,VL,Pos,Con,Source) - ). - '$execute_commands'(C,VL,Pos,Con,Source) :- - '$execute_command'(C,VL,Pos,Con,Source). - - % - % - % - -'$execute_command'(C,_,_,top,Source) :- - var(C), - !, - '$do_error'(instantiation_error,meta_call(Source)). -'$execute_command'(C,_,_,top,Source) :- - number(C), - !, - '$do_error'(type_error(callable,C),meta_call(Source)). - '$execute_command'(R,_,_,top,Source) :- - db_reference(R), - !, - '$do_error'(type_error(callable,R),meta_call(Source)). - '$execute_command'(end_of_file,_,_,_,_) :- !. - '$execute_command'(Command,_,_,_,_) :- - '$nb_getval'('$if_skip_mode', skip, fail), - \+ '$if_directive'(Command), - !. - '$execute_command'((:-G),VL,Pos,Option,_) :- -% !, - Option \= top, !, - % allow user expansion - expand_term((:- G), O), - ( - O = (:- G1) - -> - '$yap_strip_module'(G1, M, G2), - '$process_directive'(G2, Option, M, VL, Pos) - ; - '$execute_commands'(G1,VL,Pos,Option,O) - ). - '$execute_command'((?-G), VL, Pos, Option, Source) :- - Option \= top, - !, - '$execute_command'(G, VL, Pos, top, Source). - '$execute_command'(G, VL, Pos, Option, Source) :- - '$continue_with_command'(Option, VL, Pos, G, Source). - - -'$continue_with_command'(Where,V,'$stream_position'(C,_P,A1,A2,A3),'$source_location'(_F,L):G,Source) :- - !, - '$continue_with_command'(Where,V,'$stream_position'(C,L,A1,A2,A3),G,Source). -'$continue_with_command'(reconsult,V,Pos,G,Source) :- -% writeln(G), - '$go_compile_clause'(G,V,Pos,reconsult,Source), - fail. -'$continue_with_command'(consult,V,Pos,G,Source) :- - '$go_compile_clause'(G,V,Pos,consult,Source), - fail. -'$continue_with_command'(top,V,_,G,_) :- - '$query'(G,V). - - %% - % @pred '$go_compile_clause'(G,Vs,Pos, Where, Source) is det - % - % interfaces the loader and the compiler - % not 100% compatible with SICStus Prolog, as SICStus Prolog would put - % module prefixes all over the place, although unnecessarily so. - % - % @param [in] _G_ is the clause to compile - % @param [in] _Vs_ a list of variables and their name - % @param [in] _Pos_ the source-code position - % @param [in] _N_ a flag telling whether to add first or last - % @param [out] _Source_ the user-tranasformed clause -'$go_compile_clause'(G, _Vs, _Pos, Where, Source) :- - '$precompile_term'(G, Source, G1), - !, - '$$compile'(G1, Where, Source, _). - '$go_compile_clause'(G,_Vs,_Pos, _Where, _Source) :- - throw(error(system, compilation_failed(G))). - -'$$compile'(C, Where, C0, R) :- - '$head_and_body'( C, MH, B ), - strip_module( MH, Mod, H), - ( - '$undefined'(H, Mod) - -> - '$init_pred'(H, Mod, Where) - ; - true - ), -% writeln(Mod:((H:-B))), - '$compile'((H:-B), Where, C0, Mod, R). - -'$init_pred'(H, Mod, _Where ) :- - recorded('$import','$import'(NM,Mod,NH,H,_,_),RI), -% NM \= Mod, - functor(NH,N,Ar), - print_message(warning,redefine_imported(Mod,NM,Mod:N/Ar)), - erase(RI), - fail. -'$init_pred'(H, Mod, Where ) :- - '$init_as_dynamic'(Where), - !, - functor(H, Na, Ar), - '$dynamic'(Na/Ar, Mod). -'$init_pred'(_H, _Mod, _Where ). - -'$init_as_dynamic'( asserta ). -'$init_as_dynamic'( assertz ). -'$init_as_dynamic'( consult ) :- - '$nb_getval'('$assert_all',on,fail). -'$init_as_dynamic'( reconsult ) :- - '$nb_getval'('$assert_all',on,fail). - -'$check_if_reconsulted'(N,A) :- - once(recorded('$reconsulted',N/A,_)), - recorded('$reconsulted',X,_), - ( X = N/A , !; - X = '$', !, fail; - fail - ). - -'$inform_as_reconsulted'(N,A) :- - recorda('$reconsulted',N/A,_). - -'$clear_reconsulting' :- - recorded('$reconsulted',X,Ref), - erase(Ref), - X == '$', - !, - ( recorded('$reconsulting',_,R) -> erase(R) ). - -'$prompt_alternatives_on'(determinism). - -/* Executing a query */ - -'$query'(end_of_file,_). -'$query'(G,[]) :- - '$prompt_alternatives_on'(OPT), - ( OPT = groundness ; OPT = determinism), - !, - '$yes_no'(G,(?-)). -'$query'(G,V) :- - ( - '$current_choice_point'(CP), - '$current_module'(M), - '$user_call'(G, M), - '$current_choice_point'(NCP), - '$delayed_goals'(G, V, NV, LGs, DCP), - '$write_answer'(NV, LGs, Written), - '$write_query_answer_true'(Written), - ( - '$prompt_alternatives_on'(determinism), CP == NCP, DCP = 0 - -> - format(user_error, '.~n', []), - ! - ; - '$another', - ! - ), - fail - ; - '$out_neg_answer' - ). - - '$yes_no'(G,C) :- - '$current_module'(M), - '$do_yes_no'(G,M), - '$delayed_goals'(G, [], NV, LGs, _), - '$write_answer'(NV, LGs, Written), - ( Written = [] -> - !,'$present_answer'(C, true) - ; - '$another', ! - ), - fail. - '$yes_no'(_,_) :- - '$out_neg_answer'. - -'$add_env_and_fail' :- fail. - -% -% *-> at this point would require compiler support, which does not exist. -% -'$delayed_goals'(G, V, NV, LGs, NCP) :- - ( - CP is '$last_choice_pt', - '$current_choice_point'(NCP1), - attributes:delayed_goals(G, V, NV, LGs), - '$current_choice_point'(NCP2), - '$clean_ifcp'(CP), - NCP is NCP2-NCP1 - ; - copy_term_nat(V, NV), - LGs = [], -% term_factorized(V, NV, LGs), - NCP = 0 - ). - -'$out_neg_answer' :- - print_message( help, false), - fail. - - -'$do_yes_no'([X|L], M) :- - !, - '$csult'([X|L], M). -'$do_yes_no'(G, M) :- - '$user_call'(G, M). - -'$write_query_answer_true'([]) :- !, - format(user_error,true,[]). -'$write_query_answer_true'(_). - - -% -% present_answer has three components. First it flushes the streams, -% then it presents the goals, and last it shows any goals frozen on -% the arguments. -% -'$present_answer'(_,_):- - flush_output, - fail. -'$present_answer'((?-), Answ) :- - current_prolog_flag(break_level, BL ), - ( BL \= 0 -> format(user_error, '[~p] ',[BL]) ; - true ), - ( current_prolog_flag(toplevel_print_options, Opts) -> - write_term(user_error,Answ,Opts) ; - format(user_error,'~w',[Answ]) - ), - format(user_error,'.~n', []). - -'$another' :- - '$clear_input'(user_input), - format(user_error,' ? ',[]), - get_code(user_input,C), - '$do_another'(C). - -'$do_another'(C) :- - ( C=:= ";" -> - skip(user_input,10), % - % '$add_nl_outside_console', - fail - ; - C== 10 - -> - '$add_nl_outside_console', - ( - '$undefined'(print_message(_,_),prolog) - -> - format(user_error,'yes~n', []) - ; - print_message(help,yes) - ) - ; - C== 13 - -> - get0(user_input,NC), - '$do_another'(NC) - ; - C== -1 - -> - halt - ; - skip(user_input,10), '$ask_again_for_another' - ). - -%'$add_nl_outside_console' :- -% '$is_same_tty'(user_input, user_error), !. -'$add_nl_outside_console' :- - format(user_error,'~n',[]). - -'$ask_again_for_another' :- - format(user_error,'Action (\";\" for more choices, for exit)', []), - '$another'. - -'$write_answer'(_,_,_) :- - flush_output, - fail. -'$write_answer'(Vs, LBlk, FLAnsw) :- - '$purge_dontcares'(Vs,IVs), - '$sort'(IVs, NVs), - '$prep_answer_var_by_var'(NVs, LAnsw, LBlk), - '$name_vars_in_goals'(LAnsw, Vs, NLAnsw), - '$write_vars_and_goals'(NLAnsw, first, FLAnsw). - -'$purge_dontcares'([],[]). -'$purge_dontcares'([Name=_|Vs],NVs) :- - atom_codes(Name, [C|_]), C is "_", !, - '$purge_dontcares'(Vs,NVs). -'$purge_dontcares'([V|Vs],[V|NVs]) :- - '$purge_dontcares'(Vs,NVs). - - -'$prep_answer_var_by_var'([], L, L). -'$prep_answer_var_by_var'([Name=Value|L], LF, L0) :- - '$delete_identical_answers'(L, Value, NL, Names), - '$prep_answer_var'([Name|Names], Value, LF, LI), - '$prep_answer_var_by_var'(NL, LI, L0). - -% fetch all cases that have the same solution. -'$delete_identical_answers'([], _, [], []). -'$delete_identical_answers'([(Name=Value)|L], Value0, FL, [Name|Names]) :- - Value == Value0, !, - '$delete_identical_answers'(L, Value0, FL, Names). -'$delete_identical_answers'([VV|L], Value0, [VV|FL], Names) :- - '$delete_identical_answers'(L, Value0, FL, Names). - -% now create a list of pairs that will look like goals. -'$prep_answer_var'(Names, Value, LF, L0) :- var(Value), !, - '$prep_answer_unbound_var'(Names, LF, L0). -'$prep_answer_var'(Names, Value, [nonvar(Names,Value)|L0], L0). - -% ignore unbound variables -'$prep_answer_unbound_var'([_], L, L) :- !. -'$prep_answer_unbound_var'(Names, [var(Names)|L0], L0). - -'$gen_name_string'(I,L,[C|L]) :- I < 26, !, C is I+65. -'$gen_name_string'(I,L0,LF) :- - I1 is I mod 26, - I2 is I // 26, - C is I1+65, - '$gen_name_string'(I2,[C|L0],LF). - -'$write_vars_and_goals'([], _, []). -'$write_vars_and_goals'([nl,G1|LG], First, NG) :- !, - nl(user_error), - '$write_goal_output'(G1, First, NG, Next, IG), - '$write_vars_and_goals'(LG, Next, IG). -'$write_vars_and_goals'([G1|LG], First, NG) :- - '$write_goal_output'(G1, First, NG, Next, IG), - '$write_vars_and_goals'(LG, Next, IG). - -'$goal_to_string'(Format, G, String) :- - format(codes(String),Format,G). - -'$write_goal_output'(var([V|VL]), First, [var([V|VL])|L], next, L) :- !, - ( First = first -> true ; format(user_error,',~n',[]) ), - format(user_error,'~a',[V]), - '$write_output_vars'(VL). -'$write_goal_output'(nonvar([V|VL],B), First, [nonvar([V|VL],B)|L], next, L) :- !, - ( First = first -> true ; format(user_error,',~n',[]) ), - format(user_error,'~a',[V]), - '$write_output_vars'(VL), - format(user_error,' = ', []), - ( yap_flag(toplevel_print_options, Opts) -> - write_term(user_error,B,[priority(699)|Opts]) ; - write_term(user_error,B,[priority(699)]) - ). -'$write_goal_output'(nl, First, NG, First, NG) :- !, - format(user_error,'~n',[]). -'$write_goal_output'(Format-G, First, NG, Next, IG) :- !, - G = [_|_], !, - % dump on string first so that we can check whether we actually - % had any output from the solver. - '$goal_to_string'(Format, G, String), - ( String == [] -> - % we didn't - IG = NG, First = Next - ; - % we did - ( First = first -> true ; format(user_error,',~n',[]) ), - format(user_error, '~s', [String]), - NG = [G|IG] - ). -'$write_goal_output'(_-G, First, [G|NG], next, NG) :- !, - ( First = first -> true ; format(user_error,',~n',[]) ), - ( yap_flag(toplevel_print_options, Opts) -> - write_term(user_error,G,Opts) ; - format(user_error,'~w',[G]) - ). -'$write_goal_output'(_M:G, First, [G|NG], next, NG) :- !, - ( First = first -> true ; format(user_error,',~n',[]) ), - ( yap_flag(toplevel_print_options, Opts) -> - write_term(user_error,G,Opts) ; - format(user_error,'~w',[G]) - ). -'$write_goal_output'(G, First, [M:G|NG], next, NG) :- - '$current_module'(M), - ( First = first -> true ; format(user_error,',~n',[]) ), - ( yap_flag(toplevel_print_options, Opts) -> - write_term(user_error,G,Opts) ; - format(user_error,'~w',[G]) - ). - -'$name_vars_in_goals'(G, VL0, G) :- - '$name_well_known_vars'(VL0), - '$variables_in_term'(G, [], GVL), - '$name_vars_in_goals1'(GVL, 0, _). - -'$name_well_known_vars'([]). -'$name_well_known_vars'([Name=V|NVL0]) :- - var(V), !, - V = '$VAR'(Name), - '$name_well_known_vars'(NVL0). -'$name_well_known_vars'([_|NVL0]) :- - '$name_well_known_vars'(NVL0). - -'$name_vars_in_goals1'([], I, I). -'$name_vars_in_goals1'([V|NGVL], I0, IF) :- - I is I0+1, - '$gen_name_string'(I0,[],SName), !, - atom_codes(Name, [95|SName]), - V = '$VAR'(Name), - '$name_vars_in_goals1'(NGVL, I, IF). -'$name_vars_in_goals1'([NV|NGVL], I0, IF) :- - nonvar(NV), - '$name_vars_in_goals1'(NGVL, I0, IF). - -'$write_output_vars'([]). -'$write_output_vars'([V|VL]) :- - format(user_error,' = ~a',[V]), - '$write_output_vars'(VL). - - -/** @pred + _P_ is nondet - -The same as `call( _P_)`. This feature has been kept to provide -compatibility with C-Prolog. When compiling a goal, YAP -generates a `call( _X_)` whenever a variable _X_ is found as -a goal. - -~~~~~{.prolog} - a(X) :- X. -~~~~~ -is converted to: - -~~~~~{.prolog} - a(X) :- call(X). -~~~~~ - - -*/ - -/** @pred call(+ _P_) is iso -Meta-call predicate. - -If _P_ is instantiated to an atom or a compound term, the goal `call( -_P_)` is executed as if the clause was originally written as _P_ -instead as call( _P_ ), except that any "cut" occurring in _P_ only -cuts alternatives in the execution of _P_. - - -*/ -call(G) :- '$execute'(G). - -/** @pred incore(+ _P_) - - -The same as call/1. - - -*/ -incore(G) :- '$execute'(G). - -% -% standard meta-call, called if $execute could not do everything. -% -'$meta_call'(G, M) :- - '$current_choice_point'(CP), - '$call'(G, CP, G, M). - -'$user_call'(G, M) :- - ( - '$$save_by'(CP), - '$enable_debugging', - '$call'(G, CP, M:G, M), - '$$save_by'(CP2), - ( - CP == CP2 - -> - ! - ; - ( true ; '$enable_debugging', fail ) - ), - '$disable_debugging' - ; - '$disable_debugging', - fail - ). - - - -% enable creeping -'$enable_debugging':- - current_prolog_flag(debug, false), !. -'$enable_debugging' :- - '$trace_on', !, - '$creep'. -'$enable_debugging'. - -'$trace_on' :- - '$nb_getval'('$trace', on, fail). - -'$trace_off' :- - '$nb_getval'('$trace', off, fail). - - -/** @pred :_P_ , :_Q_ is iso, meta -Conjunction of goals (and). - -The conjunction is a fundamental construct of Prolog. Example: - -~~~~~~~ - p(X) :- q(X), r(X). -~~~~~~~ - -should be read as `p( _X_) if q( _X_) and r( _X_). - - -*/ -','(X,Y) :- - yap_hacks:env_choice_point(CP), - '$current_module'(M), - '$call'(X,CP,(X,Y),M), - '$call'(Y,CP,(X,Y),M). -';'((X->A),Y) :- !, - yap_hacks:env_choice_point(CP), - '$current_module'(M), - ( '$execute'(X) - -> - '$call'(A,CP,(X->A;Y),M) - ; - '$call'(Y,CP,(X->A;Y),M) - ). -';'((X*->A),Y) :- !, - yap_hacks:env_choice_point(CP), - '$current_module'(M), - ( - '$current_choice_point'(DCP), - '$execute'(X), - yap_hacks:cut_at(DCP), - '$call'(A,CP,((X*->A),Y),M) - ; - '$call'(Y,CP,((X*->A),Y),M) - ). -';'(X,Y) :- - yap_hacks:env_choice_point(CP), - '$current_module'(M), - ( '$call'(X,CP,(X;Y),M) ; '$call'(Y,CP,(X;Y),M) ). -'|'(X,Y) :- - yap_hacks:env_choice_point(CP), - '$current_module'(M), - ( '$call'(X,CP,(X|Y),M) ; '$call'(Y,CP,(X|Y),M) ). -'->'(X,Y) :- - yap_hacks:env_choice_point(CP), - '$current_module'(M), - ( '$call'(X,CP,(X->Y),M) -> '$call'(Y,CP,(X->Y),M) ). -'*->'(X,Y) :- - yap_hacks:env_choice_point(CP), - '$current_module'(M), - ( '$call'(X,CP,(X*->Y),M), '$call'(Y,CP,(X*->Y),M) ). -\+(G) :- \+ '$execute'(G). -not(G) :- \+ '$execute'(G). - -'$cut_by'(CP) :- '$$cut_by'(CP). - -% -% do it in ISO mode. -% -'$meta_call'(G,_ISO,M) :- - '$iso_check_goal'(G,G), - '$current_choice_point'(CP), - '$call'(G, CP, G, M). - -'$meta_call'(G, CP, G0, M) :- - '$call'(G, CP, G0, M). - -'$call'(G, CP, G0, _, M) :- /* iso version */ - '$iso_check_goal'(G,G0), - '$call'(G, CP, G0, M). - - -'$call'(M:_,_,G0,_) :- var(M), !, - '$do_error'(instantiation_error,call(G0)). -'$call'(M:G,CP,G0,_) :- !, - '$call'(G,CP,G0,M). -'$call'((X,Y),CP,G0,M) :- !, - '$call'(X,CP,G0,M), - '$call'(Y,CP,G0,M). -'$call'((X->Y),CP,G0,M) :- !, - ( - '$call'(X,CP,G0,M) - -> - '$call'(Y,CP,G0,M) - ). -'$call'((X*->Y),CP,G0,M) :- !, - '$call'(X,CP,G0,M), - '$call'(Y,CP,G0,M). -'$call'((X->Y; Z),CP,G0,M) :- !, - ( - '$call'(X,CP,G0,M) - -> - '$call'(Y,CP,G0,M) - ; - '$call'(Z,CP,G0,M) - ). -'$call'((X*->Y; Z),CP,G0,M) :- !, - ( - '$current_choice_point'(DCP), - '$call'(X,CP,G0,M), - yap_hacks:cut_at(DCP), - '$call'(Y,CP,G0,M) - ; - '$call'(Z,CP,G0,M) - ). -'$call'((A;B),CP,G0,M) :- !, - ( - '$call'(A,CP,G0,M) - ; - '$call'(B,CP,G0,M) - ). -'$call'((X->Y| Z),CP,G0,M) :- !, - ( - '$call'(X,CP,G0,M) - -> - '$call'(Y,CP,G0,M) - ; - '$call'(Z,CP,G0,M) - ). -'$call'((X*->Y| Z),CP,G0,M) :- !, - ( - '$current_choice_point'(DCP), - '$call'(X,CP,G0,M), - yap_hacks:cut_at(DCP), - '$call'(Y,CP,G0,M) - ; - '$call'(Z,CP,G0,M) - ). -'$call'((A|B),CP, G0,M) :- !, - ( - '$call'(A,CP,G0,M) - ; - '$call'(B,CP,G0,M) - ). -'$call'(\+ X, _CP, G0, M) :- !, - \+ ('$current_choice_point'(CP), - '$call'(X,CP,G0,M) ). -'$call'(not(X), _CP, G0, M) :- !, - \+ ('$current_choice_point'(CP), - '$call'(X,CP,G0,M) ). -'$call'(!, CP, _,_) :- !, - '$$cut_by'(CP). -'$call'([A|B], _, _, M) :- !, - '$csult'([A|B], M). -'$call'(G, _CP, _G0, CurMod) :- - ( - '$is_metapredicate'(G,CurMod) - -> - '$disable_debugging', - ( '$expand_meta_call'(CurMod:G, [], NG) -> true ; true ), - '$enable_debugging' - ; - NG = G - ), - '$execute0'(NG, CurMod). - -'$check_callable'(V,G) :- var(V), !, - '$do_error'(instantiation_error,G). -'$check_callable'(M:_G1,G) :- var(M), !, - '$do_error'(instantiation_error,G). -'$check_callable'(_:G1,G) :- !, - '$check_callable'(G1,G). -'$check_callable'(A,G) :- number(A), !, - '$do_error'(type_error(callable,A),G). -'$check_callable'(R,G) :- db_reference(R), !, - '$do_error'(type_error(callable,R),G). -'$check_callable'(_,_). - - -bootstrap(F) :- - % '$open'(F, '$csult', Stream, 0, 0, F), -% '$file_name'(Stream,File), - yap_flag(verbose_load, Old, silent), - open(F, read, Stream), - stream_property(Stream, [file_name(File)]), - '$start_consult'(consult, File, LC), - file_directory_name(File, Dir), - working_directory(OldD, Dir), - ( - current_prolog_flag(verbose_load, silent) - -> - true - ; - H0 is heapused, '$cputime'(T0,_), - format(user_error, '~*|% consulting ~w...~n', [LC,F]) - ), - '$boot_loop'(Stream,consult), - working_directory(_, OldD), - '$current_module'(_, prolog), - '$end_consult', - ( - current_prolog_flag(verbose_load, silent) - -> - true - ; - H is heapused-H0, '$cputime'(TF,_), T is TF-T0, - format(user_error, '~*|% ~w consulted ~w bytes in ~d msecs~n', [LC,F,H,T]) - ), - !, - yap_flag(verbose_load, _, Old), - close(Stream). - - -'$loop'(Stream,exo) :- - prolog_flag(agc_margin,Old,0), - prompt1(': '), prompt(_,' '), - '$current_module'(OldModule), - repeat, - '$system_catch'(dbload_from_stream(Stream, OldModule, exo), '$db_load', Error, - user:'$LoopError'(Error, top)), - prolog_flag(agc_margin,_,Old), - !. -'$loop'(Stream,db) :- - prolog_flag(agc_margin,Old,0), - prompt1(': '), prompt(_,' '), - '$current_module'(OldModule), - repeat, - '$system_catch'(dbload_from_stream(Stream, OldModule, db), '$db_load', Error, - user:'$LoopError'(Error, top)), - prolog_flag(agc_margin,_,Old), - !. -'$loop'(Stream,Status) :- - repeat, - '$current_module'( OldModule, OldModule ), - '$system_catch'( '$enter_command'(Stream,OldModule,Status), - OldModule, Error, - user:'$LoopError'(Error, Status) - ), - !. - -'$boot_loop'(Stream,Where) :- - repeat, - '$current_module'( OldModule, OldModule ), - read_clause(Stream, Command, [module(OldModule), syntax_errors(dec10),variable_names(_Vars), term_position(_Pos)]), - (Command == end_of_file - -> - ! - ; - Command = (:- Goal) -> - '$system_catch'('$boot_execute'(Goal), prolog, Error, - user:'$LoopError'(Error, consult) ), - fail - ; -Command = (H --> B) -> - '$system_catch'('$boot_dcg'(H,B, Where), prolog, Error, - user:'$LoopError'(Error, consult) ), - - fail - ; - '$system_catch'('$boot_clause'( Command, Where ), prolog, Error, - user:'$LoopError'(Error, consult) ), - - fail - ). - - '$boot_execute'( Goal ) :- - '$execute'( Goal ), - !. - '$boot_execute'( Goal ) :- - format(user_error, ':- ~w failed.~n', [Goal]). - -'$boot_dcg'( H, B, Where ) :- - '$translate_rule'((H --> B), (NH :- NB) ), - '$$compile'((NH :- NB), Where, ( H --> B), _R), - !. -'$boot_dcg'( H, B, _ ) :- - format(user_error, ' ~w --> ~w failed.~n', [H,B]). - -'$boot_clause'( Command, Where ) :- - '$$compile'(Command, Where, Command, _R), - !. -'$boot_clause'( Command, _ ) :- - format(user_error, ' ~w failed.~n', [Command]). - - - -'$enter_command'(Stream, Mod, Status) :- - '$clear_input'(Stream), - prompt1(': '), prompt(_,' '), - Options = [module(Mod), syntax_errors(dec10),variable_names(Vars), term_position(Pos)], - ( - Status == top - -> - read_term(Stream, Command, Options) - ; - read_clause(Stream, Command, Options) - ), - '$command'(Command,Vars,Pos, Status). - -/** @pred user:expand_term( _T_,- _X_) is dynamic,multifile. - - This user-defined predicate is called by YAP after - reading goals and clauses. - - - _Module_:`expand_term(` _T_ , _X_) is called first on the - current source module _Module_ ; if i - - `user:expand_term(` _T_ , _X_ `)` is available on every module. - - */ - -/* General purpose predicates */ - -'$head_and_body'((H:-B),H,B) :- !. -'$head_and_body'(H,H,true). - -% -% split head and body, generate an error if body is unbound. -% -'$check_head_and_body'(C,M,H,B,P) :- - '$yap_strip_module'(C,M1,(MH:-B0)), - !, - '$yap_strip_module'(M1:MH,M,H), - ( M == M1 -> B = B0 ; B = M1:B0), - is_callable(M:H,P). - -'$check_head_and_body'(MH, M, H, true, P) :- - '$yap_strip_module'(MH,M,H), - is_callable(M:H,P). - % term expansion -% -% return two arguments: Expanded0 is the term after "USER" expansion. -% Expanded is the final expanded term. -% -'$precompile_term'(Term, ExpandedUser, Expanded) :- -%format('[ ~w~n',[Term]), - '$expand_clause'(Term, ExpandedUser, ExpandedI), - !, -%format(' -> ~w~n',[Expanded0]), - ( - current_prolog_flag(strict_iso, true) /* strict_iso on */ - -> - Expanded = ExpandedI, - '$check_iso_strict_clause'(ExpandedUser) - ; - '$expand_array_accesses_in_term'(ExpandedI,Expanded) - -> true - ; - Expanded = ExpandedI - ). -'$precompile_term'(Term, Term, Term). - -'$expand_clause'(InputCl, C1, CO) :- - source_module(SM), - '$yap_strip_clause'(SM:InputCl, M, ICl), - '$expand_a_clause'( M:ICl, SM, C1, CO), - !. -'$expand_clause'(Cl, Cl, Cl). - -/** @pred expand_term( _T_,- _X_) - -This predicate is used by YAP for preprocessing each top level -term read when consulting a file and before asserting or executing it. -It rewrites a term _T_ to a term _X_ according to the following -rules: first try term_expansion/2 in the current module, and then try to use the user defined predicate user:term_expansion/2`. If this call fails then the translating process -for DCG rules is applied, together with the arithmetic optimizer -whenever the compilation of arithmetic expressions is in progress. - - -*/ -expand_term(Term,Expanded) :- - ( - '$do_term_expansion'(Term,Expanded) - -> - true - ; - '$expand_term_grammar'(Term,Expanded) - ). - -% -% Grammar Rules expansion -% -'$expand_term_grammar'((A-->B), C) :- - prolog:'$translate_rule'((A-->B),C), !. -'$expand_term_grammar'(A, A). - -% -% Arithmetic expansion -% -'$expand_array_accesses_in_term'(Expanded0,ExpandedF) :- - '$array_refs_compiled', - '$arrays':'$c_arrays'(Expanded0,ExpandedF), !. -'$expand_array_accesses_in_term'(Expanded,Expanded). - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% catch/throw implementation - -% at each catch point I need to know: -% what is ball; -% where was the previous catch -/** @pred catch( : _Goal_,+ _Exception_,+ _Action_) is iso - - -The goal `catch( _Goal_, _Exception_, _Action_)` tries to -execute goal _Goal_. If during its execution, _Goal_ throws an -exception _E'_ and this exception unifies with _Exception_, the -exception is considered to be caught and _Action_ is executed. If -the exception _E'_ does not unify with _Exception_, control -again throws the exception. - -The top-level of YAP maintains a default exception handler that -is responsible to capture uncaught exceptions. - - -*/ -catch(G, C, A) :- - '$catch'(G,C,A). - -% makes sure we have an environment. -'$true'. - - -% system_catch is like catch, but it avoids the overhead of a full -% meta-call by calling '$execute0' instead of $execute. -% This way it -% also avoids module preprocessing and goal_expansion -% -'$system_catch'(G, M, C, A) :- - % check current trail - '$catch'(M:G,C,A). - -'$catch'(MG,_,_) :- - '$$save_by'(CP0), - '$execute'(MG), - '$$save_by'(CP1), - % remove catch - ( - CP0 == CP1 - -> - ! - ; - true - ). -'$catch'(_,C,A) :- - nonvar(C), - '$run_catch'(A, C). - -% variable throws are user-handled. -'$run_catch'(G,E) :- - E = '$VAR'(_), - !, - call(G ). -'$run_catch'(abort,_) :- - abort. -'$run_catch'('$Error'(E),E) :- - !, - '$LoopError'(E, top ). -'$run_catch'('$LoopError'(E, Where),E) :- - !, - '$LoopError'(E, Where). -'$run_catch'('$TraceError'(E, GoalNumber, G, Module, CalledFromDebugger),E) :- - !, - '$TraceError'(E, GoalNumber, G, Module, CalledFromDebugger). -'$run_catch'(_Signal,E) :- - functor( E, N, _), - '$hidden_atom'(N), !, - throw(E). -'$run_catch'(E, _Signal) :- - call(E). - -% -% throw has to be *exactly* after system catch! -% -/** @pred throw(+ _Ball_) is iso - - -The goal `throw( _Ball_)` throws an exception. Execution is -stopped, and the exception is sent to the ancestor goals until reaching -a matching catch/3, or until reaching top-level. - -*/ -throw(Ball) :- - % get current jump point - '$jump_env_and_store_ball'(Ball). - -'$run_toplevel_hooks' :- - current_prolog_flag(break_level, 0 ), - recorded('$toplevel_hooks',H,_), - H \= fail, !, - ( call(user:H) -> true ; true). -'$run_toplevel_hooks'. - -'$run_at_thread_start' :- - recorded('$thread_initialization',M:D,_), - '$meta_call'(D, M), - fail. -'$run_at_thread_start'. - -log_event( String, Args ) :- - format( atom( M ), String, Args), - log_event( M ). - -'$prompt' :- - current_prolog_flag(break_level, BreakLevel), - ( - BreakLevel == 0 - -> - LF = LD - ; - LF = ['Break (level ', BreakLevel, ')'|LD] - ), - current_prolog_flag(debug, DBON), - ( - '$trace_on' - -> - ( - var(LF) - -> - LD = ['trace'|LP] - ; - LD = [', trace '|LP] - ) - ; - DBON == true - -> - (var(LF) - -> - LD = ['debug'|LP] - ; - LD = [', debug'|LP] - ) - ; - LD = LP - ), - ( - var(LF) - -> - LP = [P] - ; - LP = [' ',P] - ), - yap_flag(toplevel_prompt, P), - atomic_concat(LF, PF), - prompt1(PF), - prompt(_,' | '), - '$ensure_prompting'. - -/** -@} @} -*/ diff --git a/packages/python/swig/yap4py/prolog/pl/bootlists.yap b/packages/python/swig/yap4py/prolog/pl/bootlists.yap deleted file mode 100644 index 5508b55b1..000000000 --- a/packages/python/swig/yap4py/prolog/pl/bootlists.yap +++ /dev/null @@ -1,140 +0,0 @@ -/** - * @file bootlists.yap - * @author VITOR SANTOS COSTA - * @date Thu Nov 19 09:54:00 2015 - * - * @addtogroup lists - * @{ -*/ - -:- system_module( '$_lists', [], []). - -:- set_prolog_flag(source, true). % source. - -% memberchk(+Element, +Set) -% means the same thing, but may only be used to test whether a known -% Element occurs in a known Set. In return for this limited use, it -% is more efficient when it is applicable. -/** @pred memberchk(+ _Element_, + _Set_) - - -As member/2, but may only be used to test whether a known - _Element_ occurs in a known Set. In return for this limited use, it -is more efficient when it is applicable. - - -*/ -lists:memberchk(X,[X|_]) :- !. -lists:memberchk(X,[_|L]) :- - lists:memberchk(X,L). - -%% member(?Element, ?Set) -% is true when Set is a list, and Element occurs in it. It may be used -% to test for an element or to enumerate all the elements by backtracking. -% Indeed, it may be used to generate the Set! - -/** @pred member(? _Element_, ? _Set_) - - -True when _Set_ is a list, and _Element_ occurs in it. It may be used -to test for an element or to enumerate all the elements by backtracking. - - -*/ -lists:member(X,[X|_]). -lists:member(X,[_|L]) :- - lists:member(X,L). - -%% @pred identical_member(?Element, ?Set) is nondet -% -% identical_member holds true when Set is a list, and Element is -% exactly identical to one of the elements that occurs in it. - -lists:identical_member(X,[Y|M]) :- - ( - X == Y - ; - M \= [], lists:identical_member(X,M) - ). - -/** @pred append(? _List1_,? _List2_,? _List3_) - - -Succeeds when _List3_ unifies with the concatenation of _List1_ -and _List2_. The predicate can be used with any instantiation -pattern (even three variables). - - -*/ -lists:append([], L, L). -lists:append([H|T], L, [H|R]) :- - lists:append(T, L, R). - - -:- set_prolog_flag(source, true). % :- no_source. - -% lists:delete(List, Elem, Residue) -% is true when List is a list, in which Elem may or may not occur, and -% Residue is a copy of List with all elements identical to Elem lists:deleted. - -/** @pred delete(+ _List_, ? _Element_, ? _Residue_) - -eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee -True when _List_ is a list, in which _Element_ may or may not -occur, and _Residue_ is a copy of _List_ with all elements -identical to _Element_ deleted. - -eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee -*/ -lists:delete([], _, []). -lists:delete([Head|List], Elem, Residue) :- - Head = Elem, - lists:delete(List, Elem, Residue). -lists:delete([Head|List], Elem, [Head|Residue]) :- - lists:delete(List, Elem, Residue). - -:- set_prolog_flag(source, false). % disable source. - - - -% length of a list. - -/** @pred length(? _L_,? _S_) - - -Unify the well-defined list _L_ with its length. The procedure can -be used to find the length of a pre-defined list, or to build a list -of length _S_. - -*/ - -prolog:length(L, M) :- - '$skip_list'(L, M, M0, R), - ( var(R) -> '$$_length'(R, M, M0) ; - R == [] - ). - -% -% in case A1 is unbound or a difference list, things get tricky -% -'$$_length'(R, M, M0) :- - ( var(M) -> '$$_length1'(R,M,M0) - ; M >= M0 -> '$$_length2'(R,M,M0) ). - -% -% Size is unbound, generate lists -% -'$$_length1'([], M, M). -'$$_length1'([_|L], O, N) :- - M is N + 1, - '$$_length1'(L, O, M). - -% -% Size is bound, generate single list -% -'$$_length2'(NL, O, N) :- - ( N =:= O -> NL = []; - M is N + 1, NL = [_|L], '$$_length2'(L, O, M) ). - -%% @} - diff --git a/packages/python/swig/yap4py/prolog/pl/callcount.yap b/packages/python/swig/yap4py/prolog/pl/callcount.yap deleted file mode 100644 index f8be21661..000000000 --- a/packages/python/swig/yap4py/prolog/pl/callcount.yap +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: callcount.yap * -* Last rev: 8/2/02 * -* mods: * -* comments: Some profiling predicates available in yap * -* * -*************************************************************************/ - -%% @{ - -/** @defgroup Profiling Profiling Prolog Programs -@ingroup extensions - -YAP includes two profilers. The count profiler keeps information on the -number of times a predicate was called. This information can be used to -detect what are the most commonly called predicates in the program. The -count profiler can be compiled by setting YAP's flag profiling -to `on`. The time-profiler is a `gprof` profiler, and counts -how many ticks are being spent on specific predicates, or on other -system functions such as internal data-base accesses or garbage collects. - -The YAP profiling sub-system is currently under -development. Functionality for this sub-system will increase with newer -implementation. - - - */ - -%% @{ - -/** @defgroup Call_Counting Counting Calls -@ingroup Profiling - -Predicates compiled with YAP's flag call_counting set to -`on` update counters on the numbers of calls and of -retries. Counters are actually decreasing counters, so that they can be -used as timers. Three counters are available: - -+ `calls`: number of predicate calls since execution started or since -system was reset; -+ `retries`: number of retries for predicates called since -execution started or since counters were reset; -+ `calls_and_retries`: count both on predicate calls and -retries. - -These counters can be used to find out how many calls a certain -goal takes to execute. They can also be used as timers. - -The code for the call counters piggybacks on the profiling -code. Therefore, activating the call counters also activates the profiling -counters. - -These are the predicates that access and manipulate the call counters. -*/ - -:- system_module( '$_callcount', [call_count/3, - call_count_data/3, - call_count_reset/0], []). - -:- use_system_module( '$_errors', ['$do_error'/2]). - - -/** @pred call_count_data(- _Calls_, - _Retries_, - _CallsAndRetries_) - - -Give current call count data. The first argument gives the current value -for the _Calls_ counter, next the _Retries_ counter, and last -the _CallsAndRetries_ counter. - -*/ -call_count_data(Calls, Retries, Both) :- - '$call_count_info'(Calls, Retries, Both). - -/** @pred call_count_reset - - -Reset call count counters. All timers are also reset. - -*/ -call_count_reset :- - '$call_count_reset'. - -/** @pred call_count(? _CallsMax_, ? _RetriesMax_, ? _CallsAndRetriesMax_) - - -Set call counters as timers. YAP will generate an exception -if one of the instantiated call counters decreases to 0: - -+ _CallsMax_ - - throw the exception `call_counter` when the -counter `calls` reaches 0; - -+ _RetriesMax_ - - throw the exception `retry_counter` when the -counter `retries` reaches 0; - -+ _CallsAndRetriesMax_ - - throw the exception -`call_and_retry_counter` when the counter `calls_and_retries` -reaches 0. - - YAP will ignore counters that are called with unbound arguments. - -Next, we show a simple example of how to use call counters: - -~~~~~{.prolog} - ?- yap_flag(call_counting,on), [-user]. l :- l. end_of_file. yap_flag(call_counting,off). - -yes - -yes - ?- catch((call_count(10000,_,_),l),call_counter,format("limit_exceeded.~n",[])). - -limit_exceeded. - -yes -~~~~~ -Notice that we first compile the looping predicate `l/0` with -call_counting `on`. Next, we catch/3 to handle an -exception when `l/0` performs more than 10000 reductions. - - - */ -call_count(Calls, Retries, Both) :- - '$check_if_call_count_on'(Calls, CallsOn), - '$check_if_call_count_on'(Retries, RetriesOn), - '$check_if_call_count_on'(Both, BothOn), - '$call_count_set'(Calls, CallsOn, Retries, RetriesOn, Both, BothOn). - -'$check_if_call_count_on'(Calls, 1) :- integer(Calls), !. -'$check_if_call_count_on'(Calls, 0) :- var(Calls), !. -'$check_if_call_count_on'(Calls, A) :- - '$do_error'(type_error(integer,Calls),call_count(A)). - -%% @} - -/** -@} -*/ - diff --git a/packages/python/swig/yap4py/prolog/pl/checker.yap b/packages/python/swig/yap4py/prolog/pl/checker.yap deleted file mode 100644 index e409592cb..000000000 --- a/packages/python/swig/yap4py/prolog/pl/checker.yap +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: checker.yap * -* comments: style checker for Prolog * -* * -* Last rev: $Date: 2008-03-31 22:56:22 $,$Author: vsc $ * -* * -*************************************************************************/ - -:- system_module( style_checker, [no_style_check/1, - style_check/1], ['$check_term'/5, - '$sv_warning'/2, - '$syntax_check_discontiguous'/2, - '$syntax_check_multiple'/2, - '$syntax_check_single_var'/2]). - -%% @{ - -/** - -@defgroup YAPStyle Checker - @ingroup YAPCompilerSettings - -YAP implements a style-checker thay currently verifies whether: - -1 named variables occur once in a clause. - -2 clauses from dofferent predicates are mixed together. - -3 clauses for the same predicate occur in different files. - -One can declare a predicate to be discontiguous (see the -discontiguous/1 declaration) and/or multifile/1. - -*/ - -/* -@pred style_check(+ _X_) - -Turns on style checking according to the attribute specified by _X_, -which must be one of the following: - - + single_var - Checks single occurrences of named variables in a clause. - - + discontiguous - Checks non-contiguous clauses for the same predicate in a file. - - + multiple - Checks the presence of clauses for the same predicate in more than one - file when the predicate has not been declared as `multifile` - - + all - Performs style checking for all the cases mentioned above. - - -By default, style checking is disabled in YAP unless we are in -`sicstus` or `iso` language mode. - -The style_check/1 built-in is now deprecated. Please use -`set_prolog_flag/1` instead. - - **/ -% -% A Small style checker for YAP - -:- op(1150, fx, [multifile,discontiguous]). - -style_check(V) :- var(V), !, fail. -style_check(V) :- - \+atom(V), - \+ is_list(V), - V \= + _, - V \= - _, !, - '$do_error'( type_error('+|-|?(Flag)', V), style_check(V) ). -style_check(V) :- - \+atom(V), - \+ is_list(V), - V \= + _, - V \= + _, !, - '$do_error'( domain_error(style_name, V), style_check(V) ). - - -style_check(all) :- - style_check( [ singleton, discontiguous, multiple ] ). -style_check(+X) :- - style_check(X). -style_check(single_var) :- - style_check( singleton ). -style_check(singleton) :- - yap_flag( single_var_warnings, true ). -style_check(-single_var) :- - yap_flag( single_var_warnings, false ). -style_check(-singleton) :- - yap_flag( single_var_warnings, false ). -style_check(discontiguous) :- - yap_flag( discontiguous_warnings, true ). -style_check(-discontiguous) :- - yap_flag( discontiguous_warnings, false ). -style_check(multiple) :- - yap_flag( redefine_warnings, true ). -style_check(-multiple) :- - yap_flag( redefine_warnings, false ). -style_check(no_effect). -style_check(+no_effect) . -style_check(-no_effect). -style_check(var_branches). -style_check(+var_branches) :- - '$style_checker'( [ var_branches ] ). -style_check(-var_branches) :- - '$style_checker'( [ -var_branches ] ). -style_check(atom). -style_check(+atom) :- - '$style_checker'( [ atom ] ). -style_check(-atom) :- - '$style_checker'( [ -atom ] ). -style_check(charset) :- - '$style_checker'( [ charset ] ). -style_check(+charset) :- - '$style_checker'( [ charset ] ). -style_check(-charset) :- - '$style_checker'( [ -charset ] ). -style_check('?'(Info) ) :- - L = [ singleton, discontiguous, multiple ], - ( lists:member(Style, L ) -> Info = +Style ; Info = -Style ). -style_check([]). -style_check([H|T]) :- style_check(H), style_check(T). - -/** @pred no_style_check(+ _X_) - -Turns off style checking according to the attribute specified by - _X_, which have the same meaning as in style_check/1. - -The no_style_check/1 built-in is now deprecated. Please use -`set_prolog_flag/1` instead. - -**/ -no_style_check(V) :- var(V), !, fail. -no_style_check(all) :- - '$style_checker'( [ -singleton, -discontiguous, -multiple ] ). -no_style_check(-single_var) :- - '$style_checker'( [ -singleton ] ). -no_style_check(-singleton) :- - '$style_checker'( [ -singleton ] ). -no_style_check(-discontiguous) :- - '$style_checker'( [ -discontiguous ] ). -no_style_check(-multiple) :- - '$style_checker'( [ -multiple ] ). -no_style_check([]). -no_style_check([H|T]) :- no_style_check(H), no_style_check(T). - -/** @pred discontiguous(+ _G_) is iso - Avoid warnings from the sytax checker. - -Declare that the predicate _G_ or list of predicates are discontiguous -procedures, that is, clauses for discontigous procedures may be -separated by clauses from other procedures. - -*/ - -discontiguous(P) :- '$discontiguous'(P). - -/* -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/pl/consult.yap b/packages/python/swig/yap4py/prolog/pl/consult.yap deleted file mode 100644 index 42ee2d300..000000000 --- a/packages/python/swig/yap4py/prolog/pl/consult.yap +++ /dev/null @@ -1,1604 +0,0 @@ -/************************************************************************* -* * - * YAP Prolog * -* * - * Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: consult.yap * -* Last rev: 8/2/88 * -* mods: * -* comments: Consulting Files in YAP * -* * -*************************************************************************/ -/** - * @file consult.yap - * @author VITOR SANTOS COSTA - * @date Wed Nov 18 14:01:10 2015 - * - * @brief loading programs into YAP - * - * -*/ -:- system_module( '$_consult', [compile/1, - consult/1, - db_files/1, - ensure_loaded/1, - exists_source/1, - exo_files/1, - (initialization)/2, - load_files/2, - make/0, - make_library_index/1, - module/2, - prolog_load_context/2, - reconsult/1, - source_file/1, - source_file/2, - source_file_property/2, - use_module/3], - ['$add_multifile'/3, - '$csult'/2, - '$do_startup_reconsult'/1, - '$elif'/2, - '$else'/1, - '$endif'/1, - '$if'/2, - '$include'/2, - '$initialization'/1, - '$initialization'/2, - '$lf_opt'/3, - '$load_files'/3, - '$require'/2, - '$set_encoding'/1, - '$use_module'/3]). - -:- use_system_module( '$_absf', ['$full_filename'/3]). - -:- use_system_module( '$_boot', ['$clear_reconsulting'/0, - '$init_system'/0, - '$init_win_graphics'/0, - '$loop'/2, - '$system_catch'/4]). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -:- use_system_module( '$_load_foreign', ['$import_foreign'/3]). - -:- use_system_module( '$_modules', ['$add_to_imports'/3, - '$convert_for_export'/7, - '$extend_exports'/3]). - -:- use_system_module( '$_preds', ['$current_predicate'/4]). - -/** - - @defgroup YAPConsulting Loading files into YAP - @ingroup consult - - @{ - - We present the main predicates and directives available to load -files and to set-up the Prolog environment. We discuss - - + @ref YAPReadFiles - - + @ref YAPCompilerSettings - -@defgroup YAPReadFiles The Predicates that Read Source Files - @ingroup YAPConsulting - -@{ - */ - -/** - - @pred load_files(+_Files_, +_Options_) - -Implementation of the consult/1 family. Execution is controlled by the -following flags: - -+ consult(+ _Mode_) - - This extension controls the type of file to load. If _Mode_ is: - - `consult`, clauses are added to the data-base, unless from the same file; - `reconsult`, clauses are recompiled, - `db`, these are facts that need to be added to the data-base, - `exo`, these are facts with atoms and integers that can be stored in a compact representation (see load_exo/1). - -+ silent(+ _Bool_) - - If true, load the file without printing a message. The specified - value is the default for all files loaded as a result of loading - the specified files. - -+ stream(+ _Input_) - - This SWI-Prolog extension compiles the data from the stream - _Input_. If this option is used, _Files_ must be a single atom - which is used to identify the source-location of the loaded - clauses as well as remove all clauses if the data is re-consulted. - - This option is added to allow compiling from non-file locations - such as databases, the web, the user (see consult/1) or other - servers. - -+ compilation_mode(+ _Mode_) - - This extension controls how procedures are compiled. If _Mode_ is - `compact` clauses are compiled and no source code is stored; if it - is `source` clauses are compiled and source code is stored; if it - is `assert_all` clauses are asserted into the data-base. - -+ encoding(+ _Encoding_) - - Character encoding used in consulting files. Please (see - [Encoding](@ref Encoding)) for supported encodings. - -+ expand(+ _Bool_) - - If `true`, run the filenames through expand_file_name/2 and load - the returned files. Default is false, except for consult/1 which - is intended for interactive use. - -+ if(+ _Condition_) - - Load the file only if the specified _Condition_ is satisfied. The - value `true` the file unconditionally, `changed` loads the file if - it was not loaded before, or has been modified since it was loaded - the last time, `not_loaded` loads the file if it was not loaded - before. - -+ imports(+ _ListOrAll_) - - If `all` and the file is a module file, import all public - predicates. Otherwise import only the named predicates. Each - predicate is referred to as `\/\`. This option has - no effect if the file is not a module file. - -+ must_be_module(+ _Bool_) - - If true, raise an error if the file is not a module file. Used by - ` use_module/1 and use_module/2. - -+ qcompile(+ _Value_) - - SWI-Prolog flag that controls whether loaded files should be also - compiled into `qly` files. The default value is obtained from the flag - `qcompile`: - - `never`, no `qly` file is generated unless the user calls - qsave_file/1 and friends, or sets the qcompile option in - load_files/2; - - `auto`, all files are qcompiled. - - `large`, files above 100KB are qcompiled. - - `part`, not supported in YAP. - - -+ autoload(+ _Autoload_) - - SWI-compatible option where if _Autoload_ is `true` undefined - predicates are loaded on first call. - -+ derived_from(+ _File_) - - SWI-compatible option to control make/0. Currently not supported. - -*/ -% -% SWI options -% autoload(true,false) -% derived_from(File) -> make -% encoding(Encoding) => implemented -% expand(true,false) -% if(changed,true,not_loaded) => implemented -% imports(all,List) => implemented -% qcompile() => implemented -% silent(true,false) => implemented -% stream(Stream) => implemented -% consult(consult,reconsult,exo,db) => implemented -% compilation_mode(compact,source,assert_all) => implemented -% register(true, false) => implemented -% -load_files(Files,Opts) :- - '$load_files'(Files,Opts,load_files(Files,Opts)). - -'$lf_option'(autoload, 1, false). -'$lf_option'(derived_from, 2, false). -'$lf_option'(encoding, 3, default). -'$lf_option'(expand, 4, false). -'$lf_option'(if, 5, true). -'$lf_option'(imports, 6, all). -'$lf_option'(qcompile, 7, Current) :- - '$nb_getval'('$qcompile', Current, Current = never). -'$lf_option'(silent, 8, _). -'$lf_option'(skip_unix_header, 9, true). -'$lf_option'(compilation_mode, 10, Flag) :- - current_prolog_flag(source, YFlag), - ( YFlag == false -> Flag = compact ; Flag = source ). -'$lf_option'(consult, 11, reconsult). -'$lf_option'(stream, 12, _). -'$lf_option'(register, 13, true). -'$lf_option'('$files', 14, _). -'$lf_option'('$call', 15, _). -'$lf_option'('$use_module', 16, _). -'$lf_option'('$consulted_at', 17, _). -'$lf_option'('$options', 18, _). -'$lf_option'('$location', 19, _). -'$lf_option'(dialect, 20, yap). -'$lf_option'(format, 21, source). -'$lf_option'(redefine_module, 22, Warn) :- - ( var(Warn) -> current_prolog_flag( redefine_warnings, Redefine ), Redefine = Warn ; true ). -'$lf_option'(reexport, 23, false). -'$lf_option'(sandboxed, 24, false). -'$lf_option'(scope_settings, 25, false). -'$lf_option'(modified, 26, _). -'$lf_option'('$context_module', 27, _). -'$lf_option'('$parent_topts', 28, _). -'$lf_option'(must_be_module, 29, false). -'$lf_option'('$source_pos', 30, _). -'$lf_option'(initialization, 31, Ref) :- - nb:nb_queue(Ref). - -'$lf_option'(last_opt, 31). - -'$lf_opt'( Op, TOpts, Val) :- - '$lf_option'(Op, Id, _), - arg( Id, TOpts, Val ). - -'$set_lf_opt'( Op, TOpts, Val) :- - '$lf_option'(Op, Id, _), - setarg( Id, TOpts, Val ). - -'$load_files'(Files, Opts, Call) :- - ( '$nb_getval'('$lf_status', OldTOpts, fail), nonvar(OldTOpts) -> - '$lf_opt'(autoload, OldTOpts, OldAutoload) - ; - '$lf_option'(last_opt, LastOpt), - functor( OldTOpts, opt, LastOpt ), - '$lf_opt'('$context_module', OldTOpts, user) - ), - '$check_files'(Files,load_files(Files,Opts)), - '$lf_option'(last_opt, LastOpt), - functor( TOpts, opt, LastOpt ), - ( source_location(ParentF, Line) -> true ; ParentF = user_input, Line = -1 ), - '$lf_opt'('$location', TOpts, ParentF:Line), - '$lf_opt'('$files', TOpts, Files), - '$lf_opt'('$call', TOpts, Call), - '$lf_opt'('$options', TOpts, Opts), - '$lf_opt'('$parent_topts', TOpts, OldTOpts), - '$process_lf_opts'(Opts,TOpts,Files,Call), - '$lf_default_opts'(1, LastOpt, TOpts), - '$check_use_module'(Call,UseModule), - '$lf_opt'('$use_module', TOpts, UseModule), - '$current_module'(M0), - ( '$lf_opt'(autoload, TOpts, Autoload), - var(Autoload) -> - Autoload = OldAutoload - ; - true - ), - % make sure we can run consult - '$init_consult', - '$lf'(Files, M0, Call, TOpts). - -'$check_files'(Files, Call) :- - var(Files), !, - '$do_error'(instantiation_error, Call). -'$check_files'(M:Files, Call) :- !, - (var(M) - -> - '$do_error'(instantiation_error, Call) - ; - atom(M) - -> - '$check_files'(Files,Call) - ; - '$do_error'(type_error(atom,M), Call) - ). -'$check_files'(Files, Call) :- - ( ground(Files) - -> - true - ; - '$do_error'(instantiation_error, Call) - ). - -'$process_lf_opts'(V, _, _, Call) :- - var(V), !, - '$do_error'(instantiation_error,Call). -'$process_lf_opts'([], _, _, _). -'$process_lf_opts'([Opt|Opts],TOpt,Files,Call) :- - Opt =.. [Op, Val], - ground(Val), - '$lf_opt'(Op, TOpt, Val), - '$process_lf_opt'(Op, Val,Call), !, - '$process_lf_opts'(Opts, TOpt, Files, Call). -'$process_lf_opts'([Opt|_],_,_,Call) :- - '$do_error'(domain_error(unimplemented_option,Opt),Call). - -'$process_lf_opt'(autoload, Val, Call) :- - ( Val == false -> true ; - Val == true -> true ; - '$do_error'(domain_error(unimplemented_option,autoload(Val)),Call) ). -'$process_lf_opt'(derived_from, File, Call) :- - ( atom(File) -> true ; '$do_error'(type_error(atom,File),Call) ). -'$process_lf_opt'(encoding, Encoding, _Call) :- - atom(Encoding). -'$process_lf_opt'(expand, Val, Call) :- - ( Val == true -> '$do_error'(domain_error(unimplemented_option,expand),Call) ; - Val == false -> true ; - '$do_error'(domain_error(unimplemented_option,expand(Val)),Call) ). -'$process_lf_opt'(if, If, Call) :- - ( If == changed -> true ; - If == true -> true ; - If == not_loaded -> true ; - '$do_error'(domain_error(unimplemented_option,if),Call) ). -'$process_lf_opt'(imports, Val, Call) :- - ( Val == all -> true ; - var(Val) -> Val = all ; - is_list(Val) -> ( ground(Val) -> true ; '$do_error'(instantiation_error,Call) ) ; - '$do_error'(domain_error(unimplemented_option,imports(Val)),Call) ). -'$process_lf_opt'(qcompile, Val,Call) :- - ( Val == part -> '$do_error'(domain_error(unimplemented_option,expand),Call) ; - Val == never -> true ; - Val == auto -> true ; - Val == large -> true ; - '$do_error'(domain_error(unknown_option,qcompile(Val)),Call) ). -'$process_lf_opt'(silent, Val, Call) :- - ( Val == false -> yap_flag(verbose_load, full) ; - Val == true -> yap_flag(verbose_load, silent) ; - '$do_error'(domain_error(out_of_domain_option,silent(Val)),Call) ). -'$process_lf_opt'(skip_unix_header, Val, Call) :- - ( Val == false -> true ; - Val == true -> true ; - '$do_error'(domain_error(unimplemented_option,skip_unix_header(Val)),Call) ). -'$process_lf_opt'(compilation_mode, Val, Call) :- - ( Val == source -> true ; - Val == compact -> true ; - Val == assert_all -> true ; - '$do_error'(domain_error(unimplemented_option,compilation_mode(Val)),Call) ). -'$process_lf_opt'(consult, Val , Call) :- - ( Val == reconsult -> true ; - Val == consult -> true ; - Val == exo -> true ; - Val == db -> true ; - '$do_error'(domain_error(unimplemented_option,consult(Val)),Call) ). -'$process_lf_opt'(reexport, Val , Call) :- - ( Val == true -> true ; - Val == false -> true ; - '$do_error'(domain_error(unimplemented_option,reexport(Val)),Call) ). -'$process_lf_opt'(must_be_module, Val , Call) :- - ( Val == true -> true ; - Val == false -> true ; - '$do_error'(domain_error(unimplemented_option,must_be_module(Val)),Call) ). -'$process_lf_opt'(stream, Val, Call) :- - ( current_stream(_,_,Val) -> true ; - '$do_error'(type_error(stream,Val),Call) ). -'$process_lf_opt'(register, Val, Call) :- - ( Val == false -> true ; - Val == true -> true ; - '$do_error'(domain_error(unimplemented_option,register(Val)),Call) ). -'$process_lf_opt'('$context_module', Mod, Call) :- - ( atom(Mod) -> true ; '$do_error'(type_error(atom,Mod),Call) ). - - -'$lf_default_opts'(I, LastOpt, _TOpts) :- I > LastOpt, !. -'$lf_default_opts'(I, LastOpt, TOpts) :- - I1 is I+1, - arg(I, TOpts, A), - ( nonvar(A) -> true ; - '$lf_option'(_Name, I, A) - ), - '$lf_default_opts'(I1, LastOpt, TOpts). - - - -'$check_use_module'(use_module(_), use_module(_)) :- !. -'$check_use_module'(use_module(_,_), use_module(_)) :- !. -'$check_use_module'(use_module(M,_,_), use_module(M)) :- !. -'$check_use_module'(_, load_files) :- !. - -'$lf'(V,_,Call, _ ) :- var(V), !, - '$do_error'(instantiation_error,Call). -'$lf'([], _, _, _) :- !. -'$lf'(M:X, _, Call, TOpts) :- !, - ( - atom(M) - -> - '$lf'(X, M, Call, TOpts) - ; - '$do_error'(type_error(atom,M),Call) - ). -'$lf'([F|Fs], Mod, Call, TOpts) :- !, - % clean up after each consult - ( '$lf'(F,Mod,Call, TOpts), fail ; - '$lf'(Fs, Mod, Call, TOpts), fail; - true - ). -'$lf'(user, Mod, _, TOpts) :- !, - b_setval('$user_source_file', user), - '$do_lf'(Mod, user_input, user_input, user_input, TOpts). -'$lf'(user_input, Mod, _, TOpts) :- !, - b_setval('$user_source_file', user_input), - '$do_lf'(Mod, user_input, user_input, user_input, TOpts). -'$lf'(File, Mod, Call, TOpts) :- - '$lf_opt'(stream, TOpts, Stream), - b_setval('$user_source_file', File), - ( var(Stream) -> - /* need_to_open_file */ - ( '$full_filename'(File, Y, Call) -> true ; '$do_error'(existence_error(source_sink,File),Call) ), - ( open(Y, read, Stream) -> true ; '$do_error'(permission_error(input,stream,Y),Call) ) - ; - stream_property(Stream, file_name(Y)) - ), !, - ( file_size(Stream, Pos) -> true ; Pos = 0), - '$set_lf_opt'('$source_pos', TOpts, Pos), - '$lf_opt'(reexport, TOpts, Reexport), - '$lf_opt'(if, TOpts, If), - ( var(If) -> If = true ; true ), - '$lf_opt'(imports, TOpts, Imports), - '$start_lf'(If, Mod, Stream, TOpts, File, Y, Reexport, Imports), - close(Stream). - - -'$start_lf'(not_loaded, Mod, _Stream, TOpts, UserFile, File, Reexport,Imports) :- - '$file_loaded'(File, Mod, Imports, TOpts), !, - '$lf_opt'('$options', TOpts, Opts), - '$lf_opt'('$location', TOpts, ParentF:Line), - '$loaded'(File, UserFile, Mod, ParentF, Line, not_loaded, _, _Dir, Opts), - '$reexport'( TOpts, ParentF, Reexport, Imports, File ). -'$start_lf'(changed, Mod, _Stream, TOpts, UserFile, File, Reexport, Imports) :- - '$file_unchanged'(File, Mod, Imports, TOpts), !, - '$lf_opt'('$options', TOpts, Opts), - '$lf_opt'('$location', TOpts, ParentF:Line), - '$loaded'(File, UserFile, Mod, ParentF, Line, changed, _, _Dir, Opts), - '$reexport'( TOpts, ParentF, Reexport, Imports, File ). -'$start_lf'(_, Mod, PlStream, TOpts, _UserFile, File, Reexport, ImportList) :- - % check if there is a qly file -% start_low_level_trace, - '$absolute_file_name'(File,[access(read),file_type(qly),file_errors(fail),solutions(first),expand(true)],F,qload_file(File)), - open( F, read, Stream , [type(binary)] ), - ( - '$q_header'( Stream, Type ), - Type == file - -> - ! - ; - close(Stream), - fail - ), - H0 is heapused, '$cputime'(T0,_), - time_file64(F, T0F), - stream_property(PlStream, file_name(FilePl)), - time_file64(FilePl, T0Fl), - T0F >= T0Fl, - !, - file_directory_name(F, Dir), - working_directory(OldD, Dir), - '$qload_file'(Stream, Mod, F, FilePl, File, ImportList, TOpts), - close( Stream ), - H is heapused-H0, '$cputime'(TF,_), T is TF-T0, - '$current_module'(M, Mod), - working_directory( _, OldD), - '$lf_opt'('$location', TOpts, ParentF:_Line), - '$reexport'( TOpts, ParentF, Reexport, ImportList, File ), - print_message(informational, loaded( loaded, F, M, T, H)), - working_directory( _, OldD), - '$exec_initialization_goals', - '$current_module'(_M, Mod). -'$start_lf'(_, Mod, Stream, TOpts, UserFile, File, _Reexport, _Imports) :- - '$do_lf'(Mod, Stream, UserFile, File, TOpts). - - -/** - - @pred ensure_loaded(+ _F_) is iso - -When the files specified by _F_ are module files, -ensure_loaded/1 loads them if they have note been previously -loaded, otherwise advertises the user about the existing name clashes - and prompts about importing or not those predicates. Predicates which -are not public remain invisible. - -When the files are not module files, ensure_loaded/1 loads them - if they have not been loaded before, and does nothing otherwise. - - _F_ must be a list containing the names of the files to load. -*/ -ensure_loaded(Fs) :- - '$load_files'(Fs, [if(not_loaded)],ensure_loaded(Fs)). - -compile(Fs) :- - '$load_files'(Fs, [], compile(Fs)). - -/** - @pred [ _F_ ] - @pred consult(+ _F_) - - -Adds the clauses written in file _F_ or in the list of files _F_ -to the program. - -In YAP consult/1 does not remove previous clauses for -the procedures defined in other files than _F_, but since YAP-6.4.3 it will redefine all procedures defined in _F_. - -All code in YAP is compiled, and the compileer generates static -procedures by default. In case you need to manipulate the original -code, the expanded version of the original source code is available by -calling source/0 or by enabling the source flag. - -*/ -% consult(Fs) :- -% '$has_yap_or', -% '$do_error'(context_error(consult(Fs),clause),query). -consult(V) :- - var(V), !, - '$do_error'(instantiation_error,consult(V)). -consult(M0:Fs) :- !, - '$consult'(Fs, M0). -consult(Fs) :- - '$current_module'(M0), - '$consult'(Fs, M0). - -'$consult'(Fs,Module) :- - current_prolog_flag(language_mode, iso), % SICStus Prolog compatibility - !, - '$load_files'(Module:Fs,[],consult(Fs)). -'$consult'(Fs, Module) :- - '$load_files'(Module:Fs,[consult(consult)],consult(Fs)). - - -/** - -@pred [ - _F_ ] -@pred reconsult(+ _F_ ) - @pred compile(+ _F_ ) - -Updates the program by replacing the -previous definitions for the predicates defined in _F_. It differs from consult/1 -in that it only multifile/1 predicates are not reset in a reconsult. Instead, consult/1 -sees all predicates as multifile. - -YAP also offers no difference between consult/1 and compile/1. The two -are implemented by the same exact code. - -Example: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -?- [file1, -file2, -file3, file4]. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - will consult `file1` `file4` and reconsult `file2` and -`file3`. That is, it could be written as: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -?- consult(file1), - reconsult( [file2, file3], - consult( [file4] ). -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*/ -reconsult(Fs) :- - '$load_files'(Fs, [], reconsult(Fs)). - - -/* exo_files(+ _Files_) - -Load compactly a database of facts with equal structure, see @cite -x. Useful when wanting to read in a very compact way database tables, -it saves space by storing data, not a compiled program. The idea was -introduced in @cite y, but never implemented because often indexing -just takes more room. It was redefined recebtly by exploiting -different forms of indexing, as shown in @cite x. - -@note implementation - - The function Yap_ExoLookup() is the mai interface betwwen the WAM - and exo components. The algorithms are straightforward, that is, - mostly hash-tables but have close to linear performance.. -*/ - -exo_files(Fs) :- - '$load_files'(Fs, [consult(exo), if(not_loaded)], exo_files(Fs)). - -/** - - @pred load_db(+ _Files_) - - -Load a database of ground facts. All facts must take up the same amount of storage, so that - a fact $I$ can be accessed at position _P[I-1]_. This representation thus stores the facts as a huge continuous array, the so-called mega clause. - -See \cite for a motivation for this technique. YAP implements this -optimization by default whenever it loads a large number of facts (see -Yap_BuildMegaClause(PredEntry *ap) ) for the details. On the other -hand, loading the data-base will cause fragmentation because -individual facts facts need extra headers ands tails, and because -often new atoms will be stored in the Symbol Table, see -LookupAtom(const char *atom). The main advantage of load_db/1 is -that it allocates the necessary memory only once. Just doing this - may halve total memory usage in large in-memory database-oriented applications. - -@note Implementation - -YAP implements load_db/1 as a two-step non-optimised process. First, - it counts the nmuber of facts and checks their size. Second, it - allocates and fills the memory. The first step of the algorithm is - implemented by dbload_get_space(), and the second by - dbload_add_facts(). - - db_files/1 itself is just a call to load_files/2. -*/ -db_files(Fs) :- - '$load_files'(Fs, [consult(db), if(not_loaded)], exo_files(Fs)). - - -'$csult'(Fs, M) :- - '$extract_minus'(Fs, MFs), !, - '$load_files'(M:MFs,[],[M:Fs]). -'$csult'(Fs, M) :- - '$load_files'(M:Fs,[consult(consult)],[M:Fs]). - -'$extract_minus'([], []). -'$extract_minus'([-F|Fs], [F|MFs]) :- - '$extract_minus'(Fs, MFs). - -'$do_lf'(_ContextModule, Stream, _UserFile, _File, _TOpts) :- - stream_property(Stream, file_name(Y)), - '$nb_getval'('$loop_streams',Sts0, Sts0 = []), - lists:member(Stream0, Sts0), - stream_property(Stream0, file_name(Y)), - !. -'$do_lf'(ContextModule, Stream, UserFile, File, TOpts) :- - prompt1(': '), prompt(_,' '), - stream_property(OldStream, alias(loop_stream) ), - '$lf_opt'(encoding, TOpts, Encoding), - set_stream( Stream, [alias(loop_stream), encoding(Encoding)] ), - '$nb_getval'('$loop_streams',Sts0, Sts0=[]), - nb_setval('$loop_streams',[Stream|Sts0]), - '$lf_opt'('$context_module', TOpts, ContextModule), - '$lf_opt'(reexport, TOpts, Reexport), - '$lf_opt'(qcompile, TOpts, QCompiling), - '$nb_getval'('$qcompile', ContextQCompiling, ContextQCompiling = never), - nb_setval('$qcompile', QCompiling), -% format( 'I=~w~n', [Verbosity=UserFile] ), - % export to process - b_setval('$lf_status', TOpts), - '$reset_if'(OldIfLevel), - % take care with [a:f], a is the ContextModule - '$current_module'(SourceModule, ContextModule), - '$lf_opt'(consult, TOpts, Reconsult0), - '$lf_opt'('$options', TOpts, Opts), - '$lf_opt'('$location', TOpts, ParentF:Line), - '$loaded'(File, UserFile, SourceModule, ParentF, Line, Reconsult0, Reconsult, Dir, Opts), - working_directory(OldD, Dir), - H0 is heapused, '$cputime'(T0,_), - current_prolog_flag(generate_debug_info, GenerateDebug), - '$lf_opt'(compilation_mode, TOpts, CompMode), - '$comp_mode'(OldCompMode, CompMode), - ( Reconsult \== consult -> - '$start_reconsulting'(File), - '$start_consult'(Reconsult,File,LC), - '$remove_multifile_clauses'(File), - StartMsg = reconsulting, - EndMsg = reconsulted - ; - '$start_consult'(Reconsult,File,LC), - ( File \= user_input, File \= [] -> '$remove_multifile_clauses'(File) ; true ), - StartMsg = consulting, - EndMsg = consulted - ), - current_prolog_flag(verbose_load, VerboseLoad), - print_message(informational, loading(StartMsg, UserFile)), - '$lf_opt'(skip_unix_header , TOpts, SkipUnixHeader), - ( SkipUnixHeader == true - -> - '$skip_unix_header'(Stream) - ; - true - ), - '$loop'(Stream,Reconsult), - '$lf_opt'(imports, TOpts, Imports), - '$import_to_current_module'(File, ContextModule, Imports, _, TOpts), - '$current_module'(Mod, SourceModule), - set_prolog_flag(verbose_load, VerboseLoad), - H is heapused-H0, '$cputime'(TF,_), T is TF-T0, - print_message(informational, loaded(EndMsg, File, Mod, T, H)), - '$end_consult', - nb_setval('$loop_streams',Sts0), - '$q_do_save_file'(File, UserFile, TOpts ), - ( - Reconsult = reconsult -> - '$clear_reconsulting' - ; - true - ), - set_stream( OldStream, alias(loop_stream) ), - set_prolog_flag(generate_debug_info, GenerateDebug), - '$comp_mode'(_CompMode, OldCompMode), - working_directory(_,OldD), - % surely, we were in run mode or we would not have included the file! - nb_setval('$if_skip_mode',run), - % back to include mode! - nb_setval('$if_level',OldIfLevel), - '$lf_opt'('$use_module', TOpts, UseModule), - '$bind_module'(Mod, UseModule), - '$reexport'( TOpts, ParentF, Reexport, Imports, File ), - nb_setval('$qcompile', ContextQCompiling), - ( LC == 0 -> prompt(_,' |: ') ; true), - '$exec_initialization_goals', - !. - - -'$q_do_save_file'(File, UserF, TOpts ) :- - '$lf_opt'(qcompile, TOpts, QComp), - '$lf_opt'('$source_pos', TOpts, Pos), - ( QComp == auto ; QComp == large, Pos > 100*1024), - '$absolute_file_name'(UserF,[file_type(qly),solutions(first),expand(true)],F,load_files(File)), - !, - '$qsave_file_'( File, UserF, F ). -'$q_do_save_file'(_File, _, _TOpts ). - -'$reset_if'(OldIfLevel) :- - '$nb_getval'('$if_level', OldIfLevel, fail), !, - nb_setval('$if_level',0). -'$reset_if'(0) :- -nb_setval('$if_le1vel',0). - -'$get_if'(Level0) :- - '$nb_getval'('$if_level', Level, fail), !, - Level0 = Level. -'$get_if'(0). - -'$bind_module'(_, load_files). -'$bind_module'(Mod, use_module(Mod)). - -'$import_to_current_module'(File, ContextModule, _Imports, _RemainingImports, _TOpts) :- - \+ recorded('$module','$module'(File, _Module, _, _ModExports, _),_), - % enable loading C-predicates from a different file - recorded( '$load_foreign_done', [File, M0], _), - '$import_foreign'(File, M0, ContextModule ), - fail. -'$import_to_current_module'(File, ContextModule, Imports, RemainingImports, TOpts) :- - recorded('$module','$module'(File, Module, _Source, ModExports, _),_), - Module \= ContextModule, !, - '$lf_opt'('$call', TOpts, Goal), - '$convert_for_export'(Imports, ModExports, Module, ContextModule, TranslationTab, RemainingImports, Goal), - '$add_to_imports'(TranslationTab, Module, ContextModule). -'$import_to_current_module'(_, _, _, _, _). - -'$start_reconsulting'(F) :- - recorda('$reconsulted','$',_), - recorda('$reconsulting',F,_). - -'$exec_initialization_goals' :- - recorded('$blocking_code',_,R), - erase(R), - fail. -% system goals must be performed first -'$exec_initialization_goals' :- - recorded('$system_initialization',G,R), - erase(R), - G \= '$', - strip_module(user:G, M0, G0), - ( catch(M0:G0, Error, user:'$LoopError'(Error, top)) - -> - true - ; - format(user_error,':- ~w failed.~n',[G]) - ), - fail. -'$exec_initialization_goals' :- - '$current_module'(M), - '$nb_getval'('$lf_status', TOpts, fail), - '$lf_opt'( initialization, TOpts, Ref), - nb:nb_queue_close(Ref, Answers, []), - lists:member(G, Answers), - strip_module( M:G, M0, G0), - ( - catch(M0:G0, Error, user:'$LoopError'(Error, top)) - -> - true - ; - format(user_error,':- ~w:~w failed.~n',[M,G]) - ), - fail. -'$exec_initialization_goals'. - -/** - @pred include(+ _F_) is directive - - The `include` directive adds the text files or sequence of text - files specified by _F_ into the files being currently consulted. - It may be used - as an replacement to consult/1 by allowing the programmer to include a - data-base - split into several files. -*/ - -'$include'(V, _) :- var(V), !, - '$do_error'(instantiation_error,include(V)). -'$include'([], _) :- !. -'$include'([F|Fs], Status) :- !, - '$include'(F, Status), - '$include'(Fs, Status). -'$include'(X, Status) :- - b_getval('$lf_status', TOpts), - '$full_filename'(X, Y , ( :- include(X)) ), - '$including'(Old, Y), - '$lf_opt'(stream, TOpts, OldStream), - '$current_module'(Mod), - ( open(Y, read, Stream) -> - true ; - '$do_error'(permission_error(input,stream,Y),include(X)) - ), - file_directory_name(Y, Dir), - H0 is heapused, '$cputime'(T0,_), - working_directory(Dir0, Dir), - '$lf_opt'(encoding, TOpts, Encoding), - set_stream(Stream, [encoding(Encoding),alias(loop_stream)] ), - '$loaded'(Y, X, Mod, _OldY, _L, include, _, Dir, []), - ( '$nb_getval'('$included_file', OY, fail ) -> true ; OY = [] ), - nb_setval('$included_file', Y), - print_message(informational, loading(including, Y)), - '$loop'(Stream,Status), - set_stream(OldStream, alias(loop_stream) ), - close(Stream), - H is heapused-H0, '$cputime'(TF,_), T is TF-T0, - print_message(informational, loaded(included, Y, Mod, T, H)), - working_directory(_Dir, Dir0), - '$including'(Y, Old), - nb_setval('$included_file',OY). - - - -% -% reconsult at startup... -% -'$do_startup_reconsult'(_X) :- - '$init_win_graphics', - fail. -'$do_startup_reconsult'(X) :- - catch(load_files(user:X, [silent(true)]), Error, '$LoopError'(Error, consult)), - !, - ( current_prolog_flag(halt_after_consult, false) -> true ; halt). -'$do_startup_reconsult'(_). - -'$skip_unix_header'(Stream) :- - peek_code(Stream, 0'#), !, % 35 is ASCII for '# - skip(Stream, 10), - '$skip_unix_header'(Stream). -'$skip_unix_header'(_). - - -source_file(FileName) :- - recorded('$source_file','$source_file'(FileName, _, _),_). - -source_file(Mod:Pred, FileName) :- - current_module(Mod), - Mod \= prolog, - '$current_predicate'(_,Mod,Pred,all), - '$owned_by'(Pred, Mod, FileName). - -'$owned_by'(T, Mod, FileName) :- - '$is_multifile'(T, Mod), - functor(T, Name, Arity), - setof(FileName, Ref^recorded('$multifile_defs','$defined'(FileName,Name,Arity,Mod), Ref), L), - lists:member(FileName, L). -'$owned_by'(T, Mod, FileName) :- - '$owner_file'(T, Mod, FileName). - -/** @pred prolog_load_context(? _Key_, ? _Value_) - - Obtain information on what is going on in the compilation process. The - following keys are available: - - + directory (prolog_load_context/2 option) - - Full name for the directory where YAP is currently consulting the - file. - - + file (prolog_load_context/2 option) - - Full name for the file currently being consulted. Notice that included - filed are ignored. - - + module (prolog_load_context/2 option) - - Current source module. - - + `source` (prolog_load_context/2 option) - - Full name for the file currently being read in, which may be consulted, - reconsulted, or included. - - + `stream` (prolog_load_context/2 option) - - Stream currently being read in. - - + `term_position` (prolog_load_context/2 option) - - Stream position at the stream currently being read in. For SWI - compatibility, it is a term of the form - '$stream_position'(0,Line,0,0). - - + `source_location(? _File Name_, ? _Line_)` (prolog_load_context/2 option) - - SWI-compatible predicate. If the last term has been read from a physical file (i.e., not from the file user or a string), unify File with an absolute path to the file and Line with the line-number in the file. Please use prolog_load_context/2. - - + `source_file(? _File_)` (prolog_load_context/2 option) - - SWI-compatible predicate. True if _File_ is a loaded Prolog source file. - - + `source_file(? _ModuleAndPred_ ,? _File_)` (prolog_load_context/2 option) - - SWI-compatible predicate. True if the predicate specified by _ModuleAndPred_ was loaded from file _File_, where _File_ is an absolute path name (see `absolute_file_name/2`). - -*/ -prolog_load_context(directory, DirName) :- - ( source_location(F, _) - -> file_directory_name(F, DirName) ; - working_directory( DirName, DirName ) - ). -prolog_load_context(file, FileName) :- - ( source_location(FileName, _) - -> - true - ; - FileName = user_input - ). -prolog_load_context(module, X) :- - '$nb_getval'('$consulting_file', _, fail), - '$current_module'(X). -prolog_load_context(source, F0) :- - ( source_location(F0, _) /*, - '$input_context'(Context), - '$top_file'(Context, F0, F) */ - -> - true - ; - F0 = user_input - ). -prolog_load_context(stream, Stream) :- - stream_property(Stream, alias(loop_stream) ). - - -% if the file exports a module, then we can -% be imported from any module. -'$file_loaded'(F0, M, Imports, TOpts) :- - %format( 'L=~w~n', [(F0)] ), - ( - atom_concat(Prefix, '.qly', F0 ), - '$absolute_file_name'(Prefix,[access(read),file_type(prolog),file_errors(fail),solutions(first),expand(true)],F,load_files(Prefix)) - ; - F0 = F - ), - '$ensure_file_loaded'(F, M), - !, - '$import_to_current_module'(F, M, Imports, _, TOpts). - -'$ensure_file_loaded'(F, M) :- - % loaded from the same module, but does not define a module. - recorded('$source_file','$source_file'(F, _Age, NM), _R), - % make sure: it either defines a new module or it was loaded in the same context - ( M == NM -> true ; recorded('$module','$module'(F,NM,_Source,_P,_),_) ), !. - - % if the file exports a module, then we can -% be imported from any module. -'$file_unchanged'(F, M, Imports, TOpts) :- - '$ensure_file_unchanged'(F, M), -% format( 'IU=~w~n', [(F1:Imports->M)] ), - '$import_to_current_module'(F, M, Imports, _, TOpts). - -% module can be reexported. -'$ensure_file_unchanged'(F, M) :- - % loaded from the same module, but does not define a module. - recorded('$source_file','$source_file'(F, Age, NM), R), - % make sure: it either defines a new module or it was loaded in the same context - '$file_is_unchanged'(F, R, Age), - !, -% ( F = '/usr/local/share/Yap/rbtrees.yap' ->start_low_level_trace ; true), - recorded('$module','$module'(F,NM,_ASource,_P,_),_), - ( M == NM -> true ; recorded('$module','$module'(F,NM,_Source,_P,_),_) ), !. - -'$file_is_unchanged'(F, R, Age) :- - time_file64(F,CurrentAge), - ( (Age == CurrentAge ; Age = -1) -> true; erase(R), fail). - - - % inform the file has been loaded and is now available. -'$loaded'(F, UserFile, M, OldF, Line, Reconsult0, Reconsult, Dir, Opts) :- - ( F == user_input -> working_directory(Dir,Dir) ; file_directory_name(F, Dir) ), - nb_setval('$consulting_file', F ), - ( - % if we are reconsulting, always start from scratch - Reconsult0 \== consult, - Reconsult0 \== not_loaded, - Reconsult0 \== changed, - recorded('$source_file','$source_file'(F, _,_),R), - erase(R), - fail - ; - var(Reconsult0) - -> - Reconsult = consult - ; - Reconsult = Reconsult0 - ), - ( - Reconsult \== consult, - recorded('$lf_loaded','$lf_loaded'(F, _, _, _, _, _, _),R), - erase(R), - fail - ; - var(Reconsult) - -> - Reconsult = consult - ; - Reconsult = Reconsult0 - ), - ( F == user_input -> Age = 0 ; time_file64(F, Age) ), - % modules are logically loaded only once - - ( recorded('$module','$module'(F,_DonorM,_SourceF, _AllExports, _Line),_) -> true ; - recordaifnot('$source_file','$source_file'( F, Age, M), _) -> true ; - true ), - recorda('$lf_loaded','$lf_loaded'( F, M, Reconsult, UserFile, OldF, Line, Opts), _). - -/** @pred make is det - -SWI-Prolog originally included this built-in as a Prolog version of the Unix `make` -utility program. In this case the idea is to reconsult all source files that have been -changed since they were originally compiled into Prolog. YAP has a limited implementation of make/0 that -just goes through every loaded file and verifies whether reloading is needed. - -*/ - -make :- - recorded('$lf_loaded','$lf_loaded'(F1,_M,reconsult,_,_,_,_),_), - '$load_files'(F1, [if(changed)],make), - fail. -make. - -make_library_index(_Directory). - -'$fetch_stream_alias'(OldStream,Alias) :- - stream_property(OldStream, alias(Alias)), !. - -'$require'(_Ps, _M). - -'$store_clause'('$source_location'(File, _Line):Clause, File) :- - assert_static(Clause). - - -exists_source(File) :- - '$full_filename'(File, _AbsFile, exists_source(File)). - -% reload_file(File) :- -% ' $source_base_name'(File, Compile), -% findall(M-Opts, -% source_file_property(File, load_context(M, _, Opts)), -% Modules), -% ( Modules = [First-OptsFirst|Rest] -% -> Extra = [ silent(false), -% register(false) -% ], -% merge_options([if(true)|Extra], OptsFirst, OFirst), -% % debug(make, 'Make: First load ~q', [load_files(First:Compile, OFirst)]), -% load_files(First:Compile, OFirst), -% forall(member(Context-Opts, Rest), -% ( merge_options([if(not_loaded)|Extra], Opts, O), -% % debug(make, 'Make: re-import: ~q', -% % [load_files(Context:Compile, O)]), -% load_files(Context:Compile, O) -% )) -% ; load_files(user:Compile) -% ). - -% ' $source_base_name'(File, Compile) :- -% file_name_extension(Compile, Ext, File), -% user:prolog_file_type(Ext, prolog), !. -% ' $source_base_name'(File, File). - -source_file_property( File0, Prop) :- - ( nonvar(File0) -> absolute_file_name(File0,File) ; File = File0 ), - '$source_file_property'( File, Prop). - -'$source_file_property'( OldF, includes(F, Age)) :- - recorded('$lf_loaded','$lf_loaded'( F, _M, include, _File, OldF, _Line, _), _), - recorded('$source_file','$source_file'( F, Age, _), _). -'$source_file_property'( F, included_in(OldF, Line)) :- - recorded('$lf_loaded','$lf_loaded'( F, _M, include, _File, OldF, Line, _), _). -'$source_file_property'( F, load_context(OldF, Line, Options)) :- - recorded('$lf_loaded','$lf_loaded'( F, _M, V, _File, OldF, Line, Options), _), V \== include. -'$source_file_property'( F, modified(Age)) :- - recorded('$source_file','$source_file'( F, Age, _), _). -'$source_file_property'( F, module(M)) :- - recorded('$module','$module'(F,M,_,_,_),_). - -unload_file( F0 ) :- - absolute_file_name( F0, F1, [expand(true),file_type(prolog)] ), - '$unload_file'( F1, F0 ). - -% eliminate multi-files; -% get rid of file-only predicataes. -'$unload_file'( FileName, _F0 ) :- - current_module(Mod), - '$current_predicate'(_A,Mod,P,all), - '$owner_file'(P,Mod,FileName), - \+ '$is_multifile'(P,Mod), - functor( P, Na, Ar), - abolish(Mod:Na/Ar), - fail. -%next multi-file. -'$unload_file'( FileName, _F0 ) :- - recorded('$source_file','$source_file'( FileName, _Age, _), R), - erase(R), - fail. -'$unload_file'( FileName, _F0 ) :- - recorded('$mf','$mf_clause'(FileName,_Name,_Arity, Module,ClauseRef), R), - erase(R), - '$erase_clause'(ClauseRef, Module), - fail. -'$unload_file'( FileName, _F0 ) :- - recorded('$multifile_dynamic'(_,_,_), '$mf'(_Na,_A,_M,FileName,R), R1), - erase(R1), - erase(R), - fail. -'$unload_file'( FileName, _F0 ) :- - recorded('$multifile_defs','$defined'(FileName,_Name,_Arity,_Mod), R), - erase(R), - fail. -'$unload_file'( FileName, _F0 ) :- - recorded('$module','$module'( FileName, Mod, _SourceF, _, _), R), - erase( R ), - unload_module(Mod), - fail. -'$unload_file'( FileName, _F0 ) :- - recorded('$directive','$d'( FileName, _M:_G, _Mode, _VL, _Pos ), R), - erase(R), - fail. - -%% @} - - -/** - -@defgroup ModPreds Module Interface Predicates -@ingroup YAPModules - - - @{ - -**/ - -% -% stub to prevent modules defined within the prolog module. -% -module(Mod, Decls) :- - '$current_module'(prolog, Mod), !, - '$export_preds'(Decls). - -'$export_preds'([]). -'$export_preds'([N/A|Decls]) :- - functor(S, N, A), - '$sys_export'(S, prolog), - '$export_preds'(Decls). - - -% prevent modules within the kernel module... -/** @pred use_module(? _M_,? _F_,+ _L_) is directive - SICStus compatible way of using a module - -If module _M_ is instantiated, import the procedures in _L_ to the -current module. Otherwise, operate as use_module/2, and load the files -specified by _F_, importing the predicates specified in the list _L_. -*/ - -use_module(M,F,Is) :- '$use_module'(M,F,Is). - -'$use_module'(M,F,Is) :- - var(Is), !, - '$use_module'(M,F,all). -'$use_module'(M,F,Is) :- - nonvar(F), !, - strip_module(F, M0, F0), - '$load_files'(M0:F0, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)), - ( var(M) -> true - ; - absolute_file_name( F0, F1, [expand(true),file_type(prolog)] ), - recorded('$module','$module'(F1,M,_,_,_),_) - ). -'$use_module'(M,F,Is) :- - nonvar(M), !, - strip_module(F, M0, F0), - ( - recorded('$module','$module'(F1,M,_,_,_),_) - -> - '$load_files'(M0:F1, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)) - ), - (var(F0) -> F0 = F1 ; absolute_file_name( F1, F2, [expand(true),file_type(prolog)] ) -> F2 = F0 ). -'$use_module'(M,F,Is) :- - '$do_error'(instantiation_error,use_module(M,F,Is)). - -/** - - @pred reexport(+F) is directive - @pred reexport(+F, +Decls ) is directive - allow a module to use and export predicates from another module - -Export all predicates defined in list _F_ as if they were defined in -the current module. - -Export predicates defined in file _F_ according to _Decls_. The -declarations should be of the form: - -
    - A list of predicate declarations to be exported. Each declaration -may be a predicate indicator or of the form `` _PI_ `as` - _NewName_'', meaning that the predicate with indicator _PI_ is -to be exported under name _NewName_. - - `except`( _List_) -In this case, all predicates not in _List_ are exported. Moreover, -if ` _PI_ `as` _NewName_` is found, the predicate with -indicator _PI_ is to be exported under name _NewName_ as -before. - - -Re-exporting predicates must be used with some care. Please, take into -account the following observations: - -
      - -
    • The `reexport` declarations must be the first declarations to - follow the `module` declaration.
    • - -
    • It is possible to use both `reexport` and `use_module`, but all - predicates reexported are automatically available for use in the - current module.
    • - -
    • In order to obtain efficient execution, YAP compiles - dependencies between re-exported predicates. In practice, this means - that changing a `reexport` declaration and then *just* recompiling - the file may result in incorrect execution.
    • - -
    -*/ -'$reexport'( TOpts, File, Reexport, Imports, OldF ) :- - ( Reexport == false -> true ; - '$lf_opt'('$parent_topts', TOpts, OldTOpts), - '$lf_opt'('$context_module', OldTOpts, OldContextModule), - '$import_to_current_module'(File, OldContextModule, Imports, _, TOpts), - '$extend_exports'(File, Imports, OldF ) - ). - -/** -@} -**/ - - -/** @defgroup YAPCompilerSettings Directing and Configuring the Compiler - @ingroup YAPProgramming - -@{ - - The YAP system also includes a number of primitives designed to set - compiler parameters and to track the state of the compiler. One - important example is the number of directivees that allow setting up - properties of predicates. It is also possible to enable or disable - waraanings about possible issues with the code in the program, sich - as the occurrence . - -This section presents a set of built-ins predicates designed to set the -environment for the compiler. - -*/ - - -/** @pred prolog_to_os_filename(+ _PrologPath_,- _OsPath_) - -This is an SWI-Prolog built-in. Converts between the internal Prolog -pathname conventions and the operating-system pathname conventions. The -internal conventions are Unix and this predicates is equivalent to =/2 -(unify) on Unix systems. On DOS systems it will change the -directory-separator, limit the filename length map dots, except for the -last one, onto underscores. - -*/ - -% add_multifile_predicate when we start consult -'$add_multifile'(Name,Arity,Module) :- - source_location(File,_), - '$add_multifile'(File,Name,Arity,Module). - -'$add_multifile'(File,Name,Arity,Module) :- - recorded('$multifile_defs','$defined'(File,Name,Arity,Module), _), !. -% print_message(warning,declaration((multifile Module:Name/Arity),ignored)). -'$add_multifile'(File,Name,Arity,Module) :- - recordz('$multifile_defs','$defined'(File,Name,Arity,Module),_), !, - fail. -'$add_multifile'(File,Name,Arity,Module) :- - recorded('$mf','$mf_clause'(File,Name,Arity,Module,Ref),R), - erase(R), - '$erase_clause'(Ref,Module), - fail. -'$add_multifile'(_,_,_,_). - -% retract old multifile clauses for current file. -'$remove_multifile_clauses'(FileName) :- - recorded('$multifile_defs','$defined'(FileName,_,_,_),R1), - erase(R1), - fail. -'$remove_multifile_clauses'(FileName) :- - recorded('$mf','$mf_clause'(FileName,_,_,Module,Ref),R), - '$erase_clause'(Ref, Module), - erase(R), - fail. -'$remove_multifile_clauses'(_). - -/** @pred initialization(+ _G_) is iso - -The compiler will execute goals _G_ after consulting the current -file. - -Notice that the goal will execute in the calling context, not within the file context, -In other words, the source module and execution directory will be the ones of the parent -environment. Use initialization/2 for more flexible behavior. - -*/ -'$initialization'(G) :- - '$initialization'( G, after_load ). - -'$initialization_queue'(G) :- - b_getval('$lf_status', TOpts), - '$lf_opt'( initialization, TOpts, Ref), - nb:nb_queue_enqueue(Ref, G), - fail. -'$initialization_queue'(_). - - - -/** @pred initialization(+ _Goal_,+ _When_) - -Similar to initialization/1, but allows for specifying when - _Goal_ is executed while loading the program-text: - - - + now - Execute _Goal_ immediately. - - + after_load - Execute _Goal_ after loading program-text. This is the same as initialization/1. - - + restore - Do not execute _Goal_ while loading the program, but only when restoring a state (not implemented yet). - -*/ -initialization(G0,OPT) :- - expand_goal(G0, G), - catch('$initialization'(G, OPT), Error, '$LoopError'( Error, consult ) ), - fail. -initialization(_G,_OPT). - -'$initialization'(G,OPT) :- - must_be_of_type(callable, G, initialization(G,OPT)), - must_be_of_type(oneof([after_load, now, restore]), - OPT, initialization(G,OPT)), - ( - OPT == now - -> - ( call(G) -> true ; format(user_error,':- ~w failed.~n',[G]) ) - ; - OPT == after_load - -> - '$initialization_queue'(G) - ; - OPT == restore - -> - recordz('$call_at_restore', G, _ ) - ). -:- . -/** - -@} -*/ - -%% @{ - - - -/** - -@defgroup Conditional_Compilation Conditional Compilation - -@ingroup YAPCompilerSettings - - Conditional compilation builds on the same principle as -term_expansion/2, goal_expansion/2 and the expansion of -grammar rules to compile sections of the source-code -conditionally. One of the reasons for introducing conditional -compilation is to simplify writing portable code. - - -Note that these directives can only be appear as separate terms in the - input. Typical usage scenarios include: - - - Load different libraries on different dialects - - Define a predicate if it is missing as a system predicate - - Realise totally different implementations for a particular -part of the code due to different capabilities. - - Realise different configuration options for your software. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -:- if(test1). -section_1. -:- elif(test2). -section_2. -:- elif(test3). -section_3. -:- else. -section_else. - :- endif. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*/ - -/** @pred if( : _Goal_) - - Compile subsequent code only if _Goal_ succeeds. For enhanced -portability, _Goal_ is processed by `expand_goal/2` before execution. -If an error occurs, the error is printed and processing proceeds as if - _Goal_ has failed. - -*/ -% -% This is complicated because of embedded ifs. -% -'$if'(_,top) :- !, fail. -'$if'(_Goal,_) :- - '$get_if'(Level0), - Level is Level0 + 1, - nb_setval('$if_level',Level), - ( '$nb_getval'('$endif', OldEndif, fail) -> true ; OldEndif=top), - ( '$nb_getval'('$if_skip_mode', Mode, fail) -> true ; Mode = run ), - nb_setval('$endif',elif(Level,OldEndif,Mode)), - fail. -% we are in skip mode, ignore.... -'$if'(_Goal,_) :- - '$nb_getval'('$endif',elif(Level, OldEndif, skip), fail), !, - nb_setval('$endif',endif(Level, OldEndif, skip)). -% we are in non skip mode, check.... -'$if'(Goal,_) :- - ('$if_call'(Goal) - -> - % we will execute this branch, and later enter skip - '$nb_getval'('$endif', elif(Level,OldEndif,Mode), fail), - nb_setval('$endif',endif(Level,OldEndif,Mode)) - - ; - % we are now in skip, but can start an elif. - nb_setval('$if_skip_mode',skip) - ). - -/** -@pred else -Start `else' branch. - -*/ -'$else'(top) :- !, fail. -'$else'(_) :- - '$get_if'(0), !, - '$do_error'(context_error(no_if),(:- else)). -% we have done an if, so just skip -'$else'(_) :- - nb_getval('$endif',endif(_Level,_,_)), !, - nb_setval('$if_skip_mode',skip). -% we can try the elif -'$else'(_) :- - '$get_if'(Level), - nb_getval('$endif',elif(Level,OldEndif,Mode)), - nb_setval('$endif',endif(Level,OldEndif,Mode)), - nb_setval('$if_skip_mode',run). - -/** @pred elif(+ _Goal_) - - -Equivalent to `:- else. :-if(Goal) ... :- endif.` In a sequence -as below, the section below the first matching elif is processed, If -no test succeeds the else branch is processed. -*/ -'$elif'(_,top) :- !, fail. -'$elif'(Goal,_) :- - '$get_if'(0), - '$do_error'(context_error(no_if),(:- elif(Goal))). -% we have done an if, so just skip -'$elif'(_,_) :- - nb_getval('$endif',endif(_,_,_)), !, - nb_setval('$if_skip_mode',skip). -% we can try the elif -'$elif'(Goal,_) :- - '$get_if'(Level), - '$nb_getval'('$endif',elif(Level,OldEndif,Mode),fail), - ('$if_call'(Goal) - -> -% we will not skip, and we will not run any more branches. - nb_setval('$endif',endif(Level,OldEndif,Mode)), - nb_setval('$if_skip_mode',run) - ; -% we will (keep) on skipping - nb_setval('$if_skip_mode',skip) - ). -'$elif'(_,_). - -/** @pred endif -End of conditional compilation. - -*/ -'$endif'(top) :- !, fail. -'$endif'(_) :- -% unmmatched endif. - '$get_if'(0), - '$do_error'(context_error(no_if),(:- endif)). -'$endif'(_) :- -% back to where you belong. - '$get_if'(Level), - nb_getval('$endif',Endif), - Level0 is Level-1, - nb_setval('$if_level',Level0), - arg(2,Endif,OldEndif), - arg(3,Endif,OldMode), - nb_setval('$endif',OldEndif), - nb_setval('$if_skip_mode',OldMode). - - -'$if_call'(G) :- - catch('$eval_if'(G), E, (print_message(error, E), fail)). - -'$eval_if'(Goal) :- - expand_term(Goal,TrueGoal), - once(TrueGoal). - -'$if_directive'((:- if(_))). -'$if_directive'((:- else)). -'$if_directive'((:- elif(_))). -'$if_directive'((:- endif)). - - -'$comp_mode'( OldCompMode, CompMode) :- - var(CompMode), !, - '$fetch_comp_status'( OldCompMode ). -'$comp_mode'(OldCompMode, assert_all) :- - '$fetch_comp_status'(OldCompMode), - nb_setval('$assert_all',on). -'$comp_mode'(OldCompMode, source) :- - '$fetch_comp_status'(OldCompMode), - set_prolog_flag(source, true). -'$comp_mode'(OldCompMode, compact) :- - '$fetch_comp_status'(OldCompMode), - set_prolog_flag(source, false). - -'$fetch_comp_status'(assert_all) :- - '$nb_getval'('$assert_all',on, fail), !. -'$fetch_comp_status'(source) :- - current_prolog_flag(source, true), !. -'$fetch_comp_status'(compact). - -consult_depth(LV) :- '$show_consult_level'(LV). - -/** - @} - - @} -*/ diff --git a/packages/python/swig/yap4py/prolog/pl/control.yap b/packages/python/swig/yap4py/prolog/pl/control.yap deleted file mode 100644 index 099a33ccd..000000000 --- a/packages/python/swig/yap4py/prolog/pl/control.yap +++ /dev/null @@ -1,648 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: control.yap * -* Last rev: 20/08/09 * -* mods: * -* comments: control predicates available in yap * -* * -*************************************************************************/ - -/** - * @file control.yap - * @author VITOR SANTOS COSTA - * @date Thu Nov 19 10:26:35 2015 - * - * @brief Control Predicates - * - * -*/ - -:- system_module( '$_control', [at_halt/1, - b_getval/2, - break/0, - call/2, - call/3, - call/4, - call/5, - call/6, - call/7, - call/8, - call/9, - call/10, - call/11, - call/12, - call_cleanup/2, - call_cleanup/3, - forall/2, - garbage_collect/0, - garbage_collect_atoms/0, - gc/0, - grow_heap/1, - grow_stack/1, - halt/0, - halt/1, - if/3, - ignore/1, - nb_getval/2, - nogc/0, - notrace/1, - once/1, - prolog_current_frame/1, - prolog_initialization/1, - setup_call_catcher_cleanup/4, - setup_call_cleanup/3, - version/0, - version/1], ['$run_atom_goal'/1, - '$set_toplevel_hook'/1]). - -:- use_system_module( '$_boot', ['$call'/4, - '$disable_debugging'/0, - '$do_live'/0, - '$enable_debugging'/0, - '$system_catch'/4, - '$version'/0]). - -:- use_system_module( '$_debug', ['$init_debugger'/0]). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -:- use_system_module( '$_utils', ['$getval_exception'/3]). - -:- use_system_module( '$coroutining', [freeze_goal/2]). - -/** - - -@addtogroup YAPControl - -%% @{ - -*/ - - -/** @pred once(: _G_) is iso - - -Execute the goal _G_ only once. The predicate is defined by: - -~~~~~{.prolog} - once(G) :- call(G), !. -~~~~~ - -Note that cuts inside once/1 can only cut the other goals inside -once/1. - - -*/ -once(G) :- - strip_module(G, M, C), - '$meta_call'(C, M), - !. - -/** @pred forall(: _Cond_,: _Action_) - - -For all alternative bindings of _Cond_ _Action_ can be -proven. The example verifies that all arithmetic statements in the list - _L_ are correct. It does not say which is wrong if one proves wrong. - -~~~~~{.prolog} -?- forall(member(Result = Formula, [2 = 1 + 1, 4 = 2 * 2]), - Result =:= Formula). -~~~~~ - - -*/ -/** @pred forall(+ _Cond_,+ _Action_) - - - - -For all alternative bindings of _Cond_ _Action_ can be proven. -The next example verifies that all arithmetic statements in the list - _L_ are correct. It does not say which is wrong if one proves wrong. - -~~~~~ -?- forall(member(Result = Formula, [2 = 1 + 1, 4 = 2 * 2]), - Result =:= Formula). -~~~~~ - - - -*/ -forall(Cond, Action) :- \+((Cond, \+(Action))). - -/** @pred ignore(: _Goal_) - - -Calls _Goal_ as once/1, but succeeds, regardless of whether -`Goal` succeeded or not. Defined as: - -~~~~~{.prolog} -ignore(Goal) :- - Goal, !. -ignore(_). -~~~~~ - - -*/ -ignore(Goal) :- (Goal->true;true). - -notrace(G) :- - strip_module(G, M, G1), - ( '$$save_by'(CP), - '$debug_stop'( State ), - '$call'(G1, CP, G, M), - '$$save_by'(CP2), - (CP == CP2 -> ! ; '$debug_state'( NState ), ( true ; '$debug_restart'(NState), fail ) ), - '$debug_restart'( State ) - ; - '$debug_restart'( State ), - fail - ). - -/** @pred if(? _G_,? _H_,? _I_) - -Call goal _H_ once per each solution of goal _H_. If goal - _H_ has no solutions, call goal _I_. - -The built-in `if/3` is similar to `->/3`, with the difference -that it will backtrack over the test goal. Consider the following -small data-base: - -~~~~~{.prolog} -a(1). b(a). c(x). -a(2). b(b). c(y). -~~~~~ - -Execution of an `if/3` query will proceed as follows: - -~~~~~{.prolog} - ?- if(a(X),b(Y),c(Z)). - -X = 1, -Y = a ? ; - -X = 1, -Y = b ? ; - -X = 2, -Y = a ? ; - -X = 2, -Y = b ? ; - -no -~~~~~ - -The system will backtrack over the two solutions for `a/1` and the -two solutions for `b/1`, generating four solutions. - -Cuts are allowed inside the first goal _G_, but they will only prune -over _G_. - -If you want _G_ to be deterministic you should use if-then-else, as -it is both more efficient and more portable. - -*/ -if(X,Y,Z) :- - ( - CP is '$last_choice_pt', - '$call'(X,CP,if(X,Y,Z),M), - '$execute'(X), - '$clean_ifcp'(CP), - '$call'(Y,CP,if(X,Y,Z),M) - ; - '$call'(Z,CP,if(X,Y,Z),M) - ). - -call(X,A) :- '$execute'(X,A). - -call(X,A1,A2) :- '$execute'(X,A1,A2). - -/** @pred call(+ _Closure_,...,? _Ai_,...) is iso - - -Meta-call where _Closure_ is a closure that is converted into a goal by -appending the _Ai_ additional arguments. The number of arguments varies -between 0 and 10. - - -*/ -call(X,A1,A2,A3) :- '$execute'(X,A1,A2,A3). - -call(X,A1,A2,A3,A4) :- '$execute'(X,A1,A2,A3,A4). - -call(X,A1,A2,A3,A4,A5) :- '$execute'(X,A1,A2,A3,A4,A5). - -call(X,A1,A2,A3,A4,A5,A6) :- '$execute'(X,A1,A2,A3,A4,A5,A6). - -call(X,A1,A2,A3,A4,A5,A6,A7) :- '$execute'(X,A1,A2,A3,A4,A5,A6,A7). - -call(X,A1,A2,A3,A4,A5,A6,A7,A8) :- '$execute'(X,A1,A2,A3,A4,A5,A6,A7,A8). - -call(X,A1,A2,A3,A4,A5,A6,A7,A8,A9) :- '$execute'(X,A1,A2,A3,A4,A5,A6,A7,A8,A9). - -call(X,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) :- '$execute'(X,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10). - -call(X,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) :- '$execute'(X,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11). - -/** @pred call_cleanup(: _Goal_, : _CleanUpGoal_) - -This is similar to call_cleanup/1 but with an additional - _CleanUpGoal_ which gets called after _Goal_ is finished. - -*/ -call_cleanup(Goal, Cleanup) :- - setup_call_catcher_cleanup(true, Goal, _Catcher, Cleanup). - -call_cleanup(Goal, Catcher, Cleanup) :- - setup_call_catcher_cleanup(true, Goal, Catcher, Cleanup). - -/** @pred setup_call_cleanup(: _Setup_,: _Goal_, : _CleanUpGoal_) - - -Calls `(Setup, Goal)`. For each sucessful execution of _Setup_, -calling _Goal_, the cleanup handler _Cleanup_ is guaranteed to be -called exactly once. This will happen after _Goal_ completes, either -through failure, deterministic success, commit, or an exception. -_Setup_ will contain the goals that need to be protected from -asynchronous interrupts such as the ones received from -`call_with_time_limit/2` or thread_signal/2. In most uses, _Setup_ -will perform temporary side-effects required by _Goal_ that are -finally undone by _Cleanup_. - -*/ - -setup_call_cleanup(Setup,Goal, Cleanup) :- - setup_call_catcher_cleanup(Setup, Goal, _Catcher, Cleanup). - -/** @pred call_with_args(+ _Name_,...,? _Ai_,...) - - -Meta-call where _Name_ is the name of the procedure to be called and -the _Ai_ are the arguments. The number of arguments varies between 0 -and 10. New code should use `call/N` for better portability. - -If _Name_ is a complex term, then call_with_args/n behaves as -call/n: - -~~~~~{.prolog} -call(p(X1,...,Xm), Y1,...,Yn) :- p(X1,...,Xm,Y1,...,Yn). -~~~~~ - - -*/ - -%%% Some "dirty" predicates - -% Only efective if yap compiled with -DDEBUG -% this predicate shows the code produced by the compiler -'$show_code' :- '$debug'(0'f). %' just make emacs happy - -/** @pred grow_heap(+ _Size_) -Increase heap size _Size_ kilobytes. - - -*/ -grow_heap(X) :- '$grow_heap'(X). -/** @pred grow_stack(+ _Size_) - - -Increase stack size _Size_ kilobytes - - - */ -grow_stack(X) :- '$grow_stack'(X). - -% -% gc() expects to be called from "call". Make sure it has an -% environment to return to. -% -%garbage_collect :- save(dump), '$gc', save(dump2). -/** @pred garbage_collect - - -The goal `garbage_collect` forces a garbage collection. - - -*/ -garbage_collect :- - '$gc'. - - - -/** @pred gc - - -The goal `gc` enables garbage collection. The same as -`yap_flag(gc,on)`. - - -*/ -gc :- - yap_flag(gc,on). -/** @pred nogc - - -The goal `nogc` disables garbage collection. The same as -`yap_flag(gc,off)`. - - -*/ -nogc :- - yap_flag(gc,off). - - -/** @pred garbage_collect_atoms - - -The goal `garbage_collect` forces a garbage collection of the atoms -in the data-base. Currently, only atoms are recovered. - - -*/ -garbage_collect_atoms :- - '$atom_gc'. - -'$force_environment_for_gc'. - -'$good_list_of_character_codes'(V) :- var(V), !. -'$good_list_of_character_codes'([]). -'$good_list_of_character_codes'([X|L]) :- - '$good_character_code'(X), - '$good_list_of_character_codes'(L). - -'$good_character_code'(X) :- var(X), !. -'$good_character_code'(X) :- integer(X), X > -2, X < 256. - -/** @pred prolog_initialization( _G_) - - -Add a goal to be executed on system initialization. This is compatible -with SICStus Prolog's initialization/1. - - -*/ -prolog_initialization(G) :- var(G), !, - '$do_error'(instantiation_error,initialization(G)). -prolog_initialization(T) :- callable(T), !, - '$assert_init'(T). -prolog_initialization(T) :- - '$do_error'(type_error(callable,T),initialization(T)). - -'$assert_init'(T) :- recordz('$startup_goal',T,_), fail. -'$assert_init'(_). - -/** @pred version - -Write YAP's boot message. - - -*/ -version :- '$version'. - -/** @pred version(- _Message_) - -Add a message to be written when yap boots or after aborting. It is not -possible to remove messages. - - -*/ -version(V) :- var(V), !, - '$do_error'(instantiation_error,version(V)). -version(T) :- atom(T), !, '$assert_version'(T). -version(T) :- - '$do_error'(type_error(atom,T),version(T)). - -'$assert_version'(T) :- recordz('$version',T,_), fail. -'$assert_version'(_). - -'$set_toplevel_hook'(_) :- - recorded('$toplevel_hooks',_,R), - erase(R), - fail. -'$set_toplevel_hook'(H) :- - recorda('$toplevel_hooks',H,_), - fail. -'$set_toplevel_hook'(_). - -%% @} - -%% @{ - -%% @addtogroup Global_Variables - -/** @pred nb_getval(+ _Name_, - _Value_) - - -The nb_getval/2 predicate is a synonym for b_getval/2, -introduced for compatibility and symmetry. As most scenarios will use -a particular global variable either using non-backtrackable or -backtrackable assignment, using nb_getval/2 can be used to -document that the variable is used non-backtrackable. - - -*/ -/** @pred nb_getval(+ _Name_,- _Value_) - - -The nb_getval/2 predicate is a synonym for b_getval/2, introduced for -compatibility and symmetry. As most scenarios will use a particular -global variable either using non-backtrackable or backtrackable -assignment, using nb_getval/2 can be used to document that the -variable is used non-backtrackable. - - -*/ -nb_getval(GlobalVariable, Val) :- - '$nb_getval'(GlobalVariable, Val, Error), - (var(Error) - -> - true - ; - '$getval_exception'(GlobalVariable, Val, nb_getval(GlobalVariable, Val)) -> - nb_getval(GlobalVariable, Val) - ; - '$do_error'(existence_error(variable, GlobalVariable),nb_getval(GlobalVariable, Val)) - ). - - -/** @pred b_getval(+ _Name_, - _Value_) - - -Get the value associated with the global variable _Name_ and unify -it with _Value_. Note that this unification may further -instantiate the value of the global variable. If this is undesirable -the normal precautions (double negation or copy_term/2) must be -taken. The b_getval/2 predicate generates errors if _Name_ is not -an atom or the requested variable does not exist. - -Notice that for compatibility with other systems _Name_ must be already associated with a term: otherwise the system will generate an error. - - -*/ -/** @pred b_getval(+ _Name_,- _Value_) - - -Get the value associated with the global variable _Name_ and unify -it with _Value_. Note that this unification may further instantiate -the value of the global variable. If this is undesirable the normal -precautions (double negation or copy_term/2) must be taken. The -b_getval/2 predicate generates errors if _Name_ is not an atom or -the requested variable does not exist. - - -*/ -b_getval(GlobalVariable, Val) :- - '$nb_getval'(GlobalVariable, Val, Error), - (var(Error) - -> - true - ; - '$getval_exception'(GlobalVariable, Val, b_getval(GlobalVariable, Val)) -> - true - ; - '$do_error'(existence_error(variable, GlobalVariable),b_getval(GlobalVariable, Val)) - ). - - -%% @} - -%% @{ - -%% @addtogroup YAPControl - -/* This is the break predicate, - it saves the importante data about current streams and - debugger state */ - -'$debug_state'(state(Trace, Debug, Jump, Run, SPY_GN, GList)) :- - '$init_debugger', - nb_getval('$trace',Trace), - nb_getval('$debug_jump',Jump), - nb_getval('$debug_run',Run), - current_prolog_flag(debug, Debug), - nb_getval('$spy_gn',SPY_GN), - b_getval('$spy_glist',GList). - - -'$debug_stop'( State ) :- - '$debug_state'( State ), - b_setval('$trace',off), -% set_prolog_flag(debug, false), - b_setval('$spy_glist',[]), - '$disable_debugging'. - -'$debug_restart'(state(Trace, Debug, Jump, Run, SPY_GN, GList)) :- - b_setval('$spy_glist',GList), - b_setval('$spy_gn',SPY_GN), - set_prolog_flag(debug, Debug), - b_setval('$debug_jump',Jump), - b_setval('$debug_run',Run), - b_setval('$trace',Trace), - '$enable_debugging'. - -/** @pred break - - -Suspends the execution of the current goal and creates a new execution -level similar to the top level, displaying the following message: - -~~~~~{.prolog} - [ Break (level ) ] -~~~~~ -telling the depth of the break level just entered. To return to the -previous level just type the end-of-file character or call the -end_of_file predicate. This predicate is especially useful during -debugging. - - -*/ -break :- - '$init_debugger', - nb_getval('$trace',Trace), - nb_setval('$trace',off), - nb_getval('$debug_jump',Jump), - nb_getval('$debug_run',Run), - current_prolog_flag(debug, Debug), - set_prolog_flag(debug, false), - '$break'( true ), - nb_getval('$spy_gn',SPY_GN), - b_getval('$spy_glist',GList), - b_setval('$spy_glist',[]), - current_output(OutStream), current_input(InpStream), - current_prolog_flag(break_level, BL ), - NBL is BL+1, - set_prolog_flag(break_level, NBL ), - format(user_error, '% Break (level ~w)~n', [NBL]), - '$do_live', - !, - set_value('$live','$true'), - b_setval('$spy_glist',GList), - nb_setval('$spy_gn',SPY_GN), - set_input(InpStream), - set_output(OutStream), - set_prolog_flag(debug, Debug), - nb_setval('$debug_jump',Jump), - nb_setval('$debug_run',Run), - nb_setval('$trace',Trace), - set_prolog_flag(break_level, BL ), - '$break'( false ). - - -at_halt(G) :- - recorda('$halt', G, _), - fail. -at_halt(_). - -/** @pred halt is iso - -Halts Prolog, and exits to the calling application. In YAP, -halt/0 returns the exit code `0`. -*/ -halt :- - print_message(informational, halt), - fail. -halt :- - halt(0). - -/** @pred halt(+ _I_) is iso - -Halts Prolog, and exits to 1the calling application returning the code -given by the integer _I_. - -*/ -halt(_) :- - recorded('$halt', G, _), - catch(once(G), Error, user:'$Error'(Error)), - fail. -halt(X) :- - '$sync_mmapped_arrays', - set_value('$live','$false'), - '$halt'(X). - -prolog_current_frame(Env) :- - Env is '$env'. - -'$run_atom_goal'(GA) :- - '$current_module'(Module), - atom_to_term(GA, G, _), - catch(once(Module:G), Error,user:'$Error'(Error)). - -'$add_dot_to_atom_goal'([],[0'.]) :- !. %' -'$add_dot_to_atom_goal'([0'.],[0'.]) :- !. -'$add_dot_to_atom_goal'([C|Gs0],[C|Gs]) :- - '$add_dot_to_atom_goal'(Gs0,Gs). - -/** -@} -*/ diff --git a/packages/python/swig/yap4py/prolog/pl/corout.yap b/packages/python/swig/yap4py/prolog/pl/corout.yap deleted file mode 100644 index d9f970f40..000000000 --- a/packages/python/swig/yap4py/prolog/pl/corout.yap +++ /dev/null @@ -1,581 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: corout.pl * -* Last rev: * -* mods: * -* comments: Coroutines implementation * -* * -*************************************************************************/ - - -/** - * @file corout.yap - * @author VITOR SANTOS COSTA - * @date Mon Nov 16 22:47:27 2015 - * * - */ - - -:- module('$coroutining',[ - op(1150, fx, block) - %dif/2, - %when/2, - %block/1, - %wait/1, - %frozen/2 - ]). - -:- use_system_module( '$_boot', ['$$compile'/4]). - - -:- use_system_module( attributes, [get_module_atts/2, - put_module_atts/2]). - - -/** - * @defgroup corout Implementing Attributed Variables and Co-Routining - * - * @ingroup attributes - * @{ - * @brief Support for co-routining - * - * -”” */ - - -/** @pred attr_unify_hook(+ _AttValue_,+ _VarValue_) - - - -Hook that must be defined in the module an attributed variable refers -to. Is is called after the attributed variable has been -unified with a non-var term, possibly another attributed variable. - _AttValue_ is the attribute that was associated to the variable -in this module and _VarValue_ is the new value of the variable. -Normally this predicate fails to veto binding the variable to - _VarValue_, forcing backtracking to undo the binding. If - _VarValue_ is another attributed variable the hook often combines -the two attribute and associates the combined attribute with - _VarValue_ using put_attr/3. - - -*/ -attr_unify_hook(DelayList, _) :- - wake_delays(DelayList). - -wake_delays([]). -wake_delays([Delay|List]) :- - wake_delay(Delay), - wake_delays(List). - -% -% Interface to attributed variables. -% -wake_delay(redo_dif(Done, X, Y)) :- - redo_dif(Done, X, Y). -wake_delay(redo_freeze(Done, V, Goal)) :- - redo_freeze(Done, V, Goal). -wake_delay(redo_eq(Done, X, Y, Goal)) :- - redo_eq(Done, X, Y, Goal, _G). -wake_delay(redo_ground(Done, X, Goal)) :- - redo_ground(Done, X, Goal). - - -attribute_goals(Var) --> - { get_attr(Var, '$coroutining', Delays) }, - attgoal_for_delays(Delays, Var). - -attgoal_for_delays([], _V) --> []. -attgoal_for_delays([G|AllAtts], V) --> - attgoal_for_delay(G, V), - attgoal_for_delays(AllAtts, V). - -attgoal_for_delay(redo_dif(Done, X, Y), V) --> - { var(Done), first_att(dif(X,Y), V) }, !, - [prolog:dif(X,Y)]. -attgoal_for_delay(redo_freeze(Done, V, Goal), V) --> - { var(Done) }, !, - { remove_when_declarations(Goal, NoWGoal) }, - [ prolog:freeze(V,NoWGoal) ]. -attgoal_for_delay(redo_eq(Done, X, Y, Goal), V) --> - { var(Done), first_att(Goal, V) }, !, - [ prolog:when(X=Y,Goal) ]. -attgoal_for_delay(redo_ground(Done, X, Goal), _V) --> - { var(Done) }, !, - [ prolog:when(ground(X),Goal) ]. -attgoal_for_delay(_, _V) --> []. - -remove_when_declarations(when(Cond,Goal,_), when(Cond,NoWGoal)) :- !, - remove_when_declarations(Goal, NoWGoal). -remove_when_declarations(Goal, Goal). - - -% -% operators defined in this module: -% -/** - @pred freeze(? _X_,: _G_) - -Delay execution of goal _G_ until the variable _X_ is bound. - - -*/ -prolog:freeze(V, G) :- - var(V), !, - freeze_goal(V,G). -prolog:freeze(_, G) :- - '$execute'(G). - -freeze_goal(V,VG) :- - var(VG), !, - '$current_module'(M), - internal_freeze(V, redo_freeze(_Done,V,M:VG)). -freeze_goal(V,M:G) :- !, - internal_freeze(V, redo_freeze(_Done,V,M:G)). -freeze_goal(V,G) :- - '$current_module'(M), - internal_freeze(V, redo_freeze(_Done,V,M:G)). - -% -% -% Dif is tricky because we need to wake up on the two variables being -% bound together, or on any variable of the term being bound to -% another. Also, the day YAP fully supports infinite rational trees, -% dif should work for them too. Hence, term comparison should not be -% implemented in Prolog. -% -% This is the way dif works. The '$can_unify' predicate does not know -% anything about dif semantics, it just compares two terms for -% equaility and is based on compare. If it succeeds without generating -% a list of variables, the terms are equal and dif fails. If it fails, -% dif succeeds. -% -% If it succeeds but it creates a list of variables, dif creates -% suspension records for all these variables on the '$redo_dif'(V, -% X, Y) goal. V is a flag that says whether dif has completed or not, -% X and Y are the original goals. Whenever one of these variables is -% bound, it calls '$redo_dif' again. '$redo_dif' will then check whether V -% was bound. If it was, dif has succeeded and redo_dif just -% exits. Otherwise, '$redo_dif' will call dif again to see what happened. -% -% Dif needs two extensions from the suspension engine: -% -% First, it needs -% for the engine to be careful when binding two suspended -% variables. Basically, in this case the engine must be sure to wake -% up one of the goals, as they may make dif fail. The way the engine -% does so is by searching the list of suspended variables, and search -% whether they share a common suspended goal. If they do, that -% suspended goal is added to the WokenList. -% -% Second, thanks to dif we may try to suspend on the same variable -% several times. dif calls a special version of freeze that checks -% whether that is in fact the case. -% -/** @pred dif( _X_, _Y_) - - -Succeed if the two arguments do not unify. A call to dif/2 will -suspend if unification may still succeed or fail, and will fail if they -always unify. - - -*/ -prolog:dif(X, Y) :- - '$can_unify'(X, Y, LVars), !, - LVars = [_|_], - dif_suspend_on_lvars(LVars, redo_dif(_Done, X, Y)). -prolog:dif(_, _). - - -dif_suspend_on_lvars([], _). -dif_suspend_on_lvars([H|T], G) :- - internal_freeze(H, G), - dif_suspend_on_lvars(T, G). - -% -% This predicate is called whenever a variable dif was suspended on is -% bound. Note that dif may have already executed successfully. -% -% Three possible cases: dif has executed and Done is bound; we redo -% dif and the two terms either unify, hence we fail, or may unify, and -% we try to increase the number of suspensions; last, the two terms -% did not unify, we are done, so we succeed and bind the Done variable. -% -redo_dif(Done, _, _) :- nonvar(Done), !. -redo_dif(Done, X, Y) :- - '$can_unify'(X, Y, LVars), !, - LVars = [_|_], - dif_suspend_on_lvars(LVars, redo_dif(Done, X, Y)). -redo_dif('$done', _, _). - -redo_freeze(Done, V, G0) :- -% If you called nonvar as condition for when, then you may find yourself -% here. -% -% someone else (that is Cond had ;) did the work, do nothing -% - (nonvar(Done) -> true ; -% -% We still have some more conditions: continue the analysis. -% - G0 = when(C, G, Done) -> when(C, G, Done) ; -% -% check if the variable was really bound -% - var(V) -> internal_freeze(V, redo_freeze(Done,V,G0)) ; -% -% I can't believe it: we're done and can actually execute our -% goal. Notice we have to say we are done, otherwise someone else in -% the disjunction might decide to wake up the goal themselves. -% - Done = '$done', '$execute'(G0) ). - -% -% eq is a combination of dif and freeze -redo_eq(Done, _, _, _, _) :- nonvar(Done), !. -redo_eq(_, X, Y, _, G) :- - '$can_unify'(X, Y, LVars), - LVars = [_|_], !, - dif_suspend_on_lvars(LVars, G). -redo_eq(Done, _, _, when(C, G, Done), _) :- !, - when(C, G, Done). -redo_eq('$done', _ ,_ , Goal, _) :- - '$execute'(Goal). - -% -% ground is similar to freeze -redo_ground(Done, _, _) :- nonvar(Done), !. -redo_ground(Done, X, Goal) :- - '$non_ground'(X, Var), !, - internal_freeze(Var, redo_ground(Done, X, Goal)). -redo_ground(Done, _, when(C, G, Done)) :- !, - when(C, G, Done). -redo_ground('$done', _, Goal) :- - '$execute'(Goal). - - -% -% support for when/2 built-in -% -/** @pred when(+ _C_,: _G_) - - -Delay execution of goal _G_ until the conditions _C_ are -satisfied. The conditions are of the following form: - -+ _C1_, _C2_ -Delay until both conditions _C1_ and _C2_ are satisfied. -+ _C1_; _C2_ -Delay until either condition _C1_ or condition _C2_ is satisfied. -+ ?=( _V1_, _C2_) -Delay until terms _V1_ and _V1_ have been unified. -+ nonvar( _V_) -Delay until variable _V_ is bound. -+ ground( _V_) -Delay until variable _V_ is ground. - - -Note that when/2 will fail if the conditions fail. - - -*/ -prolog:when(Conds,Goal) :- - '$current_module'(Mod), - prepare_goal_for_when(Goal, Mod, ModG), - when(Conds, ModG, Done, [], LG), !, -%write(vsc:freezing(LG,Done)),nl, - suspend_when_goals(LG, Done). -prolog:when(_,Goal) :- - '$execute'(Goal). - -% -% support for when/2 like declaration. -% -% -% when will block on a conjunction or disjunction of nonvar, ground, -% ?=, where ?= is both terms being bound together -% -% -'$declare_when'(Cond, G) :- - generate_code_for_when(Cond, G, Code), - '$current_module'(Module), - '$$compile'(Code, Code, 5, Module), fail. -'$declare_when'(_,_). - -% -% use a meta interpreter for now -% -generate_code_for_when(Conds, G, - ( G :- when(Conds, ModG, Done, [], LG), !, - suspend_when_goals(LG, Done)) ) :- - '$current_module'(Mod), - prepare_goal_for_when(G, Mod, ModG). - - -% -% make sure we have module info for G! -% -prepare_goal_for_when(G, Mod, Mod:call(G)) :- var(G), !. -prepare_goal_for_when(M:G, _, M:G) :- !. -prepare_goal_for_when(G, Mod, Mod:G). - - -% -% now for the important bit -% - -% Done is used to synchronise: when it is bound someone else did the -% goal and we can give up. -% -% when/5 and when_suspend succeds when there is need to suspend a goal -% -% -when(V, G, _Done, LG, LG) :- var(V), !, - '$do_error'(instantiation_error,when(V,G)). -when(nonvar(V), G, Done, LG0, LGF) :- - when_suspend(nonvar(V), G, Done, LG0, LGF). -when(?=(X,Y), G, Done, LG0, LGF) :- - when_suspend(?=(X,Y), G, Done, LG0, LGF). -when(ground(T), G, Done, LG0, LGF) :- - when_suspend(ground(T), G, Done, LG0, LGF). -when((C1, C2), G, Done, LG0, LGF) :- - % leave it open to continue with when. - ( - when(C1, when(C2, G, Done), Done, LG0, LGI) - -> - LGI = LGF - ; - % we solved C1, great, now we just have to solve C2! - when(C2, G, Done, LG0, LGF) - ). -when((G1 ; G2), G, Done, LG0, LGF) :- - when(G1, G, Done, LG0, LGI), - when(G2, G, Done, LGI, LGF). - -% -% Auxiliary predicate called from within a conjunction. -% Repeat basic code for when, as inserted in first clause for predicate. -% -when(_, _, Done) :- - nonvar(Done), !. -when(Cond, G, Done) :- - when(Cond, G, Done, [], LG), - !, - suspend_when_goals(LG, Done). -when(_, G, '$done') :- - '$execute'(G). - -% -% Do something depending on the condition! -% -% some one else did the work. -% -when_suspend(_, _, Done, _, []) :- nonvar(Done), !. -% -% now for the serious stuff. -% -when_suspend(nonvar(V), G, Done, LG0, LGF) :- - try_freeze(V, G, Done, LG0, LGF). -when_suspend(?=(X,Y), G, Done, LG0, LGF) :- - try_eq(X, Y, G, Done, LG0, LGF). -when_suspend(ground(X), G, Done, LG0, LGF) :- - try_ground(X, G, Done, LG0, LGF). - - -try_freeze(V, G, Done, LG0, LGF) :- - var(V), - LGF = ['$coroutining':internal_freeze(V, redo_freeze(Done, V, G))|LG0]. - -try_eq(X, Y, G, Done, LG0, LGF) :- - '$can_unify'(X, Y, LVars), LVars = [_|_], - LGF = ['$coroutining':dif_suspend_on_lvars(LVars, redo_eq(Done, X, Y, G))|LG0]. - -try_ground(X, G, Done, LG0, LGF) :- - '$non_ground'(X, Var), % the C predicate that succeds if - % finding out the term is nonground - % and gives the first variable it - % finds. Notice that this predicate - % must know about svars. - LGF = ['$coroutining':internal_freeze(Var, redo_ground(Done, X, G))| LG0]. - -% -% When executing a when, if nobody succeeded, we need to create suspensions. -% -suspend_when_goals([], _). -suspend_when_goals(['$coroutining':internal_freeze(V, G)|Ls], Done) :- - var(Done), !, - internal_freeze(V, G), - suspend_when_goals(Ls, Done). -suspend_when_goals([dif_suspend_on_lvars(LVars, G)|LG], Done) :- - var(Done), !, - dif_suspend_on_lvars(LVars, G), - suspend_when_goals(LG, Done). -suspend_when_goals([_|_], _). - -% -% Support for wait declarations on goals. -% Or we also use the more powerful, SICStus like, "block" declarations. -% -% block or wait declarations must precede the first clause. -% - -% -% I am using the simplest solution now: I'll add an extra clause at -% the beginning of the procedure to do this work. This creates a -% choicepoint and make things a bit slower, but it's probably not as -% significant as the remaining overheads. -% -prolog:'$block'(Conds) :- - generate_blocking_code(Conds, _, Code), - '$current_module'(Module), - '$$compile'(Code, Code, 5, Module), fail. -prolog:'$block'(_). - -generate_blocking_code(Conds, G, Code) :- - extract_head_for_block(Conds, G), - recorded('$blocking_code','$code'(G,OldConds),R), !, - erase(R), - functor(G, Na, Ar), - '$current_module'(M), - abolish(M:Na, Ar), - generate_blocking_code((Conds,OldConds), G, Code). -generate_blocking_code(Conds, G, (G :- (If, !, when(When, G)))) :- - extract_head_for_block(Conds, G), - recorda('$blocking_code','$code'(G,Conds),_), - generate_body_for_block(Conds, G, If, When). - -% -% find out what we are blocking on. -% -extract_head_for_block((C1, _), G) :- !, - extract_head_for_block(C1, G). -extract_head_for_block(C, G) :- - functor(C, Na, Ar), - functor(G, Na, Ar). - -% -% If we suspend on the conditions, we should continue -% execution. If we don't suspend we should fail so that we can take -% the next clause. To -% know what we have to do we just test how many variables we suspended -% on ;-). -% - -% -% We generate code as follows: -% -% block a(-,-,?) -% -% (var(A1), var(A2) -> true ; fail), !, when((nonvar(A1);nonvar(A2)),G). -% -% block a(-,-,?), a(?,-, -) -% -% (var(A1), var(A2) -> true ; (var(A2), var(A3) -> true ; fail)), !, -% when(((nonvar(A1);nonvar(A2)),(nonvar(A2);nonvar(A3))),G). - -generate_body_for_block((C1, C2), G, (Code1 -> true ; Code2), (WhenConds,OtherWhenConds)) :- !, - generate_for_cond_in_block(C1, G, Code1, WhenConds), - generate_body_for_block(C2, G, Code2, OtherWhenConds). -generate_body_for_block(C, G, (Code -> true ; fail), WhenConds) :- - generate_for_cond_in_block(C, G, Code, WhenConds). - -generate_for_cond_in_block(C, G, Code, Whens) :- - C =.. [_|Args], - G =.. [_|GArgs], - fetch_out_variables_for_block(Args,GArgs,L0Vars), - add_blocking_vars(L0Vars, LVars), - generate_for_each_arg_in_block(LVars, Code, Whens). - -add_blocking_vars([], [_]) :- !. -add_blocking_vars(LV, LV). - -fetch_out_variables_for_block([], [], []). -fetch_out_variables_for_block(['?'|Args], [_|GArgs], LV) :- - fetch_out_variables_for_block(Args, GArgs, LV). -fetch_out_variables_for_block(['-'|Args], [GArg|GArgs], - [GArg|LV]) :- - fetch_out_variables_for_block(Args, GArgs, LV). - -generate_for_each_arg_in_block([], false, true). -generate_for_each_arg_in_block([V], var(V), nonvar(V)) :- !. -generate_for_each_arg_in_block([V|L], (var(V),If), (nonvar(V);Whens)) :- - generate_for_each_arg_in_block(L, If, Whens). - - -% -% The wait declaration is a simpler and more efficient version of block. -% -prolog:'$wait'(Na/Ar) :- - functor(S, Na, Ar), - arg(1, S, A), - '$current_module'(M), - '$$compile'((S :- var(A), !, freeze(A, S)), (S :- var(A), !, freeze(A, S)), 5, M), fail. -prolog:'$wait'(_). - -/** @pred frozen( _X_, _G_) - - -Unify _G_ with a conjunction of goals suspended on variable _X_, -or `true` if no goal has suspended. - - -*/ -prolog:frozen(V, LG) :- - var(V), !, - '$attributes':attvars_residuals([V], Gs, []), - simplify_frozen( Gs, SGs ), - list_to_conj( SGs, LG ). -prolog:frozen(V, G) :- - '$do_error'(uninstantiation_error(V),frozen(V,G)). - -simplify_frozen( [prolog:freeze(_, G)|Gs], [G|NGs] ) :- - simplify_frozen( Gs,NGs ). -simplify_frozen( [prolog:when(_, G)|Gs], [G|NGs] ) :- - simplify_frozen( Gs,NGs ). -simplify_frozen( [prolog:dif(_, _)|Gs], NGs ) :- - simplify_frozen( Gs,NGs ). -simplify_frozen( [], [] ). - -list_to_conj([], true). -list_to_conj([El], El). -list_to_conj([E,E1|Els], (E,C) ) :- - list_to_conj([E1|Els], C). - -%internal_freeze(V,G) :- -% attributes:get_att(V, 0, Gs), write(G+Gs),nl,fail. -internal_freeze(V,G) :- - update_att(V, G). - -update_att(V, G) :- - attributes:get_module_atts(V, '$coroutining'(_,Gs)), - not_vmember(G, Gs), !, - attributes:put_module_atts(V, '$coroutining'(_,[G|Gs])). -update_att(V, G) :- - attributes:put_module_atts(V, '$coroutining'(_,[G])). - - -not_vmember(_, []). -not_vmember(V, [V1|DonesSoFar]) :- - V \== V1, - not_vmember(V, DonesSoFar). - -first_att(T, V) :- - term_variables(T, Vs), - check_first_attvar(Vs, V). - -check_first_attvar([V|_Vs], V0) :- attvar(V), !, V == V0. -check_first_attvar([_|Vs], V0) :- - check_first_attvar(Vs, V0). - -/** - @} -*/ diff --git a/packages/python/swig/yap4py/prolog/pl/dbload.yap b/packages/python/swig/yap4py/prolog/pl/dbload.yap deleted file mode 100644 index ca7837117..000000000 --- a/packages/python/swig/yap4py/prolog/pl/dbload.yap +++ /dev/null @@ -1,189 +0,0 @@ -/************************************************************************* -* * -* YAP Prolog * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: dbload.yap * -* Last rev: 8/2/88 * -* mods: * -* comments: Compact Loading of Facts in YAP * -* * -*************************************************************************/ - -:- module('$db_load', - []). - -:- use_system_module( '$_boot', ['$$compile'/4]). - -:- use_system_module( '$_errors', ['$do_error'/2]). - -:- use_system_module( attributes, [get_module_atts/2, - put_module_atts/2]). - -%%% @file dbload.yap - -%%% @defgroup YAPBigLoad -%%% @brief Fast and Exo Loading - -/*! - * @pred load_mega_clause( +Stream ) is detail - * Load a single predicare composed of facts with the same size. - */ -load_mega_clause( Stream ) :- -% line_spec( Stream, Line), - repeat, - ( fact( Stream ), fail ; - stream_property(Stream, at_end_of_file( on )) ). - -'$input_lines'(R, csv, Lines ) :- - '$process_lines'(R, Lines, _Type ), - close(R). - -/*! - * @pred load_db( +Files ) is det - * Load files each one containing as single predicare composed of facts with the same size. - */ -prolog:load_db(Fs) :- - '$current_module'(M0), - prolog_flag(agc_margin,Old,0), - dbload(Fs,M0,load_db(Fs)), - load_facts, - prolog_flag(agc_margin,_,Old), - clean_up. - -dbload(Fs, _, G) :- - var(Fs), - '$do_error'(instantiation_error,G). -dbload([], _, _) :- !. -dbload([F|Fs], M0, G) :- !, - dbload(F, M0, G), - dbload(Fs, M0, G). -dbload(M:F, _M0, G) :- !, - dbload(F, M, G). -dbload(F, M0, G) :- - atom(F), !, - do_dbload(F, M0, G). -dbload(F, _, G) :- - '$do_error'(type_error(atom,F),G). - -do_dbload(F0, M0, G) :- - '$full_filename'(F0, F, G), - assert(dbprocess(F, M0)), - open(F, read, R), - check_dbload_stream(R, M0), - close(R). - - -check_dbload_stream(R, M0) :- - repeat, - catch(read(R,T), _, fail), - ( T = end_of_file -> !; - dbload_count(T, M0), - fail - ). - -dbload_count(T0, M0) :- - get_module(T0,M0,T,M), - functor(T,Na,Arity), -% dbload_check_term(T), - ( - dbloading(Na,Arity,M,_,NaAr,_) -> - nb_getval(NaAr,I0), - I is I0+1, - nb_setval(NaAr,I) - ; - atomic_concat([Na,'__',Arity,'__',M],NaAr), - assert(dbloading(Na,Arity,M,T,NaAr,0)), - nb_setval(NaAr,1) - ). - -get_module(M1:T0,_,T,M) :- !, - get_module(T0, M1, T , M). -get_module(T,M,T,M). - - -load_facts :- - !, % yap_flag(exo_compilation, on), !. - load_exofacts. -load_facts :- - retract(dbloading(Na,Arity,M,T,NaAr,_)), - nb_getval(NaAr,Size), - dbload_get_space(T, M, Size, Handle), - assertz(dbloading(Na,Arity,M,T,NaAr,Handle)), - nb_setval(NaAr,0), - fail. -load_facts :- - dbprocess(F, M), - open(F, read, R), - dbload_add_facts(R, M), - close(R), - fail. -load_facts. - -dbload_add_facts(R, M) :- - repeat, - catch(read(R,T), _, fail), - ( T = end_of_file -> !; - dbload_add_fact(T, M), - fail - ). - -dbload_add_fact(T0, M0) :- - get_module(T0,M0,T,M), - functor(T,Na,Arity), - dbloading(Na,Arity,M,_,NaAr,Handle), - nb_getval(NaAr,I0), - I is I0+1, - nb_setval(NaAr,I), - dbassert(T,Handle,I0). - -load_exofacts :- - retract(dbloading(Na,Arity,M,T,NaAr,_)), - nb_getval(NaAr,Size), - exo_db_get_space(T, M, Size, Handle), - assertz(dbloading(Na,Arity,M,T,NaAr,Handle)), - nb_setval(NaAr,0), - fail. -load_exofacts :- - dbprocess(F, M), - open(F, read, R), - exodb_add_facts(R, M), - close(R), - fail. -load_exofacts. - -exodb_add_facts(R, M) :- - repeat, - catch(protected_exodb_add_fact(R, M), _, fail), - !. - -protected_exodb_add_fact(R, M) :- - repeat, - read(R,T), - ( T == end_of_file -> !; - exodb_add_fact(T, M), - fail - ). - -exodb_add_fact(T0, M0) :- - get_module(T0,M0,T,M), - functor(T,Na,Arity), - dbloading(Na,Arity,M,_,NaAr,Handle), - nb_getval(NaAr,I0), - I is I0+1, - nb_setval(NaAr,I), - exoassert(T,Handle,I0). - -clean_up :- - retractall(dbloading(_,_,_,_,_,_)), - retractall(dbprocess(_,_)), - fail. - -clean_up. - -%% @} diff --git a/packages/python/swig/yap4py/prolog/pl/debug.yap b/packages/python/swig/yap4py/prolog/pl/debug.yap deleted file mode 100644 index dd6b96dc7..000000000 --- a/packages/python/swig/yap4py/prolog/pl/debug.yap +++ /dev/null @@ -1,1169 +0,0 @@ -/************************************************************************* -* * - * YAP Prolog * -* * - * Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * -************************************************************************** -* * -* File: debug.pl * -* Last rev: * -* mods: * -* comments: YAP debugger * -* * -*************************************************************************/ - - -:- system_module( '$_debug', [], ['$do_spy'/4, - '$init_debugger'/0, - '$skipeol'/1]). - - - -/** @defgroup Deb_Interaction Interacting with the debugger -@ingroup YAPProgramming - -Debugging with YAP is similar to debugging with C-Prolog. Both systems -include a procedural debugger, based on Byrd's four port model. In this -model, execution is seen at the procedure level: each activation of a -procedure is seen as a box with control flowing into and out of that -box. - -In the four port model control is caught at four key points: before -entering the procedure, after exiting the procedure (meaning successful -evaluation of all queries activated by the procedure), after backtracking but -before trying new alternative to the procedure and after failing the -procedure. Each one of these points is named a port: - -~~~~~ - *--------------------------------------* - Call | | Exit ----------> + descendant(X,Y) :- offspring(X,Y). + ---------> - | | - | descendant(X,Z) :- | -<--------- + offspring(X,Y), descendant(Y,Z). + <--------- - Fail | | Redo - *--------------------------------------* -~~~~~ - - - -+ `Call` - - The call port is activated before initial invocation of -procedure. Afterwards, execution will try to match the goal with the -head of existing clauses for the procedure. - -+ `Exit` - - This port is activated if the procedure succeeds. -Control will now leave the procedure and return to its ancestor. - -+ `Redo` - - If the goal, or goals, activated after the call port -fail then backtracking will eventually return control to this procedure -through the redo port. - -+ `Fail` - - If all clauses for this predicate fail, then the -invocation fails, and control will try to redo the ancestor of this -invocation. - - -To start debugging, the user will either call `trace` or spy the -relevant procedures, entering debug mode, and start execution of the -program. When finding the first spy-point, YAP's debugger will take -control and show a message of the form: - -~~~~~ -* (1) call: quicksort([1,2,3],_38) ? -~~~~~ - -The debugger message will be shown while creeping, or at spy-points, -and it includes four or five fields: - -+ -The first three characters are used to point out special states of the -debugger. If the port is exit and the first character is '?', the -current call is non-deterministic, that is, it still has alternatives to -be tried. If the second character is a `\*`, execution is at a -spy-point. If the third character is a `>`, execution has returned -either from a skip, a fail or a redo command. -+ -The second field is the activation number, and uniquely identifies the -activation. The number will start from 1 and will be incremented for -each activation found by the debugger. -+ -In the third field, the debugger shows the active port. -+ -The fourth field is the goal. The goal is written by -`write_term/3` on the standard error stream, using the options -given by debugger_print_options. - - -If the active port is leashed, the debugger will prompt the user with a -`?`, and wait for a command. A debugger command is just a -character, followed by a return. By default, only the call and redo -entries are leashed, but the leash/1 predicate can be used in -order to make the debugger stop where needed. - -There are several commands available, but the user only needs to -remember the help command, which is `h`. This command shows all the -available options, which are: - -+ `c` - creep - - this command makes YAP continue execution and stop at the next -leashed port. - -+ `return` - creep - - the same as c - -+ `l` - leap - - YAP will execute until it meets a port for a spied predicate; this mode -keeps all computation history for debugging purposes, so it is more -expensive than standard execution. Use k or z for fast execution. - -+ `k` - quasi-leap - - similar to leap but faster since the computation history is -not kept; useful when leap becomes too slow. - -+ `z` - zip - - - same as k -+ `s` - skip - - YAP will continue execution without showing any messages until -returning to the current activation. Spy-points will be ignored in this -mode. Note that this command keeps all debugging history, use t for fast execution. This command is meaningless, and therefore illegal, in the fail -and exit ports. - -+ `t` - fast-skip - - similar to skip but faster since computation history is not -kept; useful if skip becomes slow. - -+ `f [ _GoalId_]` - fail - - If given no argument, forces YAP to fail the goal, skipping the fail -port and backtracking to the parent. -If f receives a goal number as -the argument, the command fails all the way to the goal. If goal _GoalId_ has completed execution, YAP fails until meeting the first active ancestor. - -+ `r` [ _GoalId_] - retry - - This command forces YAP to jump back call to the port. Note that any -side effects of the goal cannot be undone. This command is not available -at the call port. If f receives a goal number as the argument, the -command retries goal _GoalId_ instead. If goal _GoalId_ has -completed execution, YAP fails until meeting the first active ancestor. - -+ `a` - abort - - execution will be aborted, and the interpreter will return to the -top-level. YAP disactivates debug mode, but spypoints are not removed. - -+ `n` - nodebug - - stop debugging and continue execution. The command will not clear active -§spy-points. - -+ `e` - exit - - leave YAP. - -+ `h` - help - - show the debugger commands. - -+ `!` Query - - execute a query. YAP will not show the result of the query. - -+ `b` - break - - break active execution and launch a break level. This is the same as `!break`. - -+ `+` - spy this goal - - start spying the active goal. The same as `! spy G` where _G_ -is the active goal. - -+ `-` - nospy this goal - - stop spying the active goal. The same as `! nospy G` where _G_ is -the active goal. - -+ `p` - print - - shows the active goal using print/1 - -+ `d` - display - - shows the active goal using display/1 - -+ `