close must be last to be proted, otherwise YAP gets confused about who owns the stream.
This commit is contained in:
parent
80f190bc8a
commit
8b2312daf7
@ -421,6 +421,10 @@ putAtom(Atom atom, int Quote_illegal, wrf writewch) /* writes an atom */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (IsBlob(atom)) {
|
||||
wrputref(RepAtom(atom),1,writewch);
|
||||
return;
|
||||
}
|
||||
if (IsWideAtom(atom)) {
|
||||
wchar_t *ws = (wchar_t *)s;
|
||||
|
||||
|
@ -1382,9 +1382,11 @@ cd(Dir) :- working_directory(_, Dir).
|
||||
getcwd(Dir) :- working_directory(Dir, Dir).
|
||||
|
||||
close(Stream) :-
|
||||
swi_close(Stream).
|
||||
'$close'(Stream).
|
||||
% swi_close(Stream). must be last
|
||||
close(Stream, Options) :-
|
||||
swi_close(Stream, Options).
|
||||
'$close'(Stream).
|
||||
% swi_close(Stream, Options). must be last
|
||||
open(File, Type, Stream) :-
|
||||
swi_open(File, Type, Stream).
|
||||
open(File, Type, Stream, Opts) :-
|
||||
|
@ -159,8 +159,8 @@ load_files(Files,Opts) :-
|
||||
'$do_lf'(Mod, user_input, InfLevel, CompilationMode,Imports,SkipUnixComments,CompMode,Reconsult,UseModule).
|
||||
'$lf'(X, Mod, Call, InfLevel,_,Changed,CompilationMode,Imports,_,Enc,SkipUnixComments,CompMode,Reconsult,UseModule) :-
|
||||
'$find_in_path'(X, Y, Call),
|
||||
(X = 'arith.yap' -> start_low_level_trace ; true),
|
||||
'$valid_encoding'(Encoding, Enc),
|
||||
open(Y, read, Stream, [encoding(Encoding)]), !, % '$open'(Y, '$csult', Stream, 0, Enc, X)
|
||||
'$set_changed_lfmode'(Changed),
|
||||
'$start_lf'(X, Mod, Stream, InfLevel, CompilationMode, Imports, Changed,SkipUnixComments,CompMode,Reconsult,UseModule),
|
||||
'$close'(Stream).
|
||||
@ -434,7 +434,7 @@ initialization(G,OPT) :-
|
||||
'$valid_encoding'(Encoding, Enc),
|
||||
( open(Y, read, Stream, [encoding(Encoding)]), !, % '$open'(Y, '$csult', Stream, 0, Encoding, X), !,
|
||||
print_message(Verbosity, loading(including, Y)),
|
||||
'$loop'(Stream,Status), '$close'(Stream)
|
||||
'$loop'(Stream,Status), close(Stream)
|
||||
;
|
||||
'$do_error'(permission_error(input,stream,Y),include(X))
|
||||
),
|
||||
|
Reference in New Issue
Block a user