a way to run program with arguments

This commit is contained in:
minjaesong
2020-11-01 12:03:03 +09:00
parent af876866b5
commit c331af2cc4
8 changed files with 52 additions and 24 deletions

View File

@@ -65,4 +65,10 @@ var GL = eval(filesystem.readAll("A"));
// Boot script
filesystem.open("A", "tvdos/command.js", "R");
eval(filesystem.readAll("A"));
let cmdsrc = filesystem.readAll("A");
// app execution stub
let prg = eval("let _appStub=function(exec_args){"+cmdsrc+"};_appStub;"); // making 'exec_args' a app-level global
prg(undefined);
//let testtest = prg(42);
//println(testtest.test);

View File

@@ -1,4 +1,4 @@
const PROMPT_TEXT = ">";
let PROMPT_TEXT = ">";
let CURRENT_DRIVE = "A";
let shell_pwd = [""];
@@ -15,6 +15,11 @@ function greet() {
}
let shell = {};
shell.test = "command.js test string";
if (exec_args !== undefined) return shell;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
println("Starting TVDOS...");
@@ -47,9 +52,10 @@ while (true) {
println();
try {
println("You entered: " + cmdbuf);
}
catch (e) {
println(e);
printerrln(e);
}
finally {
if (cmdbuf.trim().length > 0)
@@ -91,4 +97,6 @@ while (true) {
}
}
}
}
}
return 0;