fix repl playground and add clog-user:*probe*

This commit is contained in:
David Botton 2024-05-31 17:37:45 -04:00
parent 49f777530e
commit ab9a8f3024
4 changed files with 24 additions and 4 deletions

View file

@ -22,13 +22,14 @@
(defpackage #:clog-user (defpackage #:clog-user
(:use #:cl #:clog #:clog-gui #:clog-web) (:use #:cl #:clog #:clog-gui #:clog-web)
(:import-from :clog-tools #:clog-builder-probe) (:import-from :clog-tools #:clog-builder-probe)
(:export :*body* :clog-repl)) (:export :*body* :*probe* :clog-repl))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation - CLOG Utilities ;; Implementation - CLOG Utilities
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar clog-user::*body* nil "clog-repl access to body") (defvar clog-user:*body* nil "clog-repl access to body")
(defvar clog-user:*probe* nil "Used by probes to return value of symbol")
;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;
;; clog-install-dir ;; ;; clog-install-dir ;;

View file

@ -35,7 +35,7 @@ replaced. (Exported)"
(defun add-inspector (name func) (defun add-inspector (name func)
"Add a custom inspector with NAME and (FUNC object title value clog-obj)" "Add a custom inspector with NAME and (FUNC object title value clog-obj)"
(push (list :name name :func func) *inspectors*)) (pushnew (list :name name :func func) *inspectors*))
(defun reset-control-pallete (panel) (defun reset-control-pallete (panel)
(let* ((app (connection-data-item panel "builder-app-data")) (let* ((app (connection-data-item panel "builder-app-data"))

View file

@ -1,7 +1,11 @@
(in-package :clog-tools) (in-package :clog-tools)
(defparameter *inspectors* (defparameter *inspectors*
`((:name "Print to Console" `((:name "Set object to clog-user:*probed*"
:func ,(lambda (symbol title value clog-obj)
(declare (ignore title value clog-obj))
(setf clog-user:*probe* symbol)))
(:name "Print to Console"
:func ,(lambda (symbol title value clog-obj) :func ,(lambda (symbol title value clog-obj)
(declare (ignore symbol)) (declare (ignore symbol))
(on-open-console clog-obj) (on-open-console clog-obj)
@ -22,6 +26,20 @@
(SWANK::*BUFFER-READTABLE* *READTABLE*)) (SWANK::*BUFFER-READTABLE* *READTABLE*))
(swank:inspect-in-emacs symbol)))))) (swank:inspect-in-emacs symbol))))))
(defun inspect-class (symbol title value clog-obj)
(declare (ignore clog-obj))
(let ((class (class-of symbol)))
(format t "~%Inspecting ~A = ~A~%" title value)
(format t "Class of : ~A~%" class)
(format t "Class Name : ~A~%" (class-name class))
(format t "Class Precedence List : ~A~%" (closer-mop:class-precedence-list class))
(format t "Class Slots : ~A~%" (mapcar (lambda (obj)
(closer-mop:slot-definition-name obj))
(closer-mop:class-slots class)))
))
(add-inspector "Class Inspector" 'inspect-class)
(defun on-probe-panel (obj) (defun on-probe-panel (obj)
(let ((app (connection-data-item obj "builder-app-data"))) (let ((app (connection-data-item obj "builder-app-data")))
(if (probe-win app) (if (probe-win app)

View file

@ -39,6 +39,7 @@
:left 300 :left 300
:height "" :width "" :height "" :width ""
:bottom 5 :right 0) :bottom 5 :right 0)
(clog-ace:resize (playground repl))
(set-on-window-move win nil) (set-on-window-move win nil)
(set-on-window-move win (lambda (obj) (set-on-window-move win (lambda (obj)
(setf (width obj) (width obj)) (setf (width obj) (width obj))