diff --git a/README.md b/README.md index fa7d8ce..99a197b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/clog-helpers.lisp b/clog-helpers.lisp new file mode 100644 index 0000000..6a3a0b6 --- /dev/null +++ b/clog-helpers.lisp @@ -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)) diff --git a/clog.asd b/clog.asd index dc1c43a..746dedf 100644 --- a/clog.asd +++ b/clog.asd @@ -26,4 +26,5 @@ (:file "clog-document") (:file "clog-location") (:file "clog-navigator") - (:file "clog-body"))) + (:file "clog-body") + (:file "clog-helpers"))) diff --git a/clog.lisp b/clog.lisp index 0eff974..95e1272 100644 --- a/clog.lisp +++ b/clog.lisp @@ -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)) - -(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)) +(defsection @clog-helpers (:title "CLOG Helper Functions") + "Tutorial and demo helpers" + (clog-install-dir function) + (run-tutorial function) -(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)) diff --git a/doc/clog-manual.html b/doc/clog-manual.html index d1edb92..f4e676d 100644 --- a/doc/clog-manual.html +++ b/doc/clog-manual.html @@ -50,7 +50,8 @@
  • 14 CLOG Document Objects
  • 15 CLOG Location Objects
  • 16 CLOG Navigator Objects
  • -
  • 17 CLOG Framework internals and extensions
  • +
  • 17 CLOG Helper Functions
  • +
  • 18 CLOG Framework internals and extensions
  • [in package CLOG]
    @@ -4826,7 +4827,7 @@ on-storage event is fired for changes to :local storage keys.

    15 CLOG Location Objects

    -

    CLOG-Location - CLOG Location Objects

    +

    Clog-Location - CLOG Location Objects

    @@ -4938,7 +4939,7 @@ on-storage event is fired for changes to :local storage keys.

    -

    +

    16 CLOG Navigator Objects

    @@ -4986,11 +4987,57 @@ on-storage event is fired for changes to :local storage keys.

    Get browser vendor.

    +

    + +

    + +

    17 CLOG Helper Functions

    + +

    Tutorial and demo helpers

    + +

    + + + +

    + + + +

    Functions for Compilation and Documentation

    + +

    + + + +

    + + + +

    + + + +

    + + +

    -

    +

    -

    17 CLOG Framework internals and extensions

    +

    18 CLOG Framework internals and extensions

    * Introduction to Internals *

    diff --git a/tutorial/01-tutorial.lisp b/tutorial/01-tutorial.lisp index d92cda9..142b388 100644 --- a/tutorial/01-tutorial.lisp +++ b/tutorial/01-tutorial.lisp @@ -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 diff --git a/tutorial/13-tutorial.lisp b/tutorial/13-tutorial.lisp new file mode 100644 index 0000000..795eb5b --- /dev/null +++ b/tutorial/13-tutorial.lisp @@ -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)))) diff --git a/tutorial/README.md b/tutorial/README.md index 21bab58..76777db 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -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)