some arrangements to fix quirks of symbols in the executable program

note that (eq 'baz:foo bar:foo) is not true
so some stuff that works in the repl fails in executable
This commit is contained in:
2024-07-29 23:15:38 +03:00
parent 49b58b2d57
commit 004c2b5628
4 changed files with 35 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
(in-package :cl-forth)
(defparameter *operations* (make-hash-table))
(defparameter *operations* (make-hash-table :test 'equal))
(eval-always
(defun normalize-op-list (asm-list)
@@ -27,7 +27,7 @@
(defmacro defop (op-name+args (&key (indent 4)) &body body)
(with-gensyms (out-stream)
(destructuring-bind (op-name . args) (mklist op-name+args)
`(setf (gethash ',op-name *operations*)
`(setf (gethash ,(string op-name) *operations*)
(lambda (,out-stream ,@args)
,(if (or (stringp (car body)) (stringp (caar body)))
`(defop-format ,out-stream ,indent
@@ -141,7 +141,7 @@
(format str " ;; -- ~s --~%" op))
(defun gen-code (op str)
(let ((op-fn (gethash (car op) *operations*)))
(let ((op-fn (gethash (string (car op)) *operations*)))
(if (null op-fn)
(error "~s is not a valid op" op)
(apply op-fn str (cdr op)))))