More helpers for clog in quicklisp

This commit is contained in:
David Botton 2021-01-29 00:41:32 -05:00
parent 2c3df8d408
commit 264cef0db2
8 changed files with 187 additions and 55 deletions

View file

@ -56,12 +56,26 @@ git clone https://github.com/rabbibotton/clog.git
To load this package and work through tutorials (assuming you
have Quicklisp configured):
1. Start emacs/slime
3. In the REPL, run:
1. Start emacs then M-x slime
2. In the REPL, run:
```
CL-USER> (ql:quickload :clog)
CL-USER> (load "~/common-lisp/clog/tutorial/01-tutorial.lisp")
CL-USER> (clog-user:start-tutorial)
CL-USER> (clog-user:run-tutorial 1)
```
To see where the source files are:
```
CL-USER> (clog:clog-install-dir)
```
You can the load the demos with:
```
CL-USER> (load "path to clog/demos/01-snake.lisp)
CL-USER> (clog-user:start-demo)
```
Work your way through the tutorials. You will see how quick and easy it is
to be a CLOGer.
@ -158,7 +172,6 @@ Enhancements underway:
- GUI Builder
- Grid style
- Page style
- Electron for native GUIs
- Plugin API
- General CL systems

83
clog-helpers.lisp Normal file
View file

@ -0,0 +1,83 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; CLOG - The Common Lisp Omnificent GUI ;;;;
;;;; (c) 2020-2021 David Botton ;;;;
;;;; License BSD 3 Clause ;;;;
;;;; ;;;;
;;;; clog-helpers.lisp - Various helpers for learning ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cl:in-package :clog)
(defpackage #:clog-user
(:use #:cl #:clog)
(:export start-tutorial))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation - CLOG Utilities
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;
;; clog-install-dir ;;
;;;;;;;;;;;;;;;;;;;;;;
(defun clog-install-dir ()
"Return the directory CLOG was installed in."
(asdf:system-source-directory :clog))
;;;;;;;;;;;;;;;;;;
;; run-tutorial ;;
;;;;;;;;;;;;;;;;;;
(defun run-tutorial (num)
"Run tutorial NUM"
(let ((p (merge-pathnames (format nil "./tutorial/~2,'0d-tutorial.lisp" num)
(asdf:system-source-directory :clog))))
(load p)
(clog-user:start-tutorial)
(format t "~%~% ---- The tutorial src is located at: ~A~%" p)))
;;;;;;;;;;;;;;;;
;; load-world ;;
;;;;;;;;;;;;;;;;
(defun load-world ()
(load "clog.lisp")
(load "clog-docs.lisp")
(load "clog-base.lisp")
(load "clog-element.lisp")
(load "clog-element-common.lisp")
(load "clog-canvas.lisp")
(load "clog-form.lisp")
(load "clog-window.lisp")
(load "clog-navigator.lisp")
(load "clog-document.lisp")
(load "clog-location.lisp")
(load "clog-system.lisp")
(load "clog-utilities.lisp")
(load "clog-body.lisp")
(load "clog-helpers.lisp"))
;;;;;;;;;;;;;;;;;;;;
;; make-mark-down ;;
;;;;;;;;;;;;;;;;;;;;
(defun make-mark-down ()
(load-world)
(describe clog:@CLOG-MANUAL))
;;;;;;;;;;;;;;;
;; make-html ;;
;;;;;;;;;;;;;;;
(defun make-html ()
(load-world)
(mgl-pax:update-asdf-system-html-docs clog:@CLOG-MANUAL :clog))
;;;;;;;;;;;;;;;;
;; make-world ;;
;;;;;;;;;;;;;;;;
(defun make-world ()
(make-html)
(asdf:compile-system :clog))

View file

@ -26,4 +26,5 @@
(:file "clog-document")
(:file "clog-location")
(:file "clog-navigator")
(:file "clog-body")))
(:file "clog-body")
(:file "clog-helpers")))

View file

