mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
Added a REPL
This commit is contained in:
parent
a7bd5e5ed2
commit
cc7f90496d
2 changed files with 30 additions and 10 deletions
3
clog.asd
3
clog.asd
|
|
@ -48,13 +48,14 @@
|
||||||
:components ((:file "clog-docs")))
|
:components ((:file "clog-docs")))
|
||||||
|
|
||||||
(asdf:defsystem #:clog/tools
|
(asdf:defsystem #:clog/tools
|
||||||
:depends-on (#:clog #:clog-ace #:s-base64 #:swank)
|
:depends-on (#:clog #:clog-ace #:clog-terminal #:s-base64 #:swank)
|
||||||
:pathname "tools/"
|
:pathname "tools/"
|
||||||
:components ((:file "clog-db-admin")
|
:components ((:file "clog-db-admin")
|
||||||
(:file "clog-builder-settings")
|
(:file "clog-builder-settings")
|
||||||
(:file "clog-templates")
|
(:file "clog-templates")
|
||||||
(:file "clog-new-app")
|
(:file "clog-new-app")
|
||||||
(:file "clog-builder")
|
(:file "clog-builder")
|
||||||
|
(:file "clog-builder-repl")
|
||||||
(:file "image-to-data")
|
(:file "image-to-data")
|
||||||
(:file "quick-start")
|
(:file "quick-start")
|
||||||
(:file "clog-builder-images")))
|
(:file "clog-builder-images")))
|
||||||
|
|
|
||||||
|
|
@ -123,17 +123,26 @@
|
||||||
|
|
||||||
;; Lisp code evaluation utilities
|
;; Lisp code evaluation utilities
|
||||||
|
|
||||||
(defun capture-eval (form &key (eval-in-package "clog-user"))
|
(defun capture-eval (form &key (clog-obj nil) (eval-in-package "clog-user"))
|
||||||
"Capture lisp evaluaton of FORM"
|
"Capture lisp evaluaton of FORM"
|
||||||
(let ((result (make-array '(0) :element-type 'base-char
|
(let ((result (make-array '(0) :element-type 'base-char
|
||||||
:fill-pointer 0 :adjustable t))
|
:fill-pointer 0 :adjustable t))
|
||||||
(eval-result))
|
(eval-result))
|
||||||
(with-output-to-string (stream result)
|
(with-output-to-string (stream result)
|
||||||
(let* ((*standard-output* stream)
|
(labels ((my-debugger (condition me-or-my-encapsulation)
|
||||||
(*error-output* stream)
|
(if clog-obj
|
||||||
(*package* (find-package (string-upcase eval-in-package))))
|
(clog-web-alert (connection-body clog-obj) "Error"
|
||||||
(setf eval-result (eval (read-from-string (format nil "(progn ~A)" form))))))
|
(format nil "~&Error: ~A" condition)
|
||||||
(format nil "~A~%=>~A~%" result eval-result)))
|
:time-out 3))
|
||||||
|
(format t "~&Error: ~A" condition)))
|
||||||
|
(let* ((*standard-output* stream)
|
||||||
|
(*terminal-io* stream)
|
||||||
|
(*error-output* stream)
|
||||||
|
(*debug-io* stream)
|
||||||
|
(*debugger-hook* #'my-debugger)
|
||||||
|
(*package* (find-package (string-upcase eval-in-package))))
|
||||||
|
(setf eval-result (eval (read-from-string (format nil "(progn ~A)" form))))))
|
||||||
|
(format nil "~A~%=>~A~%" result eval-result))))
|
||||||
|
|
||||||
;; Local file utilities
|
;; Local file utilities
|
||||||
|
|
||||||
|
|
@ -2116,6 +2125,15 @@ of controls and double click to select control."
|
||||||
(capture-eval (text-value ace))
|
(capture-eval (text-value ace))
|
||||||
:title "Eval Result")))))
|
:title "Eval Result")))))
|
||||||
|
|
||||||
|
(defun on-repl (obj)
|
||||||
|
"Open quick start"
|
||||||
|
(let* ((win (create-gui-window obj :title "CLOG Builder REPL"
|
||||||
|
:top 40 :left 225
|
||||||
|
:width 600 :height 400
|
||||||
|
:client-movement t)))
|
||||||
|
(set-geometry (create-clog-builder-repl (window-content win))
|
||||||
|
:units "%" :width 100 :height 100)))
|
||||||
|
|
||||||
(defun on-new-builder (body)
|
(defun on-new-builder (body)
|
||||||
"Launch instance of the CLOG Builder"
|
"Launch instance of the CLOG Builder"
|
||||||
(set-html-on-close body "Connection Lost")
|
(set-html-on-close body "Connection Lost")
|
||||||
|
|
@ -2145,9 +2163,10 @@ of controls and double click to select control."
|
||||||
(create-gui-menu-item file :content "New Custom Boot Page" :on-click 'on-new-builder-custom)
|
(create-gui-menu-item file :content "New Custom Boot Page" :on-click 'on-new-builder-custom)
|
||||||
(create-gui-menu-item file :content "New Application Template" :on-click 'on-new-app-template)
|
(create-gui-menu-item file :content "New Application Template" :on-click 'on-new-app-template)
|
||||||
(create-gui-menu-item src :content "New Source Editor" :on-click 'on-open-file)
|
(create-gui-menu-item src :content "New Source Editor" :on-click 'on-open-file)
|
||||||
(create-gui-menu-item tools :content "Control Events" :on-click 'on-show-control-events-win)
|
(create-gui-menu-item tools :content "Control Events" :on-click 'on-show-control-events-win)
|
||||||
(create-gui-menu-item tools :content "Copy/Cut History" :on-click 'on-show-copy-history-win)
|
(create-gui-menu-item tools :content "CLOG Builder REPL" :on-click 'on-repl)
|
||||||
(create-gui-menu-item tools :content "Image to Data" :on-click 'on-image-to-data)
|
(create-gui-menu-item tools :content "Copy/Cut History" :on-click 'on-show-copy-history-win)
|
||||||
|
(create-gui-menu-item tools :content "Image to HTML Data" :on-click 'on-image-to-data)
|
||||||
(create-gui-menu-item tools :content "Launch DB Admin" :on-click
|
(create-gui-menu-item tools :content "Launch DB Admin" :on-click
|
||||||
(lambda (obj)
|
(lambda (obj)
|
||||||
(declare (ignore obj))
|
(declare (ignore obj))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue