WINTERP 2.0 example programs

00.winterp.lsp
WINTERP SESSION STARTUP FILE. This file is a template for ~/.winterp -- this is loaded each time WINTERP is started up. Typically, ~/.winterp sets up the default environment for both interactive WINTERP prototyping sessions as well as for sessions where WINTERP is running an application (e.g. invoking "winterp -init_file my-app.lsp"). If you do not have a ~/.winterp file, WINTERP will load "lib-utils/initialize.lsp" instead, hopefully finding that file within the directory specified by X Resource Winterp.lispLibDir. Therefore, you will typically have a ~/.winterp file if you have personal preferences or special environment settings which you want different than those in "lib-utils/initialize.lsp". Note, however, that you probably should have *AT* *LEAST* (REQUIRE "lib-utils/initialize") within your ~/.winterp.
01.winterp.lsp
WINTERP DEVELOPMENT SESSION STARTUP FILE. This file is a template for ~/.winterpapp -- this is loaded each time WINTERP is started up without an initialization file as specified by X resource Winterp.lispInitFile or command line -init_file. ~/.winterpapp contains the default development environment.
(screen snap) Command.lsp
Demo of XM_COMMAND_WIDGET_CLASS
(screen snap) FileSB.lsp
Demo of XM_FILE_SELECTION_BOX_WIDGET_CLASS
(screen snap) Form1.lsp
Form widget layout -- same as formtest.c on p 88 of Doug Young's Motif book.
(screen snap) Form2.lsp
Form widget layout -- similar to formtest.c on p 91-92 of Doug Young's Motif book.
(screen snap) Form3.lsp
Example options panel for Bob Leichner's audio controller...
(screen snap) List.lsp
Demo of XM_LIST_WIDGET_CLASS including methods and callbacks.
(screen snap) List1.lsp
Demo of accessing/using Scrolled XmList widget's Scrolled Window callbacks. This was used to prototype an incremental list browser that would only read/generate data (object lists) when the XmList was scrolled to the first or last list item. this is useful for accessing persistent data that is potentially unbounded in size... This demo, however, is boring...
(screen snap) List2.lsp
Test of XmList using multiple font-lists/character-sets this assumes your system has the following fonts: -*-courier-medium-r-normal-*-12-*-*-*-m-*-iso8859-1 -*-courier-bold-r-normal-*-12-*-*-*-m-*-iso8859-1
(screen snap) List3.lsp
Demo of XmList using multiple font-lists and multi-line list entries. I think multi-line list entries only work as of Motif 1.2. This assumes your system has the following fonts -*-courier-medium-r-normal-*-12-*-*-*-m-*-iso8859-1 -*-courier-bold-r-normal-*-12-*-*-*-m-*-iso8859-1
(screen snap) RowColumn.lsp
Some examples of XmCreateSimpleRadioBox(), XmCreateSimpleCheckBox(), and XmCreateSimpleOptionMenu(). Note that in Motif 1.1, XmCreateSimpleOptionMenu() invokes window manager "close" bug. See ./../doc/BUGS for details.
(screen snap) SHELL.lsp
tests out the following classes and methods on those classes OVERRIDE_SHELL_WIDGET_CLASS, TRANSIENT_SHELL_WIDGET_CLASS, TOP_LEVEL_SHELL_WIDGET_CLASS, APPLICATION_SHELL_WIDGET_CLASS, TOP_LEVEL_POPUP_SHELL_WIDGET_CLASS, APPLICATION_POPUP_SHELL_WIDGET_CLASS, OVERRIDE_POPUP_SHELL_WIDGET_CLASS, TRANSIENT_POPUP_SHELL_WIDGET_CLASS, XM_DIALOG_POPUP_SHELL_WIDGET_CLASS.
(screen snap) Scale.lsp
shows use of XM_SCALE_WIDGET_CLASS.
(screen snap) SelectioB.lsp
tests XM_SELECTION_BOX_WIDGET_CLASS methods and callbacks.
(screen snap) (screen snap) (screen snap) (screen snap) (screen snap) Table.lsp
demo of TABLE_WIDGET_CLASS
(screen snap) Text.lsp
Tests XM_TEXT_WIDGET_CLASS methods and callbacks. Also demonstrates use of :CALL_ACTION_PROC to invoke a widget action procedure programmatically.
(screen snap) accel.lsp
Example of accelerator usage. Load this file, and type letters [a-z] into any pushbutton widget. each pushbutton widget has a single accelerator, one of key [a-z], and accelerators for all other pushbuttons get installed on each pushbutton... THe accelerator arms the pushbutton, and the pushbutton's arm callback enters the typed character into the text widget. Thus, this is a highly rube-goldbergian means of echoing characters typed into the text widget... (Note that focus must be on a pushbutton or the textwdget.)
(screen snap) barchart.lsp
A 256 elt barchart which meters the number of elements/hashbucket within WINTERP's *saved_objs* hashtable. This measurement demonstrates the heisenberg uncertainty principle, :-) since repeated re-evaluation of this form will show the growth of each list-hashbucket within the hashtable *saved_objs*. The barchart element in this app is a gadget, so these show up on the graph in subsequent invocations of this app. NB: *saved_objs* is a globally accessible storage area for all objects in the outside world that WINTERP must interface with -- in particular, WIDGETS, CALLBACKOBJs, TIMEOUTOBJs, EVENTHANDLEROBJs INPUTCBOBJs, etc.
(screen snap) bigoptmenu.lsp
Example code to create an option menu with lots of items on it; Normally, option menus would create a single-column layout of the option-buttons. This one uses a 10x10 rectangular array... Load this file to see the example.
(screen snap) bitmap-br.lsp
Given a directory of X11 bitmaps at location <bitmap_directory_path>, the function (BROWSE-BITMAP-DIRECTORY <bitmap_directory_path> [<ext-regexp-str>]) will put up a browser that will allow you to change your root pixmap pattern by clicking on a bitmap image in the browser. EXAMPLES: (BROWSE-BITMAP-DIRECTORY "/usr/local/include/X11/AIcons/bground/" "*.xbm") (BROWSE-BITMAP-DIRECTORY "/usr/include/X11/bitmaps/")
(screen snap) bitmap-br2.lsp
Similar to bitmap-br.lsp, except that simply loading this file will bring up a browser of the bitmaps in directory /usr/include/X11/bitmaps/*. Unlike bitmap-br.lsp, this file contains comments on what is happening in this simple application..
(screen snap) calculator.lsp
A simple calculator. The layout on this example leaves much to be desired. Shows a use of widget subclassing.
(screen snap) calendar.lsp
Simple and Stupid Calendar UI generated by Unix 'cal' command.
(screen snap) callbacks.lsp
Demonstrates using callbacks and timeouts. Just load this file and click on the "start" or "stop" button...
(screen snap) colorsetr.lsp
Each time you load this file, it will bring up a window containing a single slider for red, green, and blue colors. You can use the sliders to create colors interactively, then click the button "Set Color On Selected Widget", followed by clicking on the widget whose color you want to set. Once the color on a widget has been set, you may move the sliders to change that color value without having to reselect the widget. By bringing up multiple instances of the colorsetr.lsp application you can set multiple color planes in other winterp widgets... Note that this uses XM_GET_COLORS to generate top/bottom/shadow colors based on the background color you've dialed in. Unless you have a lot of planes on your display, this can cause you to run out of colors quickly. Note that this works only on Motif 1.1 or later.
(screen snap) dialogshel.lsp
Demonstrates WINTERP's dialog shells, and what happens when you manage/unmanage them. You may either load this file in it's entirety, or interactively evaluate individual forms using gnu-emacs or w_ctrlpnl.lsp.
(screen snap) dircmp.lsp
A browser allowing the comparison of directories... a motif'd version of the SYSV-Unix 'dircmp' program. To use this app, browse the desired directories in the file selection widgets, then click the vertical "Compare Dirs" button. Then use up and down arrow keys, or the following mouse/key bindings to browse the differences between the directories.
Mouse bindings on browsers:
* single left click	-- select item for use by
			   $EDITOR button or other op...
* double left click	-- select item and browse it in
			   associated viewer widget.
* single middle click	-- select item and browse it in
			   associated viewer widget.
* single right click	-- select item and display
			   corresponding text in $EDITOR.
Key bindings on browsers:
* E			-- view selected item in user's
			   editor ($EDITOR).
* ^E			-- select next item and view in
			   user's editor ($EDITOR).
* ^N, ^DownArrow	-- select next item.
* ^P, ^UpArrow		-- select prev item.
* N , DownArrow		-- browse next item in viewer.
* P , UpArrow		-- browse prev item in viewer.
epoch-test.lsp
Test/demos of Epoch_Widget_Class (see lib-widgets/epoch-text.lsp) a text editor widget created by reparenting an EPOCH multiwindow emacs editor window inside a WINTERP/Motif widget. This allows you to edit files with a real text editor while placing the Epoch-edit windows into y our WINTERP-based applications. Epoch is a multiwindow gnu-emacs-based editor available for free by anonymous ftp from cs.uiuc.edu. You must load epoch-widg.el into Epoch first, as this file calls epoch-functions defined there. This file also assumes that you have Andy Norman's gnuserv package running under Epoch -- the program /usr/local/epoch/bin/gnudoit is used to send emacs-lisp commands to Epoch.
epoch-widg.el
Epoch 4.X Emacs-Lisp functions used by epoch-widg.lsp in this directory. You must load these functions into Epoch before you load epoch-widg.lsp into WINTERP.
epoch-widg.lsp
Create a drawing-area widget containing a reparented epoch 4.0 "screen" -- this allows you to edit files with a real text editor while placing the Epoch-edit windows into your WINTERP-based applications. Epoch is a multiwindow gnu-emacs-based editor available for free by anonymous ftp from cs.uiuc.edu. You must load epoch-widg.el into Epoch first, as this file calls epoch-functions defined there. This file also assumes that you have Andy Norman's gnuserv package running under Epoch -- the program /usr/local/epoch/bin/gnudoit is used to send emacs-lisp commands to Epoch.
(screen snap) fake-app.lsp
Example application using XM_MAIN_WINDOW_WIDGET_CLASS + XM_ROW_COLUMN_WIDGET_CLASS/:simple_menu_bar + XM_ROW_COLUMN_WIDGET_CLASS/:simple_pulldown_menu to create a window with a menubar and pulldowns, etc.
(screen snap) fake-app1.lsp
Example application using higher-level widget-class subclasses WINTERP:APPLICATION-WIDGET-CLASS, WINTERP:POPUP-MENU-WIDGET-CLASS, WINTERP:RADIO-BOX-WIDGET-CLASS, WINTERP:CHECK-BOX-WIDGET-CLASS, WINTERP:OPTION-MENU-WIDGET-CLASS... to create a window with a menubar and pulldowns, etc.
(screen snap) fifo-read.lsp
A text widget that reads whatever text is sent to the named pipe (~/.fifo). See fifo-write.lsp for a similar program which uses a text widget to write to a named pipe.
(screen snap) fifo-write.lsp
A text widget that writes to a named pipe (~/.fifo) See fifo-read.lsp for a similar program which will read text sent to this named pipe.
getvalues.lsp
This file should is a random test to see whether the code in winterp/src-server/w_resources.c has any machine dependencies. Load this file, and if your stdout beeps and you see messages about "failed: ..." then please send the output to npm@netwiz.net NOTE: the actual graphical result of loading this file is not pretty. In fact, it's not supposed to be pretty....
(screen snap) gif.lsp
Demo of displaying GIF in a widget; GIF retrieved via GIF_TO_PIXMAP.
(screen snap) graphcalc.lsp
A calculator with "direct manipulation" graphic display of previous results. Expressions may be entered by typing them in on the mock-keyboard, inputting the value into the XmText widget, or by clicking on a "node" in the XmGraph widget. Operators are entered by clicking the operator buttons ('*' '/' '-' '+') on the mock-keyboard. Expressions must be terminated by clicking on the '==' operator button.
Users may also enter expressions in infix notation into the text widget, and these will be displayed with disambiguation provided by precedence rules in the code below. As a test of this, paste the following into the XmText widget
[ HW1 + HW2 + HW3 + 2 * MT1 + HW4 + HW5 + 2 * MT2 + HW6 + HW7 + 4 * FIN ] / 15
then hit the [return] key and watch the results.
graphcalc1.lsp
Add an "options" button and popup panel for graphcalc.lsp
graphcalc2.lsp
Add a scale widget to display results from graphcalc.lsp
(screen snap) grep-br.lsp
A file search browser using the Unix "grep" command to perform search. Enter the desired search string in "Search Regexp" and enter the set of files to search in "Wildcarded Files"; then enter [return] in one of those widgets, "Do Search". Then use up and down arrow keys, or the following mouse/key bindings to browse list of search items
Mouse bindings on browsers:
* single left click	-- select item for use by
			   $EDITOR button or other op...
* double left click	-- select item and browse it in
			   associated viewer widget.
* single middle click	-- select item and browse it in
			   associated viewer widget.
* single right click	-- select item and display
			   corresponding text in $EDITOR.
Key bindings on browsers::
* E			-- view selected item in user's
			   editor ($EDITOR).
* ^E			-- select next item and view in
			   user's editor ($EDITOR).
* ^N, ^DownArrow	-- select next item.
* ^P, ^UpArrow		-- select prev item.
* N , DownArrow		-- browse next item in viewer.
* P , UpArrow		-- browse prev item in viewer.
grep-br1.0.lsp
Old version of grep-br.lsp, for Motif 1.0. Motif >= 1.1 users should use grep-br.lsp. This file is loaded from grep-br.lsp
(screen snap) grph-sexpr.lsp
Using XM_GRAPH_WIDGET_CLASS to display a lisp s-expression (or any lisp list) as a tree. Click on button "Graph Methods of Selected Widget" then click mouse on a WINTERP application widget. Will pop up a display of the methods on that widget. This is really only interesting if widget has been subclassed such that there are Winterp-Lisp methods available on the widget-class. Alternately, you can just call SHOW-SEXP interactively, e.g.
(show-sexp '((5 6 7 '(6 7) 7 "quackity" #(0 1 2 3 4))))
(show-sexp (map 'list #'(lambda (i) i) (generic #'show-sexp)))
(show-sexp (map 'list #'(lambda (i) i) (generic #'show-sexp-aux)))
(show-sexp (map 'list #'(lambda (i) i) (generic #'pp)))
(show-sexp (map 'list #'(lambda (i) i) (generic #'pp1)))
(screen snap) grph-whier.lsp
Displays the widget hierarchy under a shell widget. Click on "Show Widget Hierarchy" button, then click mouse on a window created by WINTERP -- a widget hierarchy will be displayed. Click on a "node" within the graph widget -- the fully qualified resource name and other info will be displayed in the Text widget more info will also be printed onto standard output.
(screen snap) helloworld.lsp
10-20 lines of Winterp-Lisp code is all that is needed to produce the canonical "Hello World" program in WINTERP.
(screen snap) hostlookup.lsp
A lamo application that uses method :FORCED_EXPOSE_UPDATE to popup and display contents of a "working dialog" before a time-consuming subprocess begins to execute.
(screen snap) identifier.lsp
A useful UI debugging tool. Loading this file creates a panel that allows you to click on a widget to identify it, click on a widget to destroy it, or change the foreground and background colors of the widget you click on. For Motif 1.1, the "Identify Selected Widget" button becomes especially useful because it will print out the fully qualified resource name -- this allows setting up your X-resources on a per widget basis and allows you to better understand which widgets are affected by a particular setting in your ~/.Xdefaults...
(screen snap) identifier2.lsp
Like "identifier.lsp" except that it allows you to print out the translations and accelerators on a widget.
(screen snap) inf-square.lsp
Run "bc" calculator as subprocess, computing infinite number of powers of 2 (or until user gets bored and quits). Displays them in a row-column widget.
(screen snap) mail-br.lsp
A simple MH mail browser based on Object_Browser_Widget_Class. This does MH's scan(1) operation on the last:30 messages in folder +inbox, then allows you to browse the messages via the following mouse/key bindings on the message browser:
Mouse bindings on browsers:
* single left click	-- select item for use by
			   $EDITOR button or other op...
* double left click	-- select item and browse it in
			   associated viewer widget.
* single middle click	-- select item and browse it in
			   associated viewer widget.
* single right click	-- select item and display
			   corresponding text in $EDITOR.
Key bindings on browsers::
* E			-- view selected item in user's
			   editor ($EDITOR).
* ^E			-- select next item and view in
			   user's editor ($EDITOR).
* ^N, ^DownArrow	-- select next item.
* ^P, ^UpArrow		-- select prev item.
* N , DownArrow		-- browse next item in viewer.
* P , UpArrow		-- browse prev item in viewer.
(screen snap) man-br.lsp
Load this file to create a simple manual page browser for looking at formatted manual pages installed in /usr/local/X11R5/man/man3/*.3 (see *MAN-DIR-REGEXP-STR*). I use this application to browse my X11/Motif manual pages, which are kept in that directory.
(screen snap) menushare.lsp
Demo of shared pulldown menu panes. Some versions of Motif are buggy when using shared menu panes and may coredump WINTERP when you destroy the windows created in this file.
(screen snap) menutear.lsp
menutree.lsp with tear-off menus enabled...
(screen snap) menutree.lsp
Simple menu tree program.
(screen snap) modal-dia.lsp
Tests of Modal Dialogs through resource :XMN_DIALOG_STYLE
(screen snap) modem-dialer.lsp
Dials phone numbers on a Hayes-Compatible modem by running kermit(1) as an asynchronous subprocess. Hayes-compatible commands may be sent to the modem directly by entering text in the edit-field widget directly below the menu bar. The app. provides a browser of people/phone-numbers -- in the browser, double-left click (or single-middle click) on the person to dial his/her number (details on mouse and key bindings below). Put your database of people in file "$HOME/people.lsp" (see variable *MODEM-DIALER-FILEPATH* below)
(screen snap) numentry.lsp
Test of Cardinal_Number_Entry_Field_Widget_Class
(screen snap) popup-menu.lsp
POPUP menu example. This is a 1-to-1 translation of the popup menu example in the Motif Programmer's Guide. Just 'load' this file to see the example. See fake-app1.lsp for a less lame way of creating popup menus.
(screen snap) radiobox1.lsp
The straighforward way to define a radio box. See radiobox2.lsp for a better way using a WINTERP-subclassed toggle-button.
(screen snap) radiobox2.lsp
A better (?) way of creating a radio box, using subclassing of togglebutton. Note that this version doesn't waste as much memory as radiobox1.lsp because it defines a single entry-callback on the rowcolumn widget instead of forcing each toggle-button to have separate copies of very similar callback-closures.
(screen snap) radiobox3.lsp
Create radio-box via XM_ROW_COLUMN_WIDGET_CLASS/ :simple_radio_box.
(screen snap) rc-shell.lsp
Load this file to put up a default rowcolumn shell for experimentation purposes. Create other widgets with rc_w as parent and they'll appear in this manager.
(screen snap) subcalc.lsp
Demo of spawning an interactive subprocess and interacting with the subrpocess through XT_ADD_INPUT/:READ_LINE_TO_STRING. Subprocess can be off doing a long calculation while WINTERP GUI remains active.
(screen snap) subcalcslo.lsp
Demo of spawning an interactive subprocess and interacting with the subrpocess through XT_ADD_INPUT/:READ. Subprocess can be off doing a long calculation while WINTERP GUI remains active. A faster version of this same example is in "subcalc.lsp" efficiency is improved by using XT_ADD_INPUT/:READ_LINE_TO_STRING....
(screen snap) subshell.lsp
Demo of spawning an interactive shell subprocess and interacting with the subrpocess through XT_ADD_INPUT. Subprocess can be off doing a long computation while WINTERP GUI remains active.
(screen snap) timesheet.lsp
Project timesheet application. You probably want to modify this file to create a project timesheet for your own organization -- the named entries in this timesheet example are bogus... This example makes use of the timechart widgets in lib-widgets/timechart.lsp.
(screen snap) w_ctrlpnl.lsp
A control panel for WINTERP, including a rudimentary way to edit and send lisp to winterp's xlisp evaluator without having to use the gnuemacs interface (src-client/winterp.el) or src-client/wl.c. For details on this application, see ../doc/winterp.doc section [[Interacting with WINTERP via the "Winterp Control Panel":]].
(screen snap) xbiff.lsp
Load this file to have WINTERP check for new mail periodically. This periodically runs '/usr/ucb/mail -H' (or if running HP-UX, or OSF1 ... 'mailx -H') to create listing of unread mail in /usr/mail/$LOGNAME... I make no promises this will work on other Unix machines, but it does work on HP-UX, SunOS, OSF1, Ultrix, etc. If other hosts have problems you need to set variable *xbiff-nondestructively-scan-mail-headers-cmd* (see below). Also, you may want to modify variable *xbiff-incorporate-new-mail-cmd* -- the default calls MH's 'inc' program (must be on your path) and outputs the result in the xbiff window. I personally use one which calls "gnudoit '(mh-rmail)'" which uses GNU Emacs' mh-e package to read the new mail; WINTERP notifies GNU Emacs through Andy Norman's gnudoit/gnuclient package.
(screen snap) xtaddinput.lsp
Demo of XT_ADD_INPUT with :READ_LINE_TO_STRING versus :READ_SEXP_TO_USTREAM options. The program itself is stupid -- I spawn cat(1) as a subprocess just to echo the input to the subprocess back to the output, then use XT_ADD_INPUT to read the output back line-by-line or sexpr-by-sexpr.

Niels P. Mayer
Last modified: Fri Feb 5 12:47:08 PST 1999