about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-05-04 19:49:11 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-05-04 19:49:21 -0700
commit9156823c5d1ba6bd79f2f3f07f903b0337203c36 (patch)
tree00fa85a065a8167a65d7c7ded30f024ca267a347
parent7465fbb19f3cf2a9c262e634502d07b4215c1470 (diff)
downloadmu-9156823c5d1ba6bd79f2f3f07f903b0337203c36.tar.gz
shell: start implementing macros
-rw-r--r--shell/macroexpand.mu3
-rw-r--r--shell/sandbox.mu5
2 files changed, 7 insertions, 1 deletions
diff --git a/shell/macroexpand.mu b/shell/macroexpand.mu
new file mode 100644
index 00000000..018fa200
--- /dev/null
+++ b/shell/macroexpand.mu
@@ -0,0 +1,3 @@
+fn macroexpand _in-ah: (addr handle cell), _out-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) {
+  copy-object _in-ah, _out-ah
+}
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index c26c5408..85190f5f 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -609,13 +609,16 @@ fn run _in-ah: (addr handle gap-buffer), out: (addr stream byte), globals: (addr
     break-if-=
     return
   }
+  var macroexpand-result-h: (handle cell)
+  var macroexpand-result-ah/edx: (addr handle cell) <- address macroexpand-result-h
+  macroexpand read-result-ah, macroexpand-result-ah, globals, trace
   var nil-h: (handle cell)
   var nil-ah/eax: (addr handle cell) <- address nil-h
   allocate-pair nil-ah
   var eval-result-h: (handle cell)
   var eval-result-ah/edi: (addr handle cell) <- address eval-result-h
   debug-print "^", 4/fg, 0xc5/bg=blue-bg
-  evaluate read-result-ah, eval-result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, 1/call-number
+  evaluate macroexpand-result-ah, eval-result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, 1/call-number
   debug-print "$", 4/fg, 0xc5/bg=blue-bg
   var error?/eax: boolean <- has-errors? trace
   {