make consult reconsult the original file, so that

[x]. [x].
is more like
[x]. [-x].
This commit is contained in:
Vítor Santos Costa 2014-04-24 11:40:35 +01:00
parent d8f4a77f47
commit 1db83cc30d
3 changed files with 19 additions and 8 deletions

View File

@ -915,7 +915,7 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
p->ExtraPredFlags = 0L;
#endif
p->src.OwnerFile = ap->src.OwnerFile;
p->OpcodeOfPred = UNDEF_OPCODE;
p->OpcodeOfPred = FAIL_OPCODE;
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
p->cs.p_code.ExpandCode = EXPAND_OP_CODE;
p->ModuleOfPred = ap->ModuleOfPred;

View File

@ -2018,8 +2018,17 @@ not_was_reconsulted(PredEntry *p, Term t, int mode)
} else {
fp = LOCAL_ConsultBase;
}
if (fp != LOCAL_ConsultBase)
if (fp != LOCAL_ConsultBase) {
return FALSE;
} else if (!mode) { // consulting again a predicate in the original file.
if ((p->cs.p_code.NOfClauses &&
p->src.OwnerFile == Yap_ConsultingFile( PASS_REGS1 ) &&
p->src.OwnerFile != AtomNil &&
p->src.OwnerFile != AtomUserIn) ) {
retract_all(p, static_in_use(p,TRUE));
return TRUE;
}
}
if (mode) {
if (LOCAL_ConsultSp == LOCAL_ConsultLow+1) {
expand_consult();

View File

@ -401,7 +401,7 @@ use_module(M,F,Is) :-
'$reset_if'(OldIfLevel),
% take care with [a:f], a is the ContextModule
'$current_module'(SourceModule, ContextModule),
'$lf_opt'(consult, TOpts, Reconsult),
'$lf_opt'(consult, TOpts, Reconsult0),
'$lf_opt'('$options', TOpts, Opts),
'$lf_opt'('$location', TOpts, ParentF:Line),
'$loaded'(Stream, UserFile, SourceModule, ParentF, Line, Reconsult, File, Dir, Opts),
@ -413,7 +413,7 @@ use_module(M,F,Is) :-
'$comp_mode'(OldCompMode, CompMode),
( get_value('$syntaxcheckflag',on) -> '$init_style_check'(File) ; true ),
recorda('$initialisation','$',_),
( Reconsult = reconsult ->
( Reconsult \== consult ->
'$start_reconsulting'(File),
'$start_consult'(Reconsult,File,LC),
'$remove_multifile_clauses'(File),
@ -421,6 +421,7 @@ use_module(M,F,Is) :-
EndMsg = reconsulted
;
'$start_consult'(Reconsult,File,LC),
( File \= user_input, File \= [] -> '$remove_multifile_clauses'(File) ; true ),
StartMsg = consulting,
EndMsg = consulted
),
@ -931,9 +932,10 @@ make_library_index(_Directory).
'$file_name'(Stream,F) :-
stream_property(Stream, file_name(F)), !.
'$file_name'(user_input,user_input).
'$file_name'(user_output,user_ouput).
'$file_name'(user_error,user_error).
'$file_name'(user_input,user_input) :- !.
'$file_name'(user_output,user_ouput) :- !.
'$file_name'(user_error,user_error) :- !.
'$file_name'(_,[]).
'$fetch_stream_alias'(OldStream,Alias) :-