option to handle evals on main thread so break can work with sbcl

This commit is contained in:
David Botton 2024-05-07 19:21:16 -04:00
parent 6f61020904
commit acf55705ab
4 changed files with 72 additions and 63 deletions

5
clog.asd vendored
View file

@ -16,7 +16,6 @@
#:bordeaux-threads #:trivial-open-browser #:parse-float #:quri #:bordeaux-threads #:trivial-open-browser #:parse-float #:quri
#:lack-middleware-static #:lack-request #:lack-util-writer-stream #:lack-middleware-static #:lack-request #:lack-util-writer-stream
#:trivial-gray-streams #:closer-mop #:mgl-pax #:cl-template #:atomics #:trivial-gray-streams #:closer-mop #:mgl-pax #:cl-template #:atomics
#:cl-indentify
#:sqlite #:cl-dbi #:cl-pass #-(or mswindows win32 cormanlisp) #:cl-isaac) #:sqlite #:cl-dbi #:cl-pass #-(or mswindows win32 cormanlisp) #:cl-isaac)
:components ((:module "static-files" :components ((:module "static-files"
:components ((:static-file "js/boot.js"))) :components ((:static-file "js/boot.js")))
@ -72,8 +71,8 @@
(:file "clog-docs"))) (:file "clog-docs")))
(asdf:defsystem #:clog/tools (asdf:defsystem #:clog/tools
:depends-on (#:clog #:clog-ace #:clog-terminal #:s-base64 #:swank :depends-on (#:clog #:clog-ace #:clog-terminal #:s-base64 #:swank #:cl-indentify
#:definitions #:parenscript) #:definitions #:parenscript #:trivial-main-thread)
:pathname "tools/" :pathname "tools/"
:components (;; clog-db-admin app :components (;; clog-db-admin app
(:file "clog-db-admin") (:file "clog-db-admin")

View file

@ -81,6 +81,7 @@ provide an interactive console.)"))
nil) nil)
;; Lisp code evaluation utilities ;; Lisp code evaluation utilities
(defun capture-eval (form &key (capture-console t) (defun capture-eval (form &key (capture-console t)
(capture-result t) (capture-result t)
(capture-result-form "=>~A~%") (capture-result-form "=>~A~%")
@ -89,6 +90,8 @@ provide an interactive console.)"))
(private-console-win nil) (private-console-win nil)
(eval-in-package "clog-user")) (eval-in-package "clog-user"))
"Capture lisp evaluaton of FORM." "Capture lisp evaluaton of FORM."
(let ((cef
(lambda ()
(let (console (let (console
(result (make-array '(0) :element-type 'base-char (result (make-array '(0) :element-type 'base-char
:fill-pointer 0 :adjustable t)) :fill-pointer 0 :adjustable t))
@ -142,7 +145,10 @@ provide an interactive console.)"))
(values (values
(format nil eval-form result eval-result) (format nil eval-form result eval-result)
*package* *package*
eval-result)))))))) eval-result))))))))))
(if *clog-repl-eval-on-main-thread*
(trivial-main-thread:call-in-main-thread cef :blocking t)
(funcall cef))))
(defun do-eval (obj form-string cname &key (package "clog-user") (test t) custom-boot) (defun do-eval (obj form-string cname &key (package "clog-user") (test t) custom-boot)
"Render, evalute and run code for panel" "Render, evalute and run code for panel"

View file

@ -58,6 +58,8 @@
(defparameter *clog-repl-open-console-on-start* nil) (defparameter *clog-repl-open-console-on-start* nil)
(defparameter *clog-repl-send-result-to-console* nil) (defparameter *clog-repl-send-result-to-console* nil)
(defparameter *clog-repl-private-console* t) (defparameter *clog-repl-private-console* t)
;; eval on main thread so (break) works for sbcl.
(defparameter *clog-repl-eval-on-main-thread* nil)
;; Panel Builder ;; Panel Builder

View file

@ -69,6 +69,8 @@
(setf *clog-repl-open-console-on-start* nil) (setf *clog-repl-open-console-on-start* nil)
(setf *clog-repl-send-result-to-console* nil) (setf *clog-repl-send-result-to-console* nil)
(setf *clog-repl-private-console* t) (setf *clog-repl-private-console* t)
;; eval on main thread so (break) works for sbcl.
(setf *clog-repl-eval-on-main-thread* nil)
;; CLOG Panel Builder ;; CLOG Panel Builder
(setf *builder-render-right-margin* 80) (setf *builder-render-right-margin* 80)