diff options
Diffstat (limited to 'shell/global.mu')
-rw-r--r-- | shell/global.mu | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/shell/global.mu b/shell/global.mu index 21076549..4cf17de3 100644 --- a/shell/global.mu +++ b/shell/global.mu @@ -35,6 +35,7 @@ fn initialize-globals _self: (addr global-table) { append-primitive self, "=" append-primitive self, "no" append-primitive self, "not" + append-primitive self, "dbg" # for pairs append-primitive self, "car" append-primitive self, "cdr" @@ -608,6 +609,13 @@ fn apply-primitive _f: (addr cell), args-ah: (addr handle cell), out: (addr hand return } { + var debug?/eax: boolean <- string-equal? f-name, "dbg" + compare debug?, 0/false + break-if-= + apply-debug args-ah, out, trace + return + } + { var lesser?/eax: boolean <- string-equal? f-name, "<" compare lesser?, 0/false break-if-= @@ -1181,6 +1189,30 @@ fn apply-not _args-ah: (addr handle cell), out: (addr handle cell), trace: (addr new-integer out, 1 } +fn apply-debug _args-ah: (addr handle cell), out: (addr handle cell), trace: (addr trace) { + trace-text trace, "eval", "apply debug" + var args-ah/eax: (addr handle cell) <- copy _args-ah + var _args/eax: (addr cell) <- lookup *args-ah + var args/esi: (addr cell) <- copy _args + # TODO: check that args is a pair + var empty-args?/eax: boolean <- nil? args + compare empty-args?, 0/false + { + break-if-= + error trace, "not needs 1 arg but got 0" + return + } + # dump args->left uglily to screen and wait for a keypress + var first-ah/eax: (addr handle cell) <- get args, left + dump-cell-from-cursor-over-full-screen first-ah + { + var foo/eax: byte <- read-key 0/keyboard + compare foo, 0 + loop-if-= + } + # return nothing +} + fn apply-< _args-ah: (addr handle cell), out: (addr handle cell), trace: (addr trace) { trace-text trace, "eval", "apply '<'" var args-ah/eax: (addr handle cell) <- copy _args-ah |