diff --git a/tools/clog-builder.lisp b/tools/clog-builder.lisp index 8d089d9..6e8af02 100644 --- a/tools/clog-builder.lisp +++ b/tools/clog-builder.lisp @@ -2299,50 +2299,47 @@ of controls and double click to select control." (setf (disabledp (eval-sel-button panel)) nil) (setf (state panel) nil) (let* ((type (type-of item)) - (name (format nil "~A" (definitions:designator item))) - ;; we need to filter for *,(,),\ - s) + (name (format nil "~A" (definitions:designator item)))) (setf name (ppcre:regex-replace-all "\\\\" name "\\x5C\\x5C")) (setf name (ppcre:regex-replace-all "\\\(" name "\\x5C(")) (setf name (ppcre:regex-replace-all "\\\)" name "\\x5C)")) (setf name (ppcre:regex-replace-all "\\\*" name "\\x5C*")) - (setf s (format nil "~A.find('~A',{caseSensitive:false,regExp:true})" - (clog-ace::js-ace (src-box panel)) - (cond ((eq type 'definitions:generic-function) - (format nil "defgeneric\\\\s+~A" name)) - ((eq type 'definitions:method) - (format nil "defmethod\\\\s+~A" name)) - ((eq type 'definitions:function) - (format nil "defun\\\\s+~A" name)) - ((eq type 'definitions:macro) - (format nil "defmacro\\\\s+~A" name)) - ((eq type 'definitions:class) - (format nil "defclass\\\\s+~A" name)) - ((eq type 'definitions:compiler-macro) - (format nil "define-compiler-macro\\\\s+~A" name)) - ((eq type 'definitions:condition) - (format nil "define-condition\\\\s+~A" name)) - ((eq type 'definitions:alien-type) - (format nil "define-alien-type ~A" name)) - ((eq type 'definitions:constant) - (format nil "defconstant\\\\s+~A" name)) - ((eq type 'definitions:package) - (format nil "defpackage\\\\s+~A" name)) - ((eq type 'definitions:special-variable) - (format nil "(defsection|defparameter|defvar)\\\\s+~A" name)) - ((eq type 'definitions:vop) - (format nil "define-type-vop\\\\s+~A" name)) - ((eq type 'definitions:structure) - (format nil "defstruct\\\\s*\\\\(\\\\s*~A" name)) - ((eq type 'definitions:setf-expander) - (format nil "(defsetf|def)\\\\s+~A" name)) - ((eq type 'definitions:optimizer) - (format nil "defoptimizer\\\\s*\\\\(\\\\s*~A" name)) - ((eq type 'definitions:ir1-convert) - (format nil "def-ir1-translator\\\\s+~A" name)) - (t - name)))) - (js-execute target s))) + (js-execute target (format nil "~A.find('~A',{caseSensitive:false,regExp:true})" + (clog-ace::js-ace (src-box panel)) + (cond ((eq type 'definitions:generic-function) + (format nil "defgeneric\\\\s+~A" name)) + ((eq type 'definitions:method) + (format nil "defmethod\\\\s+~A" name)) + ((eq type 'definitions:function) + (format nil "defun\\\\s+~A" name)) + ((eq type 'definitions:macro) + (format nil "defmacro\\\\s+~A" name)) + ((eq type 'definitions:class) + (format nil "defclass\\\\s+~A" name)) + ((eq type 'definitions:compiler-macro) + (format nil "define-compiler-macro\\\\s+~A" name)) + ((eq type 'definitions:condition) + (format nil "define-condition\\\\s+~A" name)) + ((eq type 'definitions:alien-type) + (format nil "define-alien-type ~A" name)) + ((eq type 'definitions:constant) + (format nil "defconstant\\\\s+~A" name)) + ((eq type 'definitions:package) + (format nil "defpackage\\\\s+~A" name)) + ((eq type 'definitions:special-variable) + (format nil "(defsection|defparameter|defvar)\\\\s+~A" name)) + ((eq type 'definitions:vop) + (format nil "define-type-vop\\\\s+~A" name)) + ((eq type 'definitions:structure) + (format nil "defstruct\\\\s*\\\\(\\\\s*~A" name)) + ((eq type 'definitions:setf-expander) + (format nil "(defsetf|def)\\\\s+~A" name)) + ((eq type 'definitions:optimizer) + (format nil "defoptimizer\\\\s*\\\\(\\\\s*~A" name)) + ((eq type 'definitions:ir1-convert) + (format nil "def-ir1-translator\\\\s+~A" name)) + (t + name)))))) (t (setf (text-value (file-name panel)) "") (setf (disabledp (eval-button panel)) t) @@ -2351,6 +2348,24 @@ of controls and double click to select control." (setf (state panel) t) (setf (text-value (src-box panel)) "No file information"))))) +(defun on-convert-image (body) + (let ((params (form-multipart-data body))) + (create-div body :content params) + (destructuring-bind (stream fname content-type) + (form-data-item params "filename") + (create-div body :content (format nil "filename = ~A - (contents printed in REPL)" fname)) + (let ((s (flexi-streams:make-flexi-stream stream)) + (pic-data "")) + (setf pic-data (format nil "data:~A;base64,~A" content-type + (with-output-to-string (out) + (s-base64:encode-base64 s out)))) + (create-img body :url-src pic-data) + (create-br body) + (create-div body :content "User the following as a url source:") + (set-geometry (create-text-area body :value pic-data) :width 500 :height 400) + (create-br body) + (create-div body :content (format nil "For example:
(create-img body :url-src \"~A\")" pic-data)))))) + (defun on-new-builder (body) "Launch instance of the CLOG Builder" (set-html-on-close body "Connection Lost") @@ -2387,7 +2402,7 @@ of controls and double click to select control." (create-gui-menu-item tools :content "CLOG Builder REPL" :on-click 'on-repl) (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 System Browser" :on-click + (create-gui-menu-item tools :content "Launch Package Browser" :on-click (lambda (obj) (declare (ignore obj)) (open-window (window body) "/sysbrowser"))) @@ -2442,23 +2457,6 @@ of controls and double click to select control." (declare (ignore obj)) ;; return empty string to prevent nav off page "")))) -(defun on-convert-image (body) - (let ((params (form-multipart-data body))) - (create-div body :content params) - (destructuring-bind (stream fname content-type) - (form-data-item params "filename") - (create-div body :content (format nil "filename = ~A - (contents printed in REPL)" fname)) - (let ((s (flexi-streams:make-flexi-stream stream)) - (pic-data "")) - (setf pic-data (format nil "data:~A;base64,~A" content-type - (with-output-to-string (out) - (s-base64:encode-base64 s out)))) - (create-img body :url-src pic-data) - (create-br body) - (create-div body :content "User the following as a url source:") - (set-geometry (create-text-area body :value pic-data) :width 500 :height 400) - (create-br body) - (create-div body :content (format nil "For example:
(create-img body :url-src \"~A\")" pic-data)))))) (defun clog-builder (&key (port 8080) static-root system) "Start clog-builder."