@ -43,8 +43,10 @@ embedded in a native template application.)"
(@clog-document section)
(@clog-location section)
(@clog-navigator section)
(@clog-helpers section)
(@clog-internals section))
(defsection @clog-system (:title "CLOG System")
"CLOG Startup and Shutdown"
(initialize function)
@ -711,7 +713,7 @@ embedded in a native template application.)"
(vendor generic-function))
(defsection @clog-location (:title "CLOG Location Objects")
"CLOG-Location - CLOG Location Objects"
"Clog-Location - CLOG Location Objects"
(clog-location class)
"CLOG-Location - Properties"
@ -730,43 +732,13 @@ embedded in a native template application.)"
(url-replace generic-function)
(url-assign generic-function))
(export 'make-markup)
(defun make-markup ()
(load "clog.lisp")
(load "clog-docs.lisp")
(load "clog-base.lisp")
(load "clog-element.lisp")
(load "clog-element-common.lisp")
(load "clog-canvas.lisp")
(load "clog-form.lisp")
(load "clog-window.lisp")
(load "clog-navigator.lisp")
(load "clog-document.lisp")
(load "clog-location.lisp")
(load "clog-system.lisp")
(load "clog-utilities.lisp")
(load "clog-body.lisp")
(describe clog:@CLOG-MANUAL))
(defsection @clog-helpers (:title "CLOG Helper Functions")
"Tutorial and demo helpers"
(clog-install-dir function)
(run-tutorial function)
(export 'make-html)
(defun make-html ()
(load "clog.lisp")
(load "clog-docs.lisp")
(load "clog-base.lisp")
(load "clog-element.lisp")
(load "clog-element-common.lisp")
(load "clog-canvas.lisp")
(load "clog-form.lisp")
(load "clog-window.lisp")
(load "clog-navigator.lisp")
(load "clog-document.lisp")
(load "clog-location.lisp")
(load "clog-system.lisp")
(load "clog-utilities.lisp")
(load "clog-body.lisp")
(mgl-pax:update-asdf-system-html-docs clog:@CLOG-MANUAL :clog))
(export 'make-world)
(defun make-world ()
(make-html)
(asdf:compile-system :clog))
"Functions for Compilation and Documentation"
(load-world function)
(make-mark-down function)
(make-html function)
(make-world function))

View file

@ -50,7 +50,8 @@
<li><a href="#x-28CLOG-3A-40CLOG-DOCUMENT-20MGL-PAX-3ASECTION-29" title="CLOG Document Objects">14 CLOG Document Objects</a></li>
<li><a href="#x-28CLOG-3A-40CLOG-LOCATION-20MGL-PAX-3ASECTION-29" title="CLOG Location Objects">15 CLOG Location Objects</a></li>
<li><a href="#x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29" title="CLOG Navigator Objects">16 CLOG Navigator Objects</a></li>
<li><a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29" title="CLOG Framework internals and extensions">17 CLOG Framework internals and extensions</a></li>
<li><a href="#x-28CLOG-3A-40CLOG-HELPERS-20MGL-PAX-3ASECTION-29" title="CLOG Helper Functions">17 CLOG Helper Functions</a></li>
<li><a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29" title="CLOG Framework internals and extensions">18 CLOG Framework internals and extensions</a></li>
</ul>
<h6>[in package CLOG]</h6>
@ -4826,7 +4827,7 @@ on-storage event is fired for changes to :local storage keys.</p></li>
<h2><a href="#x-28CLOG-3A-40CLOG-LOCATION-20MGL-PAX-3ASECTION-29">15 CLOG Location Objects</a></h2>
<p>CLOG-Location - <code>CLOG</code> Location Objects</p>
<p>Clog-Location - <code>CLOG</code> Location Objects</p>
<p><a id='x-28CLOG-3ACLOG-LOCATION-20CLASS-29'></a></p>
@ -4938,7 +4939,7 @@ on-storage event is fired for changes to :local storage keys.</p></li>
<p><a id='x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29'></a></p>
<p><span class="outer-navigation"><span class="navigation"> <a href="#x-28CLOG-3A-40CLOG-LOCATION-20MGL-PAX-3ASECTION-29" title="CLOG Location Objects">&#8592;</a> <a href="#x-28CLOG-3A-40CLOG-MANUAL-20MGL-PAX-3ASECTION-29" title="The CLOG manual">&#8593;</a> <a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29" title="CLOG Framework internals and extensions">&#8594;</a> <a href="#x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29" title="CLOG Navigator Objects">&#8634;</a></span></span></p>
<p><span class="outer-navigation"><span class="navigation"> <a href="#x-28CLOG-3A-40CLOG-LOCATION-20MGL-PAX-3ASECTION-29" title="CLOG Location Objects">&#8592;</a> <a href="#x-28CLOG-3A-40CLOG-MANUAL-20MGL-PAX-3ASECTION-29" title="The CLOG manual">&#8593;</a> <a href="#x-28CLOG-3A-40CLOG-HELPERS-20MGL-PAX-3ASECTION-29" title="CLOG Helper Functions">&#8594;</a> <a href="#x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29" title="CLOG Navigator Objects">&#8634;</a></span></span></p>
<h2><a href="#x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29">16 CLOG Navigator Objects</a></h2>
@ -4986,11 +4987,57 @@ on-storage event is fired for changes to :local storage keys.</p></li>
<p>Get browser vendor.</p></li>
</ul>
<p><a id='x-28CLOG-3A-40CLOG-HELPERS-20MGL-PAX-3ASECTION-29'></a></p>
<p><span class="outer-navigation"><span class="navigation"> <a href="#x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29" title="CLOG Navigator Objects">&#8592;</a> <a href="#x-28CLOG-3A-40CLOG-MANUAL-20MGL-PAX-3ASECTION-29" title="The CLOG manual">&#8593;</a> <a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29" title="CLOG Framework internals and extensions">&#8594;</a> <a href="#x-28CLOG-3A-40CLOG-HELPERS-20MGL-PAX-3ASECTION-29" title="CLOG Helper Functions">&#8634;</a></span></span></p>
<h2><a href="#x-28CLOG-3A-40CLOG-HELPERS-20MGL-PAX-3ASECTION-29">17 CLOG Helper Functions</a></h2>
<p>Tutorial and demo helpers</p>
<p><a id='x-28CLOG-3ACLOG-INSTALL-DIR-20FUNCTION-29'></a></p>
<ul>
<li><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3ACLOG-INSTALL-DIR-20FUNCTION-29" >CLOG-INSTALL-DIR</a></span></span> <span class="locative-args"></span></span></li>
</ul>
<p><a id='x-28CLOG-3ARUN-TUTORIAL-20FUNCTION-29'></a></p>
<ul>
<li><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3ARUN-TUTORIAL-20FUNCTION-29" >RUN-TUTORIAL</a></span></span> <span class="locative-args">NUM</span></span></li>
</ul>
<p>Functions for Compilation and Documentation</p>
<p><a id='x-28CLOG-3ALOAD-WORLD-20FUNCTION-29'></a></p>
<ul>
<li><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3ALOAD-WORLD-20FUNCTION-29" >LOAD-WORLD</a></span></span> <span class="locative-args"></span></span></li>
</ul>
<p><a id='x-28CLOG-3AMAKE-MARK-DOWN-20FUNCTION-29'></a></p>
<ul>
<li><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3AMAKE-MARK-DOWN-20FUNCTION-29" >MAKE-MARK-DOWN</a></span></span> <span class="locative-args"></span></span></li>
</ul>
<p><a id='x-28CLOG-3AMAKE-HTML-20FUNCTION-29'></a></p>
<ul>
<li><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3AMAKE-HTML-20FUNCTION-29" >MAKE-HTML</a></span></span> <span class="locative-args"></span></span></li>
</ul>
<p><a id='x-28CLOG-3AMAKE-WORLD-20FUNCTION-29'></a></p>
<ul>
<li><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3AMAKE-WORLD-20FUNCTION-29" >MAKE-WORLD</a></span></span> <span class="locative-args"></span></span></li>
</ul>
<p><a id='x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29'></a></p>
<p><span class="outer-navigation"><span class="navigation"> <a href="#x-28CLOG-3A-40CLOG-NAVIGATOR-20MGL-PAX-3ASECTION-29" title="CLOG Navigator Objects">&#8592;</a> <a href="#x-28CLOG-3A-40CLOG-MANUAL-20MGL-PAX-3ASECTION-29" title="The CLOG manual">&#8593;</a> <a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29" title="CLOG Framework internals and extensions">&#8634;</a></span></span></p>
<p><span class="outer-navigation"><span class="navigation"> <a href="#x-28CLOG-3A-40CLOG-HELPERS-20MGL-PAX-3ASECTION-29" title="CLOG Helper Functions">&#8592;</a> <a href="#x-28CLOG-3A-40CLOG-MANUAL-20MGL-PAX-3ASECTION-29" title="The CLOG manual">&#8593;</a> <a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29" title="CLOG Framework internals and extensions">&#8634;</a></span></span></p>
<h2><a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29">17 CLOG Framework internals and extensions</a></h2>
<h2><a href="#x-28CLOG-3A-40CLOG-INTERNALS-20MGL-PAX-3ASECTION-29">18 CLOG Framework internals and extensions</a></h2>
<p><em>* Introduction to Internals *</em></p>

View file

@ -23,7 +23,7 @@
(set-on-click hello-element ; Now we set a function to handle clicks
(lambda (obj) ; In this case we use an anonymous function
(declare (ignore obj))
(setf (color hello-element) "green")))
(setf (color hello-element) :green)))
(run body))) ; Keep our thread alive until connection closes
; and prevent garbage collection of our CLOG-Objects

16
tutorial/13-tutorial.lisp Normal file
View file

@ -0,0 +1,16 @@
(defpackage #:clog-user
(:use #:cl #:clog)
(:export start-tutorial))
(in-package :clog-user)
(defun start-tutorial ()
"Start turtorial."
(format t "Tutorial 13 is a how to on building your own clog appliction.~%~
Copy the directory - ~A~%~
to your ~~/common-lisp directory or other asdf / quicklisp~%~
directory. Then follow the directions in the tuturial 13 ~%~
directory."
(merge-pathnames "./tutorial/tutorial13"
(asdf:system-source-directory :clog))))

View file

@ -1,4 +1,4 @@
To run a tutorial, start emacs/slime or your CL Lisp in the common-lisp/clog directory:
To run a tutorial load clog:
```
CL-USER> (ql:quickload :clog)
@ -10,14 +10,14 @@ To load "clog":
(:CLOG)
```
Load the demo:
Load the tutorial:
```
CL-USER> (load "/Users/dbotton/common-lisp/clog/tutorial/01-tutorial.lisp")
#P"/Users/dbotton/common-lisp/clog/tutorial/01-tutorial.lisp"
```
Start the demo:
Start the tutorial:
```
CL-USER> (clog-user:start-tutorial)