29:- system_module( absf, [
37absf_trace(
Msg,
Args )
-->
38 {
absf_trace(
Msg,
Args) }.
41absf_trace(
Msg,
Args )
:-
44 print_message( informational, absolute_file_path(
Msg,
Args ) ),
54 print_message( informational, absolute_file_path(
File ) ),
61absf_trace_component(
Prefix,
List )
:-
64 print_message( informational, absolute_file_path_component(
Prefix,
List ) ),
69absf_trace_component(
_,
_ ).
72'$validate_absf'(
_File,
TrueFile,
LOpts,
LOpts,
TrueFile)
:-
76'$validate_absf'(
_File,
LOpts,
TrueFile,
LOpts,
TrueFile ).
78'$enter_absf'(
File,
LOpts,
Opts,
State )
:- '$enter_absf',
80 absf_trace(
'input: ~w',
File),
81 absf_trace_component(
' ',
LOpts),
82 abs_file_parameters(
LOpts,
Opts),
87 State = abs_entry(
File,
D0,
PreviousFileErrors,
PreviousVerbose,
PreviousFileNameExpand ).
89'$set_absf'(
Opts)
:- '$set_absf',
90 get_abs_file_parameter( verbose_file_search,
Opts,
Verbose ),
91 get_abs_file_parameter( expand,
Opts,
PreviousFileNameExpand ),
92 get_abs_file_parameter( file_errors,
Opts,
FileErrors ),
97'$restore_absf'(abs_entry(
_OldF,
D0,
PreviousFileErrors,
PreviousVerbose,
PreviousFileNameExpand) )
:- '$restore_absf',
103'$absf_port'(answer,
File,
Opts,
TrueFileName,
State )
:-
104 '$absf_port'(exit,
File,
Opts,
TrueFileName,
State ).
105'$absf_port'(exit,
_File,
_Opts,
TrueFileName,
State )
:-
106 '$restore_absf'(
State),
107 absf_trace(
' |------- exit: found ~a', [
TrueFileName]).
108'$absf_port'(redo,
_File,
Opts,
_TrueFileName,
_State )
:-
109 absf_trace(
' !------- retry', []),
111'$absf_port'(fail,
File,
_Opts,
TrueFileName,
_State)
:-
112 absf_trace(
' !------- failed.', []),
115 '$do_error'(existence_error(file,
File),absolute_file_name(
File,
TrueFileName, [
File])).
116'$absf_port'(fail,
_File,
_Opts,
_TrueFileName,
State)
:-
117 '$restore_absf'(
State).
118'$absf_port'(!,
_File,
_Opts,
_TrueFileName,
_State ).
119'$absf_port'(exception(
_),
_File,
_Opts,
_TrueFileName,
State )
:-
120 '$restore_absf'(
State).
121'$absf_port'(external_exception(
_),
_File,
_Opts,
_TrueFileName,
State )
:-
122 '$restore_absf'(
State).
124'$find_in_path'(
Name,
Opts,
File)
:-
125 '$library'(
Name,
Opts,
Name1),
126 absf_trace(
'library expansion done: ~s',
Name1),
127 '$path2atom'(
Name1,
Name2),
128 absf_trace(
'path to text done: ~s',
Name2),
129 '$suffix'(
Name2,
Opts,
_,
Name3),
130 absf_trace(
'suffix done ~s',
Name3),
131 '$glob'(
Name3,
Opts,
Name4),
132 absf_trace(
'glob done ~s',
Name5),
133 get_abs_file_parameter( expand,
Opts,
Exp ),
134 absf_trace(
'expansion done ~s',
Name5),
135 (
Exp = true
-> expand_file_name(
Name4,
Names),
136 absf_trace(
'expansion done ~s',
Names)
138 lists
:member(
Name5,
Names),
139 absf_trace(
'pick ~s',
Name5),
140 '$clean_name'(
Name5,
Opts,
File),
141 get_abs_file_parameter( file_type,
Opts,
Type ),
142 get_abs_file_parameter( access,
Opts,
Access ),
143 '$check_file'(
File,
Type,
Access),
144 (
get_abs_file_parameter( solutions,
Opts, first )
-> get_abs_file_parameter
; get_abs_file_parameter ).
145'$find_in_path'(user,
_,user_input)
:- '$find_in_path'.
146'$find_in_path'(user_input,
_,user_input)
:- '$find_in_path'.
147'$find_in_path'(user_output,
_,user_ouput)
:- '$find_in_path'.
148'$find_in_path'(user_error,
_,user_error)
:- '$find_in_path'.
150'$clean_name'(
N0,
_OPts,
NF)
:-
151 is_absolute_file_name(
N0),
152 is_absolute_file_name,
154'$clean_name'(
N0,
_OPts,
NF)
:-
156'$clean_name'(
N0,
_OPts,
NF)
:-
166'$library'(
Name,
_Opts,
E)
:-
170 '$lib2path'(
Lib,
P,
E)
175'$lib2path'(
Lib,
P0,
E)
:-
178 '$lib2path'(
FLib,
P0,
E).
179'$lib2path'(
Lib,
P0,
E)
:-
181 FLib =.. [
F2Lib,
Extra],
182 '$lib2path'(
F2Lib,
Extra/P0,
E).
183'$lib2path'(
Lib,
P0,
Lib/P0).
191 '$cat_file_name'(
As,
L,[]),
195'$cat_file_name'(
A/B,
NA,
IA )
:-
197 '$cat_file_name'(
A,
NA,
RA),
198 '$cat_file_name'(
B,
RA,
IA).
199'$cat_file_name'(
File,
NFs,
Fs)
:-
204'$suffix'(
F,
_Opts,
Ext,
F)
:-
208'$suffix'(
F,
Opts,
Ext,
NF)
:-
210 get_abs_file_parameter( extensions,
Opts,
Exts ),
211 get_abs_file_parameter
:member(
Ext,
Exts),
212 absf_trace(
' trying suffix ~a from ~w', [
Ext,
Exts])
214 get_abs_file_parameter( file_type,
Opts,
Type ),
215 (
Type == source
-> NType = prolog
; NType = Type ),
218 absf_trace(
' trying suffix ~a from type ~a', [
Ext,
NType]),
220'$suffix'(
F,
_Opts,
'',
F).
223 get_abs_file_parameter( glob,
Opts,
G ),
225 get_abs_file_parameter,
226 path_concat([
F,
G],
NF).
230'$check_file'(
F, directory,
_)
:-
234'$check_file'(
_F,
_Type, none)
:- '$check_file'.
235'$check_file'(
F,
_Type, exist)
:-
236 '$access_file'(
F, exist).
237'$check_file'(
F,
_Type,
Access)
:-
238 '$access_file'(
F,
Access),
239 \+ exists_directory(
F).
243'$system_library_directories'(library,
Dir)
:-
246'$system_library_directories'(foreign,
Dir)
:-
251'$system_library_directories'(commons,
Dir)
:-
284 current_prolog_flag
:append(
_, [
'-p',
Dir0|_Alphas],
All),
286 expand(true),file_errors(fail)]).
290 (
S = []
-> X = '.' ;
312 '$check_path'(
New,
Str),
314 '$add_to_path'(
Path,
Pos).
316'$add_to_path'(
New,
_)
:-
320'$add_to_path'(
New,last)
:-
323'$add_to_path'(
New,first)
:-
331remove_from_path(
New)
:- '$check_path'(
New,
Path),
335'$check_path'(
At,
SAt)
:- atom(
At),
atom,
atom_codes(
At,
S),
'$check_path'(
S,
SAt).
337'$check_path'([
Ch],[
Ch])
:- '$dir_separator'(
Ch),
'$dir_separator'.
338'$check_path'([
Ch],[
Ch,
A])
:- '$check_path',
integer(
Ch),
'$dir_separator'(
A).
339'$check_path'([
N|S],[
N|SN])
:- integer(
N),
'$check_path'(
S,
SN).
443 '$validate_absf'(
File,
TrueFileName0,
LOpts0,
LOpts,
TrueFileName),
445 '$enter_absf'(
File,
LOpts,
Opts,
State),
446 '$find_in_path'(
File,
Opts,
TrueFileName),
448 '$absf_port'(
Port,
File,
Opts,
TrueFileName,
State)
452exists_source(
Source,
Path)
:-
absolute_file_name(+Name:atom,+Path:atom)
absolute_file_name( -File:atom, +Path:atom, +Options:list)
catch( : Goal,+ Exception,+ Action)
file_name_extension( ? BaseFile, ?Extension, ?FullNameO)
working_directory( ?_CurDir_,? NextDir)
instantiation_error(+Term)
atom_codes(?Atom, ?Codes)
sub_atom(+ A,? Bef, ? Size, ? After, ? At_out)
current_prolog_flag(? Flag,- Value)
set_prolog_flag(+ Flag,+ Value)
add_to_path(+Directory:atom)
add_to_path(+Directory:atom, +Position:atom)
remove_from_path(+Directory:atom)
append(? List1,? List2,? List3)
member(?Element, ?Set) is true when Set is a list, and Element occurs in it
commons_directory(? Directory:atom)
file_search_path(+Name:atom, -Directory:atom)
foreign_directory(? Directory:atom)
library_directory(?Directory:atom)
prolog_file_type(?Suffix:atom, ?Handler:atom)