use partial strings for passing argv to toplevel.pl

In run_top_level: rename variables, make them partial strings

The rename is mostly cosmetic: all of argv is passed, and if argv
contains flags, goals, etc, it's more than filenames.

Using partial strings instead of atom came from discussions about how to
pass goals in the CLI, and can thus be considered preliminary work for
that.

In toplevel.pl: convert partial string to atom before passing it to
`use_module`.

Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
Stephan Renatus
2020-04-06 17:35:21 +02:00
parent 97d8d07947
commit 155645307a
2 changed files with 12 additions and 18 deletions

View File

@@ -3,13 +3,14 @@
:- module('$toplevel', ['$repl'/1, consult/1, use_module/1, use_module/2]).
'$repl'(ListOfModules) :-
maplist('$use_list_of_modules', ListOfModules),
'$repl'([_|Args]) :-
maplist('$use_list_of_modules', Args),
false.
'$repl'(_) :- '$repl'.
'$use_list_of_modules'(Module) :-
catch(use_module(Module), E, '$print_exception'(E)).
'$use_list_of_modules'(Mod0) :-
atom_chars(Mod, Mod0),
catch(use_module(Mod), E, '$print_exception'(E)).
'$repl' :-
catch('$read_and_match', E, '$print_exception'(E)),