about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-03-13 00:46:00 -0700
committerKartik Agaram <vc@akkartik.com>2019-03-13 00:50:07 -0700
commit364b8f8875dfad94d96aae180b58f0003720e15c (patch)
tree5229e06636b874178e43d3856b3ba164b17e5577
parent4a943d4ed313eff001504c2b5c472266e86a38af (diff)
downloadmu-364b8f8875dfad94d96aae180b58f0003720e15c.tar.gz
5002
Bugfix in top-level prototype: commandline args were broken since commit
4266 last June.

We still don't have automated tests for commandline args, but we'll add
an example program that'll increase the odds of detecting issues there.
-rw-r--r--073scheduler.cc1
-rw-r--r--args.mu8
2 files changed, 9 insertions, 0 deletions
diff --git a/073scheduler.cc b/073scheduler.cc
index 41240e64..5f97220b 100644
--- a/073scheduler.cc
+++ b/073scheduler.cc
@@ -133,6 +133,7 @@ void run_main(int argc, char* argv[]) {
   Current_routine = main_routine;
   for (int i = 1;  i < argc;  ++i) {
     vector<double> arg;
+    arg.push_back(/*alloc id*/0);
     arg.push_back(new_mu_text(argv[i]));
     assert(get(Memory, arg.back()) == 0);
     current_call().ingredient_atoms.push_back(arg);
diff --git a/args.mu b/args.mu
new file mode 100644
index 00000000..3726f097
--- /dev/null
+++ b/args.mu
@@ -0,0 +1,8 @@
+# To provide commandline args to a Mu program, use '--'. In this case:
+#   $ ./mu args.mu -- abc
+#   abc
+def main text:text [
+  local-scope
+  load-inputs
+  $print text 10/newline
+]