changeset 9: |
b9720ba9c4a0 |
parent: |
bebb76da449c
|
child: |
79737134254d |
author: |
ellis <ellis@rwest.io> |
date: |
Mon, 08 May 2023 21:11:03 -0400 |
permissions: |
-rw-r--r-- |
description: |
readme, removed redundant script |
3 (defvar *cargo-target* #P"/Users/ellis/dev/otom8/demo/target/") 5 (defvar *rs-macros* nil) 7 (defmacro rs-find-dll (name &optional debug) 8 "Find the rust dll specified by NAME." 10 ((uiop:directory-exists-p (merge-pathnames *cargo-target* "release")) 11 `,(mkstr "./target/release/" name)) 12 ((uiop:directory-exists-p (merge-pathnames *cargo-target* "debug")) 13 `,(mkstr "./target/debug/" name)) 15 (uiop:run-program `("cargo" "build" ,(unless debug "--release")) :output t) 16 `,(find-rust-dll name debug))))) 18 (defmacro rs-defmacro (args &body body) 19 "Define a macro which expands to a string of Rust code.") 21 (defun rs-macroexpand-1 (form &optional env)) 23 (defun rs-macroexpand (env &rest body) 24 "Cbindgen is quite the menace and really doesn't like our macros used 25 to generate C FFI bindings. To compensate for this, we use a tool 26 called cargo-expand by the most excellent dtolnay which expands Rust 27 macros. The expansions are assembled into an equivalent Rust source 28 file which cbindgen won't get stuck in an infinite compile loop on.") 31 (format NIL "~8,'0x-~8,'0x" (random #xFFFFFFFF) (get-universal-time))) 33 (defun scan-dir (dir filename callback) 34 (dolist (path (directory (merge-pathnames (merge-pathnames filename "**/") dir))) 35 (funcall callback path))) 37 (defun mkstr (&rest args) 38 (with-output-to-string (s) 39 (dolist (a args) (princ a s)))) 41 (defun symb (&rest args) 42 (values (intern (apply #'mkstr args)))) 44 (defun sbq-reader (stream sub-char numarg) 45 "The anaphoric sharp-backquote reader: #`((,a1))" 46 (declare (ignore sub-char)) 47 (unless numarg (setq numarg 1)) 48 `(lambda ,(loop for i from 1 to numarg 51 (get-macro-character #\`) stream nil))) 54 (set-dispatch-macro-character 55 #\# #\` #'demo:sbq-reader))