more fixes, not quite there

This commit is contained in:
Vítor Santos Costa 2014-08-05 09:07:05 -05:00
parent 45c0671fa2
commit e431aa14fc

View File

@ -248,7 +248,8 @@ pl_interfs(Dir - Mod) :-
\+ atom_concat(_, '/.', Path), \+ atom_concat(_, '/.', Path),
\+ atom_concat(_, '/..', Path), \+ atom_concat(_, '/..', Path),
\+ atom_concat(_, '/.git', Path), \+ atom_concat(_, '/.git', Path),
pl_interfs( Path - Mod ) absolute_file_name( Path, APath ),
pl_interfs( APath - Mod )
), ),
fail. fail.
pl_interfs(_). pl_interfs(_).
@ -262,24 +263,28 @@ pl_interfs(_).
% module_on ( M, File ) % module_on ( M, File )
% %
pl_interf(F, _Mod) :- pl_interf(F, _Mod) :-
consulted(F, _M ), module_on( F , _M, _Is),
!.
pl_interf(F, Mod) :-
consulted(F, Mod ),
!. !.
pl_interf(F, Mod) :- pl_interf(F, Mod) :-
writeln(F), writeln(F),
% ( sub_atom(F,_,_,_,'matrix.yap') -> spy get_interf ; true ), % ( sub_atom(F,_,_,_,'matrix.yap') -> spy get_interf ; true ),
% ( sub_atom( F, _, _, 0, 'chr.yap' ) -> spy get_interf; true ),
assert_new(consulted(F, Mod ) ), assert_new(consulted(F, Mod ) ),
nb_getval( private, Default ), nb_getval( private, Default ),
nb_setval( private, false ), nb_setval( private, false ),
catch( open(F, read, S, []) , _, fail ), catch( open(F, read, S, [scripting(true)]) , _, fail ),
repeat, repeat,
nb_getval( current_module, MR ), nb_getval( current_module, MR ),
catch( read_term( S, T, [module( MR )] ), Throw, (writeln(F:MR:Throw), break, fail)), catch( read_term( S, T, [module( MR )] ), Throw, (writeln(F:MR:Throw), break, fail)),
% ( sub_atom(F,_,_,_,'matrix.yap') -> writeln(MR:T) ; true ), % ( sub_atom(F,_,_,_,'gecode/clpfd.yap') -> spy get_interf ; nospyall ),
( (
T == end_of_file T == end_of_file
-> ->
!, !,
% also, clo ops defined in the module M, if M \= Mod % also, close ops defined in the module M, if M \= Mod
generate_interface( F, Mod ), generate_interface( F, Mod ),
nb_setval( current_module, Mod ), nb_setval( current_module, Mod ),
nb_setval( private, Default ), nb_setval( private, Default ),
@ -331,9 +336,7 @@ get_interf( (:- reexport( Loc, Is ) ), F, M ) :-
!, !,
% find the file % find the file
search_file( Loc, F, NF ), search_file( Loc, F, NF ),
% depth visit % link b
pl_interf(NF, M), % should verify Is in _Is
% link bdd
module_on( NF, NM, _ ), module_on( NF, NM, _ ),
maplist( exported( NF, F, NM, M) , Is ), maplist( exported( NF, F, NM, M) , Is ),
maplist( public(F, M), Is ). maplist( public(F, M), Is ).
@ -345,7 +348,8 @@ get_interf( (:- use_module( Loc, Is ) ), F, M ) :- !,
pl_interf(NF, M), % should verify Is in _Is pl_interf(NF, M), % should verify Is in _Is
% link b % link b
module_on( NF, NM, _ ), module_on( NF, NM, _ ),
maplist( exported( NF, F, NM, M) , Is ). maplist( exported( NF, F, NM, M) , Is ),
maplist( public(F, M), Is ).
get_interf( (:- use_module( Loc ) ), F, M ) :- !, get_interf( (:- use_module( Loc ) ), F, M ) :- !,
!, !,
% find the file % find the file