about summary refs log tree commit diff stats
path: root/btech.lsp
diff options
context:
space:
mode:
authorDarren Bane <dbane@tilde.institute>2020-05-16 00:53:00 +0100
committerDarren Bane <dbane@tilde.institute>2020-05-16 00:53:00 +0100
commit9e46aa07a574762db4bc14fd98eca81c4f323f7f (patch)
tree8cd16d173bb2fc1ef4e50434209769c35d694ff3 /btech.lsp
parentc066ab2a55a069802009568a051673b3505503d4 (diff)
downloadlsp-9e46aa07a574762db4bc14fd98eca81c4f323f7f.tar.gz
More playing around
Diffstat (limited to 'btech.lsp')
-rwxr-xr-xbtech.lsp27
1 files changed, 27 insertions, 0 deletions
diff --git a/btech.lsp b/btech.lsp
new file mode 100755
index 0000000..5a4d11b
--- /dev/null
+++ b/btech.lsp
@@ -0,0 +1,27 @@
+#!/home/dbane/openlisp-10.9.0/uxlisp -shell
+;;; ISLisp is fine so long as you do "read-line" from the same place you call the entry point fun.
+;;; So -shell with an immediate call doesn't work, something is closed after reading the Lisp source.
+;;; -shell -keep, supplying the call from the keyboard works fine.
+;;;
+;;; Calling entry point from a Lisp CLI (after "load") also works.
+;;; And this may be what I end up with, if I'm doing a view in Emacs.
+(require "cmd")
+(require "builtins")
+(defpackage #:btech
+  (:use #:cmd #:builtins)
+  (:export
+    #:main))
+(in-package #:btech)
+;; Favour symbols & objects over C-like numbers
+(defconstant +cmds+ (list
+                      (create-tab #'bt-quit "QUIT" 1)
+                      (create-tab #'help "help" 2)
+                      (create-tab #'look "look" 2)))
+(defun main ()
+  (read-line)                           ; Throw away LF
+  (format (standard-output) "> ")
+  (let* ((tab (lookup (parse (read-line)) +cmds+))
+          (f (fun tab)))
+    (funcall f)))                       ; I *think* this is better than (flet ...
+(provide "btech")
+(main)