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