mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 10:40:45 -08:00
lisp eval working to capture stdio
This commit is contained in:
parent
777d81f6b6
commit
c7de87fa0a
1 changed files with 18 additions and 8 deletions
|
|
@ -194,20 +194,30 @@
|
||||||
(html-id (current-win app))
|
(html-id (current-win app))
|
||||||
(escape-string (copy-buf app))))))
|
(escape-string (copy-buf app))))))
|
||||||
|
|
||||||
|
(defun capture-eval (form)
|
||||||
|
(let ((result (make-array '(0) :element-type 'base-char
|
||||||
|
:fill-pointer 0 :adjustable t))
|
||||||
|
(eval-result))
|
||||||
|
(with-output-to-string (stream result)
|
||||||
|
(let ((*standard-output* stream)
|
||||||
|
(*error-output* stream))
|
||||||
|
(setf eval-result (eval (read-from-string form)))))
|
||||||
|
(format nil "~A~%=>~A~%" result eval-result)))
|
||||||
|
|
||||||
(defun do-ide-lisp-eval-buf (obj)
|
(defun do-ide-lisp-eval-buf (obj)
|
||||||
(let* ((app (connection-data-item obj "app-data"))
|
(let* ((app (connection-data-item obj "app-data"))
|
||||||
(form (copy-buf app))
|
(form-string (copy-buf app))
|
||||||
(result (eval (read-from-string form))))
|
(result (capture-eval form-string)))
|
||||||
(do-ide-file-new obj)
|
(do-ide-file-new obj)
|
||||||
(js-execute obj (format nil "editor_~A.setValue('~A')"
|
(js-execute obj (format nil "editor_~A.setValue('~A')"
|
||||||
(html-id (current-win app))
|
(html-id (current-win app))
|
||||||
(escape-string result)))))
|
(escape-string result)))))
|
||||||
|
|
||||||
(defun do-ide-lisp-eval-file (obj)
|
(defun do-ide-lisp-eval-file (obj)
|
||||||
(let* ((app (connection-data-item obj "app-data"))
|
(let* ((app (connection-data-item obj "app-data"))
|
||||||
(form (js-query obj (format nil "editor_~A.getValue()"
|
(form-string (js-query obj (format nil "editor_~A.getValue()"
|
||||||
(html-id (current-win app)))))
|
(html-id (current-win app)))))
|
||||||
(result (eval (read-from-string form))))
|
(result (capture-eval form-string)))
|
||||||
(do-ide-file-new obj)
|
(do-ide-file-new obj)
|
||||||
(js-execute obj (format nil "editor_~A.setValue('~A')"
|
(js-execute obj (format nil "editor_~A.setValue('~A')"
|
||||||
(html-id (current-win app))
|
(html-id (current-win app))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue