This file is indexed.

/usr/share/Yap/autoloader.yap is in yap 6.2.2-6+b2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
:- module(autoloader,[make_library_index/0]).

:- use_module(library(lists),[append/3]).

:- dynamic exported/3, loaded/1.

make_library_index :-
	scan_library_exports,
	scan_swi_exports.

scan_library_exports :-
	% init table file.
	open('INDEX.pl', write, W),
	close(W),
	scan_exports('../GPL/aggregate', library(aggregate)),
	scan_exports(apply, library(apply)),
	scan_exports(arg, library(arg)),
	scan_exports(assoc, library(assoc)),
	scan_exports(avl, library(avl)),
	scan_exports(bhash, library(bhash)),
	scan_exports(charsio, library(charsio)),
	scan_exports('../packages/chr/chr_swi', library(chr)),
	scan_exports(clp/clpfd, library(clpfd)),
	scan_exports('../packages/clpqr/clpr', library(clpr)),
	scan_exports(gensym, library(gensym)),
	scan_exports(heaps, library(heaps)),
	scan_exports('../packages/jpl/jpl', library(jpl)),
	scan_exports(lists, library(lists)),
	scan_exports(nb, library(nb)),
	scan_exports(occurs, library(occurs)),
	scan_exports('../LGPL/option', library(option)),
	scan_exports(ordsets, library(ordsets)),
	scan_exports(pairs, library(pairs)),
	scan_exports('../LGPL/prolog_xref', library(prolog_xref)),
	scan_exports('../packages/plunit/plunit', library(plunit)),
	scan_exports(queues, library(queues)),
	scan_exports(random, library(random)),
	scan_exports(rbtrees, library(rbtrees)),
	scan_exports(readutil, library(readutil)),
	scan_exports(regexp, library(regexp)),
	scan_exports('../LGPL/shlib', library(shlib)),
	scan_exports(system, library(system)),
	scan_exports(terms, library(terms)),
	scan_exports(timeout, library(timeout)),
	scan_exports(trees, library(trees)).

scan_exports(Library, CallName) :-
	absolute_file_name(Library, Path,
			   [ file_type(prolog),
			     access(read),
			     file_errors(fail)
			   ]),
	!,
	open(Path, read, O),
	get_exports(O, Exports, Module),
	close(O),
	open('INDEX.pl', append, W),
	publish_exports(Exports, W, CallName, Module),
	close(W).
scan_exports(Library) :-
	format(user_error,'[ warning: library ~w not defined ]~n',[Library]).
	
%
% SWI is the only language that uses autoload.
%
scan_swi_exports :-
	retractall(exported(_,_,_)),
	absolute_file_name(dialect/swi, Path,
			   [ file_type(prolog),
			     access(read),
			     file_errors(fail)
			   ]),
	open(Path, read, O),
	get_exports(O, Exports, Module),
	get_reexports(O, Reexports, Exports),
	close(O),	
	open('dialect/swi/INDEX.pl', write, W),
	publish_exports(Reexports, W, library(dialect/swi), Module),
	close(W).

get_exports(O, Exports, Module) :-
	read(O, (:- module(Module,Exports))), !.
get_exports(O, Exports, Module) :-
	get_exports(O, Exports, Module).

get_reexports(O, Exports, ExportsL) :-
	read(O, (:- reexport(_File,ExportsI))), !,
	get_reexports(O, Exports0, ExportsL),
	append(ExportsI, Exports0, Exports).
get_reexports(_, Exports, Exports).

publish_exports([], _, _, _).
publish_exports([F/A|Exports], W, Path, Module) :-
	publish_export(F, A, W, Path, Module),
	publish_exports(Exports, W, Path, Module).
publish_exports([F//A0|Exports], W, Path, Module) :-
	A is A0+2,
	publish_export(F, A, W, Path, Module),
	publish_exports(Exports, W, Path, Module).
publish_exports([op(_,_,_)|Exports], W, Path, Module) :-
	publish_exports(Exports, W, Path, Module).

publish_export(F, A, _, _, Module) :-
	exported(F, A, M), !,
	format(user_error,'[ warning: clash between ~a and ~a over ~a/~d ]~n',[Module,M,F,A]).
publish_export(F, A, W, Path, Module) :-
	assert(exported(F, A, Module)), !,
	portray_clause(W, index(F, A, Module, Path)).

find_predicate(G,ExportingModI) :-
	functor(G, Name, Arity),
	index(Name,Arity,ExportingModI,File),
	ensure_file_loaded(File).

ensure_file_loaded(File) :-
	loaded(File), !.
ensure_file_loaded(File) :-
	load_files(autoloader:File,[silent(true),if(not_loaded)]),
	assert(loaded(File)).