utils.lisp
24 lines
| 651 B
| text/x-common-lisp
|
CommonLispLexer
/ src / utils.lisp
r46 | ||||
(in-package txt2web) | ||||
(defun src-file (filename) | ||||
(uiop/pathname:merge-pathnames* | ||||
filename | ||||
(asdf:system-source-directory :txt2web))) | ||||
(defun read-progn-from-string (string) | ||||
`(progn | ||||
,@(read-code-from-string string))) | ||||
(defun read-code-from-string (string) | ||||
(with-input-from-string (in string) | ||||
(let ((*package* *package*)) | ||||
(loop :for form := (read in nil :eof) | ||||
:until (eq form :eof) | ||||
:when (eq (first form) 'cl:in-package) | ||||
:do (setf *package* (find-package (second form))) | ||||
:else | ||||
:collect form)))) | ||||
(defun load-src (filename) | ||||
(alexandria:read-file-into-string (src-file filename))) | ||||