From 9156823c5d1ba6bd79f2f3f07f903b0337203c36 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 4 May 2021 19:49:11 -0700 Subject: shell: start implementing macros --- shell/macroexpand.mu | 3 +++ shell/sandbox.mu | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 shell/macroexpand.mu 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 { -- cgit 1.4.1-2-gfad0