(in-package #:user-side-compiler) (defvar *asm-functions* (make-hash-table :test #'equalp)) (defun asm-function-exists-p (name) (not (null (gethash name *asm-functions*)))) (defun get-asm-function (name) (gethash name *asm-functions*)) (defclass asm-function () ((%name :accessor name :initarg :name) (%address :accessor address :initarg :address))) (defun add-asm-function (name address &key &allow-other-keys) (when (or (not (asm-function-exists-p name)) (/= address (address (get-asm-function name)))) (setf (gethash name *asm-functions*) (make-instance 'asm-function :name name :address address)))) (tlk:define-simple-print-object (asm-function %name)) (define-transformation (token (token-name asm-function)) (multiple-value-bind (asm-function existsp) (get-asm-function (name token)) (if existsp asm-function (progn (cerror "Create dummy function with placeholder address." 'missing-function-error :format-control "~A" :format-arguments (list (name token))) (add-asm-function (name token) #xC0FE)))))