From: plugd Date: Tue, 4 Oct 2022 07:15:09 +0000 (+0200) Subject: Scaffolding for input processing. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=c2bf7428388aedee98c42c52c3c1bf2ac75f29bc;p=ez.git Scaffolding for input processing. --- diff --git a/ez.el b/ez.el index 7a91e57..f96005a 100644 --- a/ez.el +++ b/ez.el @@ -840,12 +840,19 @@ (ez-print (ez-get-obj-name obj))) 'run) +(defvar ez--next-read-args nil) (defun ez-op-read (operands operand-types) (let ((baddr1 (car operands)) (baddr2 (cadr operands))) - ) + (setq ez--next-read-args (list baddr1 baddr2))) 'wait-for-input) +(defun ez-op-read2 (input-string) + (ez-tokenize-string input-string + (car ez--next-read-args) + (cadr ez--next-read-args)) + 'run) + ;; Execution loop (defun ez-load-and-run (filename) @@ -888,8 +895,12 @@ (defun ez-enter () (interactive) - (with-current-buffer "*ez*" - (buffer-substring ez-input-marker (point-max)))) + (if (not (eq ez-machine-state 'wait-for-input)) + (error "Z-machine not ready for input.")) + (let ((input-string (with-current-buffer "*ez*" + (buffer-substring ez-input-marker (point-max))))) + (ez-op-read2 input-string) + (ez-run))) ;; Mode