Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3
Conflicts: library/matrix.yap pl/qly.yap
This commit is contained in:
commit
66a95e96c0
@ -2358,7 +2358,7 @@ YAP_LeaveGoal(int backtrack, YAP_dogoalinfo *dgi)
|
||||
/* if backtracking asked for, recover space and bindings */
|
||||
if (backtrack) {
|
||||
P = FAILCODE;
|
||||
Yap_exec_absmi(TRUE);
|
||||
Yap_exec_absmi( true, YAP_EXEC_ABSMI);
|
||||
/* recover stack space */
|
||||
HR = B->cp_h;
|
||||
TR = B->cp_tr;
|
||||
@ -2560,7 +2560,7 @@ YAP_RestartGoal(void)
|
||||
if (LOCAL_AllowRestart) {
|
||||
P = (yamop *)FAILCODE;
|
||||
LOCAL_PrologMode = UserMode;
|
||||
out = Yap_exec_absmi(TRUE);
|
||||
out = Yap_exec_absmi(TRUE, YAP_EXEC_ABSMI);
|
||||
LOCAL_PrologMode = UserCCallMode;
|
||||
if (out == FALSE) {
|
||||
/* cleanup */
|
||||
@ -2599,7 +2599,7 @@ YAP_ShutdownGoal(int backtrack)
|
||||
B = cut_pt;
|
||||
if (backtrack) {
|
||||
P = FAILCODE;
|
||||
Yap_exec_absmi(TRUE);
|
||||
Yap_exec_absmi(TRUE, YAP_EXEC_ABSMI);
|
||||
/* recover stack space */
|
||||
HR = cut_pt->cp_h;
|
||||
TR = cut_pt->cp_tr;
|
||||
@ -2626,7 +2626,7 @@ YAP_ContinueGoal(void)
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
LOCAL_PrologMode = UserMode;
|
||||
out = Yap_exec_absmi(TRUE);
|
||||
out = Yap_exec_absmi(TRUE, YAP_EXEC_ABSMI);
|
||||
LOCAL_PrologMode = UserCCallMode;
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
@ -2936,7 +2936,7 @@ do_bootfile (char *bootfilename)
|
||||
fprintf(stderr, "%s", ErrorMessage);
|
||||
}
|
||||
/* do backtrack */
|
||||
YAP_Reset();
|
||||
YAP_Reset( YAP_FULL_RESET );
|
||||
}
|
||||
YAP_EndConsult(bootfile);
|
||||
#if DEBUG
|
||||
@ -3268,7 +3268,7 @@ YAP_CompareTerms(Term t1, Term t2)
|
||||
}
|
||||
|
||||
X_API int
|
||||
YAP_Reset(void)
|
||||
YAP_Reset(yap_reset_t mode)
|
||||
{
|
||||
CACHE_REGS
|
||||
int res = TRUE;
|
||||
@ -3278,9 +3278,10 @@ YAP_Reset(void)
|
||||
/* first, backtrack to the root */
|
||||
while (B->cp_b) {
|
||||
B = B->cp_b;
|
||||
P = FAILCODE;
|
||||
res = Yap_exec_absmi(0);
|
||||
}
|
||||
// B shoul lead to CP with _ystop0,,
|
||||
P = FAILCODE;
|
||||
res = Yap_exec_absmi( true, mode );
|
||||
/* reinitialise the engine */
|
||||
// Yap_InitYaamRegs( worker_id );
|
||||
GLOBAL_Initialised = TRUE;
|
||||
|
30
C/cdmgr.c
30
C/cdmgr.c
@ -3407,6 +3407,35 @@ p_set_pred_module( USES_REGS1 )
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
static Int
|
||||
p_set_pred_owner( USES_REGS1 )
|
||||
{ /* '$set_pred_module'(+P,+File) */
|
||||
PredEntry *pe;
|
||||
Term a2 = Deref( ARG2 );
|
||||
|
||||
pe = get_pred(Deref(ARG1), CurrentModule, "set_pred_module/1");
|
||||
if (EndOfPAEntr(pe))
|
||||
return FALSE;
|
||||
PELOCK(35,pe);
|
||||
if (pe->PredFlags & (UserCPredFlag|CArgsPredFlag|NumberDBPredFlag|AtomDBPredFlag|TestPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) {
|
||||
UNLOCKPE(56,pe);
|
||||
return FALSE;
|
||||
}
|
||||
if (IsVarTerm(a2)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, a2, "load_files/2");
|
||||
UNLOCKPE(56,pe);
|
||||
return FALSE;
|
||||
}
|
||||
if (!IsAtomTerm(a2)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM, a2, "load_files/2");
|
||||
UNLOCKPE(56,pe);
|
||||
return FALSE;
|
||||
}
|
||||
pe->src.OwnerFile = AtomOfTerm(a2);
|
||||
UNLOCKPE(56,pe);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
static Int
|
||||
p_undefined( USES_REGS1 )
|
||||
{ /* '$undefined'(P,Mod) */
|
||||
@ -6659,6 +6688,7 @@ Yap_InitCdMgr(void)
|
||||
Yap_InitCPred("$call_count_reset", 0, p_call_count_reset, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("$toggle_static_predicates_in_use", 0, p_toggle_static_predicates_in_use, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred("$set_pred_module", 2, p_set_pred_module, SafePredFlag);
|
||||
Yap_InitCPred("$set_pred_owner", 2, p_set_pred_owner, SafePredFlag);
|
||||
Yap_InitCPred("$parent_pred", 3, p_parent_pred, SafePredFlag);
|
||||
Yap_InitCPred("$system_predicate", 2, p_system_pred, SafePredFlag);
|
||||
Yap_InitCPred("$all_system_predicate", 3, p_all_system_pred, SafePredFlag);
|
||||
|
14
C/exec.c
14
C/exec.c
@ -1046,7 +1046,7 @@ p_pred_goal_expansion_on( USES_REGS1 ) {
|
||||
|
||||
|
||||
static Int
|
||||
exec_absmi(int top USES_REGS)
|
||||
exec_absmi(bool top, yap_reset_t reset_mode USES_REGS)
|
||||
{
|
||||
int lval, out;
|
||||
|
||||
@ -1152,7 +1152,7 @@ Yap_PrepGoal(UInt arity, CELL *pt, choiceptr saved_b USES_REGS)
|
||||
}
|
||||
|
||||
static Int
|
||||
do_goal(yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS)
|
||||
do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS)
|
||||
{
|
||||
choiceptr saved_b = B;
|
||||
Int out;
|
||||
@ -1161,7 +1161,7 @@ do_goal(yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS)
|
||||
P = (yamop *) CodeAdr;
|
||||
S = CellPtr (RepPredProp (PredPropByFunc (Yap_MkFunctor(AtomCall, 1),0))); /* A1 mishaps */
|
||||
|
||||
out = exec_absmi(top PASS_REGS);
|
||||
out = exec_absmi(top, YAP_EXEC_ABSMI PASS_REGS);
|
||||
Yap_flush();
|
||||
// if (out) {
|
||||
// out = Yap_GetFromSlot(sl);
|
||||
@ -1171,10 +1171,10 @@ do_goal(yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS)
|
||||
}
|
||||
|
||||
Int
|
||||
Yap_exec_absmi(int top)
|
||||
Yap_exec_absmi(bool top, yap_reset_t has_reset)
|
||||
{
|
||||
CACHE_REGS
|
||||
return exec_absmi(top PASS_REGS);
|
||||
return exec_absmi(top, has_reset PASS_REGS);
|
||||
}
|
||||
|
||||
|
||||
@ -1191,7 +1191,7 @@ Yap_execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
|
||||
PELOCK(81,ppe);
|
||||
CodeAdr = ppe->CodeOfPred;
|
||||
UNLOCK(ppe->PELock);
|
||||
out = do_goal(CodeAdr, ppe->ArityOfPE, pt, FALSE PASS_REGS);
|
||||
out = do_goal(CodeAdr, ppe->ArityOfPE, pt, false PASS_REGS);
|
||||
|
||||
if (out == 1) {
|
||||
choiceptr cut_B;
|
||||
@ -1382,7 +1382,7 @@ Yap_RunTopGoal(Term t)
|
||||
"unable to boot because of too little Trail space");
|
||||
}
|
||||
#endif
|
||||
goal_out = do_goal(CodeAdr, arity, pt, TRUE PASS_REGS);
|
||||
goal_out = do_goal(CodeAdr, arity, pt, true PASS_REGS);
|
||||
return goal_out;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ Detach the shared object identified by _Handle_.
|
||||
|
||||
|
||||
*/
|
||||
Yap_InitCPred("call_shared_object_function", 2, p_call_shared_object_function, SyncPredFlag);
|
||||
Yap_InitCPred("$call_shared_object_function", 2, p_call_shared_object_function, SyncPredFlag);
|
||||
Yap_InitCPred("$obj_suffix", 1, p_obj_suffix, SafePredFlag);
|
||||
}
|
||||
|
||||
|
21
C/qlyr.c
21
C/qlyr.c
@ -276,9 +276,12 @@ static DBRef
|
||||
LookupDBRef(DBRef dbr, int inc_ref)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||
CELL hash;
|
||||
import_dbref_hash_entry_t *p;
|
||||
|
||||
if (LOCAL_ImportDBRefHashTableSize == 0)
|
||||
return NULL;
|
||||
hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||
p = LOCAL_ImportDBRefHashChain[hash];
|
||||
while (p) {
|
||||
if (p->oval == dbr) {
|
||||
@ -297,9 +300,12 @@ static LogUpdClause *
|
||||
LookupMayFailDBRef(DBRef dbr)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||
CELL hash;
|
||||
import_dbref_hash_entry_t *p;
|
||||
|
||||
if (LOCAL_ImportDBRefHashTableSize == 0)
|
||||
return NULL;
|
||||
hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
|
||||
p = LOCAL_ImportDBRefHashChain[hash];
|
||||
while (p) {
|
||||
if (p->oval == dbr) {
|
||||
@ -1007,11 +1013,13 @@ static void
|
||||
read_module(IOSTREAM *stream) {
|
||||
qlf_tag_t x;
|
||||
|
||||
InitHash();
|
||||
read_header(stream);
|
||||
InitHash();
|
||||
ReadHash(stream);
|
||||
while ((x = read_tag(stream)) == QLY_START_MODULE) {
|
||||
Term mod = (Term)read_UInt(stream);
|
||||
if (mod == 0)
|
||||
mod = TermProlog;
|
||||
mod = MkAtomTerm(AtomAdjust(AtomOfTerm(mod)));
|
||||
if (mod)
|
||||
while ((x = read_tag(stream)) == QLY_START_PREDICATE) {
|
||||
@ -1047,10 +1055,6 @@ static void
|
||||
ReInitProlog(void)
|
||||
{
|
||||
Term t = MkAtomTerm(AtomInitProlog);
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
Yap_init_root_frames();
|
||||
#endif /* YAPOR || TABLING */
|
||||
Yap_InitYaamRegs( 0 );
|
||||
YAP_RunGoalOnce(t);
|
||||
}
|
||||
|
||||
@ -1073,12 +1077,11 @@ p_read_program( USES_REGS1 )
|
||||
if (!(stream = Yap_GetInputStream(AtomOfTerm(t1))) ) {
|
||||
return FALSE;
|
||||
}
|
||||
YAP_Reset();
|
||||
YAP_Reset( YAP_RESET_FROM_RESTORE );
|
||||
read_module(stream);
|
||||
Sclose( stream );
|
||||
/* back to the top level we go */
|
||||
ReInitProlog();
|
||||
Yap_RestartYap( 3 );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
98
C/qlyw.c
98
C/qlyw.c
@ -770,9 +770,19 @@ save_ops(IOSTREAM *stream, Term mod) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
save_header(IOSTREAM *stream)
|
||||
{
|
||||
char msg[256];
|
||||
|
||||
sprintf(msg, "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 \"$@\"\n%s", YAP_BINDIR, YAP_FULL_VERSION);
|
||||
return save_bytes(stream, msg, strlen(msg)+1);
|
||||
}
|
||||
|
||||
static size_t
|
||||
save_module(IOSTREAM *stream, Term mod) {
|
||||
PredEntry *ap = Yap_ModulePred(mod);
|
||||
save_header( stream );
|
||||
InitHash();
|
||||
ModuleAdjust(mod);
|
||||
while (ap) {
|
||||
@ -798,15 +808,6 @@ save_module(IOSTREAM *stream, Term mod) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
save_header(IOSTREAM *stream)
|
||||
{
|
||||
char msg[256];
|
||||
|
||||
sprintf(msg, "#!/bin/sh\nexec_dir=${YAPBINDIR:-%s}\nexec $exec_dir/yap $0 \"$@\"\n%s", YAP_BINDIR, YAP_FULL_VERSION);
|
||||
return save_bytes(stream, msg, strlen(msg)+1);
|
||||
}
|
||||
|
||||
static size_t
|
||||
save_program(IOSTREAM *stream) {
|
||||
ModEntry *me = CurrentModules;
|
||||
@ -849,6 +850,52 @@ save_program(IOSTREAM *stream) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static size_t
|
||||
save_file(IOSTREAM *stream, Atom FileName) {
|
||||
ModEntry *me = CurrentModules;
|
||||
|
||||
InitHash();
|
||||
save_header( stream );
|
||||
/* should we allow the user to see hidden predicates? */
|
||||
while (me) {
|
||||
PredEntry *pp;
|
||||
pp = me->PredForME;
|
||||
AtomAdjust(me->AtomOfME);
|
||||
while (pp != NULL) {
|
||||
pp = PredEntryAdjust(pp);
|
||||
if (pp &&
|
||||
!(pp->PredFlags & (MultiFileFlag|NumberDBPredFlag|AtomDBPredFlag|CPredFlag|AsmPredFlag|UserCPredFlag)) &&
|
||||
pp->src.OwnerFile == FileName) {
|
||||
CHECK(mark_pred(pp));
|
||||
}
|
||||
pp = pp->NextPredOfModule;
|
||||
}
|
||||
me = me->NextME;
|
||||
}
|
||||
|
||||
/* just to make sure */
|
||||
mark_ops(stream, 0);
|
||||
SaveHash(stream);
|
||||
me = CurrentModules;
|
||||
while (me) {
|
||||
PredEntry *pp;
|
||||
pp = me->PredForME;
|
||||
CHECK(save_tag(stream, QLY_START_MODULE));
|
||||
CHECK(save_UInt(stream, (UInt)MkAtomTerm(me->AtomOfME)));
|
||||
while (pp != NULL) {
|
||||
CHECK(save_tag(stream, QLY_START_PREDICATE));
|
||||
CHECK(save_pred(stream, pp));
|
||||
pp = pp->NextPredOfModule;
|
||||
}
|
||||
CHECK(save_tag(stream, QLY_END_PREDICATES));
|
||||
me = me->NextME;
|
||||
}
|
||||
CHECK(save_tag(stream, QLY_END_MODULES));
|
||||
save_ops(stream, 0);
|
||||
CloseHash();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_save_module_preds( USES_REGS1 )
|
||||
{
|
||||
@ -902,10 +949,43 @@ p_save_program( USES_REGS1 )
|
||||
return save_program(stream) != 0;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_save_file( USES_REGS1 )
|
||||
{
|
||||
IOSTREAM *stream;
|
||||
Term t1 = Deref(ARG1);
|
||||
Term tfile = Deref(ARG2);
|
||||
|
||||
if (IsVarTerm(t1)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t1,"save_file/3");
|
||||
return FALSE;
|
||||
}
|
||||
if (!IsAtomTerm(t1)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM,t1,"save_file/3");
|
||||
return(FALSE);
|
||||
}
|
||||
if (!(stream = Yap_GetOutputStream(AtomOfTerm(t1))) ) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!(stream = Yap_GetOutputStream(AtomOfTerm(t1))) ) {
|
||||
return FALSE;
|
||||
}
|
||||
if (IsVarTerm(tfile)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,tfile,"save_file/2");
|
||||
return FALSE;
|
||||
}
|
||||
if (!IsAtomTerm(tfile)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM,tfile,"save_file/2");
|
||||
return FALSE;
|
||||
}
|
||||
return save_file(stream, AtomOfTerm(tfile) ) != 0;
|
||||
}
|
||||
|
||||
void Yap_InitQLY(void)
|
||||
{
|
||||
Yap_InitCPred("$qsave_module_preds", 2, p_save_module_preds, SyncPredFlag|UserCPredFlag);
|
||||
Yap_InitCPred("$qsave_program", 1, p_save_program, SyncPredFlag|UserCPredFlag);
|
||||
Yap_InitCPred("$qsave_file", 2, p_save_file, SyncPredFlag|UserCPredFlag);
|
||||
if (FALSE) {
|
||||
restore_codes();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ Int Yap_JumpToEnv(Term);
|
||||
Term Yap_RunTopGoal(Term);
|
||||
void Yap_ResetExceptionTerm(int);
|
||||
Int Yap_execute_goal(Term, int, Term);
|
||||
Int Yap_exec_absmi(int);
|
||||
Int Yap_exec_absmi( bool, yap_reset_t );
|
||||
void Yap_trust_last(void);
|
||||
Term Yap_GetException(void);
|
||||
void Yap_PrepGoal(UInt, CELL *, choiceptr USES_REGS);
|
||||
|
15
Makefile.in
15
Makefile.in
@ -693,11 +693,16 @@ FULL_PATH_PL_SOURCES=$(addprefix $(srcdir)/, $(PL_SOURCES) )
|
||||
FULL_PATH_HEADERS=$(addprefix $(srcdir)/, $(HEADERS) )
|
||||
|
||||
TAGS: $(C_SOURCES) $(PL_SOURCES) $(HEADERS)
|
||||
etags $(FULL_PATH_C_SOURCES) $(FULL_PATH_PL_SOURCES) $(FULL_PATH_HEADERS)
|
||||
for p in $(PACKAGES); do \
|
||||
echo " ============== INSTALLING" $$p; \
|
||||
if [ -r $$p/Makefile ]; then $(MAKE) -C $$p TAGS || exit 1; fi; \
|
||||
done
|
||||
rm -f TAGS
|
||||
find . -name '*.c' -exec etags -a {} \;
|
||||
find . -name '*.h' -exec etags -a {} \;
|
||||
find . -name '*.i' -exec etags -a {} \;
|
||||
find . -name '*.yap' -exec etags -a {} \;
|
||||
find . -name '*.pl' -exec etags -a {} \;
|
||||
find . -name '*.cpp' -exec etags -a {} \;
|
||||
find . -name '*.hh' -exec etags -a {} \;
|
||||
find . -name '*.java' -exec etags -a {} \;
|
||||
find . -name '*.py' -exec etags -a {} \;
|
||||
|
||||
depend: $(HEADERS) $(C_SOURCES)
|
||||
-@if test "$(GCC)" = yes; then\
|
||||
|
@ -125,7 +125,7 @@ exec_top_level(int BootMode, YAP_init_args *iap)
|
||||
livegoal = YAP_FullLookupAtom("$live");
|
||||
atomfalse = YAP_MkAtomTerm (YAP_FullLookupAtom("$false"));
|
||||
while (YAP_GetValue (livegoal) != atomfalse) {
|
||||
YAP_Reset();
|
||||
YAP_Reset( YAP_FULL_RESET );
|
||||
do_top_goal (YAP_MkAtomTerm (livegoal));
|
||||
}
|
||||
YAP_Exit(EXIT_SUCCESS);
|
||||
@ -168,7 +168,7 @@ main (int argc, char **argv)
|
||||
YAP_RunGoalOnce(t_goal);
|
||||
}
|
||||
}
|
||||
YAP_Reset();
|
||||
YAP_Reset( YAP_FULL_RESET );
|
||||
/* End preprocessor code */
|
||||
|
||||
exec_top_level(BootMode, &init_args);
|
||||
|
@ -58,7 +58,7 @@ PROJECT_LOGO = misc/icons/yap_96x96x32.png
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = /scratch/vitor/doxout
|
||||
OUTPUT_DIRECTORY = /Users/vsc/Yap/doxout
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
|
@ -149,7 +149,7 @@ typedef unsigned long uintptr_t;
|
||||
#endif
|
||||
|
||||
#ifndef PL_HAVE_TERM_T
|
||||
#define PL_HAVE_TERM_Temacs
|
||||
#define PL_HAVE_TERM_T
|
||||
typedef intptr_t term_t;
|
||||
#endif
|
||||
typedef struct mod_entry *module_t;
|
||||
|
@ -302,5 +302,11 @@ typedef enum
|
||||
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
|
||||
} yap_flag_t;
|
||||
|
||||
typedef enum yap_enum_reset_t {
|
||||
YAP_EXEC_ABSMI = 0,
|
||||
YAP_FULL_RESET = 1,
|
||||
YAP_RESET_FROM_RESTORE = 3
|
||||
} yap_reset_t;
|
||||
\
|
||||
|
||||
#endif /* _YAPDEFS_H */
|
||||
|
@ -859,10 +859,13 @@ Look for the next solution to the current query by forcing YAP to
|
||||
backtrack to the latest goal. Notice that slots allocated since the last
|
||||
YAP_RunGoal() will become invalid.
|
||||
|
||||
@Item `int` YAP_Reset(`void`)
|
||||
Reset execution environment (similar to the [abort/0](@ref abort)
|
||||
built-in). This is useful when you want to start a new query before
|
||||
asking all solutions to the previous query.
|
||||
@Item `int` YAP_Reset(`yap_reset_t mode`)
|
||||
|
||||
Reset execution environment
|
||||
(similar to the abort/0 built-in). This is useful when
|
||||
you want to start a new query before asking all solutions to the
|
||||
previous query. 'mode` specifies how deep the Reset will go and what
|
||||
to do next. It will be most often set to `YAP_FULL_RESET`.
|
||||
|
||||
</li>
|
||||
<li>`int` YAP_ShutdownGoal(`int backtrack`)
|
||||
@ -1829,7 +1832,7 @@ extern X_API YAP_Bool YAP_GoalHasException(YAP_Term *);
|
||||
/* void YAP_ClearExceptions(void) */
|
||||
extern X_API void YAP_ClearExceptions(void);
|
||||
|
||||
extern X_API int YAP_Reset(void);
|
||||
extern X_API int YAP_Reset(yap_reset_t reset);
|
||||
|
||||
extern X_API void YAP_Error(int myerrno, YAP_Term t, const char *buf, ...);
|
||||
|
||||
|
@ -22,20 +22,21 @@
|
||||
This package provides a fast implementation of multi-dimensional
|
||||
matrices of integers and floats. In contrast to dynamic arrays, these
|
||||
matrices are multi-dimensional and compact. In contrast to static
|
||||
arrays. these arrays are allocated in the stack. Matrices are available
|
||||
by loading the library `library(matrix)`. They are multimensional
|
||||
objects of type:
|
||||
arrays. these arrays are allocated in the stack, and disppear in
|
||||
backtracking. Matrices are available by loading the library
|
||||
`library(matrix)`. They are multimensional objects of type:
|
||||
|
||||
+ <tt>terms</tt>: Prolog terms
|
||||
|
||||
+ <tt>ints</tt>: bounded integers, represented as an opaque term. The
|
||||
maximum integer depends on hardware, but should be obtained from the
|
||||
natural size of the machine.
|
||||
+ <tt>floats</tt>: floating-poiny numbers, represented as an opaque term.
|
||||
|
||||
+ <tt>floats</tt>: floating-point numbers, represented as an opaque term.
|
||||
|
||||
Matrix elements can be accessed through the `matrix_get/2`
|
||||
predicate or through an <tt>R</tt>-inspired access notation (that uses the ciao
|
||||
style extension to `[]`. Examples include:
|
||||
style extension to `[]`). Examples include:
|
||||
|
||||
|
||||
+ Access the second row, third column of matrix <tt>X</tt>. Indices start from
|
||||
@ -161,8 +162,10 @@ of matrix _M_ at offset _Offset_.
|
||||
create a matrix from a list. Options are:
|
||||
+ dim=
|
||||
a list of dimensions
|
||||
|
||||
+ type=
|
||||
integers, floating-point or terms
|
||||
|
||||
+ base=
|
||||
a list of base offsets per dimension (all must be the same for arrays of
|
||||
integers and floating-points
|
||||
@ -227,8 +230,9 @@ all elements of a matrix or list
|
||||
|
||||
+ `* /2`
|
||||
|
||||
multiply two numbers, multiply two matrices or lists element-by-element, or multiply a number from
|
||||
all elements of a matrix or list
|
||||
multiply two numbers, multiply two matrices or lists
|
||||
element-by-element, or multiply a number from all elements of a
|
||||
matrix or list
|
||||
|
||||
+ `log/1`
|
||||
|
||||
@ -566,10 +570,9 @@ Unify _NElems_ with the type of the elements in _Matrix_.
|
||||
|
||||
*/
|
||||
:- module( matrix,
|
||||
[op(100, yf, []),
|
||||
(<==)/2, op(710, xfx, '<=='),
|
||||
op(580, xfx, in),
|
||||
op(580, xfx, ins),
|
||||
[(<==)/2, op(600, xfx, '<=='),
|
||||
op(700, xfx, in),
|
||||
op(700, xfx, ins),
|
||||
op(450, xfx, ..), % should bind more tightly than \/
|
||||
op(590, xfx, of), of/2,
|
||||
matrix_new/3,
|
||||
@ -922,7 +925,7 @@ mtimes(I1, I2, V) :-
|
||||
|
||||
%
|
||||
% three types of matrix: integers, floats and general terms.
|
||||
%
|
||||
§%
|
||||
|
||||
matrix_new(terms,Dims, '$matrix'(Dims, NDims, Size, Offsets, Matrix) ) :-
|
||||
length(Dims,NDims),
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
|
||||
# ANDROID_RELEASE= 17 is 4.2.2, 19 is 4.4.2
|
||||
ANDROID_RELEASE=19
|
||||
ANDROID_RELEASE=17
|
||||
# ANDROID_ARCH= arm, x86, mips
|
||||
ANDROID_ARCH=arm
|
||||
# ANDROID_BUILD=linux
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ec046839d6f64e030d08bd8781cdc1495fc37f7c
|
||||
Subproject commit d8add7b7d10f57ce1b96653799b6a5662e3dc5a9
|
@ -1 +1 @@
|
||||
Subproject commit 86b82220ec929fab1e648109c53f5b46b0569190
|
||||
Subproject commit 9ee28c0798c4d7b348c8033e84da6c0a81887e79
|
10
pl/absf.yap
10
pl/absf.yap
@ -76,7 +76,7 @@
|
||||
|
||||
3. `executable` implies `['.so', ',dylib', '.dll']` depending on the Operating system,
|
||||
|
||||
4. `qlf` implies `['.qlf', '']`,
|
||||
4. `qly` implies `['.qly', '']`,
|
||||
|
||||
5. `directory` implies `['']`,
|
||||
|
||||
@ -209,7 +209,7 @@ absolute_file_name(File0,File) :-
|
||||
'$check_fn_type'(prolog,_) :- !.
|
||||
'$check_fn_type'(source,_) :- !.
|
||||
'$check_fn_type'(executable,_) :- !.
|
||||
'$check_fn_type'(qlf,_) :- !.
|
||||
'$check_fn_type'(qly,_) :- !.
|
||||
'$check_fn_type'(directory,_) :- !.
|
||||
'$check_fn_type'(T,G) :- atom(T), !,
|
||||
'$do_error'(domain_error(file_type,T),G).
|
||||
@ -563,6 +563,8 @@ remove_from_path(New) :- '$check_path'(New,Path),
|
||||
prolog_file_type(yap, prolog).
|
||||
prolog_file_type(pl, prolog).
|
||||
prolog_file_type(prolog, prolog).
|
||||
prolog_file_type(qly, prolog).
|
||||
prolog_file_type(qly, qly).
|
||||
prolog_file_type(A, prolog) :-
|
||||
current_prolog_flag(associate, A),
|
||||
A \== prolog,
|
||||
@ -586,8 +588,8 @@ user:prolog_file_type(A, prolog) :-
|
||||
A \== prolog,
|
||||
A \==pl,
|
||||
A \== yap.
|
||||
%user:prolog_file_type(qlf, prolog).
|
||||
%user:prolog_file_type(qlf, qlf).
|
||||
user:prolog_file_type(qly, prolog).
|
||||
user:prolog_file_type(qly, qly).
|
||||
user:prolog_file_type(A, executable) :-
|
||||
current_prolog_flag(shared_object_extension, A).
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
source_file/1,
|
||||
source_file/2,
|
||||
source_file_property/2,
|
||||
use_module/3], ['$add_multifile'/3,
|
||||
use_module/3],
|
||||
['$add_multifile'/3,
|
||||
'$csult'/2,
|
||||
'$do_startup_reconsult'/1,
|
||||
'$elif'/2,
|
||||
@ -93,61 +94,78 @@ General implementation of the consult/1 family. Execution is controlled by the
|
||||
following flags:
|
||||
|
||||
+ consult(+ _Mode_)
|
||||
|
||||
This extension controls the type of file to load. If _Mode_ is:
|
||||
|
||||
`consult`, clauses are added to the data-base, unless from the same file;
|
||||
`reconsult`, clauses are recompiled,
|
||||
`db`, these are facts that need to be added to the data-base,
|
||||
`exo`, these are facts with atoms and integers that can be stored in a compact representation (see load_exo/1).
|
||||
|
||||
+ silent(+ _Bool_)
|
||||
If true, load the file without printing a message. The specified value is the default for all files loaded as a result of loading the specified files.
|
||||
|
||||
If true, load the file without printing a message. The specified
|
||||
value is the default for all files loaded as a result of loading
|
||||
the specified files.
|
||||
|
||||
+ stream(+ _Input_)
|
||||
This SWI-Prolog extension compiles the data from the stream _Input_. If this option is used, _Files_ must be a single atom which is used to identify the source-location of the loaded
|
||||
|
||||
This SWI-Prolog extension compiles the data from the stream
|
||||
_Input_. If this option is used, _Files_ must be a single atom
|
||||
which is used to identify the source-location of the loaded
|
||||
clauses as well as remove all clauses if the data is re-consulted.
|
||||
|
||||
This option is added to allow compiling from non-file locations such as databases, the web, the user (see consult/1) or other servers.
|
||||
This option is added to allow compiling from non-file locations
|
||||
such as databases, the web, the user (see consult/1) or other
|
||||
servers.
|
||||
|
||||
+ compilation_mode(+ _Mode_)
|
||||
This extension controls how procedures are compiled. If _Mode_
|
||||
is `compact` clauses are compiled and no source code is stored;
|
||||
if it is `source` clauses are compiled and source code is stored;
|
||||
if it is `assert_all` clauses are asserted into the data-base.
|
||||
|
||||
This extension controls how procedures are compiled. If _Mode_ is
|
||||
`compact` clauses are compiled and no source code is stored; if it
|
||||
is `source` clauses are compiled and source code is stored; if it
|
||||
is `assert_all` clauses are asserted into the data-base.
|
||||
|
||||
+ encoding(+ _Encoding_)
|
||||
Character encoding used in consulting files. Please (see [Encoding](@ref Encoding)) for
|
||||
supported encodings.
|
||||
|
||||
Character encoding used in consulting files. Please (see
|
||||
[Encoding](@ref Encoding)) for supported encodings.
|
||||
|
||||
+ expand(+ _Bool_)
|
||||
If `true`, run the
|
||||
filenames through expand_file_name/2 and load the returned
|
||||
files. Default is false, except for consult/1 which is
|
||||
intended for interactive use.
|
||||
|
||||
If `true`, run the filenames through expand_file_name/2 and load
|
||||
the returned files. Default is false, except for consult/1 which
|
||||
is intended for interactive use.
|
||||
|
||||
+ if(+ _Condition_)
|
||||
Load the file only if the specified _Condition_ is
|
||||
satisfied. The value `true` the file unconditionally,
|
||||
`changed` loads the file if it was not loaded before, or has
|
||||
been modified since it was loaded the last time, `not_loaded`
|
||||
loads the file if it was not loaded before.
|
||||
|
||||
Load the file only if the specified _Condition_ is satisfied. The
|
||||
value `true` the file unconditionally, `changed` loads the file if
|
||||
it was not loaded before, or has been modified since it was loaded
|
||||
the last time, `not_loaded` loads the file if it was not loaded
|
||||
before.
|
||||
|
||||
+ imports(+ _ListOrAll_)
|
||||
|
||||
If `all` and the file is a module file, import all public
|
||||
predicates. Otherwise import only the named predicates. Each
|
||||
predicate is referred to as `\<name\>/\<arity\>`. This option has
|
||||
no effect if the file is not a module file.
|
||||
|
||||
+ must_be_module(+ _Bool_)
|
||||
|
||||
If true, raise an error if the file is not a module file. Used by
|
||||
` use_module/1 and use_module/2.
|
||||
|
||||
+ autoload(+ _Autoload_)
|
||||
SWI-compatible option where if _Autoload_ is `true` undefined predicates
|
||||
are loaded on first call.
|
||||
|
||||
SWI-compatible option where if _Autoload_ is `true` undefined
|
||||
predicates are loaded on first call.
|
||||
|
||||
+ derived_from(+ _File_)
|
||||
SWI-compatible option to control make/0. Currently
|
||||
not supported.
|
||||
|
||||
SWI-compatible option to control make/0. Currently not supported.
|
||||
|
||||
*/
|
||||
%
|
||||
% SWI options
|
||||
@ -368,13 +386,18 @@ load_files(Files,Opts) :-
|
||||
'$lf'([F|Fs], Mod, Call, TOpts) :- !,
|
||||
% clean up after each consult
|
||||
( '$lf'(F,Mod,Call, TOpts), fail ;
|
||||
'$lf'(Fs, Mod, Call, TOpts) ).
|
||||
'$lf'(Fs, Mod, Call, TOpts), fail;
|
||||
true
|
||||
).
|
||||
'$lf'(user, Mod, _, TOpts) :- !,
|
||||
b_setval('$source_file', user_input),
|
||||
'$do_lf'(Mod, user_input, user_input, TOpts).
|
||||
'$lf'(user_input, Mod, _, TOpts) :- !,
|
||||
b_setval('$source_file', user_input),
|
||||
'$do_lf'(Mod, user_input, user_input, TOpts).
|
||||
'$lf'(File, Mod, Call, TOpts) :-
|
||||
'$lf_opt'(stream, TOpts, Stream),
|
||||
b_setval('$source_file', File),
|
||||
( var(Stream) ->
|
||||
/* need_to_open_file */
|
||||
'$full_filename'(File, Y, Call),
|
||||
@ -664,16 +687,16 @@ db_files(Fs) :-
|
||||
'$bind_module'(Mod, use_module(Mod)).
|
||||
|
||||
'$import_to_current_module'(File, ContextModule, Imports, RemainingImports, TOpts) :-
|
||||
\+ recorded('$module','$module'(File, _Module, _ModExports, _),_),
|
||||
\+ recorded('$module','$module'(File, _Module, _, |