Merge branch 'master' of yap.dcc.fc.up.pt:yap-6
This commit is contained in:
commit
b21603ac89
20
C/attvar.c
20
C/attvar.c
@ -859,15 +859,19 @@ p_swi_all_atts(void) {
|
||||
return Yap_unify(ARG2,TermNil);
|
||||
while (!IsVarTerm(tatt)) {
|
||||
Functor f = FunctorOfTerm(tatt);
|
||||
UInt ar = ArityOfFunctor(f);
|
||||
|
||||
if (ArityOfFunctor(f) == 2) {
|
||||
if (H != h0)
|
||||
H[-1] = AbsAppl(H);
|
||||
H[0] = (CELL) attf;
|
||||
H[1] = MkAtomTerm(NameOfFunctor(f));
|
||||
H[2] = ArgOfTerm(2,tatt);
|
||||
H+=4;
|
||||
}
|
||||
if (H != h0)
|
||||
H[-1] = AbsAppl(H);
|
||||
H[0] = (CELL) attf;
|
||||
H[1] = MkAtomTerm(NameOfFunctor(f));
|
||||
/* SWI */
|
||||
if (ar == 2)
|
||||
H[2] = ArgOfTerm(2,tatt);
|
||||
else
|
||||
H[2] = tatt;
|
||||
H += 4;
|
||||
H[-1] = AbsAppl(H);
|
||||
tatt = ArgOfTerm(1,tatt);
|
||||
}
|
||||
if (h0 != H) {
|
||||
|
@ -111,6 +111,8 @@ kill_thread_engine (int wid, int always_die)
|
||||
Prop p0 = AbsPredProp(FOREIGN_ThreadHandle(wid).local_preds);
|
||||
GlobalEntry *gl = GlobalVariables;
|
||||
|
||||
FOREIGN_ThreadHandle(wid).local_preds = NIL;
|
||||
GlobalVariables = NULL;
|
||||
/* kill all thread local preds */
|
||||
while(p0) {
|
||||
PredEntry *ap = RepPredProp(p0);
|
||||
|
7
configure
vendored
7
configure
vendored
@ -6971,7 +6971,12 @@ fi
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -Wl,-install_name,\$(DESTDIR)\$(YAPLIBDIR)/\$@"
|
||||
INSTALL_ENV="YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
fi
|
||||
INSTALL_DLLS=""
|
||||
if test "$ac_cv_c_compiler_gnu" = "yes"
|
||||
then
|
||||
SHLIB_CFLAGS="-shared -fPIC $CFLAGS"
|
||||
SHLIB_CXXFLAGS="-shared -fPIC $CXXFLAGS"
|
||||
INSTALL_DLLS=""
|
||||
fi
|
||||
CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall -Wstrict-aliasing=2"
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
YAPLIB_LD="$CC -dynamiclib -Wl,-install_name,$prefix/lib/libYap.dylib"
|
||||
|
@ -1021,7 +1021,12 @@ dnl Linux has both elf and a.out, in this case we found elf
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -Wl,-install_name,\$(DESTDIR)\$(YAPLIBDIR)/\$@"
|
||||
INSTALL_ENV="YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
fi
|
||||
INSTALL_DLLS=""
|
||||
if test "$ac_cv_prog_gcc" = "yes"
|
||||
then
|
||||
SHLIB_CFLAGS="-shared -fPIC $CFLAGS"
|
||||
SHLIB_CXXFLAGS="-shared -fPIC $CXXFLAGS"
|
||||
INSTALL_DLLS=""
|
||||
fi
|
||||
CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall -Wstrict-aliasing=2"
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
YAPLIB_LD="$CC -dynamiclib -Wl,-install_name,$prefix/lib/libYap.dylib"
|
||||
|
@ -502,6 +502,7 @@ extern X_API int PL_thread_at_exit(void (*)(void *), void *, int);
|
||||
extern X_API PL_engine_t PL_create_engine(const PL_thread_attr_t *);
|
||||
extern X_API int PL_destroy_engine(PL_engine_t);
|
||||
extern X_API int PL_set_engine(PL_engine_t,PL_engine_t *);
|
||||
extern X_API int PL_get_string(term_t, char **, size_t *);
|
||||
extern X_API int PL_get_string_chars(term_t, char **, size_t *);
|
||||
extern X_API record_t PL_record(term_t);
|
||||
extern X_API int PL_recorded(record_t, term_t);
|
||||
|
@ -167,8 +167,8 @@ SWIFunctorToFunctor(functor_t at)
|
||||
{
|
||||
if (IsAtomTerm(at))
|
||||
return (Functor)at;
|
||||
if ((CELL)(at) & 1)
|
||||
return SWI_Functors[((CELL)at)/2];
|
||||
if ((CELL)(at) & 2)
|
||||
return SWI_Functors[((CELL)at)/4];
|
||||
return (Functor)at;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ Yap_InitSWIHash(void)
|
||||
add_to_hash(i*2+1, (ADDR)SWI_Atoms[i]);
|
||||
}
|
||||
for (j=0; j < N_SWI_FUNCTORS; j++) {
|
||||
add_to_hash((((CELL)(j))*2+1), (ADDR)SWI_Functors[j]);
|
||||
add_to_hash((((CELL)(j))*4+2), (ADDR)SWI_Functors[j]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -684,6 +684,11 @@ X_API int PL_get_head(term_t ts, term_t h)
|
||||
return 1;
|
||||
}
|
||||
|
||||
X_API int PL_get_string(term_t t, char **s, size_t *len)
|
||||
{
|
||||
return PL_get_string_chars(t, s, len);
|
||||
}
|
||||
|
||||
X_API int PL_get_string_chars(term_t t, char **s, size_t *len)
|
||||
{
|
||||
Term tt = Yap_GetFromSlot(t);
|
||||
|
@ -169,7 +169,7 @@ add_evidence(V,K,_,V) :-
|
||||
clpbn_marginalise(V, Dist) :-
|
||||
attributes:all_attvars(AVars),
|
||||
project_attributes([V], AVars),
|
||||
vel:get_atts(V, posterior(_,_,Dist,_)).
|
||||
clpbn_display:get_atts(V, posterior(_,_,Dist,_)).
|
||||
|
||||
%
|
||||
% called by top-level
|
||||
|
@ -33,7 +33,7 @@ gen_eqs([V], D, (V=D)) :- !.
|
||||
gen_eqs([V|Vs], [D|Ds], ((V=D),Eqs)) :-
|
||||
gen_eqs(Vs,Ds,Eqs).
|
||||
|
||||
add_alldiffs([],Eqs,Eqs).
|
||||
add_alldiffs([],Eqs,Eqs) :- !.
|
||||
add_alldiffs(AllDiffs,Eqs,(Eqs/alldiff(AllDiffs))).
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ PL_get_atom_chars.argtypes = [term_t, POINTER(c_char_p)]
|
||||
##define PL_get_string_chars(t, s, l) PL_get_string(t,s,l)
|
||||
# /* PL_get_string() is depricated */
|
||||
#PL_EXPORT(int) PL_get_string(term_t t, char **s, size_t *len);
|
||||
PL_get_string = _lib.PL_get_string
|
||||
PL_get_string = _lib.PL_get_string_chars
|
||||
PL_get_string.argtypes = [term_t, POINTER(c_char_p), c_int_p]
|
||||
PL_get_string_chars = PL_get_string
|
||||
PL_get_string_chars.argtypes = [term_t, POINTER(c_char_p), c_int_p]
|
||||
|
@ -19,6 +19,8 @@
|
||||
delayed_goals/4
|
||||
]).
|
||||
|
||||
:- dynamic attributes:attributed_module/3, attributes:modules_with_attributes/1.
|
||||
|
||||
prolog:get_attr(Var, Mod, Att) :-
|
||||
functor(AttTerm, Mod, 2),
|
||||
arg(2, AttTerm, Att),
|
||||
@ -201,6 +203,20 @@ attvar_residuals(att(Module,Value,As), V) -->
|
||||
-> % a previous projection predicate could have instantiated
|
||||
% this variable, for example, to avoid redundant goals
|
||||
[]
|
||||
; { attributes:attributed_module(Module, _, _) } ->
|
||||
% SICStus like run, put attributes back first
|
||||
{ Value =.. [Name,_|Vs],
|
||||
NValue =.. [Name,_|Vs],
|
||||
attributes:put_module_atts(V,NValue)
|
||||
},
|
||||
attvar_residuals(As, V),
|
||||
( { '$undefined'(attribute_goal(V, Goal), Module) }
|
||||
->
|
||||
[]
|
||||
;
|
||||
{ '$notrace'(Module:attribute_goal(V, Goal)) },
|
||||
dot_list(Goal)
|
||||
)
|
||||
; ( { current_predicate(Module:attribute_goals/3) }
|
||||
-> { '$notrace'(Module:attribute_goals(V, Goals, [])) },
|
||||
list(Goals)
|
||||
@ -208,9 +224,9 @@ attvar_residuals(att(Module,Value,As), V) -->
|
||||
-> { '$notrace'(Module:attribute_goal(V, Goal)) },
|
||||
dot_list(Goal)
|
||||
; [put_attr(V, Module, Value)]
|
||||
)
|
||||
),
|
||||
attvar_residuals(As, V).
|
||||
),
|
||||
attvar_residuals(As, V)
|
||||
).
|
||||
|
||||
list([]) --> [].
|
||||
list([L|Ls]) --> [L], list(Ls).
|
||||
@ -242,7 +258,7 @@ prolog:call_residue(Goal,Residue) :-
|
||||
call_residue(Goal,Module,Residue) :-
|
||||
prolog:call_residue_vars(Module:Goal,NewAttVars),
|
||||
(
|
||||
'$undefined'(modules_with_attributes(_),attributes)
|
||||
attributes:modules_with_attributes([_|_])
|
||||
->
|
||||
project_attributes(NewAttVars, Module:Goal)
|
||||
;
|
||||
@ -254,13 +270,12 @@ delayed_goals(G, Vs, NVs, Gs) :-
|
||||
project_delayed_goals(G),
|
||||
copy_term(G.Vs, _.NVs, Gs).
|
||||
|
||||
project_delayed_goals(G) :-
|
||||
'$undefined'(modules_with_attributes(_),attributes), !.
|
||||
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), !.
|
||||
@ -279,10 +294,9 @@ 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.
|
||||
project_attributes(_, _) :-
|
||||
'$undefined'(modules_with_attributes(_),attributes), !.
|
||||
project_attributes(AllVs, G) :-
|
||||
attributes:modules_with_attributes(LMods),
|
||||
LMods = [_|_],
|
||||
term_variables(G, InputVs),
|
||||
pick_att_vars(InputVs, AttIVs),
|
||||
project_module(LMods, AttIVs, AllVs).
|
||||
|
Reference in New Issue
Block a user