Merge pull request #2263 from aarroyoc/docs-toplevel

Move argv/1 to library(os)
This commit is contained in:
Mark Thom
2024-01-02 09:19:10 -07:00
committed by GitHub
8 changed files with 79 additions and 43 deletions

View File

@@ -228,7 +228,7 @@ impl Machine {
self.machine_st.throw_exception(err);
}
fn run_module_predicate(
pub fn run_module_predicate(
&mut self,
module_name: Atom,
key: PredicateKey,
@@ -307,29 +307,6 @@ impl Machine {
}
}
pub fn run_top_level(
&mut self,
module_name: Atom,
key: PredicateKey,
) -> std::process::ExitCode {
let mut arg_pstrs = vec![];
for arg in env::args() {
arg_pstrs.push(put_complete_string(
&mut self.machine_st.heap,
&arg,
&self.machine_st.atom_tbl,
));
}
self.machine_st.registers[1] = heap_loc_as_cell!(iter_to_heap_list(
&mut self.machine_st.heap,
arg_pstrs.into_iter()
));
self.run_module_predicate(module_name, key)
}
pub fn set_user_input(&mut self, input: String) {
self.user_input = Stream::from_owned_string(input, &mut self.machine_st.arena);
}