protect live against people who hide system predicates away.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@784 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-02-19 16:43:24 +00:00
parent 1709fbded4
commit 8334aa1f5e
4 changed files with 49 additions and 25 deletions

View File

@ -1826,8 +1826,12 @@ p_static_array_to_term(void)
*H++ = (CELL)Yap_MkFunctor(AbsAtom(ae),dim); *H++ = (CELL)Yap_MkFunctor(AbsAtom(ae),dim);
switch(tp) { switch(tp) {
case array_of_ints: case array_of_ints:
for (indx=0; indx < dim; indx++) { {
*H++ = MkIntegerTerm(pp->ValueOfVE.ints[indx]); CELL *sptr = H;
H += dim;
for (indx=0; indx < dim; indx++) {
*sptr++ = MkIntegerTerm(pp->ValueOfVE.ints[indx]);
}
} }
break; break;
case array_of_dbrefs: case array_of_dbrefs:
@ -1856,38 +1860,58 @@ p_static_array_to_term(void)
} }
break; break;
case array_of_doubles: case array_of_doubles:
for (indx=0; indx < dim; indx++) { {
*H++ = MkEvalFl(pp->ValueOfVE.floats[indx]); CELL *sptr = H;
H += dim;
for (indx=0; indx < dim; indx++) {
*sptr++ = MkEvalFl(pp->ValueOfVE.floats[indx]);
}
} }
break; break;
case array_of_ptrs: case array_of_ptrs:
for (indx=0; indx < dim; indx++) { {
*H++ = MkIntegerTerm((Int)(pp->ValueOfVE.ptrs[indx])); CELL *sptr = H;
H += dim;
for (indx=0; indx < dim; indx++) {
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.ptrs[indx]));
}
} }
break; break;
case array_of_chars: case array_of_chars:
for (indx=0; indx < dim; indx++) { {
*H++ = MkIntegerTerm((Int)(pp->ValueOfVE.chars[indx])); CELL *sptr = H;
H += dim;
for (indx=0; indx < dim; indx++) {
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.chars[indx]));
}
} }
break; break;
case array_of_uchars: case array_of_uchars:
for (indx=0; indx < dim; indx++) { {
*H++ = MkIntegerTerm((Int)(pp->ValueOfVE.uchars[indx])); CELL *sptr = H;
H += dim;
for (indx=0; indx < dim; indx++) {
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.uchars[indx]));
}
} }
break; break;
case array_of_terms: case array_of_terms:
for (indx=0; indx < dim; indx++) { {
/* The object is now in use */ CELL *sptr = H;
DBRef ref = pp->ValueOfVE.terms[indx]; H += dim;
Term TRef; for (indx=0; indx < dim; indx++) {
/* The object is now in use */
DBRef ref = pp->ValueOfVE.terms[indx];
Term TRef;
if (ref != NULL) { if (ref != NULL) {
TRef = Yap_FetchTermFromDB(ref,3); TRef = Yap_FetchTermFromDB(ref,3);
} else { } else {
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
TRef = TermNil; TRef = TermNil;
}
*sptr++ = TRef;
} }
*H++ = TRef;
} }
break; break;
case array_of_atoms: case array_of_atoms:

View File

@ -970,7 +970,7 @@ InitCodes(void)
heap_regs->pred_goal_expansion = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("goal_expansion"),3),1)); heap_regs->pred_goal_expansion = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("goal_expansion"),3),1));
heap_regs->env_for_trustfail_code.p = heap_regs->env_for_trustfail_code.p =
heap_regs->env_for_trustfail_code.p0 = heap_regs->env_for_trustfail_code.p0 =
RepPredProp(PredPropByAtom(Yap_LookupAtom("false"),0)); RepPredProp(PredPropByAtom(heap_regs->atom_false,0));
{ {
/* make sure we know about the module predicate */ /* make sure we know about the module predicate */
PredEntry *modp = RepPredProp(PredPropByFunc(heap_regs->functor_module,0)); PredEntry *modp = RepPredProp(PredPropByFunc(heap_regs->functor_module,0));

View File

@ -467,7 +467,7 @@ exec_top_level(int BootMode, YAP_init_args *iap)
do_bootfile (iap->YapPrologBootFile ? iap->YapPrologBootFile : BootFile); do_bootfile (iap->YapPrologBootFile ? iap->YapPrologBootFile : BootFile);
livegoal = YAP_FullLookupAtom("$live"); livegoal = YAP_FullLookupAtom("$live");
/* initialise the top-level */ /* initialise the top-level */
YAP_PutValue(livegoal, YAP_MkAtomTerm (YAP_LookupAtom("true"))); YAP_PutValue(livegoal, YAP_MkAtomTerm (YAP_FullLookupAtom("$true")));
} }
/* the top-level is now ready */ /* the top-level is now ready */
@ -475,7 +475,7 @@ exec_top_level(int BootMode, YAP_init_args *iap)
the atom false away ;-). the atom false away ;-).
*/ */
livegoal = YAP_FullLookupAtom("$live"); livegoal = YAP_FullLookupAtom("$live");
atomfalse = YAP_MkAtomTerm (YAP_LookupAtom("false")); atomfalse = YAP_MkAtomTerm (YAP_FullLookupAtom("$false"));
while (YAP_GetValue (livegoal) != atomfalse) { while (YAP_GetValue (livegoal) != atomfalse) {
YAP_Reset(); YAP_Reset();
do_top_goal (YAP_MkAtomTerm (livegoal)); do_top_goal (YAP_MkAtomTerm (livegoal));

View File

@ -172,7 +172,7 @@ read_sig.
'$run_toplevel_hooks', '$run_toplevel_hooks',
'$command'((?-Command),Varnames,top), '$command'((?-Command),Varnames,top),
'$sync_mmapped_arrays', '$sync_mmapped_arrays',
'$set_value'('$live',false). '$set_value'('$live','$false').
'$startup_goals' :- '$startup_goals' :-
'$recorded'('$startup_goal',G,_), '$recorded'('$startup_goal',G,_),
@ -858,7 +858,7 @@ break :- '$get_value'('$break',BL), NBL is BL+1,
'$format'(user_error, "[ Break (level ~w) ]~n", [NBL]), '$format'(user_error, "[ Break (level ~w) ]~n", [NBL]),
'$do_live', '$do_live',
!, !,
'$set_value'('$live',true), '$set_value'('$live','$true'),
'$set_value'(spy_sl,SPY_SL), '$set_value'(spy_sl,SPY_SL),
'$get_value'(spy_fs,SPY_FS), '$get_value'(spy_fs,SPY_FS),
'$set_value'(spy_sp,SPY_SP), '$set_value'(spy_sp,SPY_SP),