2:- module( lib_pack_index, [lib_pack_index/0,lib_pack_index/1] ).
src/LibIndex.pl
with interface predicates for a pack.
*/
9lib_pack_index :-
10 exists_directory( prolog ),
11 working_directory( Here, Here ),
12 ( atom_concat(OverHere,'/',Here) ->
13 true
14 ;
15 OverHere = Here
16 ),
17 directory_file_path( _, Pack, OverHere ),
18 file_name_extension( Pack, pl, PackPl ),
19 directory_file_path( prolog, PackPl, RelF ),
20 !,
21 lib_pack_index( RelF ).
*/
30lib_pack_index( RelPackF ) :-
31 use_module( RelPackF ),
32 absolute_file_name( RelPackF, PackF ),
33 directory_file_path( Dir, PackFile, PackF ),
34 directory_file_path( Root, prolog, Dir ),
35 file_name_extension( Pack, pl, PackFile ),
36 directory_file_path( Root, src, SrcD ),
37 directory_file_path( SrcD, 'LibIndex.pl', LibF ),
38 ( exists_file(LibF) ->
39 directory_file_path( SrcD, 'LibIndex.bku', BkuF ),
40 copy_file(LibF,BkuF)
41 ;
42 true
43 ),
44 current_prolog_flag( allow_dot_in_atom, OldADA ),
45 set_prolog_flag( allow_dot_in_atom, false ),
46 open( LibF, write, Out ),
47 findall( lib_index(Pa,Pn,any,Pack,File), (
48 predicate_property(Phead,imported_from(Pack)),
49 predicate_property(Phead,file(File)),
50 functor(Phead,Pa,Pn),
51 directory_file_path( SrcD, RelF, File ),
52 file_name_extension( RelStem, pl, RelF ),
53 portray_clause( Out, lib_index(Pa,Pn,any,Pack,RelStem) )
54 ),
55 _LITerms ),
56 set_prolog_flag( allow_dot_in_atom, OldADA ),
57 close( Out )