]> Repositorios git - scryer-prolog.git/commitdiff
collate paths as atoms in loader.pl (#778)
authorMark Thom <[email protected]>
Sat, 6 Feb 2021 03:18:56 +0000 (20:18 -0700)
committerMark Thom <[email protected]>
Sat, 6 Feb 2021 03:18:56 +0000 (20:18 -0700)
src/lib/sockets.pl
src/loader.pl

index 108ac9b9464e737f39c10940d5d53916e7db80e9..dd386a3bc2aef43cfcf561c006c6dd7e81cabdc7 100644 (file)
@@ -15,7 +15,7 @@ parse_socket_options_(Option, OptionPair) :-
 
 parse_socket_options(Options, OptionValues, Stub) :-
     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) :-
     (  var(Addr) ->
index fb9d68403e3e015b8e2a74995b9abef4ccf98882..2f5f70ff618c18373a269653da80524abff26337 100644 (file)
@@ -300,8 +300,7 @@ use_module(Module, Exports) :-
     '$push_load_state_payload'(Evacuable),
     (  Exports == [] ->
        '$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) :-
     (  var(Module) ->
        instantiation_error(load/1)
     ;  Module = library(Library) ->
-       (  atom(Library) ->
-          (  '$load_compiled_library'(Library, Evacuable) -> %% TODO: What about Exports?
+       (  path_atom(Library, LibraryPath) ->
+          (  '$load_compiled_library'(LibraryPath, Evacuable) -> %% TODO: What about Exports?
              true
-          ;  '$load_library_as_stream'(Library, Stream, Path),
+          ;  '$load_library_as_stream'(LibraryPath, Stream, Path),
              file_load(Stream, Path, Subevacuable),
              '$use_module'(Evacuable, Subevacuable, Exports)
           )
@@ -332,8 +339,8 @@ use_module(Module, Exports, Evacuable) :-
           instantiation_error(load/1)
        ;  type_error(atom, Library, load/1)
        )
-    ;  (  atom(Module) ->
-          load_context_path(Module, Path),
+    ;  (  path_atom(Module, ModulePath) ->
+          load_context_path(ModulePath, Path),
           open(Path, read, Stream),
           file_load(Stream, Path, Subevacuable),
           '$use_module'(Evacuable, Subevacuable, Exports)