void Yap_init_agc(void) { Yap_InitCPred("$atom_gc", 0, p_atom_gc, HiddenPredFlag); Yap_InitCPred("$inform_agc", 3, p_inform_agc, HiddenPredFlag); Yap_InitCPred("$agc_threshold", 1, p_agc_threshold, HiddenPredFlag|SafePredFlag); }
void Yap_InitSortPreds(void) { Yap_InitCPred("$sort", 2, p_sort, 0); Yap_InitCPred("$msort", 2, p_msort, 0); Yap_InitCPred("$keysort", 2, p_ksort, 0); }
void Yap_InitMems( void ) { CACHE_REGS Term cm = CurrentModule; CurrentModule = CHARSIO_MODULE; Yap_InitCPred ("open_mem_read_stream", 2, open_mem_read_stream, SyncPredFlag); Yap_InitCPred ("open_mem_write_stream", 1, open_mem_write_stream, SyncPredFlag); Yap_InitCPred ("peek_mem_write_stream", 3, peek_mem_write_stream, SyncPredFlag); CurrentModule = cm; }
void Yap_InitConsole(void) { CACHE_REGS LOCAL_newline = true; Yap_InitCPred("prompt", 1, prompt1, SafePredFlag | SyncPredFlag); Yap_InitCPred("prompt1", 1, prompt1, SafePredFlag | SyncPredFlag); Yap_InitCPred("$is_same_tty", 2, is_same_tty2, SafePredFlag | SyncPredFlag | HiddenPredFlag); Yap_InitCPred("prompt", 2, prompt, SafePredFlag | SyncPredFlag); Yap_InitCPred("$ensure_prompting", 0, ensure_prompting, SafePredFlag | SyncPredFlag); }
void Yap_InitReadUtil(void) { Term cm = CurrentModule; CurrentModule = READUTIL_MODULE; Yap_InitCPred("read_line_to_codes", 2, p_rl_to_codes, SyncPredFlag); Yap_InitCPred("read_line_to_codes", 3, p_rl_to_codes2, SyncPredFlag); Yap_InitCPred("read_stream_to_codes", 3, p_stream_to_codes, SyncPredFlag); Yap_InitCPred("read_stream_to_terms", 3, p_stream_to_terms, SyncPredFlag); CurrentModule = cm; }
void Yap_InitEval(void) { /* here are the arithmetical predicates */ Yap_InitConstExps(); Yap_InitUnaryExps(); Yap_InitBinaryExps(); Yap_InitCPred("is", 2, p_is, 0L); Yap_InitCPred("isnan", 1, p_isnan, TestPredFlag); Yap_InitCPred("isinf", 1, p_isinf, TestPredFlag); Yap_InitCPred("logsum", 3, p_logsum, TestPredFlag); Yap_InitCPredBack("between", 3, 2, init_between, cont_between, 0); }
void Yap_InitReadUtil(void) { CACHE_REGS Term cm = CurrentModule; CurrentModule = READUTIL_MODULE; Yap_InitCPred("read_line_to_string", 2, read_line_to_string, SyncPredFlag); Yap_InitCPred("read_line_to_codes", 2, read_line_to_codes, SyncPredFlag); Yap_InitCPred("read_line_to_codes", 3, read_line_to_codes2, SyncPredFlag); Yap_InitCPred("read_stream_to_codes", 3, read_stream_to_codes, SyncPredFlag); Yap_InitCPred("read_stream_to_terms", 3, read_stream_to_terms, SyncPredFlag); CurrentModule = cm; }
void Yap_InitCmpPreds(void) { Yap_InitCmpPred("=:=", 2, a_eq, SafePredFlag | BinaryPredFlag); Yap_InitCmpPred("=\\=", 2, a_dif, SafePredFlag | BinaryPredFlag); Yap_InitCmpPred(">", 2, a_gt, SafePredFlag | BinaryPredFlag); Yap_InitCmpPred("=<", 2, a_le, SafePredFlag | BinaryPredFlag); Yap_InitCmpPred("<", 2, a_lt, SafePredFlag | BinaryPredFlag); Yap_InitCmpPred(">=", 2, a_ge, SafePredFlag | BinaryPredFlag); Yap_InitCPred("$a_compare", 3, p_acomp, TestPredFlag | SafePredFlag); Yap_InitCmpPred("\\==", 2, a_noteq, BinaryPredFlag | SafePredFlag); Yap_InitCmpPred("@<", 2, a_gen_lt, BinaryPredFlag | SafePredFlag); Yap_InitCmpPred("@=<", 2, a_gen_le, BinaryPredFlag | SafePredFlag); Yap_InitCmpPred("@>", 2, a_gen_gt, BinaryPredFlag | SafePredFlag); Yap_InitCmpPred("@>=", 2, a_gen_ge, BinaryPredFlag | SafePredFlag); Yap_InitCPred("compare", 3, p_compare, TestPredFlag | SafePredFlag); }
void Yap_InitUnify(void) { CACHE_REGS Term cm = CurrentModule; Yap_InitCPred("unify_with_occurs_check", 2, p_ocunify, SafePredFlag); /** @pred unify_with_occurs_check(?T1,?T2) is iso Obtain the most general unifier of terms _T1_ and _T2_, if there is one. This predicate implements the full unification algorithm. An example:n ~~~~~{.prolog} unify_with_occurs_check(a(X,b,Z),a(X,A,f(B)). ~~~~~ will succeed with the bindings `A = b` and `Z = f(B)`. On the other hand: ~~~~~{.prolog} unify_with_occurs_check(a(X,b,Z),a(X,A,f(Z)). ~~~~~ would fail, because `Z` is not unifiable with `f(Z)`. Note that `(=)/2` would succeed for the previous examples, giving the following bindings `A = b` and `Z = f(Z)`. */ Yap_InitCPred("acyclic_term", 1, p_acyclic, SafePredFlag|TestPredFlag); /** @pred acyclic_term( _T_) is iso Succeeds if there are loops in the term _T_, that is, it is an infinite term. */ CurrentModule = TERMS_MODULE; Yap_InitCPred("cyclic_term", 1, p_cyclic, SafePredFlag|TestPredFlag); Yap_InitCPred("unifiable", 3, p_unifiable, 0); CurrentModule = cm; }
void Yap_udi_init(void) { UdiControlBlocks = NULL; /* to be filled in by David */ RtreeCmd.init = RtreeUdiInit; RtreeCmd.insert = RtreeUdiInsert; RtreeCmd.search = RtreeUdiSearch; RtreeCmd.destroy = RtreeUdiDestroy; Yap_InitCPred("$udi_init", 2, p_new_udi, 0); }
/* * Init Yap udi interface */ void Yap_udi_init(void) { UdiControlBlocks = NULL; /*init indexing structures array*/ utarray_new(indexing_structures, &udicb_icd); Yap_InitCPred("$udi_init", 1, p_new_udi, 0); /* TODO: decide if udi.yap should be loaded automaticaly in init.yap */ }
void Yap_InitBinaryExps(void) { unsigned int i; ExpEntry *p; for (i = 0; i < sizeof(InitBinTab)/sizeof(InitBinEntry); ++i) { AtomEntry *ae = RepAtom(Yap_LookupAtom(InitBinTab[i].OpName)); if (ae == NULL) { Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"at InitBinaryExps"); return; } WRITE_LOCK(ae->ARWLock); if (Yap_GetExpPropHavingLock(ae, 2)) { WRITE_UNLOCK(ae->ARWLock); break; } p = (ExpEntry *) Yap_AllocAtomSpace(sizeof(ExpEntry)); p->KindOfPE = ExpProperty; p->ArityOfEE = 2; p->ENoOfEE = 2; p->FOfEE = InitBinTab[i].f; p->NextOfPE = ae->PropsOfAE; ae->PropsOfAE = AbsExpProp(p); WRITE_UNLOCK(ae->ARWLock); } Yap_InitCPred("is", 4, p_binary_is, TestPredFlag | SafePredFlag); Yap_InitCPred("$binary_op_as_integer", 2, p_binary_op_as_integer, TestPredFlag|SafePredFlag); Yap_InitAsmPred("$plus", 3, _plus, export_p_plus, SafePredFlag); Yap_InitAsmPred("$minus", 3, _minus, export_p_minus, SafePredFlag); Yap_InitAsmPred("$times", 3, _times, export_p_times, SafePredFlag); Yap_InitAsmPred("$div", 3, _div, export_p_div, SafePredFlag); Yap_InitAsmPred("$and", 3, _and, export_p_and, SafePredFlag); Yap_InitAsmPred("$or", 3, _or, export_p_or, SafePredFlag); Yap_InitAsmPred("$sll", 3, _sll, export_p_sll, SafePredFlag); Yap_InitAsmPred("$slr", 3, _slr, export_p_slr, SafePredFlag); }
void Yap_InitLowLevelTrace(void) { Yap_InitCPred("start_low_level_trace", 0, p_start_low_level_trace, SafePredFlag); #if THREADS Yap_InitCPred("start_low_level_trace", 1, p_start_low_level_trace2, SafePredFlag); #endif Yap_InitCPred("stop_low_level_trace", 0, p_stop_low_level_trace, SafePredFlag); Yap_InitCPred("show_low_level_trace", 0, p_show_low_level_trace, SafePredFlag); Yap_InitCPred("total_choicepoints", 1, p_total_choicepoints, SafePredFlag); Yap_InitCPred("reset_total_choicepoints", 0, p_reset_total_choicepoints, SafePredFlag); Yap_InitCPred("vsc_wait", 0, p_vsc_wait, SafePredFlag); }
void Yap_InitMPE(void) { Yap_InitCPred( "mpe_open", 0, p_init, SafePredFlag ); Yap_InitCPred( "mpe_start", 0, p_start, SafePredFlag ); Yap_InitCPred( "mpe_close", 1, p_close, SafePredFlag ); Yap_InitCPred( "mpe_create_event", 1, p_create_event, SafePredFlag ); Yap_InitCPred( "mpe_create_state", 4, p_create_state, SafePredFlag ); Yap_InitCPred( "mpe_log", 3, p_log, SafePredFlag ); }
void Yap_InitSignalCPreds(void) { /* Basic predicates for the debugger */ Yap_InitCPred("$creep", 0, p_creep, SafePredFlag); Yap_InitCPred("$creep_fail", 0, p_creep_fail, SafePredFlag); Yap_InitCPred("$stop_creeping", 0, p_stop_creeping, SafePredFlag); Yap_InitCPred ("$first_signal", 1, p_first_signal, SafePredFlag|SyncPredFlag); Yap_InitCPred ("$continue_signals", 0, p_continue_signals, SafePredFlag|SyncPredFlag); Yap_InitCPred("$creep_allowed", 0, p_creep_allowed, 0); #ifdef DEBUG Yap_InitCPred("$debug", 1, p_debug, SafePredFlag|SyncPredFlag); #endif }
void Yap_InitFiles(void) { Yap_InitCPred("file_base_name", 2, file_base_name, SafePredFlag); Yap_InitCPred("file_directory_name", 2, file_directory_name, SafePredFlag); Yap_InitCPred("is_absolute_file_name", 1, is_absolute_file_name, SafePredFlag); Yap_InitCPred("same_file", 2, same_file, SafePredFlag | SyncPredFlag); Yap_InitCPred("$access_file", 2, access_file, SafePredFlag | SyncPredFlag); Yap_InitCPred("$lines_in_file", 2, lines_in_file, SafePredFlag | SyncPredFlag); Yap_InitCPred("access", 1, access_path, SafePredFlag | SyncPredFlag); Yap_InitCPred("exists_directory", 1, exists_directory, SafePredFlag | SyncPredFlag); Yap_InitCPred("exists_file", 1, exists_file, SafePredFlag | SyncPredFlag); Yap_InitCPred("$file_exists", 1, file_exists, SafePredFlag | SyncPredFlag); Yap_InitCPred("time_file64", 2, time_file, SafePredFlag | SyncPredFlag); Yap_InitCPred("time_file", 2, time_file, SafePredFlag | SyncPredFlag); Yap_InitCPred("file_size", 2, file_size, SafePredFlag | SyncPredFlag); Yap_InitCPred("file_name_extension", 3, file_name_extension, SafePredFlag | SyncPredFlag); Yap_InitCPred("list_directory", 2, list_directory, SyncPredFlag); }
void Yap_InitItDeepenPreds(void) { Yap_InitCPred("get_depth_limit", 1, p_get_depth_limit, SafePredFlag); Yap_InitCPred("$set_depth_limit", 1, p_set_depth_limit, HiddenPredFlag); Yap_InitCPred("$set_depth_limit_for_next_call", 1, p_set_depth_limit_for_next_call, HiddenPredFlag); }
void Yap_init_optyap_preds(void) { #ifdef TABLING Yap_InitCPred("freeze_choice_point", 1, p_freeze_choice_point, SafePredFlag|SyncPredFlag); Yap_InitCPred("wake_choice_point", 1, p_wake_choice_point, SafePredFlag|SyncPredFlag); Yap_InitCPred("abolish_frozen_choice_points", 1, p_abolish_frozen_choice_points_until, SafePredFlag|SyncPredFlag); Yap_InitCPred("abolish_frozen_choice_points", 0, p_abolish_frozen_choice_points_all, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_table", 3, p_table, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_tabling_mode", 3, p_tabling_mode, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_abolish_table", 2, p_abolish_table, SafePredFlag|SyncPredFlag); Yap_InitCPred("abolish_all_tables", 0, p_abolish_all_tables, SafePredFlag|SyncPredFlag); Yap_InitCPred("show_tabled_predicates", 1, p_show_tabled_predicates, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_show_table", 3, p_show_table, SafePredFlag|SyncPredFlag); Yap_InitCPred("show_all_tables", 1, p_show_all_tables, SafePredFlag|SyncPredFlag); Yap_InitCPred("show_global_trie", 1, p_show_global_trie, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_table_statistics", 3, p_show_statistics_table, SafePredFlag|SyncPredFlag); Yap_InitCPred("tabling_statistics", 1, p_show_statistics_tabling, SafePredFlag|SyncPredFlag); Yap_InitCPred("global_trie_statistics", 1, p_show_statistics_global_trie, SafePredFlag|SyncPredFlag); #endif /* TABLING */ #ifdef YAPOR Yap_InitCPred("parallel_mode", 1, p_parallel_mode, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_yapor_start", 0, p_yapor_start, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_yapor_workers", 1, p_yapor_workers, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_worker", 0, p_worker, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_parallel_new_answer", 1, p_parallel_new_answer, SafePredFlag|SyncPredFlag); Yap_InitCPred("$c_parallel_get_answers", 1, p_parallel_get_answers, SafePredFlag|SyncPredFlag); Yap_InitCPred("or_statistics", 1, p_show_statistics_or, SafePredFlag|SyncPredFlag); #endif /* YAPOR */ #if defined(YAPOR) && defined(TABLING) Yap_InitCPred("opt_statistics", 1, p_show_statistics_opt, SafePredFlag|SyncPredFlag); #endif /* YAPOR && TABLING */ Yap_InitCPred("$c_get_optyap_statistics", 3, p_get_optyap_statistics, SafePredFlag|SyncPredFlag); }
void Yap_InitReadlinePreds(void) { Yap_InitCPred("$has_readline", 0, has_readline, SafePredFlag | HiddenPredFlag); }
void Yap_InitPipes( void ) { Yap_InitCPred ("open_pipe_stream", 2, open_pipe_stream, SafePredFlag); }
void Yap_InitJitConfigPreds( void ) { Yap_InitCPred("execution_mode", 1, p_execution_mode, SafePredFlag); Yap_InitCPred("interpreted_mode", 0, p_interpreted_mode, SafePredFlag); Yap_InitCPred("smartjit_mode", 0, p_smartjit_mode, SafePredFlag); Yap_InitCPred("continuouscompilation_mode", 0, p_continuouscompilation_mode, SafePredFlag); Yap_InitCPred("justcompiled_mode", 0, p_justcompiled_mode, SafePredFlag); Yap_InitCPred("frequencyty1", 1, p_frequencyty1, SafePredFlag); Yap_InitCPred("frequencyty2", 2, p_frequencyty2, SafePredFlag); Yap_InitCPred("frequency_bound", 1, p_frequency_bound, SafePredFlag); Yap_InitCPred("profiling_start_point", 1, p_profiling_start_point, SafePredFlag); Yap_InitCPred("main_clause_ty", 1, p_main_clause_ty, SafePredFlag); Yap_InitCPred("compilation_threads", 1, p_compilation_threads, SafePredFlag); Yap_InitCPred("enable_recompilation", 0, p_enable_recompilation, SafePredFlag); Yap_InitCPred("disable_recompilation", 0, p_disable_recompilation, SafePredFlag); Yap_InitCPred("only_profiled_interpreter", 0, p_only_profiled_interpreter, SafePredFlag); Yap_InitCPred("noonly_profiled_interpreter", 0, p_noonly_profiled_interpreter, SafePredFlag); }