Merge branch 'master' of yap.dcc.fc.up.pt:yap-6
This commit is contained in:
commit
edf11bb1d8
2
C/save.c
2
C/save.c
@ -658,7 +658,7 @@ p_save_program(void)
|
||||
static int
|
||||
check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap)
|
||||
{
|
||||
char pp[80];
|
||||
char pp[256];
|
||||
char msg[256];
|
||||
CELL hp_size, gb_size, lc_size, tr_size, mode;
|
||||
int n;
|
||||
|
20
configure
vendored
20
configure
vendored
@ -6940,7 +6940,7 @@ fi
|
||||
then
|
||||
YAPLIB_LD="\$(CC) -shared"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
else
|
||||
YAPLIB_LD="\$(CC)"
|
||||
@ -6962,7 +6962,7 @@ fi
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
;;
|
||||
*hpux*)
|
||||
#do not use the first memory quadrant
|
||||
@ -7005,7 +7005,7 @@ fi
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
;;
|
||||
*aix*)
|
||||
# To actually use dlls in AIX I'd need to build YAP as a DLL first.
|
||||
@ -7018,7 +7018,7 @@ fi
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
;;
|
||||
*osf*)
|
||||
if ${use_condor} = no
|
||||
@ -7074,7 +7074,7 @@ fi
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
;;
|
||||
*irix6*)
|
||||
SHLIB_CFLAGS="$CFLAGS"
|
||||
@ -7088,7 +7088,7 @@ fi
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
;;
|
||||
*darwin*)
|
||||
if test ${use_dlcompat} = yes
|
||||
@ -7148,7 +7148,7 @@ fi
|
||||
SHLIB_LD="$CC -dynamiclib"
|
||||
SHLIB_CXX_LD="$CXX -dynamiclib"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-install_name,\$(YAPLIBDIR)/\$@"
|
||||
INSTALL_ENV="DYLD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="DYLD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
else
|
||||
SHLIB_LD="$CC -dynamiclib -Wl,-undefined,dynamic_lookup"
|
||||
SHLIB_CXX_LD="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup"
|
||||
@ -7188,7 +7188,7 @@ fi
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -Wl,-R,\$(YAPLIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
;;
|
||||
*solaris*)
|
||||
#an elf system
|
||||
@ -7207,7 +7207,7 @@ fi
|
||||
YAPLIB_LD="\$(CC)"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
else
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV=""
|
||||
@ -7301,7 +7301,7 @@ fi
|
||||
DYNYAPLIB=libYap."$SO"
|
||||
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
|
||||
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
10
docs/yap.tex
10
docs/yap.tex
@ -2339,14 +2339,16 @@ with the current source module:
|
||||
@cnindex meta_predicate/1 (directive)
|
||||
Each @var{Gi} is a mode specification.
|
||||
|
||||
If the argument is @code{:} or an integer, the argument is a call and
|
||||
must be expanded. Otherwise, the argument is not expanded. Note
|
||||
that the system already includes declarations for all built-ins.
|
||||
If the argument is @code{:}, it does not refer directly to a predicate
|
||||
but must be module expanded. If the argument is an integer, the argument
|
||||
is a goal or a closure and must be expanded. Otherwise, the argument is
|
||||
not expanded. Note that the system already includes declarations for all
|
||||
built-ins.
|
||||
|
||||
For example, the declaration for @code{call/1} and @code{setof/3} are:
|
||||
|
||||
@example
|
||||
:- meta_predicate call(:), setof(?,:,?).
|
||||
:- meta_predicate call(0), setof(?,0,?).
|
||||
@end example
|
||||
|
||||
@end table
|
||||
|
@ -261,14 +261,11 @@ void displaynode(TrNode node) {
|
||||
else if (TrNode_entry(node) == PairEndTag)
|
||||
printf("PairEndTag\n");
|
||||
else if (IS_FUNCTOR_NODE(node))
|
||||
{printf("2\n");
|
||||
printf("FUNCTOR %s\n", YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)( ~ApplTag & TrNode_entry(node)))));}
|
||||
printf("functor(%s)\n", YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)( ~ApplTag & TrNode_entry(node)))));
|
||||
else if (YAP_IsIntTerm(TrNode_entry(node)))
|
||||
{printf("3\n");
|
||||
printf("%ld\n", YAP_IntOfTerm(TrNode_entry(node)));}
|
||||
printf("int(%ld)\n", YAP_IntOfTerm(TrNode_entry(node)));
|
||||
else if (YAP_IsAtomTerm(TrNode_entry(node)))
|
||||
{printf("4\n");
|
||||
printf("%s\n", YAP_AtomName(YAP_AtomOfTerm(TrNode_entry(node))));}
|
||||
printf("atom(%s)\n", YAP_AtomName(YAP_AtomOfTerm(TrNode_entry(node))));
|
||||
else
|
||||
printf("What?\n");
|
||||
} else
|
||||
@ -627,10 +624,14 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
|
||||
while(!(child = *--bucket));
|
||||
}
|
||||
}
|
||||
TrNode temp = TrNode_child(child);
|
||||
if (TrNode_child(child) == NULL) return NULL;
|
||||
if (TrNode_entry(TrNode_child(child)) != PairEndTag) return NULL;
|
||||
|
||||
|
||||
/* TrNode temp = TrNode_child(child);
|
||||
if (temp == NULL)
|
||||
return NULL;
|
||||
// printf("Chosen start node child: "); displaynode(temp);
|
||||
printf("Chosen start node child: "); displaynode(temp);
|
||||
if (IS_HASH_NODE(temp)) {
|
||||
TrNode *first_bucket, *bucket;
|
||||
TrHash hash = (TrHash) temp;
|
||||
@ -646,17 +647,19 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
|
||||
} else {
|
||||
while((temp != NULL) && (TrNode_entry(temp) != PairEndTag))
|
||||
temp = TrNode_next(temp);
|
||||
}
|
||||
}*/
|
||||
// printf("while end\n");
|
||||
//Nested Trie code
|
||||
if (IS_FUNCTOR_NODE(TrNode_parent(child)) && (strcmp(YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)(~ApplTag & TrNode_entry(TrNode_parent(child))))), NESTED_TRIE_TERM) == 0)) {
|
||||
/* nested trie: stop procedure and return nested trie node */
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
PUSH_DOWN(stack_args, TrNode_entry(child), stack_top);
|
||||
count++;
|
||||
if (IS_FUNCTOR_NODE(TrNode_parent(child))) {
|
||||
temp = TrNode_parent(child);
|
||||
TrNode temp = TrNode_parent(child);
|
||||
while (IS_FUNCTOR_NODE(temp)) {
|
||||
PUSH_DOWN(stack_args, TrNode_entry(temp), stack_top);
|
||||
temp = TrNode_parent(temp);
|
||||
@ -665,6 +668,8 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
|
||||
child = TrNode_parent(child);
|
||||
}
|
||||
child = TrNode_next(child);
|
||||
// printf("Siblings: ");displaynode(child);
|
||||
|
||||
} while (child);
|
||||
// printf("pass through\n");
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ set_strategy(_) :-
|
||||
set_strategy([]) :- problog_control(on,internal_strategy).
|
||||
set_strategy([Term|R]) :-
|
||||
strategy_entry(Term,LogProb,Decision),
|
||||
(ground(Decision)->
|
||||
(user:problog_user_ground(Decision)->
|
||||
decision_fact(ID,Decision),
|
||||
grounding_id(ID,Decision,ID2),
|
||||
%format("Setting ~q/~q to ~q~n",[Decision,ID2,Prob]),
|
||||
@ -427,7 +427,7 @@ unset_strategy([]) :-
|
||||
problog_control(off,internal_strategy).
|
||||
unset_strategy([Term|R]) :-
|
||||
strategy_entry(Term,LogProb,Decision),
|
||||
(ground(Decision)->
|
||||
(user:problog_user_ground(Decision)->
|
||||
decision_fact(ID,Decision),
|
||||
grounding_id(ID,Decision,ID2),
|
||||
%format("Unsetting ~q/~q to ~q~n",[Decision,ID2,Prob]),
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-10-21 10:47:36 +0200 (Thu, 21 Oct 2010) $
|
||||
% $Revision: 4970 $
|
||||
% $Date: 2010-11-09 02:47:35 +0100 (Tue, 09 Nov 2010) $
|
||||
% $Revision: 4991 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
@ -881,19 +881,21 @@ problog_predicate(Name, Arity, ProblogName,Mod) :-
|
||||
% non-ground probabilistic facts
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
:- multifile(user:problog_user_ground/1).
|
||||
user:problog_user_ground(Goal) :-
|
||||
ground(Goal).
|
||||
|
||||
non_ground_fact_grounding_id(Goal,ID) :-
|
||||
ground(Goal),
|
||||
!,
|
||||
(
|
||||
grounding_is_known(Goal,ID)
|
||||
->
|
||||
true;
|
||||
(
|
||||
user:problog_user_ground(Goal), !,
|
||||
(grounding_is_known(Goal,ID) ->
|
||||
true
|
||||
;
|
||||
(
|
||||
nb_getval(non_ground_fact_grounding_id_counter,ID),
|
||||
ID2 is ID+1,
|
||||
nb_setval(non_ground_fact_grounding_id_counter,ID2),
|
||||
assertz(grounding_is_known(Goal,ID))
|
||||
)
|
||||
)
|
||||
).
|
||||
non_ground_fact_grounding_id(Goal,_) :-
|
||||
format(user_error,'The current program uses non-ground facts.~n', []),
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% $Date: 2010-11-03 19:08:13 +0100 (Wed, 03 Nov 2010) $
|
||||
% $Revision: 4984 $
|
||||
% $Date: 2010-11-09 15:09:33 +0100 (Tue, 09 Nov 2010) $
|
||||
% $Revision: 4992 $
|
||||
%
|
||||
% This file is part of ProbLog
|
||||
% http://dtai.cs.kuleuven.be/problog
|
||||
@ -355,7 +355,7 @@ problog_table(Name/Arity, Module) :-
|
||||
% Exact method tabling
|
||||
assert_static((
|
||||
Module:ExactPred :-
|
||||
(ground(ExactPred) ->
|
||||
(user:problog_user_ground(Head) ->
|
||||
nb_setval(problog_nested_tries, true),
|
||||
get_negated_synonym_state(OriginalPred, State),
|
||||
(State = false ->
|
||||
|
26
pl/utils.yap
26
pl/utils.yap
@ -215,6 +215,30 @@ current_op(X,Y,Z) :-
|
||||
|
||||
%%% Operating System utilities
|
||||
|
||||
cd :-
|
||||
cd('~').
|
||||
|
||||
ls :-
|
||||
getcwd(X),
|
||||
system:directory_files(X, L),
|
||||
'$do_print_files'(L).
|
||||
|
||||
'$do_print_files'([]) :-
|
||||
nl.
|
||||
'$do_print_files'([F| Fs]) :-
|
||||
'$do_print_file'(F),
|
||||
'$do_print_files'(Fs).
|
||||
|
||||
'$do_print_file'('.') :- !.
|
||||
'$do_print_file'('..') :- !.
|
||||
'$do_print_file'(F) :- atom_concat('.', _, F), !.
|
||||
'$do_print_file'(F) :-
|
||||
write(F), write(' ').
|
||||
|
||||
pwd :-
|
||||
getcwd(X),
|
||||
write(X), nl.
|
||||
|
||||
unix(V) :- var(V), !,
|
||||
'$do_error'(instantiation_error,unix(V)).
|
||||
unix(argv(L)) :- '$is_list_of_atoms'(L,L), !, '$argv'(L).
|
||||
@ -602,7 +626,7 @@ sub_atom(At, Bef, Size, After, SubAt) :-
|
||||
'$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).
|
||||
|
||||
|
||||
atom_to_term(Atom, Term, Bindings) :-
|
||||
atom_codes(Atom, Chars),
|
||||
charsio:open_mem_read_stream(Chars, Stream),
|
||||
|
Reference in New Issue
Block a user