debugging

This commit is contained in:
Vitor Santos Costa 2016-05-15 08:12:19 +01:00
parent af61c886b4
commit 8e3789d92a
1 changed files with 18 additions and 19 deletions

View File

@ -414,7 +414,7 @@ load_files(Files,Opts) :-
( (
atom(M) atom(M)
-> ->
'$lf'(X, M, Call, TOpts) '$lf'(X, M, Call, TOpts)
; ;
'$do_error'(type_error(atom,M),Call) '$do_error'(type_error(atom,M),Call)
). ).
@ -431,23 +431,23 @@ load_files(Files,Opts) :-
b_setval('$user_source_file', user_input), b_setval('$user_source_file', user_input),
'$do_lf'(Mod, user_input, user_input, user_input, TOpts). '$do_lf'(Mod, user_input, user_input, user_input, TOpts).
'$lf'(File, Mod, Call, TOpts) :- '$lf'(File, Mod, Call, TOpts) :-
'$lf_opt'(stream, TOpts, Stream), '$lf_opt'(stream, TOpts, Stream),
b_setval('$user_source_file', File), b_setval('$user_source_file', File),
( var(Stream) -> ( var(Stream) ->
/* need_to_open_file */ /* need_to_open_file */
( '$full_filename'(File, Y, Call) -> true ; '$do_error'(existence_error(source_sink,File),Call) ), ( '$full_filename'(File, Y, Call) -> true ; '$do_error'(existence_error(source_sink,File),Call) ),
( open(Y, read, Stream) -> true ; '$do_error'(permission_error(input,stream,Y),Call) ) ( open(Y, read, Stream) -> true ; '$do_error'(permission_error(input,stream,Y),Call) )
; ;
stream_property(Stream, file_name(Y)) stream_property(Stream, file_name(Y))
), !, ), !,
( file_size(Stream, Pos) -> true ; Pos = 0), ( file_size(Stream, Pos) -> true ; Pos = 0),
'$set_lf_opt'('$source_pos', TOpts, Pos), '$set_lf_opt'('$source_pos', TOpts, Pos),
'$lf_opt'(reexport, TOpts, Reexport), '$lf_opt'(reexport, TOpts, Reexport),
'$lf_opt'(if, TOpts, If), '$lf_opt'(if, TOpts, If),
( var(If) -> If = true ; true ), ( var(If) -> If = true ; true ),
'$lf_opt'(imports, TOpts, Imports), '$lf_opt'(imports, TOpts, Imports),
'$start_lf'(If, Mod, Stream, TOpts, File, Y, Reexport, Imports), '$start_lf'(If, Mod, Stream, TOpts, File, Y, Reexport, Imports),
close(Stream). close(Stream).
'$start_lf'(not_loaded, Mod, _Stream, TOpts, UserFile, File, Reexport,Imports) :- '$start_lf'(not_loaded, Mod, _Stream, TOpts, UserFile, File, Reexport,Imports) :-
@ -511,7 +511,7 @@ loaded, otherwise advertises the user about the existing name clashes
are not public remain invisible. are not public remain invisible.
When the files are not module files, ensure_loaded/1 loads them When the files are not module files, ensure_loaded/1 loads them
if they have not been loaded before, and does nothing otherwise. if they have not been loaded before, and does nothing otherwise.
_F_ must be a list containing the names of the files to load. _F_ must be a list containing the names of the files to load.
*/ */
@ -1386,8 +1386,7 @@ initialization(G0,OPT) :-
expand_goal(G0, G), expand_goal(G0, G),
catch('$initialization'(G, OPT), Error, '$LoopError'( Error, consult ) ), catch('$initialization'(G, OPT), Error, '$LoopError'( Error, consult ) ),
fail. fail.
initialization(_G,_OPT) :- initialization(_G,_OPT).
stop_low_level_trace.
'$initialization'(G,OPT) :- '$initialization'(G,OPT) :-
must_be_of_type(callable, G, initialization(G,OPT)), must_be_of_type(callable, G, initialization(G,OPT)),