add use-clog-debugger option to clog-repl

This commit is contained in:
David Botton 2024-05-17 16:01:40 -04:00
parent 438e7ede6f
commit 1acc47dc69
3 changed files with 20 additions and 6 deletions

View file

@ -95,6 +95,7 @@
(one-of-dialog function)
(dialog-in-stream class)
(dialog-out-stream class)
(*clog-debug-instance* variable)
"CLOG-GUI - Look and Feel"
(*menu-bar-class* variable)
@ -111,6 +112,10 @@
;; Default Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CLOG GUI based ebugger settings
(defparameter *clog-debug-instance* nil
"Default location to open debugger windows")
;; Menus
(defparameter *menu-bar-class* "w3-bar w3-black w3-card-4")
(defparameter *menu-bar-drop-down-class* "w3-dropdown-content w3-bar-block w3-card-4")
@ -285,6 +290,8 @@ NOTE: use-clog-debugger should not be set for security issues
(when jquery-ui
(load-script (html-document clog-body) jquery-ui))
(when (and use-clog-debugger (not clog-connection:*disable-clog-debugging*))
(unless *clog-debug-instance*
(setf *clog-debug-instance* clog-body))
(setf (connection-data-item clog-body "clog-debug")
(lambda (event data)
(with-clog-debugger (clog-body :standard-output standard-output)

View file

@ -95,11 +95,15 @@
(defun clog-repl (&key (clog-gui-initialize t)
(clog-web-initialize t)
(use-clog-debugger nil)
(boot-file "/debug.html")
(port 8080))
"Set a path /repl that opens a blank page and sets the global
clog-user:*body* to last window openned to /repl. Debug mode is
set (logging to browser console) in the default debug.html boot-file."
set (logging to browser console) in the default debug.html boot-file.
clog-web and clog-gui are initialized and if use-clog-debugger it set to
true it is initialized and this repl window used as default clog debug display
and debugger display for clog events."
(unless *clog-running*
(initialize nil :boot-file boot-file :port port))
(set-on-new-window (lambda (body)
@ -107,7 +111,8 @@ set (logging to browser console) in the default debug.html boot-file."
(when clog-web-initialize
(clog-web:clog-web-initialize body))
(when clog-gui-initialize
(clog-gui:clog-gui-initialize body))
(clog-gui:clog-gui-initialize body :use-clog-debugger
use-clog-debugger))
(setf clog-user::*body* body))
:path "/repl")
(open-browser :url (format nil "http://127.0.0.1:~A/repl" *clog-port*))

View file

@ -510,6 +510,8 @@ clog-builder window.")
(when *app-mode*
(incf *app-mode*))
(run body))
(when (eq *clog-debug-instance* body)
(setf *clog-debug-instance* nil))
(when *app-mode*
(decf *app-mode*)
(when (<= *app-mode* 0)