init and friends : cleanup

This commit is contained in:
Vítor Santos Costa 2015-11-05 19:33:38 +00:00
parent 44dc6f06d7
commit f8b5ca8291
7 changed files with 7 additions and 80 deletions

View File

@ -62,16 +62,9 @@
#if defined(YAPOR) || defined(TABLING)
#include "opt.config.h"
#endif /* YAPOR || TABLING */
#if HAVE_STRINGS_H
/* bzero */
#include <strings.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
/*

View File

@ -40,7 +40,7 @@
#endif
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
#ifndef HeapUsed
#define HeapUsed Yap_givemallinfo()
#define HeapUsed Yap_givemallinfo()
#endif
#define NotHeapUsed Yap_heap_regs->heap_used
#else
@ -94,7 +94,6 @@
#define CHTYPE_MODULE Yap_heap_regs->chtype_module
#define TERMS_MODULE Yap_heap_regs->terms_module
#define SYSTEM_MODULE Yap_heap_regs->system_module
#define OPERATING_SYSTEM_MODULE Yap_heap_regs->operating_system_module
#define READUTIL_MODULE Yap_heap_regs->readutil_module
#define HACKS_MODULE Yap_heap_regs->hacks_module
#define ARG_MODULE Yap_heap_regs->arg_module

View File

@ -40,7 +40,7 @@
#endif
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
#ifndef HeapUsed
#define HeapUsed Yap_givemallinfo()
#define HeapUsed Yap_givemallinfo()
#endif
Int heap_used;
#else
@ -94,7 +94,6 @@
Term chtype_module;
Term terms_module;
Term system_module;
Term operating_system_module;
Term readutil_module;
Term hacks_module;
Term arg_module;

View File

@ -340,7 +340,7 @@ YAP must support bignum for the configuration you are using (check the
YAP configuration and setup). For now, YAP only supports the GNU GMP
library, and `void \*` will be a cast for `mpz_t`. Notice
that [YAP_BigNumOfTerm](@ref YAP_BigNumOfTerm) requires the number to be already
initialised. As an example, we show how to print a bignum:
initialized. As an example, we show how to print a bignum:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static int
@ -815,7 +815,7 @@ ignore the variable.
There are several ways to call Prolog code from C-code. By default, the
`YAP_RunGoal()` should be used for this task. It assumes the engine
has been initialised before:
has been initialized before:
<ul>
<li>YAP_Int YAP_RunGoal(YAP_Term Goal)
@ -1792,6 +1792,8 @@ extern X_API void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCP
/* YAP_Int YAP_ListLength(YAP_Term t) */
extern X_API YAP_Int YAP_ListLength(YAP_Term);
extern X_API size_t YAP_UTF8_TextLength(YAP_Term t);
/* void UserBackCPredicate(char *name, int *init(), int *cont(), int *cut(), int
arity, int extra) */
extern X_API void YAP_UserBackCutCPredicate(const char *, YAP_UserCPred, YAP_UserCPred, YAP_UserCPred, YAP_Arity, unsigned int);
@ -1924,7 +1926,7 @@ extern X_API YAP_Term YAP_IntsToList(YAP_Int *, size_t);
extern X_API YAP_Int YAP_ListToInts(YAP_Term, YAP_Int *, size_t);
/* int StringToBuffer(YAP_Term,char *,unsigned int) */
extern X_API int YAP_StringToBuffer(YAP_Term,char *,unsigned int);
extern X_API char *YAP_StringToBuffer(YAP_Term,char *,unsigned int);
extern X_API YAP_Term YAP_BufferToString(const char *s);

View File

@ -1,52 +0,0 @@
x2%
% ProbLog extension to use an YAP BDD interface module, instead of simplecudd.
%
:- use_module(library(trie_sp)).
:- use_module(library(bdd)).
:- use_module(library(bhash)).
problog_kbest_bdd(Goal, K, Prob, ok) :-
problog_kbest_to_bdd(Goal, K, BDD, MapList),
bind_maplist(MapList, BoundVars),
bdd_to_probability_sum_product(BDD, BoundVars, Prob).
problog_kbest_as_bdd(Goal, K, bdd(Dir, Tree, MapList)) :-
problog_kbest_to_bdd(Goal, K, BDD, MapList),
bdd_tree(BDD, bdd(Dir, Tree, _Vars)),
bdd_close(BDD).
problog_kbest_to_bdd(Goal, K, BDD, MapList) :-
problog_flag(first_threshold,InitT),
init_problog_kbest(InitT),
problog_control(off,up),
problog_kbest_id(Goal, K),
retract(current_kbest(_,ListFound,_NumFound)),
build_prefixtree(ListFound),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
trie_to_bdd(Trie_Completed_Proofs, BDD, MapList),
delete_ptree(Trie_Completed_Proofs).
problog_fl_bdd(Goal, _) :-
init_problog_low(0.0),
problog_control(off, up),
timer_start(sld_time),
problog_call(Goal),
add_solution,
fail.
problog_fl_bdd(_,Prob) :-
timer_stop(sld_time,SLD_Time),
problog_var_set(sld_time, SLD_Time),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
tabled_trie_to_bdd(Trie_Completed_Proofs, BDD, MapList),
bind_maplist(MapList, BoundVars),
bdd_to_probability_sum_product(BDD, BoundVars, Prob),
(problog_flag(retain_tables, true) -> retain_tabling; true),
clear_tabling.
bind_maplist([], []).
bind_maplist([Node-_|MapList], [ProbFact|BoundVars]) :-
get_fact_probability(Node,ProbFact),
bind_maplist(MapList, BoundVars).

View File

@ -1,7 +0,0 @@
@BDD1
2
0
2
L1 = x0 + x1
L2 = L1
L2

View File

@ -1,7 +0,0 @@
digraph d{
x0 [label="burglary\nx0", style="filled", color="lightblue"];
x1 [label="earthquake\nx1", style="filled", color="lightblue"];
L3 [label="v",shape="invtriangle", style="filled", color="greenyellow"];
x0 -> L3;
x1 -> L3;
}