summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdemo1.tl (renamed from demo1)0
-rwxr-xr-xdemo2.tl (renamed from demo2)0
-rwxr-xr-xdemo3.tl (renamed from demo3)0
-rwxr-xr-xdemo4.tl (renamed from demo4)0
-rwxr-xr-xdemo5.tl (renamed from demo5)0
-rwxr-xr-xdemo6.tl (renamed from demo6)0
-rwxr-xr-xdemo7.tl (renamed from demo7)0
-rwxr-xr-xdemo8.tl (renamed from demo8)0
-rwxr-xr-xdemo9.tl (renamed from demo9)0
-rwxr-xr-xdemos16
-rw-r--r--demostuff177
-rwxr-xr-xmakesans12
-rwxr-xr-xmakesans.tl2
-rwxr-xr-xmenu.tl (renamed from menu)0
-rwxr-xr-xsanssbclbin39493272 -> 0 bytes
15 files changed, 1 insertions, 206 deletions
diff --git a/demo1 b/demo1.tl
index 3a5647d..3a5647d 100755
--- a/demo1
+++ b/demo1.tl
diff --git a/demo2 b/demo2.tl
index cd757ce..cd757ce 100755
--- a/demo2
+++ b/demo2.tl
diff --git a/demo3 b/demo3.tl
index d2ec257..d2ec257 100755
--- a/demo3
+++ b/demo3.tl
diff --git a/demo4 b/demo4.tl
index 918df4a..918df4a 100755
--- a/demo4
+++ b/demo4.tl
diff --git a/demo5 b/demo5.tl
index bcf4cc2..bcf4cc2 100755
--- a/demo5
+++ b/demo5.tl
diff --git a/demo6 b/demo6.tl
index 75ba182..75ba182 100755
--- a/demo6
+++ b/demo6.tl
diff --git a/demo7 b/demo7.tl
index e816770..e816770 100755
--- a/demo7
+++ b/demo7.tl
diff --git a/demo8 b/demo8.tl
index 2893d2b..2893d2b 100755
--- a/demo8
+++ b/demo8.tl
diff --git a/demo9 b/demo9.tl
index 228c176..228c176 100755
--- a/demo9
+++ b/demo9.tl
diff --git a/demos b/demos
deleted file mode 100755
index 37008ba..0000000
--- a/demos
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-./sanssbcl 2> >(sed '/^Backtrace/,$d;/^; /d;/^$/d')
-
-# This script, demos, uses sanssbcl to run the demos, with or without
-# sbcl installed.
-#
-# sanssbcl has to be present with this script and the demo scripts.
-# To make the demos executable do this: chmod +x demos
-# To invoke the demos, do this: ./demos
-#
-# If you want to make sanssbcl, it can be made on a Linux PC that
-# has sbcl installed by using the makesans script. To make
-# sanssbcl there, do this: chmod +x makesans
-# ./makesans
-# Then you can copy sanssbcl to another Linux PC, whether it has
-# sbcl installed or not.
diff --git a/demostuff b/demostuff
deleted file mode 100644
index c3e3f0c..0000000
--- a/demostuff
+++ /dev/null
@@ -1,177 +0,0 @@
-#|
-This file of "demostuff", used by the demo scripts, loads Gtk
-and defines gapp, window, box, button, text, xtext, and xlabel.
- gapp Establishes a Gtk app. Its arguments are the app name
- and the code to be executed in the app.
- window Establishes a window. Its arguments are the name of
- the window object, the name of the app the window is
- used in, the window title, and the default width and
- height of the window.
- box Establishes a box to place Gtk objects in. Its three
- arguments are, first, h or v, for whether the contents
- of the box are to be organized horizontally or
- vertically, second, what box to establish, and third,
- what object the box is to be placed in.
- button Establishes a button. Its arguments are, what button
- to establish, the initial label text on the button,
- the object the button is to be placed in, and the code
- to be executed when the button is pressed.
- mbutton Is like button, except the button label text will be
- left-aligned instead of centered. It's for use in a
- column of buttons, such as a menu, where it might look
- neater to not center the button labels.
- text Establishes a text display object, which Gtk calls a
- label. Its arguments are the name of the text object,
- the initial text, and what object to place the text
- object in.
- xtext Is a function to display some text in a text object.
- Its arguments are what text object to display the text
- in, and what text to display.
- xlabel Is a function to update a button label. Its arguments
- are the button and the new text.
-|#
-
-(load-shared-object "libgtk-3.so.0")
-
-; Gtk relies on being able to divide by zero. To prevent it from
-; being an error, the following line changes the floating point
-; errors to just overflow and invalid, and not division-by-zero.
-; This isn't needed in most programming languages, because most
-; of them default to having it not be an error.
-(sb-int:set-floating-point-modes :traps '(:overflow :invalid))
-
-
-; Gtk function prototypes: each has a code, such as xx or vxs. The
-; first letter of the code is the return value type, and the rest are
-; the argument types:
-; v = void
-; x = void*
-; i = int
-; l = long
-; f = float
-; d = double
-; s = c-string
-; y = vxx function
-(loop as (gfunc xx) in
- '((gtk_application_window_new xx)
- (gtk_window_set_title vxs)
- (gtk_window_set_default_size vxii)
- (gtk_button_box_new xi)
- (gtk_size_group_new xi)
- (gtk_bin_get_child xx)
- (gtk_label_set_xalign vxf)
- (gtk_container_add vxx)
- (gtk_label_new xs)
- (gtk_label_set_text vxs)
- (gtk_button_set_label vxs)
- (gtk_button_get_label sx)
- (gtk_button_new_with_label xs)
- (gtk_widget_destroy xx)
- (gtk_application_new xsi)
- (g_application_run ixix)
- (g_object_unref vx)
- (gtk_widget_show_all vx)
- (g_signal_connect_data lxsyxxi))
- as types = (loop as x across (string xx)
- collect (ecase (char-downcase x)
- (#\v 'void)
- (#\x '(* t))
- (#\i 'int)
- (#\l 'long)
- (#\f 'float)
- (#\d 'double)
- (#\s 'c-string)
- (#\y '(function void (* t) (* t)))))
- as rv = (car types)
- as args = (loop as argname in '(a b c d e f g h i j k l m)
- as argtype in (cdr types)
- collect (list argname argtype))
- do (eval `(define-alien-routine ,gfunc ,rv ,@args)))
-
-
-; callbackname makes a callback name from an object name.
-; The eval-when makes it usable during macro expansions.
-(eval-when (:compile-toplevel :load-toplevel :execute)
- (defun callbackname (object)
- (intern (concatenate 'string (symbol-name object) "-CALLBACK"))))
-
-; window establishes a Gtk window object.
-; The arguments are, what window object to establish, what
-; application the window is used in, the window title, and
-; the width and height of the window.
-(defmacro window (awin app title wid ht)
- (eval `(defparameter ,awin nil))
- `(progn
- (setf ,awin (gtk_application_window_new ,app))
- (gtk_window_set_title ,awin ,title)
- (gtk_window_set_default_size ,awin ,wid ,ht)))
-
-; box establishes a box object. The arguments are, whether the box
-; contents are organized horizontally or vertically (h or v), what
-; box is to be established, and what object to place the box in.
-(defmacro box (hv abox placement)
- (eval `(defparameter ,abox nil))
- (let ((horizvert (case hv (h 0) (v 1) (t (error
- "The first argument to box should be h or v, not ~a" hv)))))
- `(progn
- (setf ,abox (gtk_button_box_new ,horizvert))
- (gtk_container_add ,placement ,abox))))
-
-; button establishes a Gtk button object. The arguments are,
-; the name of the button object, the text shown on the button,
-; what object to place the button in, and the action of the
-; button, which can be any sequence of code.
-(defmacro button (abutton buttonlabel placement &body body)
- (eval `(defparameter ,abutton nil))
- (let ((cb (callbackname abutton)))
- (eval `(sb-alien::define-alien-callback
- ,cb void ((a (* t)) (b (* t)))
- (declare (ignore a b))
- ,@body))
- `(progn
- (setf ,abutton (gtk_button_new_with_label ,buttonlabel))
- (g_signal_connect_data ,abutton "clicked" ,cb nil nil 0)
- (gtk_container_add ,placement ,abutton))))
-
-; mbutton is like button, except that the button label text will be
-; left aligned instead of centered, to make it neater in a column of
-; buttons, such as for a menu.
-(defmacro mbutton (abutton buttonlabel placement &body body)
- `(progn
- (button ,abutton ,buttonlabel ,placement ,@body)
- (let ((thelabel (gtk_bin_get_child ,abutton)))
- (gtk_label_set_xalign thelabel 0.0))))
-
-; text establishes a Gtk "label" object which is actually a text
-; display object. The arguments are, what text object to
-; establish, the initial text to display, and what object to
-; place this text object in.
-(defmacro text (atext text0 placement)
- (eval `(defparameter ,atext nil))
- `(progn
- (setf ,atext (gtk_label_new ,text0))
- (gtk_container_add ,placement ,atext)))
-
-; xtext changes the text in a text object.
-(defun xtext (textobject newtext)
- (gtk_label_set_text textobject newtext))
-
-; xlabel changes the text label on a button.
-(defun xlabel (button newtext)
- (gtk_button_set_label button newtext))
-
-; gapp establishes a Gtk application. The arguments are,
-; the name of the application object, and the code to be
-; executed by the application.
-(defmacro gapp (theapp &body body)
- (eval `(defparameter ,theapp nil))
- (let ((cb (callbackname theapp)))
- (eval `(sb-alien::define-alien-callback
- ,cb void ((a (* t)) (b (* t)))
- (declare (ignore a b))
- ,@body))
- `(progn
- (setf ,theapp (gtk_application_new nil 0))
- (g_signal_connect_data ,theapp "activate" ,cb nil nil 0))))
-
-; End of the demostuff file, which gets loaded by each demo script.
diff --git a/makesans b/makesans
deleted file mode 100755
index a33c8de..0000000
--- a/makesans
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/local/bin/sbcl --script
-
-; This script, makesans, uses sbcl to make sanssbcl, which can then
-; be copied to a Linux PC that doesn't have sbcl.
-
-(defun load-and-go ()
- (load "demostuff")
- (load "menu")
- (loop as n from 1 to 9 do (load (format nil "demo~d" n)))
- (menu))
-
-(save-lisp-and-die "sanssbcl" :executable t :toplevel #'load-and-go)
diff --git a/makesans.tl b/makesans.tl
index bef6fc3..f2b839b 100755
--- a/makesans.tl
+++ b/makesans.tl
@@ -4,7 +4,7 @@
; be copied to a Linux PC that doesn't have sbcl.
(defun load-and-go ()
- (load "demostuff.tl")
+ (load "demostuff")
(load "menu")
(each ((i (range 1 9)))
(load `demo@i`))
diff --git a/menu b/menu.tl
index a0d3dff..a0d3dff 100755
--- a/menu
+++ b/menu.tl
diff --git a/sanssbcl b/sanssbcl
deleted file mode 100755
index 71a7f6d..0000000
--- a/sanssbcl
+++ /dev/null
Binary files differ