Skip to content

Commit f94d927

Browse files
committed
FIXED: prolog_load_context/2 for file to work correctly for .qlf.
1 parent 40257ec commit f94d927

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

boot/qlf.pl

+15-2
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,26 @@
103103

104104
'$qload_file'(File, Module, Action, LoadedModule, Options) :-
105105
setup_call_cleanup(
106-
open(File, read, In, [type(binary)]),
106+
qopen(File, In, Ref),
107107
setup_call_cleanup(
108108
'$save_lex_state'(LexState, Options),
109109
'$qload_stream'(In, Module,
110110
Action, LoadedModule, Options),
111111
'$restore_lex_state'(LexState)),
112-
close(In)).
112+
qclose(In, Ref)).
113+
114+
%! qopen(+File, -Stream, -Ref) is det.
115+
%
116+
% Open a .qlf file and push '$load_input'/2 to make sure
117+
% prolog_load_context(file, File) works correctly.
118+
119+
qopen(File, In, Ref) :-
120+
open(File, read, In, [type(binary)]),
121+
asserta(system:'$load_input'(File, In), Ref).
122+
123+
qclose(In, Ref) :-
124+
erase(Ref),
125+
close(In).
113126

114127
'$qload_stream'(In, Module, loaded, LoadedModule, Options) :-
115128
'$qlf_load'(Module:In, LM),

0 commit comments

Comments
 (0)