commit 831a9f5c479be2053b0ff925d142f5ff9ce268f7 Author: Erick Gallesio Date: Fri Sep 27 12:29:02 1996 +0200 Commit of 3.1.1 version diff --git a/BINARY_DISTRIB b/BINARY_DISTRIB new file mode 100644 index 0000000..4ccb1ef --- /dev/null +++ b/BINARY_DISTRIB @@ -0,0 +1,31 @@ +Binary distributions are available at ftp://kaolin.unice.fr/pub/Binary. +If you succeed in compiling a version for which no binary is available +on the previous site, you can probably help other people by sharing +your binary. +To make a machine-specific binary: + + 1. Type 'make binary-release' in the main distribution directory. + 2. Create a README file for your distribution which indicates + the options you chose. A model of the README file is given below. + 3. Place the binary archive (the .tar.gz) and the README file in + ftp://kaolin.unice.fr/pub/Incoming/ + +Thanks + +______________________________________________________________________________ + + Sample README file for binary-release + ------------------------------------- + + + Author: + Email: + Creation date: + X11 version used: X11R +-------------------------------------------------- +Comments: + +-------------------------------------------------- +Configuration: + + diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..b0ac853 --- /dev/null +++ b/CHANGES @@ -0,0 +1,243 @@ +09/26/96 Release 3.1.1 +---------------------- + +This release is a bug correction release. It corrects a lot bugs. +A lot of theses bugs prevent to install it on some architectures. +Apart bugs: + + - Version of Tk is now at Tk4.1p1 level (last stable version) + + - a MS VC makefile is now provided for Win 32 thanks to + Caleb Deupree (I have changed some things + from the Caleb file but cannot test them, I hope this is correct) + + - Support for sockets on Win32 was done by Caleb Deupree on MS + VC. This should also work on BC++ but I'm not able to test it. + + +07/24/96 Release 3.1 +-------------------- + + - Version of Tk is now at Tk4.1 level. + + - STk run now on Win32!!! + Some details need a little more work (some oddities on file names + due to difference conventions between Unix and DOS, and things like + that). No socket support and no dynamic loading on Win32 + + - A complete documentation of STk widgets pages (both in nroff + and HTML format). The help command really allow you to browse + man pages now. Man pages are prefixed by "stk_" now to avoid confusion + with original Tk manual pages. + + - STklos is now integrated to STk (it was dynamically loaded before). + This simplify its implementation and speed up generic functions: + o gf are now 2-4 time faster + o gf are now tail recursive + o the MOP for gf is now "public" (i.e. you can change the way + gf are called in Scheme -- it was not possible with previous + versions without using C). + + - Port implementation is different: A port contains now its + input and output handler. New primitives to access the handler: + when-port-readable and when-port-writable. + BTW, The Tk function fileevent function is no more useful + (it is written in Scheme now for compatibility, but its usage + is deprecated). It may not be supported in a future release. + + - New composite widgets: and + which allow to have embedded windows. A multiple window + has a task bar below and allow to iconify inner-windows. + Some people think it looks like Win95 desktop ;-) + + - pixmap extension doesn't require anymore the Xpm library. Code + is stolen from the Tix Library. + + - New socket code which allow multiple concurrent connection + + - Extended types can now have a compare function which is called + when eqv? or equal? is called. This modification should be + compatible with the previous extensions (I hope so) + + - STklos: Two new methods: object-eqv? and object-equal? which are + called when applying eqv? or equal? to instances. + + - A rewriting of bind-for-dragging canvas method. You can now specify + a :before-motion, which if it returns #f, forbid to move the selected + canvas item. + + - New primitives:setenv!, posix-host-name, posix-domain-name, + posix-uname + + - Option separator "--" allows to pass reserved keyword (sush as -help) + to a script. Option and parameter cannot be mixed anymore + (i.e. calling stk xyz -help ==> *argv* = ("xyz" "-help") + + - HTML browser enhancement (support of the tag with SIZE + and COLOR sub-tags. This must be compatible with the HTML spec. + + - and of course many many bug corrections. + + +01/22/96 Release 3.0 (also called 3.0b2 by error) +~~~~~~~~~~~~~~~~~~~~ + - Version of Tk is now at Tk4.0p2 level + + - Support Pixmap images + + - Strings can now contain null charters (printing of strings is more + friendly now in write mode + + - Executable is now position independant(i.e. no path coded in hard in + the interpreter). STK_LIBRARY shell variable is no more necessary. We + can now make binary distributions. + + - Signal can now be redirected to Scheme closures. The end of a GC + is seen as a signal. + + - Trace on variable are changed (and re-work now): the associated trace + must be a thunk now. + + - New option for buttons, checkbuttons, radiobuttons and entries: + :stringvalue. + This options tells if the value must be stringified or not. + For instance, with + (radiobutton '.c :text "Try" :variable 'x :stringvalue #f :value 100) + will set the "x" var to "100" whereas with + (radiobutton '.c :text "Try" :variable 'x :stringvalue #t :value 100) + value is set to the integer value 100 + Default value for :stringvalue is #t for entries and #f for check and + radio buttons. + + - stk-wtour demo is updated for STk 3.0 + + - In STklos, if a method M is defined and if it is already bound to + a procedure, the old procedure is called when no method is applicable. + Example: + (define-method car ((x )) (- x 1)) + (car 10) ==> 9 + (car (cons 'a 'b)) ==> a + As a consequence, this kind of method cannot call no-applicable-method + if parameters are not valid: + (car (vector 1 2)) ==> error car: wrong type of argument: #(1 2) + + - Small change in the STklos hierarchy. is now a subclass of + and its meta class is . + + +10/07/95 Release 3.0b1 +~~~~~~~~~~~~~~~~~~~~~~ +A lot of modifications. Briefly, + - Support of Tk4.0 + - Closures are fully supported by Tk. That means that a callback can be + now a Scheme closure with its environment. GC problems with closures + and usage of the dirty "address-of" are definitively gone. + - HTML support (a browser is provided, should be extended to support + all HTML2.0) + - Documentation is now in HTML for the Tk commands (only a few commands + are ready for now, but they will be all defined in a near future). + - .... + + +07/15/95 Release 2.2 +~~~~~~~~~~~~~~~~~~~~ + +This is the last release with Tk 3.6. Next release will integrate Tk 4.0 + + - Bug corrections + - Changing Makefiles and configure files for better dynamic loading + integration. + - Adding support for BLT-1.7. This library can be loaded dynamically + on system which support it + - New option which permit to change the initial amount of cells + - Uses really LESS memory. + - New GC. Now we have a set of heaps and a new heap is allocated as + soon as the global space is "nearly" filled. + - SLIB support (just type (require "slib") and after that process as + indicated in SLIB documentation + - Integration of the Suresh Srinivas STk-wtour demo. + - Adding support for Text in STklos: Definition of the class + (and companion class). + - call/cc is now tail recursive. (Alas, methods and dynamic-wind are + not yet tail recursive). + - Better support for autoloading files + - Adding support for an exec function a` la Tcl (i.e. execute of a + unix process and keep its output in a Scheme string) + - General run-process for running Unix process were std{in,out,err} + can be redirected in files or in pipes. + - Some code has been rewritten to ease STk porting + - Adding support for regular expression pattern matching and + replacement + - There is now a light interpreter, called snow (for Scheme + NO Window); this is in fact the STk interpreter without Tk support. + This interpreter is an independant executable. It can be called + with the `snow' shell-script or by unsetting the DISPLAY variable. + - New organisation of intalled file to permit co-existence of + several version of STk or multi-architecture file sharing + - Dynamic loading support for NetBSD-1.0 + - Dynamic loading support for HP + - Dynamic loading and dump support for FreeBsd. + - Dynamic loading for Linux (using ELF format or the DLD package) + - A mini interface builder (very simplistic, but usable) + - New contributions: A true Tetris game, a 8 queens simulation and + a demo of composite widgets. + - Every exported identifier now starts with the string "STk_" to + avoid name clashes when embedding the interpreter in an application. + - BSD sockets support + - Better integration with Emacs + - AMIB (A Mini Interface Builder) + - A lot of improvement in STklos + - ..... + +See the ChangeLog file for more information + +============================================================================== +??/??/?? Release 2.1 +~~~~~~~~~~~~~~~~~~~~ + +This is a major release version. + + - STklos (the object layer) is now written in C. It is more than 150 + times faster than before and it uses less memory (~ 1/100)!!!! + - Improvement of STklos + - STklos classes have been written for all the Tk library widgets + - Composites widgets can be easily defined in STklos. Access to those + widgets is identical to C written one. + - bindings can be now true lambda expression with their own + environment (rather than list which are evaluated in the global + environment). + - Hash tables have been added. + - Small constants are coded on a pointer rather than a cell + - Support for dynamic loading on SunOs (4 and 5). Dynamic loading + uses shared objects (it should work also on OSF1) + - Dump creates now smaller images. + - Modification of configure and Makefiles to correct of a lot + of installation problems. + - Runs on Solaris 2.3 + - Bugs corrections + - Some modification to the error notifier + - Support of dynamic loading of shared objects on Solaris 1 & 2 (it + should work also on OSF1). + - ... + +94/01/03 Release 2.0 +~~~~~~~~~~~~~~~~~~~~ + + STk 2.0 contains a completly rewritten Scheme interpreter. This new + interpreter is + - R4RS + - faster than previous release (~ 3 or 4 times) + - less bugged (I hope :-) ) + - implements integers (32 bits and bignum) and floats + - cleaner with macros + + This version contains also a prototype of a graphical inspector which + permits to see/modify a variable value. For widgets variables it permits + to modify interactively their behaviour. However, it doesn't yet contain + a C rewritting of the object layer as it was planned. This will be done + in a (probably the) next release. + +93/09/02 Release 1.00 (first public release) +~~~~~~~~~~~~~~~~~~~~~ + + Forget it :) \ No newline at end of file diff --git a/COMPILING-HINTS b/COMPILING-HINTS new file mode 100644 index 0000000..d16ef29 --- /dev/null +++ b/COMPILING-HINTS @@ -0,0 +1,261 @@ +This File contains a set of hints for compiling STk and the things +which have been reported about installation of STk. This file is very +incomplete and I hope to be able to make it growing. + +If you experience a new port or confirm/infirm/add informations which are +specified here please send a mail to 'eg@unice.fr' (there is a blank form +at the end of this file) + +If you succeed in compiling STk on an architecture for which there is no +binary release, please read the file BINARY_DISTRIB + + +______________________________________________________________________________ +SunOs 4.1.x +______________________________________________________________________________ +Compilation: + CC=gcc + CFLAGS=-O2 + +X11: + R5 and R6 + +Dynamic loading: + I was not able to make a version using dynamic loading and the gnu + loader. If your version of gcc use gld, you'll have probably to use the + --disable-dynload option during configuration. (Note: I said probably + since a lot of things don't work on this system which has a gcc with + gld. Everything seems very poorly installed on this system) + + No problem with gcc and Sun ld. +Who: + Erick Gallesio (eg@unice.fr) +Tested: + Yes :) + +Remarks: + The main system used for developping STk + +______________________________________________________________________________ +SunOs 5.3 +______________________________________________________________________________ + +Compilation: + CC=gcc + CFLAGS=-O2 +X11: + OpenWindows + +Dynamic loading: + Should work. At least it seems to be conform to documentation :-> + Must be +Who: + Erick Gallesio (eg@unice.fr) + +Tested: + just make widget-demo + +Remarks: + Some people have reported that they use dynamic loading but I can + remember who (and it was on 2.1). + +______________________________________________________________________________ +Linux 1.0.9 -> 2.0.0 +______________________________________________________________________________ + +Compilation: + CC=gcc + CFLAGS=-O2 +X11: + XFree3.1.2 + +Dynamic loading: + Dynamic loading is supported for DLD and ELF. (however DLD hqs not + been tested since a long time, I'm not sure it continues to work). + The configure script try to figure what type of dynamic loading + works for you and enable dynamic loading by default. With recent + kernels, it will probably be ELF. + +Who: + Erick Gallesio (eg@unice.fr) + +Tested: + yes + +Remarks: + The other system used for developping STk. + +______________________________________________________________________________ +DEC Alpha OSF1 V2.0 +______________________________________________________________________________ + +Compilation: + CC=cc Dont't use gcc 2.6 !!!!!! + CFLAGS=-O2 +X11: + X11 R5 + +Dynamic loading: + Erik Ostrom told me to use ld for + makeing the .so file. I quote him below: + "If SH_LOADER is "ld", you get a huge warning about all the + undefined symbols; but if it's "cc", ld just won't make the + .so file. I assume there's a way to get better results, but + this at least produced a working system." + +Who: + Erick Gallesio (eg@unice.fr) + +Tested: + Not a lot. Only the widget demo and some bignum tests. + No more core dump on undefined variable + +Remarks: + Don't use gcc. STk worked with gcc prior 2.6. It doesn't work anymore +with this version of gcc. I have not investigated a lot with it but it seems +that gcc 2.6 is unable to compile the bignum stuff (it yields warning during +compilation whereas tthe code seems correct). Tests includes in the GMP +packages dont pass anymore. Consequently, all computation +which involve a bignum will be false (and could sometimes conduct to a core +dump). + + I don't use this system. +______________________________________________________________________________ +Dec 5xxx Ultix 4.2 +______________________________________________________________________________ + +Compilation: + CC=gcc + CFLAGS=-O2 +X11: + X11 R5 + +Dynamic loading: + Not supported + +Who: + Erick Gallesio (eg@unice.fr) + +Tested: + Widget demo work. + +Remarks: + I don't use this sytem. + +______________________________________________________________________________ +HP 9000/735 (HP-UX 9.01) +______________________________________________________________________________ + +Compilation: + CC=cc + CFLAGS='-Ae -O' + +X11: + ???? + +Dynamic loading: + Dynamic loading is supported (support is due to Dipankar Gupta + ). This support has been sent to me as a patch + file over 2.1. It must be extended for newer versions (the only file + to modify is Src/dynload.c). Furthermore, options needed for + compilation dosen't seems clear for me. I have guessed some of them + but I may be wrong. +Who: + ottl@informatik.uni-muenchen.de + +Tested: + Widget demo only (I think) + +Remarks: + Other people have reported that STk work on HP. I don't know if they + have used it a lot. Every info is welcome. + +______________________________________________________________________________ +SCO +______________________________________________________________________________ + +Compilation: + ??? + +X11: + ??? + +Dynamic loading: + ??? + +Who: + markd@grizzly.com + +Tested: + ??? + +Remarks: + +Use ptar (pax tar) to untar the distribution rather than standard tar. It +seems that the standard tar doesn't handle correctly symbolic links. + +______________________________________________________________________________ +NetBSD 1.0 +______________________________________________________________________________ + +Compilation: + ??? +X11: + XFree ???? + +Dynamic loading: + Yes. Contribution of Franke Ruediger (Ruediger.Franke@rz.tu-ilmenau.de) + +Who: + Franke Ruediger + +Tested: + ??? + +Remarks: + ???? + +______________________________________________________________________________ +SGI Irix 5.3 +______________________________________________________________________________ + +Compilation: + CC=gcc CFLAGS=-O2 +X11: + X11R6 + +Dynamic loading: + Dynamic loading is supported + +Who: + tiemann@cygnus.com + +Tested: + compiled, ran all demos (stk and stklos) + +Remarks: + +______________________________________________________________________________ +A new system (Mail this form to eg@unice.fr if you have made a new port) +______________________________________________________________________________ + +Compilation: + Indicate here the values of CC and CFLAGS you used +X11: + Indicate here the X11 version you used + +Dynamic loading: + Indicate here if dynamic loading is supported and all info that seems + necessary for loading a file in a running interpreter. + +Who: + your email or "Anonymous" if you don't want to bother yourself + with that anymore. + +Tested: + How much you have tested STk (just compiled it, tested only the + demos, ...) + +Remarks: + Everythink you think is relevant. + diff --git a/COPYRIGHTS b/COPYRIGHTS new file mode 100644 index 0000000..f6bd7fc --- /dev/null +++ b/COPYRIGHTS @@ -0,0 +1,126 @@ +Since I'm not a lawyer, I don't know where to put copyrigth notices +and permission notices of softwares I use. Consequently I put them here in +hope it's sufficient.... + +Note: + STk licence seems not to be as clear as I hope. The main idea is +that you can do what you want with STk. You can even use it in +commercial products. The only restriction is that you must prevent me +if you intend to use it in a commercial product (so I can send you a +"written permission" for efectively using it). The goal is not to +restrict commercial applications but only to count them. If someone, +fluent in english and which like those aspects, can help me to make +things clearer... + +============================================================================== + +TK/TCL Copyright +---------------- +Copyright (c) 1987-1993 The Regents of the University of California. +Copyright (c) 1994 Sun Microsystems, Inc. + +This software is copyrighted by the Regents of the University of +California, Sun Microsystems, Inc., and other parties. The following +terms apply to all files associated with the software unless explicitly +disclaimed in individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +RESTRICTED RIGHTS: Use, duplication or disclosure by the government +is subject to the restrictions as set forth in subparagraph (c) (1) (ii) +of the Rights in Technical Data and Computer Software Clause as DFARS +252.227-7013 and FAR 52.227-19. + + +Siod Copyright +-------------- + +/* Scheme In One Defun, but in C this time. + + * COPYRIGHT (c) 1988-1992 BY * + * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. * + * ALL RIGHTS RESERVED * + +Permission to use, copy, modify, distribute and sell this software +and its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all copies +and that both that copyright notice and this permission notice appear +in supporting documentation, and that the name of Paradigm Associates +Inc not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +Tiny CLOS copyright +------------------- + +;;; Copyright (c) 1992 Xerox Corporation. +;;;; All Rights Reserved. +;;; +;;; Use, reproduction, and preparation of derivative works are permitted. +;;; Any copy of this software or of any derivative work must include the +;;; above copyright notice of Xerox Corporation, this paragraph and the +;;; one after it. Any distribution of this software or derivative works +;;; must comply with all applicable United States export control laws. +;;; +;;; This software is made available AS IS, and XEROX CORPORATION DISCLAIMS +;;; ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE +;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +;;; PURPOSE, AND NOTWITHSTANDING ANY OTHER PROVISION CONTAINED HEREIN, ANY +;;; LIABILITY FOR DAMAGES RESULTING FROM THE SOFTWARE OR ITS USE IS +;;; EXPRESSLY DISCLAIMED, WHETHER ARISING IN CONTRACT, TORT (INCLUDING +;;; NEGLIGENCE) OR STRICT LIABILITY, EVEN IF XEROX CORPORATION IS ADVISED +;;; OF THE POSSIBILITY OF SUCH DAMAGES. + + + +and finally + +STk Copyright +------------- + +/* + * Copyright © 1993-1996 Erick Gallesio - I3S-CNRS/ESSI + * + * + * Permission to use, copy, and/or distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that both the above copyright notice and this permission notice appear in + * all copies and derived works. Fees for distribution or use of this + * software or derived works may only be charged with express written + * permission of the copyright holder. + * This software is provided ``as is'' without express or implied warranty. + * + * This software is a derivative work of other copyrighted softwares; the + * copyright notices of these softwares are placed in the file COPYRIGHTS + * + */ \ No newline at end of file diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..8e67d67 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,1196 @@ +Thu Sep 26 19:38:42 1996 Erick Gallesio + + * STk-3.1.1 Release + + * Demos/amib.stklos: Accessing help is now stk:show-help-file (the + change was not reported) + +Wed Sep 25 14:40:21 1996 Erick Gallesio + + * Src/slib.c (STk_delete_Tcl_child_Interp): new function which must + called by a child process just after a fork. This function is + necessary to allow the dynamic loading of posix.so in snow + (otherwise some Tk symbols are undefined). + + * Extensions/posix.c (posix_fork): Use now STk_delete_Tcl_child_Interp. + + * Src/number.c: Interface has been added for the Frank Schmuelling + complex-number package. Don't rely on it, since rationnal and + complex numbers will be present in a future release. As soon as the + full tower will be implemented in STk, this door will be closed. + +Tue Sep 24 18:26:06 1996 Erick Gallesio + + * Lib/dialog.stk: The text of the dialog was reset to a message, + instead of a label (when was the change done?) + +Mon Sep 23 22:52:10 1996 Erick Gallesio + + * Src/signal.c: A lot of modifications in signal handling. Major + rewrite of some procedures. The '^Z' signal works again. BTW, I + was unable to correctly catch a SEGV on linux (which is necessary to + find that no more memory is available on Linux, since malloc never + returns NULL this OS. Need more work. + +Sun Sep 22 23:54:44 1996 Erick Gallesio + + + * Src/toplevel.c (finish_initialisation): replaced the hard-coded + call to signal when using -f option to a call to the + STk_set_signal_handler. + + * Src/slib.c (cannot_allocate): new private procedure called when + there is no more memory during a must_malloc or a must_realloc (the + old behaviour was incorrecte since it uses cons whereas there was no + more memory, conducting to a buggy report-error message). However, + the copy on write schem used by Linux cannot be detected by this + procedure. It seems that we have to wait a SIGSGV signal. + +Tue Sep 17 10:03:49 1996 Erick Gallesio + + * Src/toplevel.c: Bug correction: only create the stdin handler when + the process is interactive (Otherwise, STk interpreters launched in + backgound by system keep locked -- heavily used in the + Doc/README.html demo) + + * STklos/Tk/Composite/Multipaned.stklos: Orientation of Multi-paned + didn't work since it was done with differents keywords (:orientation + and :position) in some places (thanks to MIZUSHIMA Kazunori + ) + +Fri Sep 13 08:22:41 1996 Erick Gallesio + + * STklos/Tk/Tk-methods.stklos: Bug correction in a method of focus + (Erik Ostrom ) + + * Src/io.c: + * Src/port.c: char-ready? was incorrect when used on stdin + (thanks to Erick Ostrom) + + * STklos/Tk/Text.stklos: Correction of the value field of text + widgets. Tk always add a newline at end of buffer. + + * Lib/tk-init.stk (%redefine-Tk-command): After STklos was loaded, + each call to focus implies the loafing of file focus.stk !! + + * Extensions/socket.c: Added support for sockets on Win32 (thanks to + Caleb Deupree ) + + * Src/unix.c: Added the VC++ support for file globbing (thanks to + Caleb Deupree ) + +Wed Sep 11 23:05:32 1996 Erick Gallesio + + * Src/tk-main.c: command line argument handling for -geometry was + broken. Thanks to Harvey J. Stein + +Fri Sep 6 18:20:28 1996 Erick Gallesio + + * Extensions/stack.c: Replaced FILEPTR by PORT_FILE in the stack + demo. Thanks to Jean-Marie Kubek + + * configure.in: Get rid of '-n' on echo commands. This option is not + supported under Solaris 2.x + +Wed Sep 4 13:16:38 1996 Erick Gallesio + + * configure.in: X11 libs/includes in non standard place were not taken + into account even when a --x-libraries or a --x-includes was given + to the configure script. + +Mon Sep 2 10:46:06 1996 Erick Gallesio + + * Tk: updraded to Tk4.1p1 + + * Src/eval.c: Bug correction in eval.c: arguments were not evaluated + when the generic function is implemented in Scheme rather than in C. + (Thanks to Jean-Christophe Pazzaglia ) + + * Lib/dialog.stk: Added a binding to the dialog window that sets the + result to -1; this is needed in case something happens that destroys + the window, such as its parent window being destroyed. + +Thu Aug 29 13:43:13 1996 Erick Gallesio + + * Src/slib.c (STk_quit_interpreter): replaced Tcl_DeleteInterp by a + call to delete the command ".". Otherwise, when the interpreter + delete all the commands and find ".", the process becomes + recursive. This yield problems when the interpreter has already + allocated images. + +Sat Aug 24 15:48:40 1996 Erick Gallesio + + * Src/io.c (STk_getc): Bug correction: when a handler was set on + stdin, and the process was interactive, the system loops + indefinitely. + + * Lib/text.stk: Typo on *tk-strict-motif* for + +Fri Aug 23 22:24:33 1996 Erick Gallesio + + * Src/toplevel.c (finish_initialisation): Modifications to allow + using stdin when using the "-f" option. Signaled by Erik Ostrom + + +Sat Aug 17 11:21:30 1996 Erick Gallesio + + * Src/io.c: Tcl_DoOneEvent parameter was "TK_DONT_WAIT", which is no + more necessary and which greatly increase cpu usage when used + interactively. Tcl_DoOneEvent is now 0 + +Tue Aug 13 18:00:10 1996 Erick Gallesio + + * STklos/Tk/Composite/*.stklos: Avoid to use a (require + "Tk-classes") since it can condut to problem if normal widget have + been loaded by hand before (i.e. without using Tk-classes) + + * Lib/posix.stk: The definition of posix-access? was inverted. + + * Src/posix.c (posix_access): corrected error messages typos. + + * Mp/Makefile: replaced make by $(MAKE) + + * New directory: Doc/LaTeX-packages: This dictory contains packages + which ares used in documentation but which are absent from some + Latex distributions. + + * Lib/process.stk: mispelling in string-append. Grrr. + + * Tk/configure: Bug correction: Not everybody has "." in its PATH. + + * Tk/unix/Makefile.in: Bug correction signalled by + Matthew.R.Wette@jpl.nasa.gov for X11 include files placed in non + standard place + + * Lib/Makefile: Bug correction signalled by + Matthew.R.Wette@jpl.nasa.gov when installing Lib files + + * configure.in: Changed Linux 2.x namimg scheme (I forgot that Linux + is now in 2.0!) + +Wed Jul 24 00:04:49 1996 Erick Gallesio + + * STk-3.1 Release + + * Src/stklos.c: The slot "name" in methods (which was always (buggyly) + set to "???") is gone. A new slot replace it: + "generic-function". The value of this slot is the generic function + to which the method belongs. + + Anonymous function have a "generic-function" set to #f. + + Potential problem: an anonymous method can be added to two different + GFs. In this case, the slot "generic-function" will be incorrect. + However, this should not be a problem since + 1. anonymous method are rare + 2. this is only used by STklos to find the class of the gf + (and not the gf itself) of a method when there is no + next-method when we applying a next-method.... + + * Tk/unix/tkUnixWm.c: A lot of adaptation to Scheme (empty lists + replaced by #f, mainly). This modificcations were needed for amib + whose save/restore didn't work in 3.0. + + * Tk/generic/tkPlace.c: Bug correction in the info suboption + +Tue Jul 23 10:11:28 1996 Erick Gallesio + + * Src/argv.c (STk_process_argc_argv): has been rewritten and is + table driven now. Parameters are processed analysed + differently now: the "--" option has been added to allow a clear + separation between interpreter arguments and scripts arguments + (as in Tcl). However, interpreter arguments must precede scripts + arguments (this is different from Tcl, but more Unixish). + + * Src/tk-main.c: Bug correction: if visual was incorrect the program + enter in an infinite loop. + + * Doc/Makefile: Tk Manuals pages are now prefixed by "stk_" + to avoid confusion with original Tk ones. They are always placed + in a subtree of the STk tree installation since it eases + the distribution of binary releases. + + * New demo: mc-server a multiple-client server. This is a first + version, because this demo should be graphical to see connections + and deconnection as they arrive. (Next release) + +Mon Jul 22 15:53:44 1996 Erick Gallesio + + * BINARY_DISTRIB: description of the way to make binary releases. + Binary release will be stored in ftp://kaolin.unice.fr/Binary + + * Lib/init.stk: + Lib/Makefile.in: Adding a site-scheme directory. This is + the standard directory for non standard stuff. Local scheme + files or extensions can be put in this directory. + +Sun Jul 21 17:53:35 1996 Erick Gallesio + + * Lib/init.stk: added the variable *shared-suffix*. It is equal to + "so", except on HP-UX whers it is set to "sl". All the Lib/*.stk* + files haves been modified to use this variable rather than hardcode + the usual ".so". I hope it will be OK for HP users. + + * Src/port.c (STk_open_file): new mode accepted "a" (for append). + +Fri Jul 19 14:36:04 1996 Erick Gallesio + + * Src/posix.c: + - Renamed posix-access to posix-access? (old name exists + for compatibility but will be garbaged in afuture version) + - Added the constant X_OK which was missing + +Thu Jul 11 22:21:30 1996 Erick Gallesio + + * Src/posix.c: New primitives: posix_host_name and posix_domain_name + based on gethostname and getdomainname (POSIX.1 does not define + these functions, but ISO/IEC 9945-1:1990 mentions them in B.4.4.1., + according to the Linux documentation. + + * Src/posix.c: New primitive: posix-uname + +Fri Jul 5 19:41:38 1996 Erick Gallesio + + * Lib/html.stk: Addition of the tag with SIZE and COLOR + sub-tags. This must be compatible with the HTML spec. The + tag which was STk-specific is deleted + +Mon Jun 10 00:05:16 1996 Erick Gallesio + + * Port implementation is different: A port contains now its + input and output handler. String ports have been changed accordingly. + +Sat Jun 1 21:23:01 1996 Erick Gallesio + + * STk works on Win32: However, there are a lot of minor + things which are not correct (fonts, cursors). It seems that + most of this small problems are already resolved with Tk 4.1 + (the official one). OK, start to port from Tk4.1a2 to Tk 4.1. + The main probleme will very probably be with the event loop. + +Mon May 27 10:42:58 1996 Erick Gallesio + + * Renaming files in STklos/Tk and STklos/Tk/Composite: they have now + a .stklos suffix (rather than .stk), because Win32 filenames are not + really case sensitives. + +Sat May 11 08:33:22 1996 Erick Gallesio + + * Integration of code modification for WIN32 port (snow only) + +Fri Apr 26 09:26:10 1996 Erick Gallesio + + * Src/primitives.c: + * Src/gc.c: + * Src/tcl-lib.c: Widgets don't capture anymore the environment. This + was necessary before release 3.0, but useless now. As a matter of + fact, widget-environment primitive has also been suppressed. Since it + was never documented, I doubt that someone will cry for it. + + * Src/cont.c: Bug: Changed "#ifdef sun" by "#ifdef sparc" for + flushing the registers window Useful for Sun3 (bug signaled + by Michael A. Patton ) + + * Lib/menu.stk: Tk:option-menu: function added (identical to the + Tcl one) + +Thu Apr 25 23:10:37 1996 Erick Gallesio + + * Tk/generic/tkMenu.c: Bug correction: tearoffmenucommand was not + defined as a closure. + +Wed Apr 24 16:21:42 1996 Erick Gallesio + + * Src/stklos.c: New protocol around gf: the following methods are now + called when an error occur with a gf call: + * no-next-method ((gf ) args) as CLOS + * no-applicable-method ((gf ) args) as CLOS + * no-method ((gf ) args) when calling gf + without method + +Tue Apr 23 23:02:26 1996 Erick Gallesio + + * STklos/stklos.stk: New protocol for calling standard generic + functions. This protocol is not used for real function (in + this case we use a completly C hard-coded protocol). When a subclass + of is applied, the interpreter uses the new protocol instead + of the C one. This "opens" the generic function mechanism: + - special generic function can easily coded in Scheme (but + they will be slow) + - standard generic functions are as fast as possible. + + This protocol provides the following generic functions: + * apply-generic ((gf ) args) + * sort-applicable-methods ((gf ) methods args) + * method-more-specific? ((m1 ) (m2 ) targs) + +Mon Apr 22 23:50:18 1996 Erick Gallesio + + * Src/boolean.c: + * Src/proc.c: + * Src/print.c: + * Src/gc.c: + * Src/stklos.c: + * Src/eval.c: STklos integration. Generic functions are recognized now + by the interpreter as standard STk objects (i.e. stklos is no more a + dynamically loadable extension). This integration provides: + - faster gf (the old way to implement gf is very general and + is not efficient (each call to a generic function implied + to search the way to apply the generic function in a table). + - gf are now properly tail recursive. + +Fri Apr 19 23:53:32 1996 Erick Gallesio + + * Src/print.c: Change -- address printing: the "#p" is no more used + when displaying an address. The #p is kept for Tk (of course) and + when using write. + +Sun Apr 14 19:05:50 1996 Erick Gallesio + + * Demos/compo-demo.stklos: New compo-demo for + + * STklos/Tk/Composite/Multiwin.stk: 2 new composite widgets: + : a window which can contain several windows + : a window embedded in a + The look is very similar to the Windows 95 explorer. + +Sat Apr 13 21:58:18 1996 Erick Gallesio + + * Tk/generic/tkEvent.c (Tk_AfterCmd): Bug correction for after idle + +Sun Mar 31 22:38:54 1996 Erick Gallesio + + * Src/unix.c: New primitive: setenv! + +Fri Mar 29 15:06:46 1996 Erick Gallesio + + * Src/gc.c (allocate_new_heap): Don't use must_malloc here since it + can conduct to call GC when allocating large heaps (typically with + large -cells xxx). + +Mon Mar 25 14:20:21 1996 Erick Gallesio + + * STklos/Tk/Canvas.stk: bind-for-dragging: bug correction end + enhancement. You can now specify a :before-motion and :after-motion + scripts. The old :motion is always accepted + (it's equivalent to :after-motion). If the :before-motion closure + returns #f, the object is not displaced and the :after-motion closure + is not applied. + +Mon Feb 26 16:11:30 1996 Erick Gallesio + + * STklos/stklos.stk: Two new methods are defined in STklos: + object-eqv? and object-equal?. They are called when doing an eqv? or + an equal? on STklos instance. These methods, which can of course be + specialized, return #f. + + * Src/boolean.c: Extended types can now have a compare function which + is called when eqv? or equal? is called. This function is called when + one of the arguments of eq*? is of an extended type. See the document + on Extending STk for details. + +Sat Feb 24 01:47:06 1996 Erick Gallesio + + * Port of STk on Tk4.1a2. + This should simplify the port on Windows. + +Mon Feb 19 17:19:49 1996 Erick Gallesio + + * Src/toplevel.c (repl_driver): STk_interactivep was not correctly + initialized. This seem to be a regression (or a quirk in the home & + work files) + +Fri Feb 16 14:49:48 1996 Erick Gallesio + + * Src/number.c (do_integer_division): Correction of a bug signalled by + Raymond Toy . Integer division of bignums was + buggy (aka Pentium symptom (except that it was always erroneous)). + +Mon Feb 12 00:03:55 1996 Erick Gallesio + + * Extensions/pixmap.c: Pixmap implementation uses now the file + tixImgXpm.c from the Tix Library (Author: Ioi Kim Lam). This + implementation doesn't need the Xpm library (which is difficult to + locate automatically with configure script and which has several + version with compatibily problems). + +Wed Jan 24 11:52:49 1996 Erick Gallesio + + * Src/print.c (STk_print): Bug correction. Print of special char in + Strings was buggy. Thanks Drew.Whitehouse@anu.edu.au for signalling + it. have also added \v and \a that I have forgot. + + * STklos/Tk/Composite/Scrollcanvas.stk: Correcting a small typo error + signaled by Ralf Berger . + +Sun Jan 21 23:57:37 1996 Erick Gallesio + + * STk-3.0 (official) release (aka known as 3.0b2 since I have forgot to + set the correct version name. + +Sun Dec 10 21:37:17 1995 Erick Gallesio + + * Src/promise.c (STk_force): + Bug correction for recursive expression in a force. It is now conform + to R4RS. + (define c #f) + (define p (delay (if c 100 (begin (set! c #t) (+ (force p) 1))))) + returns now the value 100 (and not 101). + This bug was raised with test.scm. + + ******************* + Changelog was not maintained for a while. I will try to update + it later. Sorry. + ******************** + +Sat Oct 7 14:57:01 1995 Erick Gallesio + + * STk-3.0b1 release + +Tue Jul 18 08:46:49 1995 Erick Gallesio + + * Starting STk 3.0 .... + +Mon Jul 17 20:55:27 1995 Erick Gallesio + + * 2.2 Release + * Src/syntax.c (STk_syntax_begin): begin, and & or were not always + tail recursives. This bug was detected (and corrected) by Lars Thomas + Hansen + * Doc/Reference/Reference2.tex: Documentation of new hash tables + +Sun Jul 16 10:30:26 1995 Erick Gallesio + + * Snow/run-snow.in: + * Src/run-stk.in: I have changed the machine determination scheme + to avoid problems on Sun (sun4m sun4 sun4c... are all the same, at + least for STk). For Linux, there is no more differerence between + the Intel rocessor used for compiling STk (i{345}86 are all the same). + + * Src/dynload.c: + * Src/configure.in: + * Src/Makefile.in: + * configure.in: + * Makefile.in: Support for ELF format under Linux. Thanks to + Johann Friedrich Heinrichmeyer and + + * Src/slib.c (STk_machine_type): + * Src/toplevel.c (print_banner): MACH define has been changed by MACHINE + to avoid problems with Mach systems. + +Sat Jul 16 23:30:27 1995 Erick Gallesio + + * Doc/Extension/Extending.tex: Adding documentation for Tcl widget + integration + +Thu Jul 13 09:04:54 1995 Erick Gallesio + + * Doc/Reference/Appendix-D.tex: Description of Ilisp, CMU Scheme packages + * Doc/Manual/stk.txt: New manual page. Manual page is now installed in + $(prefix)/man/man1/stk.1 + + * Src/error.c (STk_err): Don't print a line number when error comes from + stdin. + + * Src/stk.h: + * Src/toplevel.c: + * Src/argv.c: New option: -interactive to force the + interpreter to be interactive, even if it doesn't seem to + be. This is useful when using STk under Emacs. + When STk is interactive, stdout and stderr are now unbuffered. + * Src/port.c (STk_init_standard_ports): line buffering of Stderr has been + deleted. Everything is done now in toplevel.c (depends on the + -interactive flag + + * Lib/regexp.stk: Bug correction in regexp-replace-all when replacing + string appears in the string to replace. Correction is due to + Sean Slattery + +Wed Jul 12 09:57:10 1995 Erick Gallesio + + * Src/syntax.c (syntax_let_family): Don't signal an error if a + symbol is defined twice in a let*. Formal semantics given in R4RS + allows it (whereas textual explanation seems to forbid it. + Problem was found by Brent Knight . + + * Src/port.c: New definition of macro READ_DATA_PENDING for + ELF compiling. Thanks to Jin S. Choi + for the bug correction. + + * Lib/init.stk: Macros are now defined in the global environment. + This avoids problems when some primitives procedure are redefined. + All the primitive should be protected for those redefinitions. + + * Lib/Makefile (install): prolog.ps is now placed in the good directory + + * Tk/tkCanvas.c (CanvasWidgetCmd): Correction of a bug signaled by + Johann Friedrich Heinrichmeyer. The result of the poscript command + must be "stringified". + + +Tue Jul 11 21:16:17 1995 Erick Gallesio + + * STklos/Tk/Canvitem.stk (initialize-item): INCOMPATIBLE CHANGE + in canvas has been renamed in to avoid a conflict + when using both cnavases and texts widgets. + Demos have been modified to take this modification into account + + * STklos/Tk/Composite/Scrollcanvas.stk (): + * STklos/Tk/Composite/Scrollbox.stk (): Bug correction in + background propagation. (Bug signaled by H. J. Stein) + + +Tue Jul 11 16:31:44 1995 Erick Gallesio + + * Correction of several bugs signaled by Eric Ostrom on text widget + +Fri Jul 7 23:27:17 1995 Erick Gallesio + + * Tk/tkWindow.c (Tk_CreateMainWindow): + * Src/toplevel.c (init_interpreter): Init system path from + STK_LIBRARY shell variable. This variable MUST be initialized now + (this is done in the stk or snow scripts). This allows us to make + binaries which are independant of their location. This will permit + to distribute binaries on kaolin. + + * Src/hash.c: Modification of the hash table module to take into + account an optional parameter which specifies the comparison function. + This permits to have equal? eqv? eq? or string? hash tables for instance + +Tue Jul 4 14:04:49 1995 Erick Gallesio + + * Src/port.c: + * Src/sport.c: Minor code cleaning (using STk_is_thunk) + +Fri Jun 23 22:27:26 1995 Erick Gallesio (eg@unice.fr) + + * STklos/Tk/Composite/Scrolltext.stk (): bug correction + in background propagation + +Mon Jun 5 18:03:47 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * STk-2.1.7 release + + * Extensions/posix.c: An extension for using Posix primitives in + Scheme. Far from complete. This is just a start. Any help on this + point would be appreciated. + + * Doc/Extension/Extending.tex: A new version which is more (but not + totally :-<) complete. + * Extensions/stack.c: a new file used for illustating the document + "Extending the STk interpreter" + + * Demos/amib.stklos: A new version of the interfac builder which + is usable now. This version handle the packer and the placer. + + * STklos/Tk/Composite/Multipaned.stk (initialize-composite-widget): + Addition of the Multipaned composite widget. Thanks to Harvey J. Stein, + for his modifications. + +Sat Jun 3 00:44:53 1995 Erick Gallesio (eg@unice.fr) + + * Lib/init.stk: + * Src/syntax.c: Rewritting of "while" and "unless" in C + + * A new type: tc_ssubr. This type is temporary and will change in + the next release. This type correspond to all n-ary functions of + number.c. Correction of an ENNORMEOUS bug: There was a double + evaluation when fsubr where called by apply!!!. Fsubr cannot be + applyed now (ssubr are the only procedure with non evaluated + parameter which can be appyed. + + * Src/proc.c (STk_procedurep): (Procedure? a-tk-command) => #t now + * Lib/inspect-misc.stk (inspect::typeof obj): correction of a bug + introcuced in the inspector by previous modification + +Fri Jun 2 00:07:20 1995 Erick Gallesio (eg@unice.fr) + + * Src/gf.c (find_method): Code cleaning. + +Thu Jun 1 19:29:39 1995 Erick Gallesio (eg@unice.fr) + + * Src/port.c (do_load): I have added a comment when a file has + finished to be loaded, as suggested by David Fox. + + * Src/gc.c (gc_sweep): GC calls now Tcl_DeleteCommand when a new + command is deleted. See below ... + + * Src/tcl-lib.c: Modifications of {Create,Delete}Interp and + {Create,Delete}Command to really execute the detete code of a + Tk-command. This seems to be useful only for the send command + annd "." command (but would also be probably useful for future + tcl extensions). The "send" associated delete proc permits to + unregister the interpreter from the X server (bug signalled by + Sean Slattery slttery@GS148.SP.CS.CMU.EDU and that I have never + seen !!!!). + +Mon May 29 17:04:53 1995 Erick Gallesio (eg@unice.fr) + + * STklos/Tk/Message.stk (): Deleteing the class + from class. This was erroneous. + +Fri May 26 23:52:40 1995 Erick Gallesio (eg@unice.fr) + + * STklos/Tk/Toplevel.stk (): Adding the :init-keyword + for class and display slots. This modification was necessary for + the new AMIB. Min-size and max-size slots contain now a string + and class and display slots contain a string (it was a symbol) + + * STklos/Tk/Frame.stk (): Adding the :init-keyword for + class slot Class slot contains a string (it was a symbol) + +Fri May 19 22:44:59 1995 Erick Gallesio (eg@unice.fr) + + * Src/sport.c (STk_get_output_string): Correction of a bug + signalled by Fritz.Heinrichmeyer@fernuni-hagen.de + +Wed May 3 12:59:24 1995 Erick Gallesio (eg@unice.fr) + + * STklos/Tk/Composite/Paned.stk (motion-grip): Applying the patch + of Harvey J. Stein which constraints + the grip ]0..1[ This permits to avoid its disappearance. + +Tue May 2 00:05:55 1995 Erick Gallesio (eg@unice.fr) + + * STklos/Tk/Tk-methods.stk: This file is always loaded now (it was + loaded only when Tk was initialized before). Read the comment in + this file when re-using STk images. *top-root* initialization is + in Tk-methods.stk rather than Toplevel.stk now. + + * Lib/tk-init.stk (Tk:initialized?): a new variable which is set + to #t when Tk is fully initialized + + +Mon May 1 16:55:18 1995 Erick Gallesio (eg@unice.fr) + + * Src/stklos.c (display_instance): + * Src/error.c (STk_err): + * Src/eval.c (STk_show_eval_stack): + * Src/port.c (STk_write): + * Src/tk-glue.c (STk_convert_for_tk): + * Src/toplevel.c (repl_loop): + * Src/extend.c (internal_display): + * Src/print.c (STk_print): All those files have been modified for + giving the port (a SCM object) to the procedure which do a print + rather than a FILE *, which is more general. This modification is + necessary for permitting a real display_object in extension. STklos + uses this for the {write,display,tk-write}-object methods. + +Tue Apr 25 14:57:48 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/number.c (STk_gcd): Bug correction in lcm, gcd, min and max (arguments + were evaluated several times!!!!). + +Tue Apr 18 14:55:23 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * STklos/Tk/Composite/Scrolltext.stk: New file. It implements what + you think it should!! + + * STklos/Tk/Composite/Scrollcanvas.stk: New file. It implements + what you think it should!! + + * STklos/Tk/Composite/Scrollbox.stk (): Scroll + listbox accept now horizontal scrollbar. + +Sat Apr 15 15:40:40 1995 Erick Gallesio (eg@unice.fr) + + * Tk/tkListbox.c (ListboxWidgetCmd): Correction of an old old bug: + Getting an element of listbox always retusrns a string. However, + this modification breaks down the inspector.... (it is time to + rewrite it....) + +Fri Apr 14 23:32:42 1995 Erick Gallesio (eg@unice.fr) + + * Src/number.c (STk_round): Bug correction. (Round x) must returns + the closest integer to x, rounding to even when x is halfway + between two integers. + +Fri Mar 31 00:15:36 1995 Erick Gallesio (eg@unice.fr) + + * Src/configure.in: Adding test for the existence of the pid_t + type. This is needed for porting STk on Sony WS (Sony NEWS, + NEWSOS 4.2R) Thanks to Nobuyuki Hikichi + + * Lib/init.stk (random): have been extended to allow the result to + be a bignum. Here again, thanks to Nobuyuki Hikichi + + +Sat Mar 25 23:33:54 1995 Erick Gallesio (eg@unice.fr) + + * STk/read.c: Modification of the reader to remember current + filename and line counters. This eases debugging since error + messages can display those informations. + +Thu Mar 16 15:32:59 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/extend.c (STk_define_C_variable): New function. This + function permit to establish a link between a C variable and a + Scheme one. Once this link is established, every reading of the + variable will call a getter function and every write will call the + setter function. No data is used in the Scheme space, variable + value is a C data. + +Wed Mar 15 17:21:40 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * New primitive type: C-pointer. This is a Scheme type to wrap a C + pointer. It greatly eases communication with C. + + * Src/extend.c: New file. This file contains all the code for + extensions and C pointers. It contains a ot of code from old + dynload.c. File dynload.c contains now only the function which do + dynamic loadind (and which is very sytem dependant. + +Tue Mar 14 13:30:11 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/slib.c (STk_internal_eval_string): Bug correction. The error + context was false. + +Fri Mar 10 15:55:47 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/userinit.c (STk_user_cleanup): STk_user_cleanup has been added. + + * Src/port.c (STk_init_standard_ports): Error file is now line + buffered. This gives better performances when used under emacs. + + +Thu Mar 9 12:49:43 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Added support for dynamic loading under Linux (with DLD). Code + is inspired from a contribution of Patrick Nguyen + (pnguyen@elde.epfl.ch) + +Sun Mar 5 16:06:11 1995 Erick Gallesio (eg@unice.fr) + + * Src/port.c (STk_char_readyp): Added support for char-ready. Code + should not be very portable... + +Sat Feb 25 11:51:45 1995 Erick Gallesio (eg@unice.fr) + + * Src/slib.c (STk_get_internal_info): Bug correction: the result + was completely erroneous. Is it possible that I have tested this + function without having seen this???? + + * Dynamic loading should work for OSF1 (Thanks to Erik Ostrom + ) + +Sun Feb 12 18:00:15 1995 Erick Gallesio (eg@unice.fr) + + * 2.1.6 release + +Sat Feb 11 23:23:15 1995 Erick Gallesio (eg@unice.fr) + + * Src/env.c (STk_parent_environment): New function. It was time to + write it... + + * Src/port.c (STk_error): Set context to ERR_OK but keep the bit + indicating if error must be caught or not. + + * New version of blt for STk. Some minor changes for compiling it + with new C conventions. + +Thu Feb 9 23:21:52 1995 Erick Gallesio (eg@unice.fr) + + * STklos/Tk/Basics.stk: Tk::find-option is defined as autoload to + permit image creation. + + * STklos/Tk/Toplevel.stk: Definition of *top-root* is deferred + until first creation (to allow image creation) + + * STklos/Tk/Tk-methods.stk: New file. This file contains the + redefinition of Tk commands as methods. This file is loaded when + the first Tk object is really created. Deferring the loading of + this file permits to make images of interpreters containing Tk + classes. + + +Thu Feb 2 23:15:15 1995 Erick Gallesio (eg@biot) + + * Src/unix.c (absolute): Bug correction for file name with mutiple + dots such as "...1../2" which were improperly expanded + + * Src: Yeaaah. All the symbols defined by STk are now prefixed by + "STk_". It tooks me some days to obtain this. I take this + occasion to pass through the code and try to ameliorate things + rather than using brute force. + +Wed Feb 1 02:17:12 1995 Erick Gallesio (eg@biot) + + * Socket support has been rewritten. It is now configured by + default. New model seems more simple (at least for me) and more + coherent with the process extension. + +Tue Jan 31 10:30:29 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Modification of all Makefile to use $(MAKE) rather than make as + suggested by Christian Lynbech + +Mon Jan 30 15:22:06 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Tk/tkConfig.h: Modifications for HPUX. + +Sun Jan 29 15:11:06 1995 Erick Gallesio (eg@biot) + + * Src/process.c: Completely cleaned up. Table of processes is + managed by the SIGCHLD signal if it exists. On machines without + job control, process management is done by hand. Some new function + have been added (suggested on the mailing list by Giorgio Cesana + ): process-exit-status, process-stop, + process-continue, process-send-signal. + + (run_process): A new option: ":host" which permits to execute the command + on a distant host. + +Mon Jan 23 12:07:23 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/tk-main.c (Tk_main): adding code for managing argument line + -geometry option. It was missing.... + + * Src/stklos.c (make_primitive_classes): Adding the new primitive + class which is the ancestor of and . Suggested + by Harvey J. Stein (hjstein@math.huji.ac.il) + +Sun Jan 22 18:12:02 1995 Erick Gallesio (eg@biot) + + * Demos/inspector.stk: A small demo, for showing usage of the + inspector with Tk object. A very simple thing but this seems to be + rather unknown. + +Sat Jan 21 23:01:15 1995 Erick Gallesio (eg@biot) + + * Src/read.c (lreadr): Cosmetic changes. Using the sym_XXX + variables instead of interning them at each time. + + * Src/gc.c (allocate_new_heap): Setting of the field gc_mark to 0 + for all new allocated cell. Thanks to Chet Murphy + for this bug correction. + + * Src/toplevel.c (init_interpreter): Bug correction: sym_unquote + was gc protected twice whereas sym_unquote_splicing was not. A + cut/paste error which took 2 days to debug :-( + + +Mon Jan 9 12:06:08 1995 Erick Gallesio (eg@kaolin.unice.fr) + + * Configure and Mafefile files modifications to allow dynamic + loading under Irix 5.3. Thanks to Michael Tiemann + for the patches. + +Sun Jan 1 21:10:45 1995 Erick Gallesio (eg@biot) + + * One important thing :-) Adding 1995 in all the files which + contains a copyright notice. This is the good day for doing that + (an only that!). + +Fri Dec 30 17:56:40 1994 Erick Gallesio (eg@biot) + + * New organization of Tcl files. All The Tcl files have been + updated to release 7.4b1 (the Tcl release that comes with Tk + 4.0b1). The file Src/tcl-util.c has shrink a lot and most of it + is now in Tcl/tlUtil.c (in fact a copy of the original file with + some #ifdefs). This last change is break the previous philosophy + of libtcl.a (a library of Tcl file *unmodified*) but changes are + minor and I hope that it will ease the port to new version of + Tcl/Tk which semble very instable at this time. + +Wed Dec 28 18:14:22 1994 Erick Gallesio (eg@biot) + + * Lib/error.stk (report-error): Modification of error message format + + * Src/primitives.c: Deleting the definition of the "lindex" + primitive which doesn't serve anymore. + +Tue Dec 20 12:02:00 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/syntax.c (syntax_define): "Bug" correction: When using a + local "define", There was a duplication of the binding if the + symbol was already defined in the out most environment. Since the + new binding was placed before the older one, good value was + found. However, it makes environment bigger than necessary + (and strange result when using environment->list). + + * Src/env.c (value_in_env): New function. It returns the value of + var in given env. Search is done only at out most level. This + function is an utility function for local "define". + +Mon Dec 19 12:08:31 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/stk.h (MAX_CHAR_CODE): Correct value is 255 (it was 256) + +Fri Dec 16 16:06:57 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * STk 2.1.5 release + +Fri Dec 16 13:56:25 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/dynload.c: Adding support for HPUX (thanks to ipankar Gupta + ) + + +Fri Dec 9 22:15:34 1994 Erick Gallesio (eg@biot) + + * Snow/run-snow.in: There is now a new interpreter, called snow + (for Scheme NO Window), which is the STk interpreter without Tk + support. This interpreter is an independant executable. It can be + called with the snow shell-script or by unsetting the DISPLAY + variable. + +Thu Dec 8 22:47:44 1994 Erick Gallesio (eg@biot) + + * Makefile.in: Modifications of all configure.in and Makefile.in. + Now we can + - share versions of STk between different architectures + - have several versions of STk installed on the same machine + +Wed Dec 7 21:46:44 1994 Erick Gallesio (eg@biot) + + * Src/dynload.c (load_object_file): Adding dynamic loading support + for NetBSD-1.0 (i386-port). Thanks to Franke Ruediger + (Ruediger.Franke@rz.tu-ilmenau.de) for the patch. + +Tue Dec 6 00:26:48 1994 Erick Gallesio (eg@biot) + + * Src/tk-glue.c (execute_Tk_lib_cmd): GC bug correction. There was a + bug when a GC occured during the creation of the argv array of a Tk + command. This bug occured on Linux with -O2; Correcting it doesn't arrange + things==> Usage of an equivalent code. Thanks to H. Stein for signaling this bug. + + +Sat Nov 26 10:46:58 1994 Erick Gallesio (eg@biot) + + * Src/stklos.c: Changing all the "class" variables by "clath" for + C++ users + + * Src/port.c (loadfile): All the code for loading file is now + written in C and things are more "orthogonal". New variable + defined: *load-suffixes*. + + * Src/toplevel.c (repl_driver): Move of user init initialisation + so taht they are taken into account in case of a "stk -f" (thanks + to Brian Webb webbb@aies.tucson.saic.com) + +Wed Nov 9 13:54:34 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * STk-2.1.4 release + +Thu Nov 3 23:20:06 1994 Erick Gallesio (eg@biot) + + * A New datatype: regular expressions. They are defined in a + dynamic loadable file (for the regexp compiler and the apply + function) and in a Scheme file + (mainly for the regexp-replace[-all] procedures + +Wed Nov 2 16:49:07 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * file-is-xxx? and file-exists? are now written in C + + * Elimination of %file and %string Tcl command. Those commands + were used behind the scene to avoid some rewriting. No code in the + distribution should use them. This conduct to the defineition of + two new primitives string-index and file-is-executable? (which was + forgotten in previous releases). + +Mon Oct 31 11:04:27 1994 Erick Gallesio (eg@biot) + + * Src/hash.c (hash_table_stats): Circumvent a bug in Tcl code on + empty hash tables (see comment in source file) + +Fri Oct 28 14:23:36 1994 Erick Gallesio (eg@biot) + + * STklos/Tk/Toplevel.stk (): All the "wm" Tk-command + options are now available through Toplevel slot accesses (Idea + from Rob Deline) A New global variable: *top-root*: This is a + toplevel which contains the *root* window. Changing the name of + the root window can now be done by + (set! (title *top-root*) "New title") + +Tue Oct 18 14:42:55 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/number.c (lround): Rewritten to avoid the use of the rint(3) + function which does'nt seems to exist on some systems (SCO and + some HP at least) + +Mon Oct 17 18:29:31 1994 Erick Gallesio (eg@biot) + + * Lib/editor.stk (stk:all-fonts): Various font specifications + changes (those which where used in all the Lib directory where not + portable. + +Mon Oct 17 11:38:17 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/slib.c (lrandom): Bug correction (bignum where not allowed + as parameter => (random(random 10)) was invalid since result of + random is always a bignum + (bug signaled by Markus Armbruster ) + +Fri Oct 14 09:02:12 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * New procedure: run-process which permit to run a process with + redirection off the stdin, stdout and stderr. The code is a + rewriting of the Alexander Taranov, Grygory Niconov and David + Tolpin contribution. + +Thu Oct 13 14:56:05 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/number.c: Add a rint compatible function for systems which + desn't provide one (SCO apparently -- signaled by + markd@grizzly.com) + +Wed Oct 12 15:12:51 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * New functions for port manipulation (port->string + port->string-list ....) With those function, it is easy to + write a Tcl-like exec. All those function are written in + Scheme. + +Tue Oct 11 15:53:49 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/slib.c (set_random_seed): modified to allow bignums for the seed. + +Mon Oct 10 14:16:52 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Minor modifications to allow a better compilation on some C and C++ + compilers. + +Sun Oct 9 18:19:01 1994 Erick Gallesio (eg@biot) + + * Bug correction: the eval_stack (which serves ONLY for displaying + context upon error was not corectly managed on "tail recursion + elimination". This leads to memory consumption on infinites loops. + +Tue Sep 27 11:46:01 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * STklos/tk-classes.stk: Creation of a new file which define a set + of autoloads. Those autoload permits to avoid to use a long list + of require at the beginning of programs + + * Src/port.c (do_autoload): Adding support for autoload in C. Now, + any kind of symbol can be autoloaded. + +Thu Sep 15 16:36:01 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * 2.1.3 Release + +Wed Sep 14 18:52:14 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/stklos.c (make_instance): GC bug correction in a critical + section of code. + + * Src/macros.c (lmacro): GC bug correction in a critical section + of code. + + * Src/symbol.c (intern): modification of a critical section of + code a GC could occur between the hash table entry creation and + the end of its initialization. Correction of the same kind of + problem in keyword.c. Bug discovered by Rob Deline. + + * Src/stklos.c (modify_instance): Bug correction (change-class + make a twist between old and new instance) ==> following GC free + the bad instance data !! + +Fri Sep 9 13:40:12 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Packing of the STk2.1.2 release + +Thu Sep 8 09:27:16 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * STklos/stklos.c: Definition of a slot_set_if_unbound which only + affect a slot if needed. This function is used in the slots + initialization process. Now, things are corrects when a slot + :initform is overloaded by inheritance or when initialization is + done in an initialize followed by a next-method + (i.e. it's the user value which is taken instead of the default one). + + * Src/gc.h: re-integretate gc_protect (can be useful for extension + writers) + + * After 3 days continuations are tail recursive..... I thought I + will become crazy before I found the little typing mistake (a + lsubr instaed of a tsubr in primitives.c) which makes things + weird. + +Mon Sep 5 18:37:16 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Symbols and keywords use now Tcl Hash table (which grow + dynamically). Keywords share now memory. This reduces drastically + space occupation. (Old symbol table uses conses, and keywords + where not shared). Unused symbols can be GCed now. + + * Change class bug correction (Thanks to Rob Deline). + +Fri Sep 2 11:41:04 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * -image can be specified needs not anymore to be the first + argument of the command line. + + * Src/argv.c: "-cells" can be specified when calling stk. This + give the amount of cells created upon init. + +Wed Aug 31 14:17:44 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/argv.h (save_unix_args_and_environment): moved to + argv.c. This new file contains all the argc/argv/env stuff. STk + doesn't rely anymore on Tk code for parsing command line + arguments. This permits to have a arguments processing even if not + compiled with -DUSE_TK. + +Tue Aug 30 13:39:53 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Tk/tkArgv.c (Tk_ParseArgv): + + * Src/gc.c (init_gc): GC complete revision: Now we have a set of + heaps and a new heap is allocated as soon as the global space is + "nearly" filled (I have fixed nearly to 75%). User can maually + grow the heap by using extend-heap. There are time statitics now + indicating how much time is spent in GC. + +Mon Aug 29 12:35:05 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/cont.c (throw): bug correction in + continuations. Specifically, the gc_mark phase for the + continuation blocks may fail because the stack starting and ending + addresses used in the code are both (char *), not (SCM *), + aligned, and the stack is copied in bytes, not in SCMs. on char * + rather than SCM. This bug was discoverred by Felix Wu + (wu@cadence.com) + + * Adding SLIB support (i.e. I have written the STk.init + file). Some modifications in stk.init were needed (accepting the + ".scm" suffix mainly) + + * Src/macros.c (expand): Cleanup in macros. We have now + macro-expand and macro-expand-1 + +Thu Aug 25 15:59:33 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/number.c (do_integer_division): bug correction for + modulo. The fix is due to kerch@parc.xerox.com. + +Wed Aug 24 12:02:41 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Src/number.c (integerp): Bug correction. integer? must returns + #t even if the value is an inexact integer. + + * port.c: - modification to allow close-port on string-port + - if the first char of a filename is a pipe ("|") character, + usage of popen instead of fopen. This permits to define + "pipe ports" very easily as in Tcl. + + * Integration of the Suresh Srinivas STk-wtour demo to the + Contrib. Some minor bugs have been fixed and some new lessons have + been added. Hierarchy was modified to fit to the contrib + directory. + +Tue Aug 23 17:16:34 1994 Erick Gallesio (eg@kaolin.unice.fr) + + * Definition of a file compatibility file which assume compatibily + among versions. When this file is loaded, a message will be + printed, saying that you have to upgrade your source. + + * Adding support for Text in STklos Definition of a new version of + the STF format (0.2) which permits to load and save files with + their enhancment (font, color, ...). Now, tags can be dynamically + created (instead of choosen in a fixed list). A compatibility + mode is provided (see above) + + + diff --git a/Contrib/%README b/Contrib/%README new file mode 100644 index 0000000..fda0b43 --- /dev/null +++ b/Contrib/%README @@ -0,0 +1,40 @@ +This directory contains contributions which have been sent to me. + +Inspect + The STk-inspector (contributor Erick Fintzel -- fintzel@kaolin.unice.fr) +Pretty + A pretty printer (contributor Martine Follen -- mf@unice.fr) + +Process + A set of new primitives to deal with Unix processes. This contribution will + be included in the core interpreter in the next release (contributors + Alexander Taranov, Grygory Niconov and David Tolpin -- tay@jet.msk.su, + gn@jet.msk.su and Dvd@CIM.Msk.SU) + +Python + A patch which permits to communicate with a Python interpreter + (contibutor jredford@lehman.com) + +Socket + An implementation of BSD-INET sockets and is known to run on + Solaris 1 and Linux. This is the starting point of current implementation. + Contributor: David Tolpin (dvd@pizza.msk.su) + +Stetris + This is a falling block game not unlike tetris(tm) :). It is + implemented in STk just to prove it can be done, and as a challenge to + TCLers. (contributor Harvey J. Stein -- hjstein@math.huji.ac.il) + +STk-wtour + A rewritting of the Andrew Payne Tcl/Tk wtour for STk. + This is excellent for learning basics od STk programming + (contributor Suresh Srinivas -- ssriniva@cs.indiana.edu) + +Trace + A trace procedure (contributor Martine Follen -- mf@unice.fr) + + + +Another contribution, called XS, (a Scheme graphical debugger) is also available +as a separate file on kaolin.unice.fr in the file ~ftp/pub/xscheme0.2.gz. + diff --git a/Contrib/Inspect/README b/Contrib/Inspect/README new file mode 100644 index 0000000..f79eaf0 --- /dev/null +++ b/Contrib/Inspect/README @@ -0,0 +1,5 @@ +This directory contains the STk graphical Inspector. It is a first step toward +a true debugger (able to set breakpoints, to see the stack, ...). +This work is due to Eric Fintzel (fintzel@kaolin.unice.fr). + +Hacked by Erick Gallesio (eg@unice.fr) for version 2 integration. diff --git a/Contrib/Inspect/inspect-detail.stk b/Contrib/Inspect/inspect-detail.stk new file mode 120000 index 0000000..78fe51b --- /dev/null +++ b/Contrib/Inspect/inspect-detail.stk @@ -0,0 +1 @@ +../../Lib/inspect-detail.stk \ No newline at end of file diff --git a/Contrib/Inspect/inspect-help.stk b/Contrib/Inspect/inspect-help.stk new file mode 120000 index 0000000..d2216be --- /dev/null +++ b/Contrib/Inspect/inspect-help.stk @@ -0,0 +1 @@ +../../Lib/inspect-help.stk \ No newline at end of file diff --git a/Contrib/Inspect/inspect-main.stk b/Contrib/Inspect/inspect-main.stk new file mode 120000 index 0000000..72f9b22 --- /dev/null +++ b/Contrib/Inspect/inspect-main.stk @@ -0,0 +1 @@ +../../Lib/inspect-main.stk \ No newline at end of file diff --git a/Contrib/Inspect/inspect-misc.stk b/Contrib/Inspect/inspect-misc.stk new file mode 120000 index 0000000..18ad105 --- /dev/null +++ b/Contrib/Inspect/inspect-misc.stk @@ -0,0 +1 @@ +../../Lib/inspect-misc.stk \ No newline at end of file diff --git a/Contrib/Inspect/inspect-view.stk b/Contrib/Inspect/inspect-view.stk new file mode 120000 index 0000000..4f322e2 --- /dev/null +++ b/Contrib/Inspect/inspect-view.stk @@ -0,0 +1 @@ +../../Lib/inspect-view.stk \ No newline at end of file diff --git a/Contrib/Pretty/pp.stk b/Contrib/Pretty/pp.stk new file mode 120000 index 0000000..6ae52ab --- /dev/null +++ b/Contrib/Pretty/pp.stk @@ -0,0 +1 @@ +../../Lib/pp.stk \ No newline at end of file diff --git a/Contrib/Process/process.c b/Contrib/Process/process.c new file mode 100644 index 0000000..ed845cd --- /dev/null +++ b/Contrib/Process/process.c @@ -0,0 +1,628 @@ +#include "stk.h" +#include +#include +#include +#include +#include +#include + + +#define MAX_PROC_NUM 256 /*enough eh?*/ +#define MAX_ARGS_NO 256 + +#define NO_REDIRECTION 0 +#define REDIRECTION_BY_FILE 1 +#define REDIRECTION_BY_STREAM 2 + + +/******** SIGUSR1 handler *******/ +static void su1_handler(){ +/* printf("SIGUSR1 arrived\n"); */ +} +/*********************************/ + +/**** Registering processes ****/ +static SCM proc_arr[MAX_PROC_NUM]; + + +static init_proc_table(){ + int i; + for(i = 0; istorage_as.extension.data)) +#define PROCESSP(x) (TYPEP (x, tc_process)) +#define NPROCESSP(x) (NTYPEP (x, tc_process)) +#define PROCPID(x) PROCESS(x)->pid + + +extern char **sys_errlist; + +static char *stdStreams[3] = { + "standard input", "standard output", "standard error", +}; + +static char *strName[3] = { + "stdin", "stdout", "stderr", +}; + +static PRIMITIVE +fork_process( SCM command, SCM args, SCM redirection, int run_async ); + +PRIMITIVE +run_process( SCM command, SCM args, SCM redirection ) { + return fork_process(command, args, redirection, 1); +} + +PRIMITIVE +run_sync( SCM command, SCM args, SCM redirection ) { + return fork_process(command, args, redirection, 0); +} + +static PRIMITIVE +fork_process( SCM command, SCM args, SCM redirection, int run_async ) { + SCM pinfo, arg, pnames, ptypes; + char *argv[MAX_ARGS_NO], msg[256], *files[3]; + int argc, pid, i; + long flag; + int pipes[3][2]; + int redirectionType[3]; + struct process_info *info; + void *old_chld_sig_action; + int svMask, usermask; int ok; + int svMask1, mypid; + usermask = (sigmask(SIGUSR1)); + + /* Checking arguments and creating UNIX-style */ + /* arguments list */ + + if( NSTRINGP( command ) ) + err("run-process: bad program name", command); + i = find_slot(); + if( i < 0) + return ntruth; + + NEWCELL(pinfo, tc_process); + proc_arr[i] = pinfo; + + info = (struct process_info *) malloc( sizeof( struct process_info ) ); + PROCESS(pinfo) = info; + /* + * + * Initializing info structure + * + */ + + info->commandLine = strdup(CHARS( command ) ); + + for( i = 0; i < 3; i++ ) { + info->redirection[i] = NO_REDIRECTION; + info->stream[i] = NIL; + } + + argv[0] = CHARS( command ); + + for( argc = 1; argc < MAX_ARGS_NO && NNULLP( args ); ++argc ) { + if( NCONSP( args ) ) + err("run-process: bad arguments list", args); + + arg = CAR( args ); + args = CDR( args ); + + if( NSTRINGP( arg ) ) { + /* In future, may be I implement conversion from */ + /* non-string argument to the string, but today */ + /* I don't want to do that :) */ + + err("run-process: bad argument -- must be string", arg); + } + + argv[argc] = CHARS( arg ); + } + + if( argc == MAX_ARGS_NO ) + err("run-process: too many arguments (limit is 256)", args); + + argv[argc] = NULL; + + + /* Parsing redirection's list and creating communication */ + + if( NNULLP( redirection ) ) { + + for( i = 0; i < 3; ++i ) { + if( NCONSP( redirection ) ) + err("run-process: wrong redirection's list", redirection); + + if( STRINGP( CAR( redirection ) ) ) { + + info->redirection[i] = REDIRECTION_BY_FILE; + info->stream[i] = string_copy( CAR( redirection ) ); + + /* redirectionType[i] = REDIRECTION_BY_FILE; + files[i] = CHARS( CAR( redirection ) ); */ + + pipes[i][0] = open(CHARS( CAR( redirection ) ), + i == 0 ? O_RDONLY : O_WRONLY); + if( pipes[i][0] < 0 ) { + sprintf(msg, "run-process: can't redirect %s to file %s", + stdStreams[i], CHARS( CAR( redirection ) )); + + err( msg, NIL ); + } + + redirection = CDR( redirection ); + continue; + } + + if( BOOLEANP( CAR( redirection ) ) ) { + + if( CAR( redirection ) == truth ) { + if( pipe( pipes[i] ) < 0 ) { + + sprintf(msg, "run-process: can't create stream for %s\n", + stdStreams[i] + + ); + perror("Process"); + err( msg, NIL ); + } + + /* redirectionType[i] = REDIRECTION_BY_STREAM; */ + + info->redirection[i] = REDIRECTION_BY_STREAM; + } + + redirection = CDR( redirection ); + continue; + } + + err("run-process: bad redirection type", CAR( redirection )); + } + } + + + /* set handler to catch SIGUSR1 */ + signal(SIGUSR1,su1_handler); + + /* block user1 signal till parent will be ready */ + svMask1 = sigblock(usermask); + mypid = getpid(); + + /* Now, forking and catching the errors */ + pid = fork(); + + if( pid < 0 ) { + char msg[256]; + + sprintf(msg, + "run-process: can't create child process because of (see stderr)" + ); + perror("CHILD process"); + err( msg, NIL ); + } + + /* Processing child's behavior */ + + if( pid == 0 ) { + if(run_async){ + svMask = sigblock(usermask); + signal(SIGUSR1,su1_handler); + /* send notification to parent that I'm ready */ + ok = kill(mypid,SIGUSR1); + if(ok < 0) perror( "Sending to parent"); + sigpause(0); + sigsetmask(svMask); +/* + * fprintf(stderr, "Mask: %x\n", usermask); + * fprintf(stderr, "Child continues..."); + * perror("Child:"); + */ + + setsid(); + } + + for( i = 0; i < 3; ++i ) { + switch( info->redirection[i] ) { + + case REDIRECTION_BY_FILE: + dup2( pipes[i][0], i ); + close( pipes[i][0] ); + break; + + case REDIRECTION_BY_STREAM: + dup2( pipes[i][ i == 0 ? 0 : 1], i ); + close( pipes[i][0] ); + close( pipes[i][1] ); + break; + + default: + break; + } + } + + for( i = 3; i < NOFILE; ++i ) + close( i ); + + + /* And then, EXEC'ing... */ + + execvp( argv[0], argv ); + + /* Unfortunatelly, we can't exec this process -- but */ + /* we can't tell 'bout this fact to our daddy. :( */ + + fprintf(stderr, "Can't exec!"); + exit( 1 ); + } + + /* Ok, guys, we are still in the parent process. Making redirection */ + /* and filling-up PROCESS structure */ + PROCPID( pinfo ) = pid; + if(!run_async) waitpid(pid); + else { + for( i = 0; i < 3; ++i ) { + switch( info->redirection[i] ) { + case REDIRECTION_BY_FILE: + close( pipes[i][0] ); + break; + + case REDIRECTION_BY_STREAM: + close( pipes[i][ i == 0 ? 0 : 1 ] ); + + flag = no_interrupt(1); + + NEWCELL( info->stream[i], i == 0 ? tc_oport : tc_iport ); + + if( (info->stream[i]->storage_as.port.f = + fdopen( pipes[i][ i == 0 ? 1 : 0], + i == 0 ? "w" : "r" )) == NULL ) + err("process-input: can't FDOPEN stream", pinfo); + + sprintf(msg, "*%s-%d*", strName[i], pid); + + info->stream[i]->storage_as.port.name = must_malloc( strlen( msg ) + 1 ); + strcpy( info->stream[i]->storage_as.port.name, msg ); + + no_interrupt( flag ); + break; + + default: + break; + } + } + /** all house keeping is done... notyfy child to go ***/ +#if 1 + sigpause(0); /* wait for child notification */ + sigsetmask(svMask1); + /* notify child */ + ok = kill(pid,SIGUSR1); + if(ok < 0) perror("Parent sigusr"); +/* else fprintf(stderr, "Parent sending SIGUSR1 to %d\n",pid); */ +#endif + } + PROCESS( pinfo ) = info; + return pinfo; +} + + +/*** INTERFACE ****/ + +PRIMITIVE + processp( SCM process ) { + return PROCESSP( process ) ? truth : ntruth; + } + + +PRIMITIVE +process_alivep( SCM process ) { + + if( NPROCESSP( process ) ) + err("process-alive?: wrong argument type", process); + + return kill( PROCPID( process ), 0 ) == 0 ? truth : ntruth; +} + +PRIMITIVE +process_pid( SCM process ) { + + if( NPROCESSP( process ) ) + err("process-pid: wrong argument type", process); + + return makeinteger( PROCPID( process ) ); +} + +static char *rtFile = "*File*"; +static char *rtStream = "*Stream*"; +static char *rtNone = "*None*"; + +static PRIMITIVE +get_internal_redirection( SCM process, int i ) { + SCM rType, rName; + struct process_info *info; + + if( NPROCESSP( process ) ) + err("process-stream-type: wrong argument type", process); + + info = PROCESS( process ); + + switch( info->redirection[i] ) { + + case REDIRECTION_BY_FILE: + rType = makestrg( strlen( rtFile ), rtFile ); + rName = string_copy( info->stream[i] ); + break; + + case NO_REDIRECTION: + rType = makestrg( strlen( rtNone ), rtNone ); + rName = NIL; + break; + + default: /* REDIRECTION_BY_STREAM */ + rType = makestrg( strlen( rtStream ), rtStream ); + rName = makestrg( strlen( stdStreams[i] ), stdStreams[i] ); + break; + } + + return cons( rType, rName ); +} + + +/*** enumerate ***/ +PRIMITIVE +process_list(){ + int i; + SCM lst = NIL; + for(i = 0; icommandLine ), info->commandLine ); +} + + +/* + * Creating and returning ports to opened streams + */ + +PRIMITIVE +process_input( SCM process ) { + struct process_info *info; + + if( NPROCESSP( process ) ) + err("process-input: wrong argument type", process); + + info = PROCESS( process ); + + if( info->redirection[0] != REDIRECTION_BY_STREAM ) { + return NIL; + } + + return info->stream[0]; +} + +PRIMITIVE +process_output( SCM process ) { + struct process_info *info; + + if( NPROCESSP( process ) ) + err("process-input: wrong argument type", process); + + info = PROCESS( process ); + + if( info->redirection[1] != REDIRECTION_BY_STREAM ) { + return NIL; + } + + return info->stream[1]; +} + +PRIMITIVE +process_error( SCM process ) { + struct process_info *info; + + if( NPROCESSP( process ) ) + err("process-input: wrong argument type", process); + + info = PROCESS( process ); + + if( info->redirection[2] != REDIRECTION_BY_STREAM ) { + return NIL; + } + + return info->stream[2]; +} + + +void +mark_process( SCM process ){ + struct process_info *info; + int i; + info = PROCESS(process); + for(i=0; i<3 ; i++) + gc_mark(info->stream[i]); +} + + +void +free_process( SCM process ) { + int i; + struct process_info *info; + info = PROCESS( process ); + i = remove_process(process); + if(i < 0) + err("cannot unregister process", process); + if( info->commandLine ) + free( info->commandLine ); + + for( i = 0; i < 3; ++i ) { + if( info->redirection[i] == REDIRECTION_BY_STREAM && info->stream[i] != NIL ) { + freeport( info->stream[i] ); + } + } + free(info); /* A.T. ++ */ +} + + +PRIMITIVE +process_kill( SCM process ) { + struct process_info *info; + int i; + if( NPROCESSP( process ) ) + err("process-kill: wrong argument", process); + + info = PROCESS( process ); +#if 1 + for( i = 0; i < 3; ++i ) { + if( info->redirection[i] == REDIRECTION_BY_STREAM && + info->stream[i] != NIL ) { + freeport( info->stream[i] ); + info->stream[i]=NIL; + } + } +#endif + kill( PROCPID( process ), 15 ); + return truth; +} + + +/******* run-time initialization ********/ +void init_process(void) +{ + tc_process = add_new_type(&process_type); + init_proc_table(); + + add_new_primitive("run-process", tc_subr_3, run_process); /* + */ + add_new_primitive("run-sync", tc_subr_3, run_sync); /* + */ + add_new_primitive("process?", tc_subr_1, processp); /* + */ + add_new_primitive("process-alive?", tc_subr_1, process_alivep); /* + */ + add_new_primitive("process-input-info", tc_subr_1, process_input_info); /* + */ + add_new_primitive("process-output-info", tc_subr_1, process_output_info); /* + */ + add_new_primitive("process-error-info", tc_subr_1, process_error_info); /* + */ + add_new_primitive("process-command", tc_subr_1, process_command); /* + */ + add_new_primitive("process-pid", tc_subr_1, process_pid); /* + */ + add_new_primitive("process-input", tc_subr_1, process_input); /* + */ + add_new_primitive("process-output", tc_subr_1, process_output); /* + */ + add_new_primitive("process-error", tc_subr_1, process_error); /* + */ + add_new_primitive("process-kill", tc_subr_1,process_kill); /* + */ + add_new_primitive("process-list", tc_subr_0,process_list); /* + */ + +} diff --git a/Contrib/Process/process.h b/Contrib/Process/process.h new file mode 100644 index 0000000..28c3581 --- /dev/null +++ b/Contrib/Process/process.h @@ -0,0 +1,50 @@ +/** + * Process.h - LISP implementation of UNIX processes + * + * Copyright (c) 1994 by Gregory Nickonov. + * + * Permission to use, copy, and/or distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that both the above copyright notice and this permission notice appear in + * all copies and derived works. Fees for distribution or use of this + * software or derived works may only be charged with express written + * permission of the copyright holder. + * This software is provided ``as is'' without express or implied warranty. + * + * This software is a derivative work of other copyrighted softwares; the + * copyright notices of these softwares are placed in the file COPYRIGHTS + * + * + * Author: Gregory Nickonov, [gn@jet.msk.su] + * Creation date: 15-Jan-1994 11:40 + * Last file update: 11-Jun-1994 22:07 + * + * Made working by David Tolpin Dvd@CIM.Msk.SU + * Port to Dynaload STk2.1b, + * synchronization and registration + * mechanism by A.Taranov tay@jet.msk.su + * + */ + +#ifndef __PROCESS_H__ +#define __PROCESS_H__ + +PRIMITIVE processp( SCM process ); +PRIMITIVE process_alivep( SCM process ); + +PRIMITIVE run_process( SCM command, SCM args, SCM redirection ); +PRIMITIVE run_sync( SCM command, SCM args, SCM redirection ); +PRIMITIVE process_kill( SCM process ); + +PRIMITIVE process_input( SCM process ); +PRIMITIVE process_output( SCM process ); +PRIMITIVE process_error( SCM process ); + +PRIMITIVE process_input_info( SCM process ); +PRIMITIVE process_output_info( SCM process ); +PRIMITIVE process_error_info( SCM process ); + +PRIMITIVE process_command( SCM process ); +PRIMITIVE process_pid( SCM process ); + +#endif /* __PROCESS_H__ */ diff --git a/Contrib/Python/jredford-mail.txt b/Contrib/Python/jredford-mail.txt new file mode 100644 index 0000000..e6b62a9 --- /dev/null +++ b/Contrib/Python/jredford-mail.txt @@ -0,0 +1,175 @@ +Herafter is an excerpt of a mail of jredford@lehman.com about Python/STk mail +I hope it will suffice to build a running system (I had no time to test it). +------------------ + + +This is the file I added.. python-stk.c: + + +#include +#include +#include +#include + +PRIMITIVE python_init(void) +{ + initall(); + return UNDEFINED; +} + +PRIMITIVE python(SCM string) +{ + run_command(CHARS(string)); + return UNDEFINED; +} + +SCM convert(object *o) +{ + if is_intobject(o) { + return makeinteger(getintvalue(o)); + } else { + if is_floatobject(o) { + return makenumber(getfloatvalue(o)); + } else { + if is_stringobject(o) { + return makestrg(getstringsize(o),getstringvalue(o)); + } else { + if is_tupleobject(o) { + int i,j = gettuplesize(o); + SCM vec; + vec = makevect(j,makeinteger(0)); + for (i = 0; i < j; i++) { + vector_set(vec, makeinteger(i), convert(gettupleitem(o,i))); + } + return vector2list(vec); + } else { + if is_listobject(o) { + int i,j = getlistsize(o); + SCM vec; + vec = makevect(j,makeinteger(0)); + for (i = 0; i < j; i++) { + vector_set(vec, makeinteger(i), convert(getlistitem(o,i))); + } + return vector2list(vec); + } + } + } + } + } + return UNDEFINED; +} + +PRIMITIVE python_value(SCM dict, SCM var) +{ + object *m, *d, *v; + m = add_module(CHARS(dict)); + if (m == NULL) + return UNDEFINED; + d = getmoduledict(m); + v = dictlookup(d,CHARS(var)); + return convert(v); +} + +char * +getprogramname() +{ + return "stk"; +} + + +END of file python-stk.c + +The initall() should be done in init_python-stk(). You might know of a +better way to convert the data types, or to more efficiently make +lists. These were the calls that I found easilly. I also didnt know +how to typecheck the arguments passed. They should all be strings. + + +This is the summary of what I added to primitives.c +/* + * + * p r i m i t i v e s . c -- List of STk subrs + */ + +#ifdef USE_PYTHON +extern PRIMITIVE python_init(void); +extern PRIMITIVE python(SCM string); +extern PRIMITIVE python_value(SCM dict, SCM var); +#endif + +static struct Primitive Scheme_primitives[] = { + . + . + . + +#ifdef USE_PYTHON + {"python-init", tc_subr_0, python_init}, + {"python", tc_subr_1, python}, + {"python-value", tc_subr_2, python_value}, +#endif + . + . + . + + + + +An example.. well, I never used Tk before Stk, so Im not gonna do +anything too pretty. + +#!/opt/stk/bin/stk -file + +(python-init) ;This should really be (require "python") or (require "python-stk") +(python "import posix") ;Python is a module based language + +(button ".b" :text "Press me" :borderwidth 2 :background "slate gray" :foreground "gold" + :command '(begin + (python "a = posix.listdir('.')") + (for-each (lambda (a) (.f.lb 'insert 99999 a)) + (python-value "__main__" "a")))) + +(frame ".f") +(listbox ".f.lb" :foreground "grey40" :background "grey70" :yscroll ".f.s 'set") +(scrollbar ".f.s" :relief "sunken" :command ".f.lb 'yview") + +(pack .f.lb .f.s :side "right" :fill "y") +(pack .b .f) + + + +Where this would populate a listbox with the filenames in the current +directory, everytime the button was pushed. posix.listdir() returns a +python 'list' type. __main__ is the name/alias of the primary module. +If I could figure out STk calling enough to use variable args, I'd +have made (python-value "a") assume a value of "__main__" for the +dict.. + + + +Makefile modifications: + +# This isnt the default python dir, just what I use. should be a +# configure option.. --with-python=/opt/python +PYTHONDIR = /opt/python +PYTHONLIBPATH = $(PYTHONDIR)/lib/python/lib +PYTHONCFLAGS = -I$(PYTHONDIR)/include -I$(PYTHONDIR)/include/Py +PYTHONOBJ = python-stk.o +PYTHONLIB = $(PYLIBPATH)/libModules.a \ + $(PYLIBPATH)/libPython.a \ + $(PYLIBPATH)/libParser.a \ + $(PYLIBPATH)/libObjects.a +PYTHONLIBS = -lreadline -ltermcap +LIBS = -lnsl -ldl $(PYTHONLIBS) -lm + + + +... + /bin/rm -f primitives.o + make CFLAGS="$(CFLAGS) -DUSE_PYTHON" primitives.o + $(CC) -o stkp-bin -DUSE_PYTHON $(OBJ) $(PYTHONOBJ) -I$(PYTHONDIR)/include/Py -DNO_MAIN $(PYTHONLIBPATH)/config.c userinit.c $(ALLIBS) $(XLIBSW) $(PYTHONLIB) $(LIBS) + /bin/rm -f primitives.o + + +Removing primitives.c to recompile with -DUSE_PYTHON is a horrible +kludge, as I am sure you agree. The key thing is to also compile in + -DNO_MAIN $(PYLIBPATH)/config.c diff --git a/Contrib/STk-wtour/CHANGES b/Contrib/STk-wtour/CHANGES new file mode 100644 index 0000000..ad764e2 --- /dev/null +++ b/Contrib/STk-wtour/CHANGES @@ -0,0 +1,7 @@ +Version 0.2 -- minor bug fixes and new lessons by Erick Gallesio (eg@unice.fr) +Version 0.1 -- original writing by Suresh Srinivas (ssriniva@cs.indiana.edu) + + +TODO +---- + Integrate STklos lessons diff --git a/Contrib/STk-wtour/README b/Contrib/STk-wtour/README new file mode 100644 index 0000000..a954be5 --- /dev/null +++ b/Contrib/STk-wtour/README @@ -0,0 +1,35 @@ +Scheme/STk Widget Tour 0.2 +-------------------------- + +This is a rewrite of the Tcl/Tk wtour2.0 in Scheme/STk. I wrote it +while I was learning the nuances of STk. I also avoided using the send +mechanisms to make it quicker/easier to learn (I had to set up all the +authentication stuff to have the Tcl/Tk wtour working). + +Installing and Running +---------------------- + +To start the tour assume that the locations of the STk binary and library +in "stk-wtour" are correct. Once this is done, just type + % ./stk-wtour + +Use the menus to navigate through different lessons. You can make changes +to the lesson source code; click on the Apply button to see the results of +the changes. + +Acknowledgements and Notes +-------------------------- +The original,excellent, tour of Tcl/Tk was due to Andrew Payne +(payne@crl.dec.com). I hope you enjoy the Scheme version +(Adding some STklos lessons is next in the set of things to do). +I've tested it on Silicon Graphics running IRIX 5.2 (They are +the coolest machines around, look them up). + +Suresh Srinivas, +Graduate Student, +Parallel Computing Group, +Indiana University, +(ssriniva@cs.indiana.edu) + +Thesis: Investigating large scale parallel programs. +Interests: Parallel Computing, Visualization, Scheming. diff --git a/Contrib/STk-wtour/lessons/bind1.stk b/Contrib/STk-wtour/lessons/bind1.stk new file mode 100644 index 0000000..2bcf178 --- /dev/null +++ b/Contrib/STk-wtour/lessons/bind1.stk @@ -0,0 +1,9 @@ +;; Event binding + +(entry '.e1 :relief "sunken") +(pack .e1 :expand #t :fill "x") + +(bind .e1 "" (lambda () + (display "You pressed Tab!\n"))) +(bind .e1 "" (lambda () + (display "You pressed Button 2!\n"))) diff --git a/Contrib/STk-wtour/lessons/bind2.stk b/Contrib/STk-wtour/lessons/bind2.stk new file mode 100644 index 0000000..fb22ee2 --- /dev/null +++ b/Contrib/STk-wtour/lessons/bind2.stk @@ -0,0 +1,7 @@ +;; More event binding + +(entry '.e1 :relief "sunken") +(pack .e1 :expand #t :fill "x") + +(bind .e1 "" (lambda () (display "ENTERED\n"))) +(bind .e1 "" (lambda () (display "EXITED\n"))) diff --git a/Contrib/STk-wtour/lessons/bind3.stk b/Contrib/STk-wtour/lessons/bind3.stk new file mode 100644 index 0000000..fb26db4 --- /dev/null +++ b/Contrib/STk-wtour/lessons/bind3.stk @@ -0,0 +1,6 @@ +;; Even more event binding: accessing the event parameters + +(entry '.e1 :relief "sunken") +(pack .e1 :expand #t :fill "x") +(bind .e1 "" (lambda (x y) + (format #t "button down at ~a,~a\n" x y))) diff --git a/Contrib/STk-wtour/lessons/button1.stk b/Contrib/STk-wtour/lessons/button1.stk new file mode 100644 index 0000000..0d3b256 --- /dev/null +++ b/Contrib/STk-wtour/lessons/button1.stk @@ -0,0 +1,4 @@ +;; A basic button widget + +(button '.hello :text "Hello World!" :command (lambda () (display "hello\n"))) +(pack .hello) diff --git a/Contrib/STk-wtour/lessons/button2.stk b/Contrib/STk-wtour/lessons/button2.stk new file mode 100644 index 0000000..128ad7f --- /dev/null +++ b/Contrib/STk-wtour/lessons/button2.stk @@ -0,0 +1,4 @@ +;; A button widget, with options + +(button '.hello :text "Hello World!" :relief "raised" :state "disabled") +(pack .hello) diff --git a/Contrib/STk-wtour/lessons/canvas-animate.stk b/Contrib/STk-wtour/lessons/canvas-animate.stk new file mode 100644 index 0000000..2549bf6 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas-animate.stk @@ -0,0 +1,12 @@ +;;; Animation! + +(pack (canvas '.c1) :expand #t :fill "both") + +(.c1 'create 'rectangle 10 10 40 40 :fill "red" :tag "item") + +(let do-update () + (.c1 'move 'item 1 1) + (after 50 (lambda () + (catch (do-update))))) + + diff --git a/Contrib/STk-wtour/lessons/canvas-drag.stk b/Contrib/STk-wtour/lessons/canvas-drag.stk new file mode 100644 index 0000000..fdaca6a --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas-drag.stk @@ -0,0 +1,34 @@ +;;; Moving an object on a canvas +;;; (drag the circle around) + +(define last-x 0) +(define last-y 0) + +(define (item-start-drag c x y) + (set! last-x (c 'canvasx x)) + (set! last-y (c 'canvasy y))) + +(define (item-drag c x y) + (set! x (c 'canvasx x)) + (set! y (c 'canvasy y)) + (c 'move 'current (- x last-x) (- y last-y)) + (set! last-x x) + (set! last-y y)) + +(pack (canvas '.c1) :expand #t :fill "both") + +(.c1 'create 'oval 150 150 170 170 :fill "skyblue" :tag "oval") + +;;; Bindings +(.c1 'bind "oval" "" (lambda () + (.c1 'itemconfig 'current :fill "red"))) +(.c1 'bind "oval" "" (lambda () + (.c1 'itemconfig 'current :fill "SkyBlue2"))) +(.c1 'bind "oval" "<1>" (lambda (x y) + (item-start-drag .c1 x y))) +(.c1 'bind "oval" "" (lambda (x y) + (item-drag .c1 x y))) +(.c1 'bind "oval" "" + (lambda () + (.c1 'dtag 'selected))) + diff --git a/Contrib/STk-wtour/lessons/canvas-draw.stk b/Contrib/STk-wtour/lessons/canvas-draw.stk new file mode 100644 index 0000000..51671fa --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas-draw.stk @@ -0,0 +1,13 @@ +;;; Drawing in a Canvas +;;; (draw with mousebutton 1) + +(pack (canvas '.c1) + :fill "both" + :expand "yes") + +(bind .c1 "" (lambda (x y) + (.c1 'create 'rectangle x y x y :width 5))) + + + + diff --git a/Contrib/STk-wtour/lessons/canvas-funky.stk b/Contrib/STk-wtour/lessons/canvas-funky.stk new file mode 100644 index 0000000..995ede5 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas-funky.stk @@ -0,0 +1,15 @@ +;;; Drawing in a Canvas (funky version) +;;; (draw with mousebutton 1) + +(define wid 0) + +(pack (canvas '.c1) :expand #t :fill "both") + +(bind .c1 "" (lambda () + (set! wid 0))) + +(bind .c1 "" (lambda (x y) + (.c1 'create 'rectangle x y x y :width wid) + (set! wid (1+ wid)))) + + diff --git a/Contrib/STk-wtour/lessons/canvas-rubber.stk b/Contrib/STk-wtour/lessons/canvas-rubber.stk new file mode 100644 index 0000000..d3a8ac2 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas-rubber.stk @@ -0,0 +1,29 @@ +;;; Rubber banding +;;; (stroke out a box with mousebutton 1) + +(define x1 0) +(define y1 0) + +(define (item-delete c) + (c 'delete 'area)) + +(define (item-mark c x y) + (set! x1 (c 'canvasx x)) + (set! y1 (c 'canvasy y)) + (item-delete c)) + +(define (item-stroke c x y) + (set! x (c 'canvasx x)) + (set! y (c 'canvasy y)) + (unless (and (= x1 x) (= y1 y)) + (item-delete c) + (c 'addtag 'area 'withtag (c 'create 'rectangle x1 y1 x y)))) + + +(pack (canvas '.c1) :fill "both" :expand #t) + +(bind .c1 "" (lambda (x y) (item-mark .c1 x y))) +(bind .c1 "" (lambda (x y) (item-stroke .c1 x y))) +(bind .c1 "" (lambda () (item-delete .c1))) + + diff --git a/Contrib/STk-wtour/lessons/canvas1.stk b/Contrib/STk-wtour/lessons/canvas1.stk new file mode 100644 index 0000000..ed5260c --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas1.stk @@ -0,0 +1,6 @@ +;;; Basic canvas widget + +(canvas '.c1) +(pack .c1) + +(.c1 'create 'line 10 10 200 200) diff --git a/Contrib/STk-wtour/lessons/canvas2.stk b/Contrib/STk-wtour/lessons/canvas2.stk new file mode 100644 index 0000000..5eadf54 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas2.stk @@ -0,0 +1,16 @@ +;; Canvas item types +;; We use here the fact that "wtour-lessondir" contains the path of the +;; wtour demo + +(canvas '.c2) +(pack .c2 :fill "both" :expand #t) + +(.c2 'create 'arc 10 10 50 50 :fill "red") +(.c2 'create 'line 10 100 40 140 :fill "blue") +(.c2 'create 'oval 150 150 170 200 :fill "yellow") +(.c2 'create 'polygon 200 10 210 50 280 20 :fill "green") +(.c2 'create 'rectangle 10 200 30 250 :fill "cyan") +(.c2 'create 'text 100 220 :text "Some random text") +(.c2 'create 'bitmap 120 70 :bitmap (string-append "@" + wtour-lessondir + "/../lib/iu.seal.small.xbm")) \ No newline at end of file diff --git a/Contrib/STk-wtour/lessons/canvas3.stk b/Contrib/STk-wtour/lessons/canvas3.stk new file mode 100644 index 0000000..bddc047 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas3.stk @@ -0,0 +1,14 @@ +;;; Canvas event bindings +;;; (click on the bitmap) + +(canvas '.c1) +(pack '.c1 :fill "both" :expand #t) + +(define i (.c1 'create 'bitmap 120 100 + :bitmap (string-append "@" + wtour-lessondir + "/../lib/iu.seal.small.xbm") + :background "grey")) + +(.c1 'bind i "" (lambda () (display "CLICK\n"))) + diff --git a/Contrib/STk-wtour/lessons/canvas4.stk b/Contrib/STk-wtour/lessons/canvas4.stk new file mode 100644 index 0000000..94941e4 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas4.stk @@ -0,0 +1,13 @@ +;; Canvas item stacking +;; Use mouse button 1 to put a square on top of stack +(canvas '.c3) +(pack .c3 :fill "both" :expand #t) + +(define r1 (.c3 'create 'rectangle 20 20 80 80 :fill "red")) +(define r2 (.c3 'create 'rectangle 60 60 120 120 :fill "green")) +(define r3 (.c3 'create 'rectangle 40 40 100 100 :fill "blue")) + +(.c3 'bind r1 "" (lambda () (.c3 'raise r1))) +(.c3 'bind r2 "" (lambda () (.c3 'raise r2))) +(.c3 'bind r3 "" (lambda () (.c3 'raise r3))) + diff --git a/Contrib/STk-wtour/lessons/canvas5.stk b/Contrib/STk-wtour/lessons/canvas5.stk new file mode 100644 index 0000000..8efaa3b --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas5.stk @@ -0,0 +1,11 @@ +;;; Canvas tags + +(pack (canvas '.c1) + :fill "both" :expand #t) + +(.c1 'create 'rectangle 20 20 80 80 :fill "red" :tag "cats") +(.c1 'create 'rectangle 60 60 120 120 :fill "green" :tag "cats") +(.c1 'create 'rectangle 40 40 100 100 :fill "blue" :tag "dogs") + +(.c1 'move 'cats 100 0) + diff --git a/Contrib/STk-wtour/lessons/canvas6.stk b/Contrib/STk-wtour/lessons/canvas6.stk new file mode 100644 index 0000000..123e731 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas6.stk @@ -0,0 +1,19 @@ +;; Canvases with scrollbars + +(canvas '.c4 :scrollregion '(-10c -10c 50c 20c) + :xscrollcommand (lambda l (apply .s2 'set l)) + :yscrollcommand (lambda l (apply .s1 'set l))) + +(.c4 'create 'rectangle 100 100 400 400 :fill "red") +(.c4 'create 'rectangle 300 300 600 600 :fill "green") +(.c4 'create 'rectangle 200 200 500 500 :fill "blue") + +(scrollbar '.s1 :orient "vert" :relief "sunken" + :command (lambda l (apply .c4 'yview l))) +(scrollbar '.s2 :orient "hor" :relief "sunken" + :command (lambda l (apply .c4 'xview l))) + +(pack .s2 :side "bottom" :fill "x") +(pack .s1 :side "right" :fill "y") +(pack .c4 :expand "yes" :fill "both") + diff --git a/Contrib/STk-wtour/lessons/canvas7.stk b/Contrib/STk-wtour/lessons/canvas7.stk new file mode 100644 index 0000000..52ea2c5 --- /dev/null +++ b/Contrib/STk-wtour/lessons/canvas7.stk @@ -0,0 +1,13 @@ +;;; Widgets embedded in a canvas + +(pack (canvas '.c1) + :expand #t + :fill "both") + +(button '.c1.b1 :text "Embedded button") + +(.c1 'create 'rectangle 20 20 80 80 :fill "red") +(.c1 'create 'rectangle 60 60 120 120 :fill "green") +(.c1 'create 'rectangle 40 40 100 100 :fill "blue") +(.c1 'create 'window 100 75 :window .c1.b1) + diff --git a/Contrib/STk-wtour/lessons/checkbutton.stk b/Contrib/STk-wtour/lessons/checkbutton.stk new file mode 100644 index 0000000..767bc56 --- /dev/null +++ b/Contrib/STk-wtour/lessons/checkbutton.stk @@ -0,0 +1,9 @@ +;; A checkbutton widget + +(checkbutton '.c1 :text "Select me" :anchor "w") +(pack .c1 :fill "x") + +;; Shorter ... +(pack + (checkbutton '.c2 :text "Select me too" :anchor "w") + :fill "x") diff --git a/Contrib/STk-wtour/lessons/dialogbox.stk b/Contrib/STk-wtour/lessons/dialogbox.stk new file mode 100644 index 0000000..a9d27f3 --- /dev/null +++ b/Contrib/STk-wtour/lessons/dialogbox.stk @@ -0,0 +1,21 @@ +;; A Dialog box + +(define do-dialog + (lambda () + (let ([i (stk:make-dialog :title "A Dialog Box" + :text "What do you want to do?" + :bitmap "question" + :grab #t + :defaults 0 + :buttons + (list + `("Ok" ,(lambda () (display "Ok\n"))) + `("Cancel" ,(lambda () (display "Cancel\n"))) + `("Abort" ,(lambda () (display "Abort\n"))) + `("Retry" ,(lambda () (display "Retry\n")) + `("Help" ,(lambda () (display "Help\n"))))))]) + + (format #t "You pressed button #~s\n" i)))) + +(button '.b :text "Press Me" :width 40 :command (lambda () (do-dialog))) +(pack .b :ipadx 10 :ipady 10) diff --git a/Contrib/STk-wtour/lessons/entry1.stk b/Contrib/STk-wtour/lessons/entry1.stk new file mode 100644 index 0000000..f550230 --- /dev/null +++ b/Contrib/STk-wtour/lessons/entry1.stk @@ -0,0 +1,5 @@ +;;A basic entry widget + +(pack (entry '.e1 :relief "sunken" :background "Light Sky Blue")) + + diff --git a/Contrib/STk-wtour/lessons/entry2.stk b/Contrib/STk-wtour/lessons/entry2.stk new file mode 100644 index 0000000..c769235 --- /dev/null +++ b/Contrib/STk-wtour/lessons/entry2.stk @@ -0,0 +1,5 @@ +;; An entry widget with options + +(entry '.e2 :relief "sunken" :font "-*-helvetica-*-r-*-*-*-240-*-*-*-*-*-*") +(pack .e2) +(.e2 'insert 0 "I'm here!!") diff --git a/Contrib/STk-wtour/lessons/frame1.stk b/Contrib/STk-wtour/lessons/frame1.stk new file mode 100644 index 0000000..54051e1 --- /dev/null +++ b/Contrib/STk-wtour/lessons/frame1.stk @@ -0,0 +1,8 @@ +;; Basic frames + +(pack [frame '.f1 :background "red" :width 100 :height 100] + [frame '.f2 :background "blue" :width 100 :height 100] + :side "top" + :expand #t + :fill "both") + diff --git a/Contrib/STk-wtour/lessons/frame2.stk b/Contrib/STk-wtour/lessons/frame2.stk new file mode 100644 index 0000000..24833e6 --- /dev/null +++ b/Contrib/STk-wtour/lessons/frame2.stk @@ -0,0 +1,5 @@ +;; Frames with options + +(frame '.f1 :relief "raised" :borderwidth 3 :width 100 :height 100) +(frame '.f2 :relief "sunken" :borderwidth 3 :width 100 :height 100) +(pack .f1 .f2 :side "top" :expand #t) diff --git a/Contrib/STk-wtour/lessons/frame3.stk b/Contrib/STk-wtour/lessons/frame3.stk new file mode 100644 index 0000000..957769a --- /dev/null +++ b/Contrib/STk-wtour/lessons/frame3.stk @@ -0,0 +1,6 @@ +;; Frames with different options + +(pack + [frame '.f1 :relief "ridge" :borderwidth 3 :width 100 :height 30] + [frame '.f2 :relief "groove" :borderwidth 3 :width 100 :height 30] + :side "top" :expand #t :fill "both" :padx 20 :pady 20) diff --git a/Contrib/STk-wtour/lessons/grouping.stk b/Contrib/STk-wtour/lessons/grouping.stk new file mode 100644 index 0000000..c7fab58 --- /dev/null +++ b/Contrib/STk-wtour/lessons/grouping.stk @@ -0,0 +1,9 @@ +;; Using frames to group widgets + +(frame '.f1 :relief "ridge" :borderwidth 2) +(pack .f1) + +(label '.f1.lab :text "Filename") +(entry '.f1.e1 :relief "sunken") + +(pack .f1.lab .f1.e1 :side "left" :padx 10 :pady 10) diff --git a/Contrib/STk-wtour/lessons/index b/Contrib/STk-wtour/lessons/index new file mode 100644 index 0000000..bf8a841 --- /dev/null +++ b/Contrib/STk-wtour/lessons/index @@ -0,0 +1,67 @@ +(lesson "Widgets" "Labels" "label1.stk") +(lesson "Widgets" "... options" "label2.stk") +(lesson "Widgets" "... with bitmaps" "label3.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Messages" "message.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Basic buttons" "button1.stk") +(lesson "Widgets" "... options" "button2.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Checkbuttons" "checkbutton.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Radiobuttons" "radiobutton.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Basic entries" "entry1.stk") +(lesson "Widgets" "... options" "entry2.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Basic scales" "scale1.stk") +(lesson "Widgets" "... options" "scale2.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Basic listboxes" "listbox1.stk") +(lesson "Widgets" "... with scrollbars" "listbox2.stk") +(lesson "Widgets" "" "") +(lesson "Widgets" "Basic Menu" "menu1.stk") +(lesson "Widgets" "... options" "menu2.stk") + +(lesson "Geometry" "Basic Packer" "pack1.stk") +(lesson "Geometry" "... with options" "pack2.stk") +(lesson "Geometry" "... more options" "pack3.stk") +(lesson "Geometry" "" "") +(lesson "Geometry" "Basic Frames" "frame1.stk") +(lesson "Geometry" "... with options" "frame2.stk") +(lesson "Geometry" "... more options" "frame3.stk") +(lesson "Geometry" "" "") +(lesson "Geometry" "Grouping widgets" "grouping.stk") + +(lesson "Events" "Binding events" "bind1.stk") +(lesson "Events" "Binding events #2" "bind2.stk") +(lesson "Events" "Binding events #3" "bind3.stk") + +(lesson "Canvas" "Basic canvas" "canvas1.stk") +(lesson "Canvas" "... item types" "canvas2.stk") +(lesson "Canvas" "... events" "canvas3.stk") +(lesson "Canvas" "... item stacking" "canvas4.stk") +(lesson "Canvas" "... tags" "canvas5.stk") +(lesson "Canvas" "... with scrollbars" "canvas6.stk") +(lesson "Canvas" "... with widgets" "canvas7.stk") +(lesson "Canvas" "" "") +(lesson "Canvas" "Drawing" "canvas-draw.stk") +(lesson "Canvas" "Funky drawing" "canvas-funky.stk") +(lesson "Canvas" "Rubber banding" "canvas-rubber.stk") +(lesson "Canvas" "Animation" "canvas-animate.stk") +(lesson "Canvas" "Drag and Drop" "canvas-drag.stk") + +(lesson "Text" "Basic \"Text\"" "text1.stk") +(lesson "Text" "... with scrollbars" "text2.stk") +(lesson "Text" "... wrap modes" "text3.stk") +(lesson "Text" "... basic tags" "text4.stk") +(lesson "Text" "... tags with bindings" "text5.stk") + +(lesson "Misc" "New toplevel windows" "misc.stk") +(lesson "Misc" "Dialog boxes" "dialogbox.stk") + +;; find a better way to do the options (so that they can be cleared) +;; (lesson "Misc" "Widget options" "options.stk") + +(lesson "Misc" "X selection" "selection.stk") +(lesson "Misc" "Tk wait" "tkwait.stk") diff --git a/Contrib/STk-wtour/lessons/label1.stk b/Contrib/STk-wtour/lessons/label1.stk new file mode 100644 index 0000000..a08186b --- /dev/null +++ b/Contrib/STk-wtour/lessons/label1.stk @@ -0,0 +1,2 @@ +(label '.lab :text "This is a label") +(pack .lab) diff --git a/Contrib/STk-wtour/lessons/label2.stk b/Contrib/STk-wtour/lessons/label2.stk new file mode 100644 index 0000000..d1820cd --- /dev/null +++ b/Contrib/STk-wtour/lessons/label2.stk @@ -0,0 +1,3 @@ +(pack + (label '.lab1 :text "This is a label1" :relief "sunken")) + diff --git a/Contrib/STk-wtour/lessons/label3.stk b/Contrib/STk-wtour/lessons/label3.stk new file mode 100644 index 0000000..2f10ae4 --- /dev/null +++ b/Contrib/STk-wtour/lessons/label3.stk @@ -0,0 +1,10 @@ +;; A label widget, with a bitmap instead of text +;; We use here the fact that "wtour-lessondir" contains the path of the +;; wtour demo + + +(label '.lab2 :bitmap (string-append "@" wtour-lessondir "/../lib/iu.ridge.xbm") + :relief "raised" + :borderwidth 2) +(pack .lab2) + diff --git a/Contrib/STk-wtour/lessons/listbox1.stk b/Contrib/STk-wtour/lessons/listbox1.stk new file mode 100644 index 0000000..62c3003 --- /dev/null +++ b/Contrib/STk-wtour/lessons/listbox1.stk @@ -0,0 +1,7 @@ +;; Basic listbox widget + +(pack (listbox '.list)) + +(.list 'insert 'end "First list item" + "Second list item" + "Third list item") diff --git a/Contrib/STk-wtour/lessons/listbox2.stk b/Contrib/STk-wtour/lessons/listbox2.stk new file mode 100644 index 0000000..93542aa --- /dev/null +++ b/Contrib/STk-wtour/lessons/listbox2.stk @@ -0,0 +1,29 @@ +;; Listbox with a scrollbar + +(scrollbar '.scroll :relief "groove" :command (lambda l + (apply .list 'yview l))) +(listbox '.list :yscroll (lambda l + (apply .scroll 'set l))) + +(pack .scroll :side "right" :fill "y") +(pack .list :side "left" :expand #t :fill "both") + +(.list 'insert 'end "First list item" + "Second list item" + "Third list item" + "Fourth list item" + "Fifth list item" + "Sixth list item" + "Seventh list item" + "Eighth list item" + "Ninth list item" + "Tenth list item" + "Eleventh list item" + "Twelfth list item" + "Thirteenth list item" + "Fourteenth list item" + "Fifteenth list item" + "Sixteenth list item" + "Seventeenth list item" + "Eighteenth list item" + "Ninteenth list item") diff --git a/Contrib/STk-wtour/lessons/menu1.stk b/Contrib/STk-wtour/lessons/menu1.stk new file mode 100644 index 0000000..653ee2a --- /dev/null +++ b/Contrib/STk-wtour/lessons/menu1.stk @@ -0,0 +1,9 @@ +;; Basic drop down menu + +(pack (menubutton '.mbutton :text "Menu Button" :menu ".mbutton.menu")) + +(menu '.mbutton.menu) +(.mbutton.menu 'add 'command :label "Open") +(.mbutton.menu 'add 'command :label "Close") +(.mbutton.menu 'add 'separator) +(.mbutton.menu 'add 'command :label "Exit") diff --git a/Contrib/STk-wtour/lessons/menu2.stk b/Contrib/STk-wtour/lessons/menu2.stk new file mode 100644 index 0000000..ee58d25 --- /dev/null +++ b/Contrib/STk-wtour/lessons/menu2.stk @@ -0,0 +1,20 @@ +;; Menu options + +(pack (menubutton '.mbutton :text "Menu Button1" :menu '.mbutton.menu)) + +(menu '.mbutton.menu) +(.mbutton.menu 'add 'command :label "Open" :command (lambda () + (display "open\n"))) +(.mbutton.menu 'add 'command :label "Close" :state "disabled") +(.mbutton.menu 'add 'cascade :label "More -->" :menu '.mbutton.menu.more) +(.mbutton.menu 'add 'separator) +(.mbutton.menu 'add 'command :label "Exit" :command (lambda () + (display "exit\n"))) + +(menu '.mbutton.menu.more) +(.mbutton.menu.more 'add 'command :label "Get" :command (lambda () + (display "get\n"))) +(.mbutton.menu.more 'add 'command :label "Put" :command (lambda () + (display "put\n"))) +(.mbutton.menu.more 'add 'command :label "Rename" :command (lambda () + (display "rename\n"))) diff --git a/Contrib/STk-wtour/lessons/message.stk b/Contrib/STk-wtour/lessons/message.stk new file mode 100644 index 0000000..15ab0aa --- /dev/null +++ b/Contrib/STk-wtour/lessons/message.stk @@ -0,0 +1,7 @@ +;; A message widget + +(message '.m :text "This is a message. Note how the lines wrap" + :aspect 200 + :justify "center") +(pack .m) + diff --git a/Contrib/STk-wtour/lessons/misc.stk b/Contrib/STk-wtour/lessons/misc.stk new file mode 100644 index 0000000..837a4fa --- /dev/null +++ b/Contrib/STk-wtour/lessons/misc.stk @@ -0,0 +1,5 @@ +;; New toplevel window + +(toplevel '.new) +(wm 'geometry .new "200x200") +(wm 'title .new "A new window") diff --git a/Contrib/STk-wtour/lessons/options.stk b/Contrib/STk-wtour/lessons/options.stk new file mode 100644 index 0000000..8549e72 --- /dev/null +++ b/Contrib/STk-wtour/lessons/options.stk @@ -0,0 +1,9 @@ +;; Widget options + +(option 'add "*background" "red") +(option 'add "*Button.foreground" "white") + +(button '.a :text "Press Me!") +(button '.b :text "And Me Too!") +(pack .a .b) + diff --git a/Contrib/STk-wtour/lessons/pack1.stk b/Contrib/STk-wtour/lessons/pack1.stk new file mode 100644 index 0000000..8eaacec --- /dev/null +++ b/Contrib/STk-wtour/lessons/pack1.stk @@ -0,0 +1,9 @@ +;; Basic geometry management with the packer + +(label '.l1 :text "Label #1" :background "red") +(label '.l2 :text "Label #2" :background "blue") +(label '.l3 :text "Label #3" :background "green") + +(pack .l1 :side "top") +(pack .l2 :side "left") +(pack .l3 :side "bottom") diff --git a/Contrib/STk-wtour/lessons/pack2.stk b/Contrib/STk-wtour/lessons/pack2.stk new file mode 100644 index 0000000..4c43ad2 --- /dev/null +++ b/Contrib/STk-wtour/lessons/pack2.stk @@ -0,0 +1,10 @@ +;; Basic geometry management with the packer (fill and expand options) + +(label '.l4 :text "Label #4" :background "red") +(label '.l5 :text "Label #5" :background "blue") +(label '.l6 :text "Label #6" :background "green") + +(pack .l4 :side "top" :fill "both") +(pack .l5 :side "left" :fill "both") +(pack .l6 :side "bottom" :fill "both") + diff --git a/Contrib/STk-wtour/lessons/pack3.stk b/Contrib/STk-wtour/lessons/pack3.stk new file mode 100644 index 0000000..c6ea190 --- /dev/null +++ b/Contrib/STk-wtour/lessons/pack3.stk @@ -0,0 +1,10 @@ +;; Basic geometry management with the packer (fill and expand options) + +(label '.l4 :text "Label #4" :background "red") +(label '.l5 :text "Label #5" :background "blue") +(label '.l6 :text "Label #6" :background "green") + + +(pack .l4 :side "top" :fill "both" :padx 20 :pady 20) +(pack .l5 :side "left" :fill "both" :padx 20 :pady 20) +(pack .l6 :side "bottom" :fill "both" :padx 20 :pady 20) diff --git a/Contrib/STk-wtour/lessons/radiobutton.stk b/Contrib/STk-wtour/lessons/radiobutton.stk new file mode 100644 index 0000000..e4314d1 --- /dev/null +++ b/Contrib/STk-wtour/lessons/radiobutton.stk @@ -0,0 +1,8 @@ +;; A set of radio button widgets + +(define color-var1 #f) ;; The variable to which radiobuttons are "connected" + +(radiobutton '.b1 :text "Red" :variable 'color-var1 :value "R" :anchor "w") +(radiobutton '.b2 :text "Green" :variable 'color-var1 :value "G" :anchor "w") +(radiobutton '.b3 :text "Blue" :variable 'color-var1 :value "B" :anchor "w") +(pack .b1 .b2 .b3 :fill "x") diff --git a/Contrib/STk-wtour/lessons/scale1.stk b/Contrib/STk-wtour/lessons/scale1.stk new file mode 100644 index 0000000..a907205 --- /dev/null +++ b/Contrib/STk-wtour/lessons/scale1.stk @@ -0,0 +1,4 @@ +;; A basic scale widget + +(pack (scale '.s1)) + diff --git a/Contrib/STk-wtour/lessons/scale2.stk b/Contrib/STk-wtour/lessons/scale2.stk new file mode 100644 index 0000000..67b6f2d --- /dev/null +++ b/Contrib/STk-wtour/lessons/scale2.stk @@ -0,0 +1,14 @@ +;; A scale widget with options + +(define (display-value n) + (format #t "Flow 1 = ~A\n" n)) + +(scale '.s1 :label "Flow 1" :from -1000 :to 1000 :orient "horizontal" + :command display-value) +(pack .s1) + +;; We could avoid the display-value definition by doing +(scale '.s2 :label "Flow 2" :from -1000 :to 1000 :orient "horizontal" + :command (lambda (n) + (format #t "Flow 2 = ~A\n" n))) +(pack .s2) diff --git a/Contrib/STk-wtour/lessons/selection.stk b/Contrib/STk-wtour/lessons/selection.stk new file mode 100644 index 0000000..e814a88 --- /dev/null +++ b/Contrib/STk-wtour/lessons/selection.stk @@ -0,0 +1,13 @@ +;; X Selection + +(pack + [label '.lab :text "Selection is:" :anchor "w"] + [text '.t :relief "raised" :bd 1 :height 15] + [button '.b1 :text "Get Selection" + :command (lambda () + ;; Clear text buffer + (.t 'delete "1.0" "end") + ;; Insert selection if it exists + (unless (catch (selection 'get)) + (.t 'insert "1.0" (selection 'get))))]) + diff --git a/Contrib/STk-wtour/lessons/text1.stk b/Contrib/STk-wtour/lessons/text1.stk new file mode 100644 index 0000000..57664c7 --- /dev/null +++ b/Contrib/STk-wtour/lessons/text1.stk @@ -0,0 +1,6 @@ +;;; Basic text widget + +(pack (text '.text)) + +(.text 'insert "current" "This is a text widget, displaying some text.\n") +(.text 'insert "current" "Try editing the text in the widget.\n") \ No newline at end of file diff --git a/Contrib/STk-wtour/lessons/text2.stk b/Contrib/STk-wtour/lessons/text2.stk new file mode 100644 index 0000000..2c45b8a --- /dev/null +++ b/Contrib/STk-wtour/lessons/text2.stk @@ -0,0 +1,14 @@ +;;; A basic text widget, with scrollbars + +(text '.text :yscroll (lambda l (apply .scroll 'set l))) +(scrollbar '.scroll :relief "flat" :command (lambda l (apply .text 'yview l))) + +(pack .scroll :side "right" :fill "y") +(pack .text :expand "yes" :fill "both") + +(.text 'insert "current" + "This is a text widget, with an attached scrollbar.\n") +(.text 'insert "current" + "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nTry scrolling me.") +(.text 'insert "current" "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nBoo!") + diff --git a/Contrib/STk-wtour/lessons/text3.stk b/Contrib/STk-wtour/lessons/text3.stk new file mode 100644 index 0000000..3fcdc10 --- /dev/null +++ b/Contrib/STk-wtour/lessons/text3.stk @@ -0,0 +1,6 @@ +;;; A basic text widget, with word wrapping + +(pack (text '.text :wrap "word")) + +(.text 'insert "current" "This is a text widget, displaying some text. ") +(.text 'insert "current" "Notice how lines are broken at words.\n") diff --git a/Contrib/STk-wtour/lessons/text4.stk b/Contrib/STk-wtour/lessons/text4.stk new file mode 100644 index 0000000..ee6245c --- /dev/null +++ b/Contrib/STk-wtour/lessons/text4.stk @@ -0,0 +1,15 @@ +;;; A basic text widget, with basic text tagging + +(text '.text :yscrollcommand (lambda l (apply .scroll 'set l)) :wrap "word") +(scrollbar '.scroll :relief "flat" :command (lambda l (apply l .text 'yview l))) + +(pack .scroll :side "right" :fill "y") +(pack .text :expand #t :fill "both") + +(.text 'insert 'current +"This is a text widget, with some tagged text:\n\n\n\n +Some tagged text.") + +(.text 'tag 'configure 'footag :relief "raised" :borderwidth 3 :background "white") +(.text 'tag 'add 'footag "end-1l linestart" "end-1c") + diff --git a/Contrib/STk-wtour/lessons/text5.stk b/Contrib/STk-wtour/lessons/text5.stk new file mode 100644 index 0000000..529ad76 --- /dev/null +++ b/Contrib/STk-wtour/lessons/text5.stk @@ -0,0 +1,19 @@ +;;; A basic text widget, with tag bindings + +(text '.text :yscrollcommand (lambda l (apply .scroll 'set l)) :wrap "word") +(scrollbar '.scroll :relief "flat" :command (lambda l (apply l .text 'yview l))) + +(pack .scroll :side "right" :fill "y") +(pack .text :expand #t :fill "both") + + +(.text 'insert 'current +"This is a text widget, with some tagged text:\n\n\n\n +Press me!!!") + +(.text 'tag 'configure 'footag :relief "raised" :borderwidth 3 :background "bisque") +(.text 'tag 'add 'footag "end-1l linestart" "end-1c") + +(.text 'tag 'bind 'footag "" (lambda () (display "Gotcha!\n"))) + + diff --git a/Contrib/STk-wtour/lessons/tkwait.stk b/Contrib/STk-wtour/lessons/tkwait.stk new file mode 100644 index 0000000..852bd12 --- /dev/null +++ b/Contrib/STk-wtour/lessons/tkwait.stk @@ -0,0 +1,30 @@ +;; tkwait, used for waiting for dialog input + +(define tkwait-label #f) + +(define make-panel + (lambda () + (toplevel '.top) + (button '.top.ok + :text "OK" + :command (lambda () + (set! tkwait-label "ok") + (destroy .top))) + (button '.top.cancel + :text "Cancel" + :command (lambda () + (set! tkwait-label "cancel") + (destroy .top))) + + (pack .top.ok .top.cancel :side "left" :padx "10" :pady "10") + (grab 'set .top) + (tkwait 'window .top) + tkwait-label)) + +(button '.b + :text "Try pressing me!" + :command (lambda () + (let ([x (make-panel)]) + (format #t "You pressed ~a\n" x)))) + +(pack .b) diff --git a/Contrib/STk-wtour/lib/iu.ridge.xbm b/Contrib/STk-wtour/lib/iu.ridge.xbm new file mode 100644 index 0000000..92846a3 --- /dev/null +++ b/Contrib/STk-wtour/lib/iu.ridge.xbm @@ -0,0 +1,117 @@ +#define iu_width 88 +#define iu_height 124 +static char iu_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe0, 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, + 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x01, 0xc0, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0xff, 0x01, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0xff, 0x01, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0xff, 0x01, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe0, 0xff, 0x01, 0xc0, 0x03, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, + 0xff, 0x01, 0xc0, 0x81, 0xff, 0xff, 0xff, 0x60, 0x00, 0x00, 0x80, 0xfd, + 0x01, 0xc0, 0xc0, 0x00, 0x00, 0x80, 0x70, 0x00, 0x00, 0x80, 0xfd, 0x01, + 0xc0, 0xe0, 0x00, 0x00, 0x80, 0x78, 0x00, 0x00, 0x80, 0xfd, 0x01, 0xc0, + 0xf0, 0x00, 0x00, 0x80, 0x7c, 0x00, 0x00, 0x80, 0xfd, 0x01, 0xc0, 0xf8, + 0x00, 0x00, 0x80, 0x7e, 0x00, 0x00, 0x80, 0xfd, 0x01, 0xc0, 0xfc, 0x00, + 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0xfd, 0x01, 0xc0, 0xfc, 0x00, 0x00, + 0x80, 0x7f, 0x00, 0x00, 0x80, 0xfd, 0x01, 0xc0, 0xfc, 0x00, 0x00, 0x80, + 0x7f, 0x00, 0x00, 0x80, 0xfd, 0x01, 0xc0, 0xfc, 0x00, 0x00, 0x80, 0x7f, + 0x00, 0x00, 0x80, 0xfd, 0x01, 0xc0, 0xfc, 0x00, 0x00, 0x80, 0x7f, 0x00, + 0x00, 0x80, 0xfd, 0x01, 0xc0, 0xfc, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, + 0x80, 0xfd, 0x01, 0xc0, 0xfc, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, + 0xfd, 0x01, 0xc0, 0xfc, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0xfd, + 0x01, 0xc0, 0xfc, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0xfd, 0x01, + 0xc0, 0xfc, 0x00, 0x00, 0x80, 0xff, 0x1f, 0x00, 0xfc, 0xfd, 0x01, 0xc0, + 0xfc, 0x3f, 0x00, 0xfc, 0xff, 0x1f, 0x00, 0xfc, 0xfc, 0x01, 0xc0, 0xfc, + 0x3f, 0x00, 0xfc, 0xff, 0x1f, 0x00, 0x7c, 0xfc, 0x01, 0xc0, 0xfc, 0x3f, + 0x00, 0x7c, 0xff, 0x1f, 0x00, 0x3c, 0xfc, 0x01, 0xc0, 0xfc, 0x3f, 0x00, + 0x3c, 0xff, 0x1f, 0x00, 0x1c, 0xfc, 0x01, 0xc0, 0xfc, 0x3f, 0x00, 0x1c, + 0xff, 0x1f, 0x00, 0x0c, 0xfc, 0x01, 0xc0, 0xfc, 0x3f, 0x00, 0x0c, 0xff, + 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xfc, 0x3f, 0x00, 0x0c, 0xff, 0x1f, + 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xfc, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, + 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, + 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, + 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, + 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, + 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, + 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, + 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, + 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, + 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, + 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, + 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, + 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, + 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, + 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, + 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, + 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, + 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, + 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, + 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, + 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, + 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, + 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, + 0x04, 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, + 0xfc, 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, + 0x01, 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, + 0xc0, 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, + 0xc0, 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0x04, 0xfc, 0x01, 0xc0, 0xc0, + 0x3f, 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0xfc, 0xff, 0x01, 0xc0, 0xff, 0x3f, + 0x00, 0x0c, 0xc0, 0x1f, 0x00, 0xfc, 0xff, 0x01, 0xc0, 0xff, 0x3f, 0x00, + 0x0c, 0xc0, 0x1f, 0x00, 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x0c, + 0xc0, 0x1f, 0x00, 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0xc0, + 0x1f, 0x00, 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x3f, + 0x00, 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x7f, 0x00, + 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0xff, 0x00, 0x00, + 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0xff, 0x01, 0x00, 0xfc, + 0x01, 0xc0, 0x00, 0x00, 0x00, 0x0e, 0x00, 0xff, 0x03, 0x00, 0xfc, 0x01, + 0xc0, 0x00, 0x00, 0x80, 0x0f, 0x00, 0xfc, 0x07, 0x00, 0xfc, 0x01, 0xc0, + 0x00, 0x00, 0xc0, 0x07, 0x00, 0xf8, 0x0f, 0x00, 0xfc, 0x01, 0xc0, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0xf0, 0x1f, 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x38, + 0x00, 0x00, 0xc0, 0x7f, 0x00, 0xfc, 0x01, 0xc0, 0x00, 0x00, 0x1e, 0x00, + 0x00, 0x80, 0xff, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x0f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, + 0xfe, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfc, + 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, + 0xff, 0x01, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, + 0x01, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x01, + 0xc0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe0, 0x0f, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, + 0x0f, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x3f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}; diff --git a/Contrib/STk-wtour/lib/iu.seal.small.xbm b/Contrib/STk-wtour/lib/iu.seal.small.xbm new file mode 100644 index 0000000..9d53e6d --- /dev/null +++ b/Contrib/STk-wtour/lib/iu.seal.small.xbm @@ -0,0 +1,136 @@ +#define iu_width 124 +#define iu_height 124 +static char iu_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0x03,0x00,0x00,0x00,0x00, + 0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0x3f,0x00,0x00,0x00, + 0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0x3f,0xff,0xff,0x03,0x00, + 0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0xff,0x0f,0x00,0x00,0xfe,0x1f, + 0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0xc0,0xff,0x00,0x00,0x00,0xc0, + 0x7f,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0xf0,0x0f,0x00,0xf8,0x38, + 0x00,0xfe,0x01,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0xfc,0x03,0xcc,0x08, + 0xe8,0x00,0xf0,0x07,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x7f,0x80,0xc9, + 0x08,0x88,0x70,0xc0,0x1f,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xc0,0x1f,0x80, + 0xd9,0x78,0xd8,0xd8,0x00,0x7f,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xe0,0x07, + 0x88,0xd1,0x08,0x7c,0x98,0x00,0xfc,0x01,0x00,0x00,0xf0,0x00,0x00,0x00,0xf8, + 0x81,0x19,0x71,0x08,0xcc,0x30,0x58,0xf0,0x03,0x00,0x00,0xf0,0x00,0x00,0x00, + 0xfc,0x80,0x1b,0x63,0xf8,0x4c,0x64,0xc8,0xc1,0x07,0x00,0x00,0xf0,0x00,0x00, + 0x00,0x3e,0x88,0x37,0x63,0x00,0xc0,0xcc,0x8c,0x87,0x1f,0x00,0x00,0xf0,0x00, + 0x00,0x80,0x0f,0x08,0x3f,0x02,0x00,0x00,0x78,0x84,0x05,0x3e,0x00,0x00,0xf0, + 0x00,0x00,0xc0,0x07,0x18,0x33,0x00,0xc0,0x00,0x00,0xc6,0x00,0x7c,0x00,0x00, + 0xf0,0x00,0x00,0xe0,0x83,0x31,0x22,0xe0,0x3f,0xff,0x00,0xc6,0x60,0xf8,0x00, + 0x00,0xf0,0x00,0x00,0xf0,0x00,0x23,0x06,0x1e,0x00,0x00,0x0f,0x60,0xf0,0xe0, + 0x01,0x00,0xf0,0x00,0x00,0x78,0x00,0x63,0xc0,0x01,0x00,0x00,0x70,0x20,0x58, + 0xc0,0x03,0x00,0xf0,0x00,0x00,0x3c,0x00,0x26,0x70,0x00,0x00,0x00,0x80,0x01, + 0x6e,0x80,0x07,0x00,0xf0,0x00,0x00,0x1e,0x00,0x1c,0x0c,0x00,0x00,0x00,0x00, + 0x06,0x7e,0x08,0x0f,0x00,0xf0,0x00,0x00,0x0f,0x00,0x00,0x03,0x00,0x02,0x18, + 0x00,0x18,0x30,0x18,0x1e,0x00,0xf0,0x00,0x80,0x07,0x00,0xc0,0x00,0x00,0x06, + 0x14,0x00,0x60,0x30,0x38,0x3c,0x00,0xf0,0x00,0xc0,0x03,0x00,0x20,0x00,0x00, + 0x09,0x22,0x00,0x80,0x21,0x4c,0x78,0x00,0xf0,0x00,0xc0,0x01,0x00,0x18,0xc0, + 0x81,0x10,0x42,0x60,0x00,0x03,0x06,0xf0,0x00,0xf0,0x00,0xe0,0x01,0x00,0x0c, + 0x40,0x86,0x50,0x02,0x98,0x00,0x04,0x03,0xe1,0x00,0xf0,0x00,0xf0,0x00,0x00, + 0x02,0x40,0x24,0xb0,0x22,0x80,0x00,0x18,0x81,0xe1,0x01,0xf0,0x00,0x78,0x38, + 0x00,0x01,0x00,0xc8,0x11,0xe3,0x85,0x00,0x30,0xc0,0xc0,0x03,0xf0,0x00,0x38, + 0x8c,0x80,0x00,0x40,0x98,0x11,0x23,0x86,0x00,0x60,0x60,0x80,0x07,0xf0,0x00, + 0x3c,0xec,0x61,0xe0,0x40,0x18,0x11,0x21,0x82,0x80,0xc1,0x38,0x0e,0x07,0xf0, + 0x00,0x1e,0x3c,0x21,0x20,0xb3,0x10,0x31,0x21,0x42,0x33,0x81,0x01,0x1b,0x0f, + 0xf0,0x00,0x0e,0x18,0x11,0x20,0x94,0x10,0x31,0x31,0x43,0x0a,0x01,0xc3,0x12, + 0x0e,0xf0,0x00,0x0f,0xe1,0x08,0x20,0x88,0x31,0x33,0x11,0x61,0x06,0x01,0x46, + 0x1a,0x1e,0xf0,0x00,0x07,0x47,0x04,0x20,0x18,0x21,0x22,0x11,0x21,0x06,0x01, + 0xc4,0x06,0x3c,0xf0,0x80,0x07,0x0e,0x02,0x40,0x10,0x23,0x00,0x80,0x31,0x83, + 0x00,0x88,0x03,0x38,0xf0,0x80,0x03,0x38,0x02,0x80,0x30,0x62,0x00,0x80,0x10, + 0x41,0x00,0x10,0x01,0x38,0xf0,0xc0,0x03,0x20,0x01,0xe0,0x61,0x46,0x51,0x8a, + 0x98,0xe1,0x01,0x30,0x00,0x70,0xf0,0xc0,0x61,0x80,0xc0,0x17,0x43,0x44,0x51, + 0xce,0xc8,0x30,0xf8,0x20,0x00,0x70,0xf0,0xe0,0x31,0x87,0x40,0x18,0xc2,0xcc, + 0x51,0x44,0x4c,0x18,0x84,0x40,0x00,0xe0,0xf0,0xe0,0x90,0x45,0x40,0x30,0x84, + 0x89,0x51,0x4e,0x66,0x08,0x83,0x40,0x00,0xe0,0xf0,0xf0,0xf0,0x24,0x40,0x60, + 0x08,0x91,0x67,0x4a,0x26,0x84,0x41,0x80,0x00,0xe0,0xf1,0xf0,0x40,0x26,0x80, + 0xc0,0x10,0x93,0x00,0x00,0x13,0xc2,0x60,0x80,0x00,0xc0,0xf1,0x70,0x00,0x03, + 0x00,0x83,0x21,0x26,0xa9,0x25,0x1b,0x63,0x10,0x00,0x01,0xc0,0xf1,0x78,0x00, + 0x10,0x80,0x07,0x63,0x24,0xa9,0xb5,0x89,0x31,0x3c,0x00,0x01,0xc0,0xf3,0x38, + 0x1c,0x10,0x00,0x1c,0xc6,0x4c,0xfb,0x97,0xc5,0x18,0x4e,0x00,0x02,0x86,0xf3, + 0x38,0xf0,0x08,0x90,0x70,0xff,0xff,0xff,0xff,0xff,0xbf,0x43,0x02,0x42,0x8f, + 0xf3,0x38,0xc0,0x09,0xe7,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x19,0x66, + 0x8b,0xf7,0x3c,0x7e,0x0c,0x81,0x83,0x19,0x00,0x40,0x00,0x00,0x66,0x70,0x10, + 0x24,0x0b,0xf7,0x1c,0x1e,0x04,0x02,0x0e,0x19,0x00,0x00,0x00,0x00,0x26,0x1c, + 0x00,0x64,0x0b,0xf7,0x1c,0xf8,0x04,0x04,0x38,0x19,0x00,0x00,0x00,0x00,0x26, + 0x07,0x08,0xc8,0x01,0xf7,0x1c,0xc0,0x04,0x1c,0xe0,0x99,0xfb,0x1e,0x3e,0x3f, + 0xe6,0x01,0x06,0x08,0x00,0xff,0x1e,0x00,0x02,0xe0,0x80,0x99,0xfb,0x1e,0x3e, + 0x3f,0x66,0xc0,0x01,0x08,0x00,0xfe,0x0e,0x01,0x02,0x98,0x07,0x19,0x00,0x00, + 0x00,0x00,0x26,0x78,0x02,0x08,0x3e,0xfe,0x0e,0x49,0x02,0x08,0x3c,0x19,0x00, + 0x00,0x00,0x00,0xa6,0x07,0x02,0xd0,0x07,0xfe,0x0e,0x49,0x02,0x00,0xe0,0x99, + 0xe7,0x1f,0xfe,0x33,0xe6,0x00,0x02,0x10,0x00,0xfe,0x0e,0x4d,0x02,0x7f,0x00, + 0x19,0x00,0x00,0x00,0x00,0x26,0xc0,0x3f,0x10,0x1e,0xfe,0x8e,0x7f,0xc1,0xe0, + 0x0f,0x19,0x00,0x00,0x00,0x00,0x26,0x7e,0xc0,0x10,0x3f,0xfe,0x0e,0x7c,0x21, + 0x00,0xfc,0x99,0xcf,0x1f,0x4e,0x3e,0xe6,0x03,0x80,0x90,0x21,0xfe,0x0e,0x00, + 0x41,0x00,0x80,0x99,0xcf,0x1f,0x4e,0x3e,0x26,0x00,0x40,0x90,0x61,0xfe,0x0e, + 0x00,0x81,0x00,0x00,0x19,0x00,0x00,0x00,0x00,0x26,0x00,0x20,0x90,0x65,0xfc, + 0x0e,0x00,0x01,0xff,0x7f,0x19,0x00,0x00,0x00,0x00,0xe6,0xff,0x03,0x10,0x37, + 0xfc,0x8f,0x3f,0x01,0x08,0xf8,0x99,0xf3,0x1c,0xfe,0x3d,0x66,0x00,0x04,0x90, + 0x17,0xfc,0x07,0x1c,0x01,0x04,0x00,0x19,0x00,0x00,0x00,0x00,0x26,0x00,0x08, + 0x10,0x00,0xfc,0x07,0x06,0x01,0x08,0xf0,0x19,0x00,0x00,0x00,0x00,0xe6,0x1f, + 0x04,0x10,0x00,0xfc,0x8e,0x3f,0x01,0xff,0xff,0x99,0x7f,0x1e,0x9e,0x3f,0x26, + 0xfe,0x1f,0x90,0x7f,0xfc,0x8e,0x3f,0x81,0x00,0x00,0x99,0x7f,0x1e,0x9e,0x3f, + 0x26,0x00,0x20,0x90,0x7f,0xfc,0x0e,0x00,0x81,0x00,0x80,0x19,0x00,0x00,0x00, + 0x00,0xe6,0x00,0x40,0x10,0x00,0xfe,0x0e,0x00,0x41,0x00,0xfc,0x19,0x00,0x00, + 0x00,0x00,0xe6,0x1f,0x80,0x90,0x03,0xfe,0x0e,0x40,0xc1,0xe0,0x1f,0x99,0xf3, + 0x19,0xce,0x39,0x26,0xfc,0x63,0x90,0x3f,0xfe,0x0e,0x70,0x02,0xff,0x00,0x99, + 0xf3,0x19,0xce,0x39,0x26,0x80,0x19,0x90,0x20,0xfe,0x0e,0x3c,0x02,0x10,0xe0, + 0x19,0x00,0x00,0x00,0x00,0xe6,0x01,0x02,0xd0,0x00,0xfe,0x0e,0x27,0x02,0x08, + 0x3c,0x99,0x9f,0x1f,0x7e,0x3e,0x26,0x1f,0x02,0xc8,0x00,0xfe,0x0e,0x3f,0x02, + 0x90,0x03,0x99,0x9f,0x1f,0x7e,0x3e,0x26,0xf8,0x01,0x08,0x00,0xfe,0x1e,0xfc, + 0x02,0x70,0x80,0x19,0x00,0x00,0x00,0x00,0x66,0x80,0x01,0x08,0x00,0xfe,0x1c, + 0x00,0x04,0x0c,0x60,0x19,0x00,0x00,0x00,0x00,0xe6,0x01,0x04,0xc8,0x00,0xff, + 0x1c,0x80,0x04,0x04,0x18,0x19,0x00,0x00,0x00,0x00,0x26,0x07,0x08,0xe4,0x07, + 0xf7,0x1c,0xf8,0x05,0x02,0x06,0x19,0x00,0x40,0x00,0x00,0x26,0x1c,0x10,0x24, + 0x1c,0xf7,0x1c,0x1e,0x08,0x82,0xc1,0x19,0x00,0xc0,0x00,0x00,0x66,0x70,0x10, + 0x24,0x00,0xf7,0x38,0x00,0x08,0xaf,0x60,0xff,0xff,0xff,0xff,0xff,0xff,0xa0, + 0x1f,0x22,0x80,0xf7,0x38,0xc0,0x09,0x80,0x30,0xff,0xff,0xff,0xff,0xff,0xbf, + 0x03,0x00,0x02,0x80,0xf3,0x38,0xf0,0x13,0x80,0x0c,0xc6,0x6c,0xa9,0xb6,0x4c, + 0x0c,0x66,0x00,0x02,0x80,0xf3,0x78,0x18,0x12,0x00,0x06,0x63,0x36,0xa9,0x24, + 0x99,0x30,0x1c,0x00,0x79,0xc0,0xf3,0x70,0x18,0x26,0x00,0x81,0x31,0xb2,0xad, + 0x24,0x1b,0x61,0x30,0x00,0xcd,0xc1,0xf1,0x70,0x18,0x27,0x80,0x40,0x00,0x00, + 0x00,0x00,0x00,0xc0,0x40,0x80,0x0c,0xc3,0xf1,0xf0,0xd0,0x43,0x00,0x20,0x00, + 0x00,0x00,0x00,0x00,0x80,0x41,0x80,0x0c,0xe0,0xf1,0xe0,0x70,0x40,0x40,0x10, + 0x14,0x42,0x8a,0x52,0xc4,0x09,0x03,0x40,0x38,0xe0,0xf0,0xe0,0x11,0x90,0x40, + 0x18,0x72,0x82,0x99,0x53,0xca,0x18,0x85,0x20,0xe0,0xe0,0xf0,0xc0,0x01,0x1c, + 0xc1,0x07,0x11,0x82,0x89,0x52,0x2e,0x31,0xf9,0x20,0x81,0x70,0xf0,0xc0,0x03, + 0x1e,0x01,0xe0,0x71,0x82,0xb9,0x52,0xca,0x60,0x00,0x10,0x03,0x70,0xf0,0x80, + 0x83,0x0b,0x02,0x80,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x08,0x0e,0x78,0xf0, + 0x80,0x87,0x6c,0x04,0x40,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xcc,0x1f,0x38, + 0xf0,0x00,0x07,0x3c,0x0c,0x00,0x18,0x31,0x33,0x11,0x21,0x06,0x00,0xa4,0x3e, + 0x3c,0xf0,0x00,0x0f,0x1e,0x19,0x00,0x94,0x31,0x33,0x11,0x61,0x0a,0x00,0x72, + 0x11,0x1e,0xf0,0x00,0x0e,0xc6,0x11,0x00,0xf2,0x10,0x31,0x11,0xc3,0x0b,0x00, + 0xc1,0x02,0x1e,0xf0,0x00,0x1e,0x60,0x20,0x80,0x81,0x10,0x31,0x31,0x42,0xe0, + 0x80,0x80,0x07,0x0f,0xf0,0x00,0x3c,0x30,0x40,0x00,0x40,0x18,0x31,0x31,0x82, + 0x00,0x40,0x00,0x06,0x07,0xf0,0x00,0x38,0x18,0x80,0x01,0x40,0x98,0x31,0x61, + 0x85,0x00,0x20,0x00,0x84,0x07,0xf0,0x00,0x78,0x00,0x00,0x03,0x40,0x60,0x31, + 0xa1,0x85,0x00,0x10,0x00,0xc0,0x03,0xf0,0x00,0xf0,0x00,0x00,0x06,0x40,0x04, + 0x50,0x20,0x88,0x00,0x0c,0x00,0xe0,0x01,0xf0,0x00,0xe0,0x01,0x04,0x08,0x40, + 0x83,0x10,0x22,0x30,0x00,0x06,0x00,0xe0,0x01,0xf0,0x00,0xe0,0x01,0x3c,0x30, + 0x80,0x00,0x11,0x22,0x40,0x00,0x81,0x02,0xf0,0x00,0xf0,0x00,0xc0,0x03,0x1c, + 0x40,0x00,0x00,0x09,0x14,0x00,0xc0,0x00,0x03,0x78,0x00,0xf0,0x00,0x80,0x07, + 0x3e,0x80,0x01,0x00,0x06,0x18,0x00,0x30,0x80,0x0f,0x3c,0x00,0xf0,0x00,0x00, + 0x0f,0x08,0x00,0x06,0x00,0x00,0x00,0x00,0x0c,0xc0,0x02,0x1e,0x00,0xf0,0x00, + 0x00,0x1e,0x08,0x18,0x38,0x00,0x00,0x00,0x00,0x03,0x00,0x02,0x0f,0x00,0xf0, + 0x00,0x00,0x3c,0x00,0x18,0xe0,0x00,0x00,0x00,0xe0,0x80,0x00,0x80,0x07,0x00, + 0xf0,0x00,0x00,0x78,0x00,0x1c,0x00,0x0f,0x00,0x00,0x1c,0xc0,0x00,0xc0,0x07, + 0x00,0xf0,0x00,0x00,0xf0,0x00,0x94,0x01,0xf8,0x01,0xf0,0x03,0xd8,0x00,0xe0, + 0x01,0x00,0xf0,0x00,0x00,0xe0,0x03,0xf6,0x01,0x00,0xfe,0x0f,0x00,0xf8,0x00, + 0xf0,0x00,0x00,0xf0,0x00,0x00,0xc0,0x07,0xaa,0x30,0x00,0x00,0x00,0x80,0xe0, + 0x00,0x7c,0x00,0x00,0xf0,0x00,0x00,0x80,0x0f,0xda,0xf0,0x01,0x00,0x00,0xd0, + 0xc0,0x01,0x3e,0x00,0x00,0xf0,0x00,0x00,0x00,0x3f,0x78,0x10,0x61,0x00,0xc0, + 0xf8,0x40,0x07,0x1f,0x00,0x00,0xf0,0x00,0x00,0x00,0x7c,0x60,0x18,0xf1,0xe1, + 0xf0,0xe1,0x40,0xc0,0x0f,0x00,0x00,0xf0,0x00,0x00,0x00,0xf8,0x01,0x18,0x19, + 0xb1,0x11,0xe1,0xc0,0xf0,0x03,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x07,0x88, + 0x19,0x10,0x11,0xe0,0x01,0xf8,0x01,0x00,0x00,0xf0,0x00,0x00,0x00,0xc0,0x1f, + 0xdc,0x08,0x18,0x10,0x60,0x03,0x7e,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00, + 0x7f,0x60,0x98,0x19,0x30,0x63,0x80,0x1f,0x00,0x00,0x00,0xf0,0x00,0x00,0x00, + 0x00,0xfc,0x01,0xf0,0x31,0xf1,0x01,0xf0,0x0f,0x00,0x00,0x00,0xf0,0x00,0x00, + 0x00,0x00,0xf0,0x0f,0xf0,0xf0,0xc1,0x00,0xfe,0x03,0x00,0x00,0x00,0xf0,0x00, + 0x00,0x00,0x00,0xc0,0x7f,0x00,0x00,0x00,0xc0,0x7f,0x00,0x00,0x00,0x00,0xf0, + 0x00,0x00,0x00,0x00,0x00,0xff,0x07,0x00,0x00,0xfc,0x1f,0x00,0x00,0x00,0x00, + 0xf0,0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0x07,0xfc,0xff,0x03,0x00,0x00,0x00, + 0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0xff,0xff,0x7f,0x00,0x00,0x00, + 0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0x07,0x00,0x00, + 0x00,0x00,0x00,0xf0}; diff --git a/Contrib/STk-wtour/lib/wtour.stk b/Contrib/STk-wtour/lib/wtour.stk new file mode 100644 index 0000000..3cd5cb8 --- /dev/null +++ b/Contrib/STk-wtour/lib/wtour.stk @@ -0,0 +1,406 @@ +#!/bin/sh +:;exec /usr/local/bin/stk -f +;; +;; STk/Scheme widget tour, Version 0.2 +;; +;; Originally for Tk/Tcl by: Andrew Payne payne@crl.dec.com +;; This one simplified and redesigned for STk/Scheme +;; by: Suresh Srinivas ssriniva@cs.indiana.edu + +;; Main differences are in the way the demo window is created +;; The Tk/Tcl version uses send mechanisms extensively. +;; The STk/Scheme version avoids using send mechanisms and +;; fixes the user's input so as to make the user widgets to +;; be children of a top-level widget called .wtour-wdemo + + +(option 'add "Tk.geometry" "+25+405" "startupFile") +(option 'add "Tk.demo-geometry" "300x300+25+25" "startupFile") + +(option 'add "*Entry*BorderWidth" "2") +(option 'add "*Entry*Background" "white") +(option 'add "*Entry*Relief" "sunken") +(option 'add "*Entry*Font" "-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*") +(option 'add "*Entry*Width" "40") + +;; prefix all the globals with wtour +;; so that we dont screw up the global name space quite a lot + +(define wtour-wdemo ".wtour-wdemo") +(define wtour-filename #f) +(define wtour-action #f) + +(define wtour-mframe #f) +(define wtour-txt #f) + +(define wtour-maxlessons 100) +(define wtour-nlessons #f) +(define wtour-lessons (make-vector wtour-maxlessons)) +(define wtour-curlesson #f) +(define wtour-dir (if (null? *argv*) "." (car *argv*))) +(define wtour-lessondir (string-append wtour-dir "/lessons/")) + +(define wtour-menus '()) +(define wtour-menu-bar '()) + + +;; some tk goodies (stolen from one of the STk demos) + +(define (->string obj) + (cond ((string? obj) obj) + ((number? obj) (number->string obj)) + ((symbol? obj) (symbol->string obj)) + ((tk-command? obj) (widget->string obj)) + (else (error "Cannot convert ~S to a string" obj)))) + +(define (& . l) + (let loop ((l l) (s "")) + (if (null? l) + s + (loop (cdr l) (string-append s (->string (car l))))))) + + + + +;; Make a text widget with an attached scrollbar +(define (mktext w) + (let ((scl #f) + (txt #f)) + (frame w) + (set! scl (scrollbar (& w ".scroll") + :relief "flat" + :command (lambda l + (apply txt 'yview l)))) + (set! txt (text (& w ".text") + :bd 1 + :relief "raised" + :yscrollcommand (lambda l + (apply scl 'set l)))) + (pack scl :side "right" :fill "y") + (pack txt :expand #t :fill "both") + txt)) + +;; Set up the demo window +(begin + (catch (destroy .wtour-wdemo)) + (toplevel wtour-wdemo) + (wm 'geometry wtour-wdemo "+300+300") + (wm 'minsize wtour-wdemo "100" "100") + (wm 'title .wtour-wdemo "STk Demo Window") + (wm 'iconname .wtour-wdemo "STk Demo Window") + (update "idletasks")) + + +;; +;; Set up main window +;; + +(wm 'title "." "STk Widget Tour") + +(set! wtour-mframe (frame ".menu" :relief "raised" :borderwidth "1")) +(pack wtour-mframe :fill "x") + +;; having to eval the return values from Tk is indeed a bother + +(let ([mframe-help (& wtour-mframe ".help")] + [mframe-file (& wtour-mframe ".file")]) + (let ([mframe-help-menu (& mframe-help ".menu")]) + (menubutton mframe-help :text "Help" :menu mframe-help-menu) + (pack mframe-help :side "right") + (let ([m (menu mframe-help-menu)]) + (m 'add 'command :label "Help!" :command '(mkHelp)))) + (let ([mframe-file-menu (& mframe-file ".menu")]) + (menubutton mframe-file :text "File" :menu mframe-file-menu) + (pack mframe-file :side "left") + (let ([m (menu mframe-file-menu)]) + (m 'add 'command :label "New" :command '(do-new)) + (m 'add 'command :label "Open..." :command '(do-open)) + (m 'add 'command :label "Save..." :command '(do-saveas)) + (m 'add 'separator) + (let ([mframe-file-menu-fonts (& mframe-file-menu ".fonts")]) + (m 'add 'cascade :label "Screen Font" :menu mframe-file-menu-fonts) + (m 'add 'separator) + (m 'add 'command :label "Exit" :command '(do-exit)) + (let ([m (menu mframe-file-menu-fonts)]) + (m 'add 'command :label "Small" :command + '(set-font "-*-courier-medium-r-*-*-12-*-*-*-*-*-*-*")) + (m 'add 'command :label "Medium" :command + '(set-font "-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*")) + (m 'add 'command :label "Large" :command + '(set-font "-*-courier-medium-r-*-*-18-*-*-*-*-*-*-*"))))))) + + +(set! wtour-txt (mkText ".text")) +(pack .text :expand "yes" :fill "both") + +(bind wtour-txt "" (lambda () (apply-changes))) +(bind wtour-txt "" (lambda () (adjust-lesson -1))) +(bind wtour-txt "" (lambda () (adjust-lesson +1))) +(focus wtour-txt) + +(let ([f (frame ".buttons" :relief "raised" :borderw "1")]) + (pack f :side "bottom" :fill "x") + (let ([f-apply (& f ".apply")] + [f-next (& f ".next")] + [f-prev (& f ".prev")]) + (button f-apply :text " Apply " :command (lambda () (apply-changes))) + (button f-next :text " Next " :command (lambda () (adjust-lesson +1))) + (button f-prev :text " Prev " :command (lambda () (adjust-lesson -1))) + (pack f-apply f-next f-prev :side "left" :padx 7 :pady 7))) + +;; +;; Set the font of both text windows +;; + +(define (set-font reg) + (wtour-txt 'configure :font reg)) + + +;; Make a new dialog toplevel window +;; + +(define (mkDialogWindow w) + (catch (destroy w)) + (toplevel w :class "Dialog" :bd 0) + (wm 'title w "Dialog box") + (wm 'iconname w "Dialog") + (wm 'geometry w "+425+300") + (grab w) + (focus w) + (string->symbol w)) + +(define (centerwindow w) + (wm 'withdraw w) + (update "idletasks") + (let ([x (- ( - (inexact->exact (/ (winfo 'screenwidth w) 2)) + (inexact->exact (/ (winfo 'reqwidth w) 2))) + (winfo 'vrootx (eval (winfo 'parent w))))] + [y (- ( - (inexact->exact (/ (winfo 'screenheight w) 2)) + (inexact->exact (/ (winfo 'reqheight w) 2))) + (winfo 'vrooty (eval (winfo 'parent w))))]) + (wm 'geom w (format #f "+~A+~A" x y)) + (wm 'deiconify w))) + +(define (mkHelp) + (let ([w (mkDialogWindow ".help")]) + (wm 'title w "Window Tour Help") + (let ([w-t (& w ".t")] + [w-f (& w ".buttons")]) + (let ([t (mkText w-t)]) + (pack w-t) + (let ([f (frame w-f :relief "raised" :borderw "1")]) + (pack f :side "bottom" :fill "x") + (let ([f-close (& w-f ".close")]) + (button f-close :text " Close " :command `(destroy ,w)) + (pack f-close :side "right" :padx "7" :pady "7"))) + (t 'insert "current" +"Wtour is an interactive tour of STk widgets. + +The main window displays a short Scheme/STk program, and the demo window +displays the results of running the program. + +You can make changes to the program and apply those changes by clicking +on the \"Apply\" button or pressing the \"Do\" button. + +You can navigate through the tour with the \"Prev\" and \"Next\" buttons. Or, +you can go directly to a specified lesson with the drop down menus. + +There is also a command window that can be used to send individual commands +to the demo process. You can toggle the command window on and off with an +option under the \"File\" menu. + +Originally by: Andrew Payne (payne@crl.dec.com) +STk rewrite by: Suresh Srinivas (ssriniva@cs.indiana.edu) +STk 3.0 port by: Erick Gallesio (eg@unice.fr)") + (t 'configure :state "disabled") + (centerwindow w))))) + + +;; Make a one-line query dialog box + +(define (mkentryquery w prompt var) + (let ([w (mkdialogwindow w)]) + (let ([w-top (& w ".top")] + [w-bot (& w ".bot")]) + (let ([t (frame w-top :relief "raised" :border "1")] + [b (frame w-bot :relief "raised" :border "1")]) + (pack t b :fill "both") + (let ([t-lab (& t ".lab")] + [t-ent (& t ".ent")] + [b-ok (& b ".ok")] + [b-default (& b ".default")] + [b-cancel (& b ".cancel")]) + (label t-lab :text prompt) + (let ([e (entry t-ent :textvar `,var)]) + (bind e "" `(set! wtour-action 'ok)) + (pack t-lab e :side "left" :padx "3m" :pady "3m") + + (button b-ok :text "Ok" :command '(set! wtour-action "ok")) + (frame b-default :relief "sunken" :bd 1) + (raise b-ok b-default) + (pack b-default :in w-bot :side "left" :expand "1" + :padx "3m" :pady "2m") + (pack b-ok :in b-default :padx "2m" + :ipadx "2m" :ipady "1m") + (button b-cancel :text "Cancel" :command + '(set! wtour-action "cancel")) + (pack b-cancel :side "left" :padx "3m" :pady "3m" + :ipadx "2m" :ipady "1m" :expand "yes") + (centerwindow w) + (focus e) + (tkwait 'variable 'wtour-action) + (destroy w) + wtour-action)))))) + +;; Write the edit buffer to the specified file + +(define (write-file fname) + (with-output-to-file fname + (lambda () + (format #t "~A" (wtour-txt 'get "1.0" "end"))))) + +;; ignoring file existence check (update) + +(define (do-save-file fname) + (write-file fname)) + +(define (do-new) + (wtour-txt 'delete "1.0" "end") + (apply-changes)) + +(define (do-saveas) + (if (equal? (mkentryquery ".dialog" + "Enter save file name:" 'wtour-filename) "ok") + (do-save-file wtour-filename))) + +(define (do-open-file fname) + (with-input-from-file fname + (lambda () + (wtour-txt 'delete "1.0" "end") + (do ((l (read-line) (read-line))) + ((eof-object? l)) + (wtour-txt 'insert "end" l) + (wtour-txt 'insert "end" "\n")) + (wtour-txt 'mark 'set 'insert "1.0"))) + (apply-changes)) + +(define (do-open) + (if (equal? (mkentryquery ".dialog" + "Enter file name to load:" 'wtour-filename) "ok") + (do-open-file wtour-filename))) + + +;; need to do it recursively! (look at X selection to see why it wont work) +(define (fix-widget-names l) + (map + (lambda (x) + (cond + ((symbol? x) (let ([y (symbol->string x)]) + (if (eq? (string-ref y 0) #\.) + (string->symbol (string-append ".wtour-wdemo" y)) + x))) + ((string? x) (if (eq? (string-ref x 0) #\.) + (string-append ".wtour-wdemo" x) + x)) + ((list? x) (fix-widget-names x)) + (else x))) + l)) + +;; mopping up the demo window prior to loading the next lesson +;; or applying the changes to the demo window. + +(define (clear-up-wtour-wdemo) + (let ([wtour-wdemo-child (winfo 'children .wtour-wdemo)]) + (if (not (null? wtour-wdemo-child)) + (if (list? wtour-wdemo-child) + (map (lambda (w) + (destroy w)) + wtour-wdemo-child) + (destroy wtour-wdemo-child))))) + +;; apply the changes to the demo window +(define (apply-changes) + (clear-up-wtour-wdemo) + (let ([x (wtour-txt 'get "1.0" "end")]) + (with-input-from-string + x + (lambda () + (let loop ([y (read)]) + (if (not (eof-object? y)) + (let ([z (fix-widget-names y)]) + (eval z) + (loop (read))))))))) + + +(define-macro (add1! var) + `(set! ,var (+ 1 ,var))) + +(define-macro (incr! var val) + `(set! ,var (+ ,var ,val))) + +(define-macro (add-to-menu-assoc item) + `(set! wtour-menus (cons ,item wtour-menus))) + + +(define-macro (add-to-menu-list item) + `(set! wtour-menu-bar (cons ,item wtour-menu-bar))) + +;; Define a new lesson + +(define (lesson mname name file) + (vector-set! wtour-lessons wtour-nlessons file) + (let ([mb (assoc mname wtour-menus)] + [first (assoc mname wtour-menus)]) + (if (not first) + (begin + (set! mb (& (& wtour-mframe ".") wtour-nlessons)) + (menubutton mb :text mname :menu (& mb ".menu")) + (pack mb :side "left") + (add-to-menu-assoc (cons mname (menu (& mb ".menu")))) + (add-to-menu-list mb))) + (if (not (equal? name "")) + (begin + ((eval (cdr (assoc mname wtour-menus))) 'add 'command :label name + :command `(set-lesson ,wtour-nlessons)) + (add1! wtour-nlessons)) + ((eval (cdr mb)) 'add "separator")))) + + +;; set the current lesson +(define (set-lesson num) + (set! wtour-curlesson num) + (do-open-file (& wtour-lessondir "/" (vector-ref wtour-lessons num)))) + +(define (do-warning-dialog str) + (stk:make-dialog :window ".info" :title "Warning" + :text str + :bitmap "" + :grab #t + :defaults 0 + :buttons (list (list "Cancel" (lambda () #f))))) + +;; adjust the current lesson by some increment + +(define (adjust-lesson i) + (incr! wtour-curlesson i) + (if (>= wtour-curlesson wtour-nlessons) + (begin + (do-warning-dialog "That was the last lesson") + (set! wtour-curlesson (- wtour-nlessons 1))) + (if (< wtour-curlesson 0) + (begin + (do-warning-dialog "That was the first lesson") + (set! wtour-curlesson 0)))) + (set-lesson wtour-curlesson)) + + +;; clean up and exit + +(define (do-exit) + (exit)) + +(set-font "-*-courier-medium-r-*-*-12-*-*-*-*-*-*-*") + +(set! wtour-nlessons 0) +(load (& wtour-lessondir "/index")) +(set-lesson 0) diff --git a/Contrib/STk-wtour/stk-wtour b/Contrib/STk-wtour/stk-wtour new file mode 100755 index 0000000..2be13de --- /dev/null +++ b/Contrib/STk-wtour/stk-wtour @@ -0,0 +1,14 @@ +#!/bin/sh +# +# This is a start up script for the STk/Scheme widget tour. +# +# Originally by: Andrew Payne payne@crl.dec.com +# Present one by: Suresh Srinivas ssriniva@cs.indiana.edu + +STK=/usr/local/bin/stk +STK_LIBRARY=/usr/local/lib/stk + +export STK_LIBRARY +export STK + +$STK -f ./lib/wtour.stk diff --git a/Contrib/Socket/socket.c b/Contrib/Socket/socket.c new file mode 100644 index 0000000..46043f2 --- /dev/null +++ b/Contrib/Socket/socket.c @@ -0,0 +1,267 @@ +/* + * This file is a contribution of David Tolpin (dvd@pizza.msk.su) + * It is an implementation of BSD-INET sockets and is known to run on + * Solaris 1 and Linux. + * + * (prepare-server-socket portnum) + * bound socket to a local address. Returns an object of type socket-handle + * + * (release-server-socket! handle) + * close server socket (created by prepare-server-socket + * + * (socket-handle? handle) + * returns truth if the handle is of type socket-handle, false otherwise + * + * (listen-socket! handle) + * listen for connection requests + * + * (accept-connection handle) + * returns a new socket in response to a detected connection request, + * the return value is a list of two ports, + * - (car sp) is opened for reading, + * - (cadr sp) - for writing + * + * (open-client-socket hostname portnum) + * connect to a socket on a remote machine, returns the same data structure + * as the function described above + * + * (shutdown-connection! skt) + * shutdown socket, the mode of shutting down is determined according to + * the mode of the port (read or write) + */ + +#include "stk.h" +#include +#include +#include +#include +#include + +PRIMITIVE prepare_server_socket(SCM portnum); +PRIMITIVE release_server_socket(SCM handle); +PRIMITIVE socket_handlep(SCM handle); +PRIMITIVE listen_socket(SCM handle); +PRIMITIVE accept_connection(SCM handle); +PRIMITIVE open_client_socket(SCM hostname, SCM portnum); +PRIMITIVE shutdown_connection(SCM skt); + +/* +: stk_socket.c,v 1.4 1994/06/26 19:14:55 dvd Exp dvd $ +*/ + +/* +: stk_socket.c,v $ + * Revision 1.4 1994/06/26 19:14:55 dvd + * *** empty log message *** + * + * Revision 1.3 1994/06/26 18:55:27 dvd + * Verbose error reporting is added + * +*/ + +#ifdef __sun__ +extern char *sys_errlist[]; +#endif + +struct socket_handle { + int portnum; + char *hostname; + int handle; +}; + +static int tc_sockhandle; + +static void free_sockhandle(SCM handle); +static void mark_sockhandle(SCM handle); +static void displ_sockhandle(SCM x, FILE *f, int mode); + +static extended_scheme_type sockhandle_type = { + "sockhandle", /* name */ + 0, /* is_procp */ + mark_sockhandle, /* gc_mark_fct */ + free_sockhandle, /* gc_free_fct */ + NULL, /* apply_fct */ + displ_sockhandle /* display_fct */ +}; + + +#define SOCKHANDLE(x) ((struct socket_handle*)(x->storage_as.extension.data)) +#define LSOCKHANDLE(x) (x->storage_as.extension.data) +#define SOCKHANDLEP(x) (TYPEP(x,tc_sockhandle)) +#define NSOCKHANDLEP(x) (NTYPEP(x,tc_sockhandle)) + +void mark_sockhandle(SCM handle) +{ +} + +void free_sockhandle(SCM handle) +{ + struct socket_handle *sh; + sh = SOCKHANDLE(handle); + if(sh->hostname) free(sh->hostname); + close(sh->handle); + free(sh); + LSOCKHANDLE(handle) = NULL; +} + +void displ_sockhandle(SCM handle, FILE *f, int mode) +{ + struct socket_handle *sh; + sh = SOCKHANDLE(handle); + sprintf(tkbuffer, "#[socket-handle %s %i]", sh->hostname, sh->portnum); + Puts(tkbuffer,f); +} + + +static SCM makesp(int s, char *hn, int portnum) +{ + int t; + int hnlen; + FILE *fs, *ft; + SCM zs, zt; + long flag; + + flag = no_interrupt(1); + + t = dup(s); /* duplicate handles so that we are able to access one socket channel */ + /* via two scheme ports */ + if(!((fs = fdopen(s, "r")) && (ft = fdopen(s, "w")))) + err("internal(makesp): cannot create ports", NIL); + NEWCELL(zs, tc_iport); + NEWCELL(zt, tc_oport); + zs->storage_as.port.f = fs; setbuf(fs, NULL); /* unbuffered input/output */ + zt->storage_as.port.f = ft; setbuf(ft, NULL); + zs->storage_as.port.name = (char*)must_malloc((hnlen = strlen(hn))+16); + sprintf(zs->storage_as.port.name, "%s:%i(r)", hn, portnum); + zt->storage_as.port.name = (char*)must_malloc((hnlen = strlen(hn))+16); + sprintf(zt->storage_as.port.name, "%s:%i(w)", hn, portnum); + + no_interrupt(flag); + return(cons(zs, cons(zt, NIL))); +} + +PRIMITIVE prepare_server_socket(SCM portnum) +{ + struct sockaddr_in sin; + int s; + long flag; + SCM ys; + + if(NINTEGERP(portnum)) + err("not a port number", portnum); + sin.sin_port = INTEGER(portnum); + sin.sin_addr.s_addr = INADDR_ANY; + if((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) + err(sys_errlist[errno], portnum); + if(bind(s, (struct sockaddr*)&sin, sizeof sin) < 0) + switch(errno) { + case EADDRINUSE: + case EADDRNOTAVAIL: { + SCM errcode; + NEWCELL(errcode, tc_integer); + SET_INTEGER(errcode, errno); + return errcode; + } + break; + default: err(sys_errlist[errno], portnum); + } + /* now we're ready to create the object */ + NEWCELL(ys, tc_sockhandle); + LSOCKHANDLE(ys) = (struct socket_handle*)must_malloc(sizeof (struct socket_handle)); + SOCKHANDLE(ys)->portnum = sin.sin_port; + SOCKHANDLE(ys)->hostname = (char*)must_malloc(strlen("localhost")+1); + strcpy(SOCKHANDLE(ys)->hostname, "localhost"); + SOCKHANDLE(ys)->handle = s; + + return ys; +} + + +PRIMITIVE release_server_socket(SCM handle) +{ + if(NSOCKHANDLEP(handle)) err("not a socket handle", handle); + close(SOCKHANDLE(handle)->handle); + return UNDEFINED; +} + +PRIMITIVE socket_handlep(SCM handle) +{ + return SOCKHANDLEP(handle)? truth: ntruth; +} + +PRIMITIVE listen_socket(SCM handle) +{ + if(NSOCKHANDLEP(handle)) + err("not a socket handle", handle); + if(listen(SOCKHANDLE(handle)->handle, 5) < 0) + err(sys_errlist[errno], handle); + return UNDEFINED; +} + +PRIMITIVE accept_connection(SCM handle) +{ + int s; + + if(NSOCKHANDLEP(handle)) + err("not a socket handle", handle); + if((s = accept(SOCKHANDLE(handle)->handle, NULL, NULL)) < 0) + err(sys_errlist[errno], handle); + return makesp(s, SOCKHANDLE(handle)->hostname, SOCKHANDLE(handle)->portnum); +} + +PRIMITIVE open_client_socket(SCM hostname, SCM portnum) +{ + char *hn; + struct hostent *hp; + struct sockaddr_in server; + int s; + + if(NSTRINGP(hostname)) err("bad hostname", hostname); + if(NINTEGERP(portnum)) err("bad port number", portnum); + hp = gethostbyname(hn = CHARS(hostname)); + if(!hp) err("unknown or misspelled host name", hostname); + bzero((char*)&server,sizeof server); + bcopy(hp->h_addr,(char*)&server.sin_addr, hp->h_length); + server.sin_family = hp->h_addrtype; + server.sin_port = INTEGER(portnum); + if((s = socket(AF_INET,SOCK_STREAM,0)) < 0) + err(sys_errlist[errno], NIL); + if(connect(s, (struct sockaddr *)&server, sizeof server) < 0) + switch(errno) { + case EADDRINUSE: + case EADDRNOTAVAIL: + case ETIMEDOUT: + case ECONNREFUSED: { + SCM errcode; + NEWCELL(errcode, tc_integer); + SET_INTEGER(errcode, errno); + return errcode; + } + break; + default: err(sys_errlist[errno], NIL); + } + return makesp(s, hn, server.sin_port); +} + +PRIMITIVE shutdown_connection(SCM skt) +{ + if(NIPORTP(skt) && NOPORTP(skt)) + err("not a port", skt); + if(shutdown(fileno(skt->storage_as.port.f), IPORTP(skt)?0:1) < 0) + err(sys_errlist[errno], NIL); + return UNDEFINED; +} + +void init_socket(void) +{ + tc_sockhandle = add_new_type(&sockhandle_type); + + add_new_primitive("prepare-server-socket", tc_subr_1, prepare_server_socket); + add_new_primitive("release-server-socket!", tc_subr_1, release_server_socket); + add_new_primitive("socket-handle?", tc_subr_1, socket_handlep); + add_new_primitive("listen-socket!", tc_subr_1, listen_socket); + add_new_primitive("accept-connection", tc_subr_1, accept_connection); + add_new_primitive("open-client-socket", tc_subr_2, open_client_socket); + add_new_primitive("shutdown-connection!", tc_subr_1, shutdown_connection); +}; + diff --git a/Contrib/Stetris/stetris.stk b/Contrib/Stetris/stetris.stk new file mode 100755 index 0000000..b5965da --- /dev/null +++ b/Contrib/Stetris/stetris.stk @@ -0,0 +1,1112 @@ +#!/bin/sh +:;exec /usr/local/bin/stk -f "$0" "$@" +;;;; +;;;; STetris Version 1.1 +;;;; By Harvey J. Stein hjstein@math.huji.ac.il +;;;; Copyright (C) 1994 Harvey J. Stein, Tel Aviv, ISRAEL +;;;; +;;;; Permission to use, copy, and/or distribute this software and its +;;;; documentation for any purpose is hereby granted, provided that +;;;; both the above copyright notice and this permission notice appear +;;;; in all copies and derived works, and that copies and/or derived +;;;; works are used, copied and/or distributed without fees. Fees for +;;;; distribution or use of this software or derived works may only be +;;;; charged with express written permission of the copyright holder. +;;;; This software is provided ``as is'' without express or implied +;;;; warranty. + +;;; This is an implementation of a falling block game. Just run it. +;;; +;;; The controls are as follows, but are easily modified (see below): +;;; Move to left : j or left arrow +;;; Move to right: l or right arrow +;;; Rotate right : k or down arrow +;;; Rotate left : i or up arrow +;;; Drop quick : space +;;; New game : n +;;; Pause : p +;;; Continue : c +;;; Scramble : s - Scrambles the blocks so that rotate left & +;;; rotate right actually transform the shape +;;; instead of rotating it. Only available +;;; between games. +;;; Unscramble : u - Go back to original configuration +;;; Help : h +;;; Quit : q +;;; End game : e +;;; Bump up level: b +;;; +;;; ------------- Installation ------------------------------- +;;; Should just work fine as is. If you have xboing, and you have a +;;; /dev/audio device, this game can produce sounds. To get the +;;; sounds, edit the definition of sounddir (first definition of the +;;; global variables section below). Make sure it refers to the +;;; directory with your xboing sounds. + +;;; To do: +;;; -Maintain high score file. Question: How can I protect it? +;;; (Typically one will make a high score file write only to group +;;; games & make the game suid games. But, this can't be done in +;;; general for shellscripts). +;;; -Man page. +;;; -Next piece preview. +;;; -More sounds. +;;; -Better way to play sounds than catting to /dev/audio. +;;; -Make up sounds for game instead of just "borrowing" sounds from +;;; xboing. +;;; -Code cleanup - Parameterize the pieces better. Right now I +;;; have the number 7 (for the number of pieces) hard wired into +;;; the code, and the colors of each piece are just stuffed into a +;;; fcn. It would be nice to have a global variable (n) for the # of +;;; blocks to use in the pieces & then to generate all the pieces +;;; containing n squares. +;;; -Find better way of playing sounds than catting to /dev/audio +;;; -Standardize comment style. +;;; -Write STk program which uses send to play stetris. +;;; -Need to change name of window before I can write a stetris +;;; player that uses send... +;;; -Fix bug where game sometimes ends with last piece overlapping +;;; another piece. + +;;; Changes from v1.0 to v1.1: +;;; -Got rid of some of the 7s. +;;; -Added scrambling & help. +;;; -Didn't fix bug where game sometimes ends with last piece +;;; overlapping another piece, but made it more rare. +;;; -Now starts of pieces off screen so that they all appear +;;; initially as one row. +;;; -Added buttons for new game, pause, unpause, help, etc. +;;; -Blank screen during pauses. +;;; -No need for stetris shellscript (thanks to Erick). +;;; -Added to increase level by 1. +;;; -Reduced min-fall-delay from 80 to 60 because it seems to be +;;; long enough (at least on my 486dx33). Make it bigger if your +;;; top level is jerky. + +;;; Helpful for debugging (so that stetris.stk can be reloaded into +;;; the interpreter): +(for-each destroy (winfo 'children *root*)) + +;;; To avoid inopportune garbage collections: +(cond ((not (symbol-bound? 'heap-expanded)) ; Don't expand after addn'l loads. + (expand-heap 75000) + (define heap-expanded #t))) + +;;; ------------------- Include files ------------------------ + +(require "Tk-classes") +(require "unix") +(require "dialog") + + +;;; ----------- Global variables --------------------------- + +;; Sound directory (set for your system, or set to a nonexistent directory to +;; disable sound): +(define sounddir "/usr/games/lib/xboing/sounds") + +;;; Sounds (modifiable): +;;; Expects to find (string-append soundir "/" "game_over.au"), for example. +;;; Sound is played by catting it to /dev/audio +(define soundmap + '((game-over "game_over.au") + (near-end "looksbad.au") + (goto-next-level "warp.au") + (piece-landed "metal.au") + (piece-moved "click.au") + (three-in-row "applause.au") + (four-in-row "youagod.au"))) + +;; Keyboard mappings & corresponding actions (modifiable). +;; Now found at end... + +;; block size & playing field size parameters (modifyable). +(define block-width 20) ; Width of a block. +(define block-height 20) ; Height of a block. +(define block-border-width 2) ; Width of block borders. +(define play-cols 9) ; cols # 0-9 = 10 cols. +(define play-rows 29) ; rows # 0-28 = 29 rows. + +;; Window shape & size parameters (modifyable). +(define frame-border-width 3) ; Width of frame border for + ; playing field & score box. +(define score-frame-width 150) ; Width of score box (don't + ; make too small!). + +;; Game parameters (modifiable). +(define start-fall-delay 750) ; initially, game drops stetris piece + ; one notch every start-fall-delay + ; milliseconds. +(define level-time (* 40 start-fall-delay)) ; Length of time (in milliseconds) + ; that each level lasts. +(define min-fall-delay 60) ; Min amt of time allowable btw piece + ; drops. +(define delta-reducer .80) ; Each time level goes up, multiply + ; fall-delay by this to get new fall + ; delay. +(define bump-bonus 300) ; When you bump up the level + ; manually, you get bump-bonus + ; pts * the % of time left + ; until the next level. + +;;; -------------- Less modifiable parameters -------------------- +;; Game parameters (don't touch). +(define winx (* block-width (1+ play-cols))) ; size of playing field +(define winy (* block-width (1+ play-rows))) +(define start-delta-count 0) ; # of steps at game start. +(define delta-count start-delta-count) ; Lapsed time (in steps) of current + ; level. +(define level-number 1) ; Current level number. +(define fall-delay start-fall-delay) ; Current amt of time btw drops (in ms) +(define move-count 1) ; # drops since beginning of game. +(define old-count 1) ; # drops since last piece hit bottom. +(define quit-now #t) ; False causes game to stop. +(define current-piece ()) ; Piece that is currently falling. +(define score 0) ; Score. +(define game-over "") ; String to display when game ends. +(define paused-game #f) + +(define (ms-left) + (- level-time (* fall-delay delta-count))) + +(define (time-left) + (inexact->exact + (/ (ms-left) 1000))) + +(define time-to-speedup (time-left)) ; Time left to current level. +(define current-block-colors ()) ; Used to store block colors + ; when screen is blanked. + +;;; ------------ Start real work ---------------------------- +;;; Check sound validity - First check that sounddir exists & that +;;; /dev/audio exists. +(cond ((or + (not (file-is-directory? sounddir)) ;;; If sounddir doesn't exist. + (not (file-is-writable? "/dev/audio"))) ;; If /dev/audio doesn't exist. + (set! soundmap ()))) + +;;; Now, check that all sounds are readable. Delete the ones that +;;; aren't. +(set! soundmap + (let delete-nonexistent ((l soundmap)) + (cond ((null? l) ()) + ((file-is-readable? (string-append sounddir "/" (cadar l))) + (cons (car l) (delete-nonexistent (cdr l)))) + (else (delete-nonexistent (cdr l)))))) + +(define (reset-vars) +;;; Clears game variables for start of new game. + (set! delta-count start-delta-count) + (set! level-number 1) + (set! fall-delay start-fall-delay) + (set! old-count 1) + (set! move-count 1) + (set! quit-now #f) + (set! score 0) + (set! game-over "")) + +;;; ------------------ Window size setup -------------------------- +(wm 'title *root* "STetris") +(wm 'minsize *root* + (+ winx score-frame-width) + (+ winy (* 2 frame-border-width))) +(wm 'maxsize *root* + (+ winx score-frame-width) + (+ winy (* 2 frame-border-width))) + +(wm 'geometry *root* (format #f "~Ax~A" + (+ winx score-frame-width) + (+ winy (* 2 frame-border-width)))) + +;;; -------------------- Widget Creation --------------------------- + +;;; Playing canvas +'(define canvas-frame + (make + :relief 'ridge + :highlight-thickness -2 + :border-width frame-border-width)) +'(pack canvas-frame :side 'left) + +(define stetris-canvas + (make + :height winy + :border-width 0 + :relief 'ridge + :highlight-thickness 0 + :width winx)) +(pack stetris-canvas :side 'left :fill 'both :expand #f) + +;;; Statistics frame +(define score-frame + (make + :relief 'ridge + :border-width frame-border-width)) +(pack score-frame :fill 'both :expand #t :side 'left) + +(define filler-1 (make :parent score-frame)) +(define score-title-label + (make