stk/Demos/showvars.stk

57 lines
1.5 KiB
Plaintext
Raw Normal View History

1996-09-27 06:29:02 -04:00
#!/bin/sh
:;exec /usr/local/bin/stk -l "$0" "$@"
1999-09-05 07:16:41 -04:00
;;;;
;;;; Copyright <20> 1993-1999 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;; show-vars w var var var ...
;;;;
;;;; Create a top-level window that displays a bunch of global variable values
;;;; and keeps the display up-to-date even when the variables change value
;;;;
;;;; Arguments:
;;;; w - Name to use for new top-level window.
;;;; var - Name of variable to monitor.
;;;;
;;;;
;;;; Note that this demo is run with the -l option (instead of the classical -f)
;;;;
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 9-Aug-1993 22:06
1999-09-27 07:20:21 -04:00
;;;; Last file update: 13-Sep-1999 20:01 (eg)
1996-09-27 06:29:02 -04:00
(define (show-vars w . args)
(catch (destroy w))
(toplevel w)
(wm 'title w "Variable values")
(label (& w ".title")
:text "Variable values:"
:width 20
:anchor "center"
:font "-Adobe-helvetica-medium-r-normal--*-180*")
(pack (& w ".title") :side "top" :fill "x")
(for-each (lambda(i)
(let* ((w.i (& w "." i))
(w.i.name (& w.i ".name"))
(w.i.value (& w.i ".value")))
(frame w.i)
(label w.i.name :text (format #f "~A: " i))
(label w.i.value :textvar i)
(pack w.i.name w.i.value :side "left")
(pack w.i :side "top" :anchor "w")))
args)
1998-04-10 06:59:06 -04:00
(pack [button (& w ".ok") :text "Quit" :command (lambda () (exit 0))]
1996-09-27 06:29:02 -04:00
:side "bottom"
:pady 2))
(define a 1)
(define b '(1 2 (a b d) x 1))
(define c "A string")
(show-vars '.test 'a 'b 'c)
1999-09-27 07:20:21 -04:00
(format #t
"\n***\n*** Try to modify value of displayed variables with set!\n***\n\n")
1996-09-27 06:29:02 -04:00