fix reloading of foreign files: don't allow it even if you are

reconsulting, it makes no sense.
This commit is contained in:
Vitor Santos Costa 2014-10-10 12:52:03 +01:00
parent 946f6cebf3
commit 96149d991f

View File

@ -56,16 +56,21 @@ load_foreign_files(Objs,Libs,Entry) :-
'$check_objs_for_load_foreign_files'(Objs,NewObjs,load_foreign_files(Objs,Libs,Entry)),
'$check_libs_for_load_foreign_files'(Libs,NewLibs,load_foreign_files(Objs,Libs,Entry)),
'$check_entry_for_load_foreign_files'(Entry,load_foreign_files(Objs,Libs,Entry)),
'$current_module'( M ),
recordzifnot( '$foreign', M:'$foreign'(Objs,Libs,Entry), _),
'$load_foreign_files'(NewObjs,NewLibs,Entry),
(
prolog_load_context(file, F)
(
recordzifnot( '$foreign', M:'$foreign'(Objs,Libs,Entry), _)
->
'$load_foreign_files'(NewObjs,NewLibs,Entry),
(
prolog_load_context(file, F)
->
ignore( recordzifnot( '$load_foreign_done', [F, M], _) )
;
true
), !.
true
)
;
true
),
!.
'$check_objs_for_load_foreign_files'(V,_,G) :- var(V), !,
'$do_error'(instantiation_error,G).