46 lines
1.1 KiB
Common Lisp
46 lines
1.1 KiB
Common Lisp
(in-package :kurt)
|
|
|
|
(eval-when (:compile-toplevel :load-toplevel :execute)
|
|
(defmacro eval-always (&body body)
|
|
`(eval-when (:compile-toplevel :load-toplevel :execute)
|
|
,@body)))
|
|
|
|
(eval-always
|
|
(defmacro with-gensyms (syms &body body)
|
|
`(let ,(mapcar (lambda (sym) `(,sym (gensym ,(string sym)))) syms)
|
|
,@body)))
|
|
|
|
(defmacro init-hash (&body body)
|
|
(with-gensyms (table)
|
|
`(let ((,table (make-hash-table)))
|
|
,@(iter (for (k v) in body)
|
|
(collect `(setf (gethash ',k ,table) ,v)))
|
|
,table)))
|
|
|
|
(defun mklist (form)
|
|
(if (listp form) form (list form)))
|
|
|
|
(defun run (args &rest options &key &allow-other-keys)
|
|
(unless (eq t (getf options :silence))
|
|
(format t "~{~a~^ ~}~%" args))
|
|
(apply #'uiop:run-program args options))
|
|
|
|
(defun from-root (path)
|
|
(merge-pathnames path (asdf:system-source-directory :kurt)))
|
|
|
|
;; ,(file-namestring
|
|
;; (make-pathname :name (pathname-name path)
|
|
;; :type "o"))
|
|
|
|
;; (defparameter *test-program*
|
|
;; '((push 34)
|
|
;; (push 35)
|
|
;; (plus)
|
|
;; (dump)
|
|
;; (push 500)
|
|
;; (push 80)
|
|
;; (minus)
|
|
;; (dump)))
|
|
|
|
|