collate paths as atoms in loader.pl (#778)

This commit is contained in:
Mark Thom
2021-02-05 20:18:56 -07:00
parent a104b35cea
commit 700778e574
2 changed files with 15 additions and 8 deletions

View File

@@ -15,7 +15,7 @@ parse_socket_options_(Option, OptionPair) :-
parse_socket_options(Options, OptionValues, Stub) :- parse_socket_options(Options, OptionValues, Stub) :-
DefaultOptions = [alias-[], eof_action-eof_code, reposition-false, tls-false, type-text], DefaultOptions = [alias-[], eof_action-eof_code, reposition-false, tls-false, type-text],
builtins:parse_options_list(Options, parse_socket_options_, DefaultOptions, OptionValues, Stub). builtins:parse_options_list(Options, sockets:parse_socket_options_, DefaultOptions, OptionValues, Stub).
socket_client_open(Addr, Stream, Options) :- socket_client_open(Addr, Stream, Options) :-
( var(Addr) -> ( var(Addr) ->

View File

@@ -300,8 +300,7 @@ use_module(Module, Exports) :-
'$push_load_state_payload'(Evacuable), '$push_load_state_payload'(Evacuable),
( Exports == [] -> ( Exports == [] ->
'$remove_module_exports'(Module, Evacuable) '$remove_module_exports'(Module, Evacuable)
; ; use_module(Module, Exports, Evacuable)
use_module(Module, Exports, Evacuable)
). ).
@@ -317,14 +316,22 @@ load_context_path(Module, Path) :-
). ).
path_atom(Dir/File, Path) :-
must_be(atom, File),
!,
path_atom(Dir, DirPath),
foldl(builtins:atom_concat, ['/', DirPath], File, Path).
path_atom(Path, Path) :-
must_be(atom, Path).
use_module(Module, Exports, Evacuable) :- use_module(Module, Exports, Evacuable) :-
( var(Module) -> ( var(Module) ->
instantiation_error(load/1) instantiation_error(load/1)
; Module = library(Library) -> ; Module = library(Library) ->
( atom(Library) -> ( path_atom(Library, LibraryPath) ->
( '$load_compiled_library'(Library, Evacuable) -> %% TODO: What about Exports? ( '$load_compiled_library'(LibraryPath, Evacuable) -> %% TODO: What about Exports?
true true
; '$load_library_as_stream'(Library, Stream, Path), ; '$load_library_as_stream'(LibraryPath, Stream, Path),
file_load(Stream, Path, Subevacuable), file_load(Stream, Path, Subevacuable),
'$use_module'(Evacuable, Subevacuable, Exports) '$use_module'(Evacuable, Subevacuable, Exports)
) )
@@ -332,8 +339,8 @@ use_module(Module, Exports, Evacuable) :-
instantiation_error(load/1) instantiation_error(load/1)
; type_error(atom, Library, load/1) ; type_error(atom, Library, load/1)
) )
; ( atom(Module) -> ; ( path_atom(Module, ModulePath) ->
load_context_path(Module, Path), load_context_path(ModulePath, Path),
open(Path, read, Stream), open(Path, read, Stream),
file_load(Stream, Path, Subevacuable), file_load(Stream, Path, Subevacuable),
'$use_module'(Evacuable, Subevacuable, Exports) '$use_module'(Evacuable, Subevacuable, Exports)