[comp.sources.sun] v01i022: Tooltool - a suntools user interface builder, Part 03/13

mcgrew@dartagnan.rutgers.edu (Charles Mcgrew) (06/07/89)

Submitted-by: Chuck Musciano <chuck@trantor.harris-atd.com>
Posting-number: Volume 1, Issue 22
Archive-name: tooltool2.1c/part03

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 13)."
# Contents:  samples/keytool.l samples/keytool.r.14.uu
#   samples/stopwatch.tt samples/vt100/newskeys.ras.uu
#   samples/vt100/term.c tooltool.c
# Wrapped by chuck@melmac on Thu Jun  1 10:39:28 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'samples/keytool.l' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'samples/keytool.l'\"
else
echo shar: Extracting \"'samples/keytool.l'\" \(6797 characters\)
sed "s/^X//" >'samples/keytool.l' <<'END_OF_FILE'
X.TH SETWIN 1 "8 December 1988"
X.SH NAME
Xkeytool \- terminal emulator with interactively redefineable function keys
X.SH SYNOPSIS
X\fBkeytool\fP [\fB\(hyi\fP \fIinit_file\fP] \fIcommand\fP [\fIargs\fP]
X.SH DESCRIPTION
X.LP
X\f2Keytool\fP is an interactive terminal emulator built with \f2tooltool\fP(1).
XIt provides a tty subwindow environment similar to \f2shelltool\fP(1) for executing
Xinteractive commands.  This is very useful for running shell programs both locally
X(such as \f2ssh\fP(1)) and remotely (using \f2rlogin\fP(1), or 
X\f2telnet\fP(1). 
X.LP
X\f2Keytool\fP behaves very much like \f2shelltool\fP(1).
XKeystrokes typed to \f2keytool\fP are passed to the program specified in \fIcommand\fP.
X(\fICommand\fP must specify the full pathname of the program.)
XIf this program is a shell, it accepts commands and runs programs in the usual way.
XAny shelltool-like window arguments may be specified in \fIargs\fP.
XThese are processed by tooltool and not sent to \fIcommand\fP. Any other \fIargs\fP
Xare passed to the program.
X.LP
X\f2Keytool\fP accepts one command line option of its own, \fB\(hyi\fP, and this must be first
Xin the command line. Its argument, \fIinit_file\fP, specifies the initial filename
X\f2keytool\fP will read for function key definitions.  The default is 
X~/.keytool if it exists, and /usr/local/lib/keytool.defaults if not.
X.LP
X\f2Keytool\fP allows definition of the function keys L2-L4, L9-L10, F1-F9, 
Xand R1-R15 with any combinations of CONTROL, SHIFT, and META.  It also 
Xallows definition of any shifted combinations of the three mouse buttons 
Xexcept for one.  CONTROL-SHIFT-META-RIGHT_MOUSE brings up the \f2keytool\fP
Xmenu that is described below.  The unshifted mouse buttons behave as in any
Xtty subwindow: select, adjust, and tty subwindow menu.
X.LP
X\f2Keytool\fP has two complete sets of function key and mouse button 
Xdefinitions designated \fBprimary\fP and \fBsecondary\fP.  These
Xcould be used, for example, with one keyset for shell operation and the 
Xother for an editor.
XThe \f2keytool\fP menu has entries to select either as the active 
Xkeyset. Also, pressing the CONTROL-SHIFT-META combination of any function 
Xkey that is not otherwise bound will toggle the active keyset, annunciating
Xa single beep if the primary keyset becomes active and a double beep for 
Xthe secondary. 
X.SH KEYTOOL MENU
X.LP
XThe \f2keytool\fP menu invoked by CONTROL-SHIFT-META-RIGHT_MOUSE contains 
Xthese entries:
X.IP "\f2Define Keys\fP"
XBring up the \f2keytool\fP \fBkey definition window\fP, descibed below.
X.IP "\f2Use Primary\fP"
XDesignate the primary keyset as active.
X.IP "\f2Use Secondary\fP"
XDesignate the secondary keyset as active.
X.IP "\f2Read Init File\fP"
XRead the currently active initialization file, redefining all function 
Xkey and mouse button combinations. 
X.SH KEY DEFINITION WINDOW
X.IP
XThe \f2keytool\fP \fBkey definition window\fP allows any key to be 
Xredefined for immediate use.  There is no need to edit ~/.keytool and 
Xrestart the application (as with shelltool and .ttyswrc).  The key 
Xdefinition window is activated from the \f2keytool\fP menu described above.
XIt may be moved around and left open without affecting the operation of the
Xapplication window. Thus key definitions can be used or tested out as soon 
Xas they are typed in.
X.IP "\f2Key Definition\fP"
XThe text entry gadget in the bottom center of the window shows the current 
Xdefinition for the selected key.  Directly to its left are choice gadgets 
Xfor selecting the key and shift combination to be defined.  The definition 
Xcan be replaced or altered with any printing or non-printing ascii 
Xcharacters (except for the \fBline separator\fP and \fBitem separator\fP 
Xcharacters described below). A special font is used so that control characters 
Xare identifiable. Certain keys have special functions. TAB advances the 
Xactive text gadget within the key definition window. CONTROL-U deletes the 
Xentire line, and CONTROL-W deletes the last word. DELETE erase the last 
Xcharacter. To enter one of these characters into a key definition, a 
Xspecial button is provided to the right of the text entry gadget. 
X.IP
XMouse button definitions may have tooltool \fIformat\fP specifications for 
Xup to two variables embedded in them. These will be replaced with the
Xmouse cursor's X and Y character positions using 1,1 as the origin.
XFor example, the definition "ESC5%c%c" will cause a mouse button to send 
X"ESC5", followed by the character with the value of the cursor's X position, 
Xfollowed by the character with the value of the cursor's Y position.
X.IP "\f2Define Button\fP"
XKey definitions do not take effect until the \fBdefine\fP button is 
Xselected. If the active key is changed without doing so, the definition is 
Xlost.
X.IP "\f2Function Key Buttons\fP"
XSurrounding the key definition window, there are buttons for each of the 
Xdefinable function keys and the mouse buttons.  The active key for 
Xdefinition can be specified by selecting one of these buttons with the 
Xappropriate shift combination.
X.IP "\f2Active Keyset\fP"
XThis choice gadget allows selection of either the primary or secondary 
Xkeyset for both definition and use.
X.IP "\f2Definition File\fP"
XThis text gadget specifies filename to save or read key definitions from.
XThe entry may be edited in the normal way (CONTROL-W, CONTROL-U, and DELETE).
XIt does filename completion when SPACE is pressed.
X.IP "\f2Item Separator\fP"
X.IP "\f2Line Separator\fP"
XKey definitions may contain any ascii characters \f2except\fP for two. 
X\f2Keytool\fP needs two special characters to separate definitions within 
Xthe definition file.  The item and line separators may be specified as any
Xascii characters that will not be used in key definitions.  The defaults 
Xare TAB and NEWLINE, respectively.  As with the key definition gadget
Xa button is provided next to the separator text gadget for entering TAB, 
XCONTROL-U, CONTROL-W, or DELETE. Selecting the "\fISeparator\fP" text will 
Xtoggle between the two character definition fields. 
X.IP "\f2Save\fP"
XThe \fBsave\fP button normally saves both keysets to the definition file. 
XShift combinations also allow loading key definitions from a file, copying 
Xeither keyset over the other, and setting the definition file gadget to the
Xdefault filename (or the filename specified with the \fB\(hyi\fP command 
Xline option). This last fuction does \f2not\fP load key definitions.
X.IP "\f2Done\fP"
XThe \fBdone\fP button removes the key definition window from the screen. It
Xcan be reopened from the \f2keytool\fP menu.
X.SH AUTHOR
X.LP
XKen Laprade
X.SH FILES
X.LP
X.br
X~/.keytool
X.br
X/usr/local/lib/keytool.defaults
X.SH "SEE ALSO"
X.LP
Xshelltool (1),
Xtooltool (1)
X.SH BUGS
X.LP
XDue to the size of the file  that \f2tooltool\fP(1) must parse, 
X\f2keytool\fP takes an obnoxiously long time to start up.
X
END_OF_FILE
if test 6797 -ne `wc -c <'samples/keytool.l'`; then
    echo shar: \"'samples/keytool.l'\" unpacked with wrong size!
fi
# end of 'samples/keytool.l'
fi
if test -f 'samples/keytool.r.14.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'samples/keytool.r.14.uu'\"
else
echo shar: Extracting \"'samples/keytool.r.14.uu'\" \(6527 characters\)
sed "s/^X//" >'samples/keytool.r.14.uu' <<'END_OF_FILE'
Xbegin 666 keytool.r.14
XM 1X(8  ( !       ! +!0 (  @ $  0"P4 "  ( "  $ L%  @ "  P ! +
XM!0 (  @ 0  0"P4 "  ( %  $ L%  @ " !@ ! +!0 (  @ <  0"P4 "  (
XM (  $ L%  @ " "0 ! +!0 (  @ H  0"P4 "  ( +  $ L%  @ " #  ! +
XM!0 (  @ T  0"P4 "  ( .  $ L%  @ " #P ! +!0 (  @!   0"P4 "  (
XM 1  $ L%  @ " $@ ! +!0 (  @!,  0"P4 "  ( 4  $ L%  @ " %0 ! +
XM!0 (  @!8  0"P4 "  ( 7  $ L%  @ " &  ! +!0 (  @!D  0"P4 "  (
XM :  $ L%  @ " &P ! +!0 (  @!P  0"P4 "  ( =  $ L%  @ " '@ ! +
XM!0 (  @!\  0"P4 "  ( @  $ L%  @ " (0 ! +!0 (  @"(  0"P4 "  (
XM C  $ L%  @ " )  ! +!0 (  @"4  0"P4 "  ( F  $ L%  @ " )P ! +
XM!0 (  @"@  0"P4 "  ( I  $ L%  @ " *@ ! +!0 (  @"L  0"P4 "  (
XM L  $ L%  @ " +0 ! +!0 (  @"X  0"P4 "  ( O  $ L%  @ " ,  ! +
XM!0 (  @#$  0"P4 "  ( R  $ L%  @ " ,P ! +!0 (  @#0  0"P4 "  (
XM U  $ L%  @ " -@ ! +!0 (  @#<  0"P4 "  ( X  $ L%  @ " .0 ! +
XM!0 (  @#H  0"P4 "  ( [  $ L%  @ " /  ! +!0 (  @#T  0"P4 "  (
XM ^  $ L%  @ " /P ! +!0 (  @$   0"P4 "  (!!  $ L%  @ " 0@ ! +
XM!0 (  @$,  0"P4 "  (!$  $ L%  @ " 10 ! +!0 (  @$8  0"P4 "  (
XM!'  $ L%  @ " 2  ! +!0 (  @$D  0"P4 "  (!*  $ L%  @ " 2P ! +
XM!0 (  @$P  0"P4 "  (!-  $ L%  @ " 3@ ! +!0 (  @$\  0"P4 "  (
XM!0  $ L%  @ " 40 ! +!0 (  @%(  0"P4 "  (!3  $ L%  @ " 5  ! +
XM!0 (  @%4  0"P4 "  (!6  $ L%  @ " 5P ! +!0 (  @%@  0"P4 "  (
XM!9  $ L%  @ " 6@ ! +!0 (  @%L  0"P4 "  (!<  $ L%  @ " 70 ! +
XM!0 (  @%X  0"P4 "  (!?  $ L%  @ " 8  ! +!0 (  @&$  0"P4 "  (
XM!B  $ L%  @ " 8P ! +!0 (  @&0  0"P4 "  (!E  $ L%  @ " 9@ ! +
XM!0 (  @&<  0"P4 "  (!H  $ L%  @ " :0 ! +!0 (  @&H  0"P4 "  (
XM!K  $ L%  @ " ;  ! +!0 (  @&T  0"P4 "  (!N  $ L%  @ " ;P ! +
XM!0 (  @'   0"P4 "  (!Q  $ L%  @ " <@ ! +!0 (  @',  0"P4 "  (
XM!T  $ L%  @ " =0 ! +!0 (  @'8  0"P4 "  (!W  $ L%  @ " >  ! +
XM!0 (  @'D  0"P4 "  (!Z  $ L%  @ " >P ! +!0 (  @'P  0"P4 "  (
XM!]  $ L%  @ " ?@ ! +!0 (  @'\  0"P4 "  ("   $ L%  @ " @0 ! +
XM!0 (  @((  0"P4 "  ("#  $ L%  @ " A  ! +!0 (  @(4  0"P4 "  (
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM                                                            
XM            3[ 7%1<1#P            !&J0D)#PD)            3JD)
XM#PD)#@           $:I" @("08           !.J0D)"0D.            
XM3Z@(#@@(#P           $^H" X(" @           !&J0@+"0D'        
XM    2:D)#PD)"0    #@0$! 4"@X*"@&!0<%!P   )#0T+"PD  (" @(" \ 
XM        2:L.# H+"0           $BH" @(" \      &"0@("08  ."0D.
XM"0D         2:D-#0L+"0           $:I"0D)"08           !.J0D.
XM" @(            1JD)"0D-!@$          $ZI"0X*"0D           !&
XMJ0@& 0D&            7Z0$! 0$!            $FI"0D)"08         
XM  !1L0H*"@0$            4;45%145"@           %&J"@0*"A$     
XM      !1J@H$! 0$            3Z$#!@P(#P    #@@." X#@@. @X!@@(
XM" 8       !(J 0$ @(!            3J(" @("#@           $2J    
XM              ! H      ?                             ! 0$! 0
XM$!   !         D)"0D                $A(2?R0D_DA(2       $#A4
XM5% P&!145#@0      !DE)AH$! L,E),        ,$A(,"!2C(B89@      
XM  @($"                0($! @(" @(! 0" 0    @$ @(! 0$! 0("! @
XM       05#@X5!               ! 0$/X0$!                     8
XM& @0(           ?@                       !@8       "! 0("! 0
XM("! 0(       #Q"0D9*4F)"0CP        (&"@(" @(" @^        /$)"
XM @0($"! ?@       #Q"0@(< @)"0CP        $#!0D1(3^! 0$        
XM?D! 0'P" D)"/        #Q"0$!\0D)"0CP       !^0@($! @($! 0    
XM    /$)"0CQ"0D)"/        #Q"0D)"/@("0CP            8&    !@8
XM            &!@    8& @0(    @0($"! (! (! (           !^    
XM?@        ! (! (! ($"! @0        #Q"0@($" @   @        8)$).
XM4E),0"(<        &!@8)"0D0GY"0@       'A$1$1X1$)"0GP        \
XM0D) 0$! 0D(\        >$1"0D)"0D)$>        'Y 0$!\0$! 0'X     
XM  !^0$! ?$! 0$!         /$)"0$!.0D)&.@       $)"0D)^0D)"0D( 
XM      !\$! 0$! 0$!!\        '@0$! 0$!$1$.        $)$2%!@<%A,
XM1D(       ! 0$! 0$! 0$!^        @H+&QJJJDI*"@@       $)B8E)2
XM2DI&1D(        \0D)"0D)"0D(\        ?$)"0D)\0$! 0        #Q"
XM0D)"0D)"0CP0" 8   !\0D)"?$A$1$)"        /$)"(!@$ D)"/       
XM /X0$! 0$! 0$!        !"0D)"0D)"0D(\        0D)"0B0D)!@8&   
XM     (*"@I)45%0H*"@       !"0B0D&!@D)$)"        @H)$1"@0$! 0
XM$        'X" @0($"! 0'X      #P@(" @(" @(" @(#P   " 0$ @(! 0
XM" @$! (     / 0$! 0$! 0$! 0$/       &"1"                    
XM         /X      " @$ @                    X1 0\1$0Z        
XM0$! 7&)"0D)B7            #Q"0$! 0CP        " @(Z1D)"0D8Z    
XM        /$)"?D!"/         P2$!!\$! 0$!             Z1D)"0D8Z
XM D(\    0$! 7&)"0D)"0@        @( #@(" @(" @        $!  <! 0$
XM! 0$!$0X    0$! 1$A0<$A$0@       #@(" @(" @(" @           #L
XMDI*2DI*2            7&)"0D)"0@           #Q"0D)"0CP         
XM  !<8D)"0F)<0$! 0       .D9"0D)&.@(" @(      %QB0$! 0$      
XM       \0D \ D(\        $! 0?! 0$! 2#            $)"0D)"1CH 
XM          !"0D(D)!@8            @H*2DI*2;            $)")!@D
XM0D(           !"0B(D%!0("!!0(       ?@0($"! ?@      #A 0$! 0
XM8! 0$! 0#@   ! 0$! 0$  0$! 0$!    !P" @(" @&" @(" AP       R
XM6DP              ."0D."0D  &"0D)"08                         
XM                                                            
XB                                                
X 
Xend
END_OF_FILE
if test 6527 -ne `wc -c <'samples/keytool.r.14.uu'`; then
    echo shar: \"'samples/keytool.r.14.uu'\" unpacked with wrong size!
fi
# end of 'samples/keytool.r.14.uu'
fi
if test -f 'samples/stopwatch.tt' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'samples/stopwatch.tt'\"
else
echo shar: Extracting \"'samples/stopwatch.tt'\" \(7891 characters\)
sed "s/^X//" >'samples/stopwatch.tt' <<'END_OF_FILE'
X#define		update_display(t)	{ tenths     = t[0]; \
X					  second_one = t[1]; \
X					  second_ten = t[2]; \
X					  minute_one = t[3]; \
X					  minute_ten = t[4]; \
X					  hour_one   = t[5]; \
X					  hour_ten   = t[6]; \
X					}
X
X#define		set_time(t)		{ t[0] = tenths; \
X					  t[1] = second_one; \
X					  t[2] = second_ten; \
X					  t[3] = minute_one; \
X					  t[4] = minute_ten; \
X					  t[5] = hour_one; \
X					  t[6] = hour_ten; \
X					}
X
X#define		inc_time(a,b,c,d,e,f,g)	{ if (by_seconds) \
X					     b = ++time[1]; \
X					  else if ((a = ++time[0]) > 9) { \
X					     a = time[0] = 0; \
X					     b = ++time[1]; \
X					     } \
X					  if (time[1] > 9) { \
X					     b = time[1] = 0; \
X					     if ((c = ++time[2]) > 5) { \
X 					        c = time[2] = 0; \
X 					        if ((d = ++time[3]) > 9) { \
X 					           d = time[3] = 0; \
X 					           if ((e = ++time[4]) > 5) { \
X 					              e = time[4] = 0; \
X 					              if ((f = ++time[5]) > 9) { \
X 					                 f = time[5] = 0; \
X 					                 if ((g = ++time[6]) > 9) \
X					                    g = time[6] = 0; \
X					                 } \
X					              } \
X					           } \
X					        } \
X					     } \
X					}
X
X#define		dec_time(a,b,c,d,e,f,g)	{ if (by_seconds) \
X					     b = --time[1]; \
X					  else if ((a = --time[0]) < 0) { \
X					     a = time[0] = 9; \
X					     b = --time[1]; \
X					     } \
X					  if (time[1] < 0) { \
X					     b = time[1] = 9; \
X					     if ((c = --time[2]) < 0) { \
X 					        c = time[2] = 5; \
X 					        if ((d = --time[3]) < 0) { \
X 					           d = time[3] = 9; \
X 					           if ((e = --time[4]) < 0) { \
X 					              e = time[4] = 5; \
X 					              if ((f = --time[5]) < 0) { \
X 					                 f = time[5] = 9; \
X 					                 if ((g = --time[6]) < 0) \
X					                    g = time[6] = 9; \
X					                 } \
X					              } \
X					           } \
X					        } \
X					     } \
X					}
X
X#define		TINY_FONT	"/usr/lib/fonts/fixedwidthfonts/screen.r.7"
X#define		MEDIUM_FONT	"/usr/lib/fonts/fixedwidthfonts/screen.b.14"
X#define		BIG_FONT	"/usr/lib/fonts/fixedwidthfonts/gallant.r.19"
X
X#define		TRUE		1
X#define		FALSE		0
X
X#define		ROW_1		4
X#define		ROW_2		17
X#define		ROW_3		39
X
Xapplication ""
X   size 0 by 200 pixels
X   label "  << Stopwatch >>"
X   icon "stopwatch.icon"
X   initialize {
X      remove split_button;
X      remove resume_button;
X      remove stop_button;
X      display start_button;
X      display reset_button;
X      remove split_light;
X      in_split = FALSE;
X      time = tokenize("0 0 0 0 0 0 0");
X      }
X
X   timer {
X      if (count_down) {
X         if (in_split)
X            dec_time(d,d,d,d,d,d,d)
X         else
X            dec_time(tenths, second_one, second_ten, minute_one, minute_ten, hour_one, hour_ten);
X         if (time == "0 0 0 0 0 0 0") {
X            interval = 0;
X            beep;
X            beep;
X            beep;
X            remove stop_button;
X            remove split_button;
X            display start_button;
X            if (!in_split)
X               display reset_button;
X            }
X         }
X      else if (in_split)
X         inc_time(d,d,d,d,d,d,d)
X      else
X         inc_time(tenths, second_one, second_ten, minute_one, minute_ten, hour_one, hour_ten);
X      }
X
Xgadgets
X   font MEDIUM_FONT
X   choice count_down
X      at 4 ROW_1
X      display current
X      "Up" : TINY_FONT	nothing;
X      "Down": TINY_FONT	nothing;
X   end_choice
X   label split_light
X      at 61 ROW_1
X      "Split" : TINY_FONT
X   end_label
X   choice by_seconds
X      at 110 ROW_1
X      display current
X      "0.1 sec" : TINY_FONT {
X         display decimal_point;
X         display tenths;
X         if (interval > 0)
X            interval = 0.1;
X         }
X      "  1 sec" : TINY_FONT {
X         remove decimal_point;
X         remove tenths;
X         tenths = time[0] = 0;
X         if (interval > 0)
X            interval = 1;
X         }
X   end_choice
X   choice hour_ten
X      at 16 ROW_2
X      display current
X      "0" : BIG_FONT		nothing;
X      "1" : BIG_FONT		nothing;
X      "2" : BIG_FONT		nothing;
X      "3" : BIG_FONT		nothing;
X      "4" : BIG_FONT		nothing;
X      "5" : BIG_FONT		nothing;
X      "6" : BIG_FONT		nothing;
X      "7" : BIG_FONT		nothing;
X      "8" : BIG_FONT		nothing;
X      "9" : BIG_FONT		nothing;
X   end_choice
X   choice hour_one
X      at 28 ROW_2
X      display current
X      "0" : BIG_FONT		nothing;
X      "1" : BIG_FONT		nothing;
X      "2" : BIG_FONT		nothing;
X      "3" : BIG_FONT		nothing;
X      "4" : BIG_FONT		nothing;
X      "5" : BIG_FONT		nothing;
X      "6" : BIG_FONT		nothing;
X      "7" : BIG_FONT		nothing;
X      "8" : BIG_FONT		nothing;
X      "9" : BIG_FONT		nothing;
X   end_choice
X   label
X      at 40 ROW_2
X      ":" : BIG_FONT
X   end_label
X   choice minute_ten
X      at 52 ROW_2
X      display current
X      "0" : BIG_FONT		nothing;
X      "1" : BIG_FONT		nothing;
X      "2" : BIG_FONT		nothing;
X      "3" : BIG_FONT		nothing;
X      "4" : BIG_FONT		nothing;
X      "5" : BIG_FONT		nothing;
X   end_choice
X   choice minute_one
X      at 64 ROW_2
X      display current
X      "0" : BIG_FONT		nothing;
X      "1" : BIG_FONT		nothing;
X      "2" : BIG_FONT		nothing;
X      "3" : BIG_FONT		nothing;
X      "4" : BIG_FONT		nothing;
X      "5" : BIG_FONT		nothing;
X      "6" : BIG_FONT		nothing;
X      "7" : BIG_FONT		nothing;
X      "8" : BIG_FONT		nothing;
X      "9" : BIG_FONT		nothing;
X   end_choice
X   label
X      at 76 ROW_2
X      ":" : BIG_FONT
X   end_label
X   choice second_ten
X      at 88 ROW_2
X      display current
X      "0" : BIG_FONT		nothing;
X      "1" : BIG_FONT		nothing;
X      "2" : BIG_FONT		nothing;
X      "3" : BIG_FONT		nothing;
X      "4" : BIG_FONT		nothing;
X      "5" : BIG_FONT		nothing;
X   end_choice
X   choice second_one
X      at 100 ROW_2
X      display current
X      "0" : BIG_FONT		nothing;
X      "1" : BIG_FONT		nothing;
X      "2" : BIG_FONT		nothing;
X      "3" : BIG_FONT		nothing;
X      "4" : BIG_FONT		nothing;
X      "5" : BIG_FONT		nothing;
X      "6" : BIG_FONT		nothing;
X      "7" : BIG_FONT		nothing;
X      "8" : BIG_FONT		nothing;
X      "9" : BIG_FONT		nothing;
X   end_choice
X   label decimal_point
X      at 112 ROW_2
X      "." : BIG_FONT
X   end_label
X   choice tenths
X      at 124 ROW_2
X      display current
X      "0" : BIG_FONT		nothing;
X      "1" : BIG_FONT		nothing;
X      "2" : BIG_FONT		nothing;
X      "3" : BIG_FONT		nothing;
X      "4" : BIG_FONT		nothing;
X      "5" : BIG_FONT		nothing;
X      "6" : BIG_FONT		nothing;
X      "7" : BIG_FONT		nothing;
X      "8" : BIG_FONT		nothing;
X      "9" : BIG_FONT		nothing;
X   end_choice
X   button start_button
X      at 4 ROW_3
X      normal "Start" {
X         interval = by_seconds? 1 : 0.1;
X         if (!in_split)
X            set_time(time);
X         remove start_button;
X         remove reset_button;
X         display stop_button;
X         if (!in_split)
X            display split_button;
X         }
X   end_button
X   button stop_button
X      at 4 ROW_3
X      normal "Stop" {
X         interval = 0;
X         remove stop_button;
X         remove split_button;
X         display start_button;
X         if (!in_split)
X            display reset_button;
X         }
X   end_button
X   button split_button
X      at 91 ROW_3
X      normal "Split" {
X         in_split = TRUE;
X         remove split_button;
X         display resume_button;
X         display split_light;
X         }
X   end_button
X   button resume_button
X      at 91 ROW_3
X      normal "Resume" {
X         in_split = FALSE;
X         remove resume_button;
X         remove split_light;
X         update_display(time);
X         if (interval > 0)
X            display split_button;
X         else
X            display reset_button;
X         }
X   end_button
X   button reset_button
X      at 91 ROW_3
X      normal "Reset" {
X         time = tokenize("0 0 0 0 0 0 0");
X         update_display(time);
X         }
X   end_button
Xend_gadgets
END_OF_FILE
if test 7891 -ne `wc -c <'samples/stopwatch.tt'`; then
    echo shar: \"'samples/stopwatch.tt'\" unpacked with wrong size!
fi
# end of 'samples/stopwatch.tt'
fi
if test -f 'samples/vt100/newskeys.ras.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'samples/vt100/newskeys.ras.uu'\"
else
echo shar: Extracting \"'samples/vt100/newskeys.ras.uu'\" \(7089 characters\)
sed "s/^X//" >'samples/vt100/newskeys.ras.uu' <<'END_OF_FILE'
Xbegin 644 newskeys.ras
XM6:9JE0   28   "&     0  $^0    !                            
XM                                                            
XM                        '________________________     !_____
XM____________X  0     $     $     $     $     $     $     $  
XM   0 !      0     0     0     0     0     0     0    !  $   
XM  !     !     !           !     !     !     $  0,,0< $2>0< $
XM,1.< $,1",<<     $,>,<,$<>,.,$<><>,0 !!))!( 1)!!( 1)(1( 1)(1
XM))(     1)!))(1)!(1(1)!)!)  $$$D$@!'G$$@!"%!$@!"%!$$D@    !"
XM'$DD!$G$!"!$G$G$$  06202 $200< $$<$< $$<(6<<     $$0><0$<06$
XM$$20<060 !!))!( 1)!!  1)(1  1)(A)1      1)!)1(11!(1(1)!1!)  
XM$##'G !$GGD !#$3D !#$4#$D     !#'DDC!$GC#C!''DGC$  0     $  
XM   $     $           $     $     $     0 !      0     0     
XM0     0     0     0     0    !  $     !     !     !     !   
XM  !     !     !     $  0     $     $     $     $     $     $
XM     $     0 !      0     0     0     0     0     0     0   
XM !  $     !     !     !     !     !     !     !     $  0    
XM $     $     $           $     $     $     0 !      0     0 
XM    0Q$)XQ    P(      0     0    !  $     !     !     !$DA$$
XMD CC!#B     !     !     $  0     $     $     $(4$<20$22$2$  
XM   $     $     0 !      0     0     01PA!) M)(1)H     0     
XM0    !  $     !     !     !$DB$$D!#DA$A     !     !     $  0
XM     $     $     $,100,>"",$.(     $     $     0 !      0   
XM  0     0      !P         0     0    !  $     !     !     ! 
XM    !     !     !     !     $  0     $     $     $     $    
XM $     $     $     0 !      0     0     0     0     0     0 
XM    0    !  '________________________     !_________________
XM\  0     $     $     $     $     $     $     $     0 !      
XM0     0     0     0     0     0     0    !  $     !     !   
XM  !     !     !     !     !     $  0<.<  $<"1>1$<"<>,$<",00$
XM     $,>0>,$2< $,$<, $,0 !!(1(  1(1E!$1(1)!(1(1)! 0     1)!!
XM!(1)( Q(1)( Q)  $$A$@ !$A%7%1$A$G$!$A$D$!     !"'$'$!$D@!#!$
XMD@!#$  02$<  $2(305$2(<06$2(>00$     $$0000$2< $2$22 $20 !!(
XM10  1(A%!L1(A1!(1(A)! 0     1)!!!(1)  1(1)( 1)  $'#D@ !'$$7D
XM1'$$GC!'$$GGA     !#'GGC!#$ #C!'# #C$  0     $     $     $  
XM   $     $     $     $     0 !      0     0     0     0     
XM0     0     0    !  $     !     !     !     !     !     !   
XM  !     $  0     $     $     $     $     $     $     $     0
XM !      0     0     0     0     0     0     0    !  $     ! 
XM    !     !     !     !     !     !     $  0     $     $    
XM $     $     $     $     $     0 !!QPY%\1Y%]P 1Y$(Q 1Y$(QP0 
XM  P(      1\QP  1PQ]]%  $$DA&1!$"A$@!$"A$D!$"A$DA CC!#B     
XM!!$D@ !$DA!&T  022$5$$<$$2 $<$$20$<$$22$$22$2$     $$22  $<2
XM$$50 !!QP1,01 H1P 1 HAY 1 HAYP0M)(1)H     01)P  1)(015  $$%!
XM$1!$$1% !$$2$D!$$2$D!!#DA$A     !!$D  !$DA!$4  002.1$$>1$2 $
XM>102>$>1020$"",$.(     $$,0  $<,$$10 !      0     0     0   
XM  0!P         0     0    !  $     !     !     !     !     ! 
XM    !     !     $  0     $     $     $     $     $     $    
XM $     0 !      0     0     0     0     0     0     0    !  
XM'________________________     !_________________\  0     $  
XM   $     $     $                         !      0     0     
XM0     0                         $'#G  ! $G  !' G'C!' C$$!   
XM                       02$2  $(22" $2$202$2$200$            
XM             !!(1(  01)(0 1(1)Q 1(1)! 0                     
XM    $$A'  ! DG" !$B'$%A$B'D$!                          02$4 
XM $$20$ $2(402$2(200$                         !!PY(  0@Q ( 1Q
XM!)XP1Q!)YX0                         $     !     !     !     
XM!                          0     $     $     $     $        
XM                 !      0     0     0     0                 
XM        $     !     !     !     !                          0
XM     $     $     $     $                         !      0   
XM        0     0                         $     !''@G#'     ! 
XM    !   # @                    0     $20$222     $     $".,$
XM.                    !      1)P1))(     0     01)(1(        
XM            $     !'$"''G     !     !"TDA$@                 
XM   0     $40(024     $     $$.2$2                    !      
XM1)Y!!)(     0     0((P0X                    $     !         
XM  !     ! '                        0     $     $     $     $
XM                         !      0     0     0     0         
XM                '________________________                   
XM       0     $     $     $     $                         !  
XM    0     0     0     0                         $     !     
XM!     !                                0<>,< $ <,  $<"1>1$ >
XM (                           !!)!)( 0A)(( 1(1E H0!!1XQ0     
XM                    $$G$D@!!$DA !$A%7!! '&B$F@              
XM           0<0>2 $"22( $<(30*$ 02(<0                        
XM !!1!)( 01)(0 10A%!$0!!(A!                          $$GDG !"
XM'# @!$D$7D1 'DACD                          0     $     $    
XM $                               !      0     0     0     0 
XM                        $     !     !     !     !           
XM               0     $     $     $     $                    
XM     !      0     0     0     0                         $   
XM  !     !           !                          0           $
XM           $                         !!QX))XP     1P)$ )(   
XM  0   P(                    $$D!$D$@    !$A&41$@    ! CC!#@ 
XM                   02<$><2     $2$5*$>     $$22$2           
XM         !!Q A)!X     1PA,0A(     0M)(1(                    
XM$%$"$D$@    !%"$2B$@    !!#DA$@                    02>02>2  
XM   $201102     $"",$.                    !            0     
XM      0!P                       $     !     !     !     !   
XM                       0     $     $     $     $            
XM             !________________________P                     
XM    $     !     !     !                                0    
XM $     $     $                               !      0     0 
XM    0                               $     !     !     !     
XM                           0     $     $                    
XM                 !!P)$  0     1P)$ )X                       
XM        $$A&40!     !$A&41$                                0
XM2$51 $     $2$51$<                               !!PA-4 0   
XM  1PA-4A                                $%"$50!     !%"$52$ 
XM                               0201* $     $201*00          
XM                     !      0     0     0                   
XM            $     !     !     !                             
XM   0     $     $     $                               !      
XM0     0     0                               $           !   
XM                                   0<"1 "2     $<"1 ">"2    
XM   ,"                    !!(1E$1(     1(1E$1 1(    (XP0X    
XM                $$A%41'@    !$A%41'!'@   !$DA$@             
XM       0<(35(2     $<(35(0(2    +22$2                    !!0
XMA%4A(     10A%4A A(    0Y(1(                    $$D$2D$@    
XM!$D$2D$$$@    @C!#@                    0           $        
XM     <                       !      0     0     0           
XM                    $     !     !     !                     
XM           ?_____\     '_____\                              
XG                                                    
X 
Xend
END_OF_FILE
if test 7089 -ne `wc -c <'samples/vt100/newskeys.ras.uu'`; then
    echo shar: \"'samples/vt100/newskeys.ras.uu'\" unpacked with wrong size!
fi
# end of 'samples/vt100/newskeys.ras.uu'
fi
if test -f 'samples/vt100/term.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'samples/vt100/term.c'\"
else
echo shar: Extracting \"'samples/vt100/term.c'\" \(8436 characters\)
sed "s/^X//" >'samples/vt100/term.c' <<'END_OF_FILE'
X /*
X * vtem - A termcap driven VT100 emulator for BSD Unix
X *
X * $Header: /home/src/local/vttool/RCS/term.c,v 1.2 89/02/08 16:04:37 jqj Exp $
X *
X * $Log:	term.c,v $
X * Revision 1.2  89/02/08  16:04:37  jqj
X * 1/ set vttype to indicate what type of termianl (VT52, VT100, or VT102)
X *    we can support
X * 2/ don't do standout on terminals with standout glitches
X * 3/ use appropriate padding on output
X * 4/ clear to beginning of line must clear cursor too
X * 5/ support for insert/delete character
X * 6/ use "sr" rather than "up" to perform an upline-with-scroll.  The spec.
X *    is unclear, but most existing termcap entries seem to work that way.
X * 
X * Version 1.1
X *
X * Public domain software.
X * Written by Leif Samuelsson (leif@erisun) in December, 1985
X */
X
X
X/* This module contains termcap and tty routines */
X
X#include "vtem.h"
X
Xextern char *tgetstr(), *tgoto();
X
Xenum vt_terminal vttype;	/* the most powerful terminal we can support */
X
X/* Variables for saving original terminal parameters */
Xstruct sgttyb oldb, newb;
Xstruct tchars oldtchars, newtchars = { -1, -1, -1, -1, -1, -1 };
Xstruct ltchars oldltchars, newltchars = { -1, -1, -1, -1, -1, -1 };
Xint oldlb, newlb, oldl, newl;
X
X/* Terminal attributes */
Xchar tbuf[1024];
XBool BS;
Xint CO, LI;
Xchar	*AL, *BC, *BL, *CB, *CD, *CL, *CE, *CM, *CR, *CS, *DC, *DL, 
X	*DO, *EI, *IC, *IM,
X	*KE, *KS, *MB, *MD, *ME, *MR, *ND, *NL, *SE, *SO, *SR,
X	*TI, *TE, *UE, *UP, *US, *MAL, *MDL;
X
X/* putchar() is (usually) just a macro, so... */ 
Xputchar_x(c)
Xchar c;
X{
X    putchar(c);
X}
X
Xttycbreak()
X{
X    ioctl(0, TIOCGETP, &oldb);
X    ioctl(0, TIOCGETC, &oldtchars);
X    ioctl(0, TIOCGETD, &oldl);
X    ioctl(0, TIOCGLTC, &oldltchars);
X    ioctl(0, TIOCLGET, &oldlb);
X
X    newb = oldb;
X    newb.sg_flags |= CBREAK;
X    newb.sg_flags &= ~(CRMOD | ECHO);
X    ioctl(0, TIOCSETP, &newb);
X    ioctl(0, TIOCSETC, &newtchars);
X    ioctl(0, TIOCSLTC, &newltchars);
X    signal(SIGINT,SIG_IGN);
X}
X
X
X/* gettermtype - Finds terminal type and reads termcap entry for it.
X */
Xgettermtype()
X{
Xchar tptr[1024];
Xchar *termtyp;
Xchar *tbufptr;
X
X    termtyp=getenv("TERM");
X    switch(tgetent(tptr,termtyp)) {
X	case -1:
X	    printf("Can't read termcap\n");
X	    exit(1);
X	case 0:
X	    printf("Can't find your terminal type (%s) in termcap\n", termtyp);
X	    exit(1);
X    }
X    tbufptr=tbuf;
X    AL = tgetstr("al", &tbufptr);
X    BC = tgetstr("bc", &tbufptr);
X    BL = tgetstr("bl", &tbufptr);
X    if (!BL)
X	BL = tgetstr("vb", &tbufptr);
X    if (!BL)
X	BL = "\007";
X    BS = tgetflag("bs",&tbufptr);
X    if (!BC && BS)
X	BC = "\b";
X    CB = tgetstr("cb", &tbufptr);
X    CD = tgetstr("cd", &tbufptr);
X    CL = tgetstr("cl", &tbufptr);
X    CE = tgetstr("ce", &tbufptr);
X    CM = tgetstr("cm", &tbufptr);
X    CR = tgetstr("cr", &tbufptr);
X    if (!CR)
X	CR = "\r";
X    CS = tgetstr("cs", &tbufptr);
X    DC = tgetstr("dc", &tbufptr);
X    DL = tgetstr("dl", &tbufptr);
X    DO = tgetstr("do", &tbufptr);
X    if (!DO)
X	DO = "\n";
X    EI = tgetstr("ei", &tbufptr);
X    if (EI && !*EI)
X	EI = NULL;
X    IC = tgetstr("ic", &tbufptr);
X    IM = tgetstr("im", &tbufptr);
X    if (!tgetflag("mi") || tgetflag("in") || (IM && !*IM))
X	IM = NULL;
X    KE = tgetstr("ke", &tbufptr);
X    KS = tgetstr("ks", &tbufptr);
X    MB = tgetstr("mb", &tbufptr);	/* blink */
X    MD = tgetstr("md", &tbufptr);	/* bold */
X    ME = tgetstr("me", &tbufptr);	/* end all attributes */
X    MR = tgetstr("mr", &tbufptr);	/* reverse-video */
X    ND = tgetstr("nd", &tbufptr);
X    NL = tgetstr("nl", &tbufptr);
X    if (!NL)
X	NL = "\n";
X    SO = tgetstr("so", &tbufptr);
X    SE = tgetstr("se", &tbufptr);
X	/* should also test tgetflag("ms") -- safe to move while standout */
X    if (tgetnum("sg") > 0 ||		/* attribute characters? */
X	tgetflag("xs"))			/* standout not erased by overwrite */
X       SO = SE = MB = MD = MR = NULL;
X    SR = tgetstr("sr", &tbufptr);
X    TI = tgetstr("ti", &tbufptr);
X    TE = tgetstr("te", &tbufptr);
X    UE = tgetstr("ue", &tbufptr);
X    UP = tgetstr("up", &tbufptr);
X    US = tgetstr("us", &tbufptr);
X    if (tgetnum("ug") > 0)		/* garbage characters on US/UE */
X	US = UE = 0;
X    MAL = tgetstr("AL", &tbufptr);
X    MDL = tgetstr("DL", &tbufptr);
X    if ((CO = tgetnum("co")) == 0) CO = 80;
X    if ((LI = tgetnum("li")) == 0) LI = 24;
X    if (!TI) {
X	    TI = tgetstr("vs", &tbufptr);
X	    TE = tgetstr("ve", &tbufptr);
X    }
X
X    if (CO < 80 || LI < 24) {
X	printf("Sorry, but vtem requires 24 by 80 lines.\r\n");
X	exit(1);
X    }
X    if (!CM || !UP) {
X	printf("Sorry, but vtem requires cursor motion capabilities (cm,up,do,nd).\r\n");
X	exit(1);
X    }
X    if (!CL || !CD) {
X	printf("Sorry, but vtem requires clear screen capabilities (cl,cd).\r\n");
X	exit(1);
X    }
X    if (!(CS && SR) && !(DL && AL))
X	vttype = VT52;			/* no scrolling capabilities */
X    else if (DC && (IC || (IM && EI)))
X	vttype = VT102;			/* insert/delete char */
X    else
X	vttype = VT100;			/* normal */
X}
X
Xsetupterm(flg)			/* If flg==TRUE, set line in cbreak mode and */
XBool flg;			/* initialize the terminal,otherwise restore */
X{
X    if (flg) {
X	ttycbreak();
X	if (TI)
X	    tputs_x(TI);	/* start CM mode */
X    }
X    else {
X	if (KE)
X	    tputs_x(KE);	/* Restores Keypad */
X	if (TE)
X	    tputs_x(TE);	/* exit CM mode */
X	ioctl(0, TIOCSETP, &oldb);
X	ioctl(0, TIOCSETC, &oldtchars);
X	ioctl(0, TIOCSLTC, &oldltchars);
X    }
X}
X
X/* clear_bos - clear from beginning of screen to cursor
X * logical cursor is at (c,r) which may be past right edge of display
X */
Xclear_bos(c,r)
Xint c,r;
X{
Xregister int i,j;
X
X    for (i=0; i<r; i++) {
X	tputs_pad(tgoto(CM, 0, i),r);
X	if (CE)
X	    tputs_x(CE);
X	else {
X	    for (j=0; j < 80; j++)
X		putchar(' ');
X	}
X    }
X    clear_bol(c,r);
X}
X
X/* clear_eos - Clear from cursor to end of screen.
X */
Xclear_eos()
X{
X    tputs_pad(CD,LI);
X}
X
X/* clear_bol - Clear from beginning of line to cursor.
X * logical cursor is at (c,r) which may be past right edge of display
X */
Xclear_bol(c,r)
Xint c,r;
X{
Xregister int i;
X
X    if (CB) {
X	tputs_x(CB);
X	return;
X    }
X    tputs_x(tgoto(CM, 0, r));
X    if (c >= CO-1) {
X	cr();
X	clear_eol(0,r);
X	tputs_x(tgoto(CM, CO-1, r));
X    } else {
X	for (i=(r==LI-1)?c-1:c; i>=0; i--)
X	    putchar(' ');
X	backspace();
X    }
X}
X
X/* clear_eol - Clear from cursor to end of line.
X * logical cursor is at (c,r) which may be past right edge of display
X */
Xclear_eol(c, r)
Xint c, r;
X{
Xregister int i;
X
X    if (CE)
X	tputs_x(CE);
X    else {
X        if (c >= CO)
X            return;
X        for (i=(r==LI-1)?CO-c-1:CO-c; i>0; i--)
X	    putchar(' ');
X	tputs_x(tgoto(CM, c, r));
X    }
X}
X
X
Xcursor_up()
X{
X    tputs_x(UP); 
X}
X
X
Xcursor_down()
X{
X    tputs_x(DO); 
X}
X
X
Xcursor_right()
X{
X    tputs_x(ND); 
X}
X
X
Xreverse_lf()
X{
X    if (SR)
X	tputs_x(SR);		/* we hope.  May not move cursor. */
X    else
X	cursor_up();		/* We hope. May not scroll up properly! */
X}
X
X
X/* start_reverse - Set terminal in reverse video mode.
X */
Xstart_reverse()
X{
X    if (MR)
X	tputs_x(MR);
X    else
X	tputs_x(SO);
X}
X
X
Xstart_blink()
X{
X    tputs_x(MB);
X}
X
X
Xstart_underline()
X{
X    tputs_x(US);
X}
X
X
Xstart_bold()
X{
X    if (MD)
X	tputs_x(MD);
X    else
X	tputs_x(SO);
X}
X
X
Xring_bell()
X{
X    tputs_x(BL);
X}
X
X
X/* end_attributes - Reset terminal attributes to normal.
X */
Xend_attributes()
X{
X    if (ME)
X	tputs_x(ME);
X    else {
X	tputs_x(SE);
X	tputs_x(UE);
X    }
X}
X
X
Xscroll_region(lin1, lin2, upward)      /* Scroll region between lin1 and */
Xint lin1, lin2;			       /* lin2 inclusive one line up or down */
X{
X    /* Use scroll region if available - otherwise use insert/delete line*/
X    if (CS && SR) {
X	tputs_x(tgoto(CS,lin2,lin1));
X	if (upward) {
X	    set_cursor(0,lin2);
X	    tputs_x(NL);
X	}
X	else {
X	    set_cursor(0,lin1);
X	    tputs_x(SR);
X	}
X	tputs_x(tgoto(CS,23,0));
X    }
X    else if (DL && AL) {
X	if (upward) {
X	    set_cursor(0,lin1);
X	    tputs_pad(DL,LI-lin1);
X	    set_cursor(0,lin2);
X	    tputs_pad(AL,LI-lin2);
X	}
X	else {
X	    set_cursor(0,lin2);
X	    tputs_pad(DL,LI-lin2);
X	    set_cursor(0,lin1);
X	    tputs_pad(AL,LI-lin1);
X	}
X    }
X}
X
Xdelete_char()
X{
X    tputs_x(DC);
X}
X
X/*
X * register intention to start/end inserting
X * (must also call insert_char() before each character actually written)
X */
Xset_insert_mode(onoff)
XBool onoff;
X{
X    if (IM && EI) {
X	if (onoff)
X	    tputs_x(IM);
X	else
X	    tputs_x(EI);
X    }
X}
X
X
X/*
X * call to write any printing char while in insert mode
X * (must call insert_mode(1) to start and insert_mode(0) to end insert mode)
X */
Xinsert_char(ch)
Xchar ch;
X{
X    if (IC && (!IM || !EI))
X	tputs_x(IC);
X    putchar(ch);
X}
END_OF_FILE
if test 8436 -ne `wc -c <'samples/vt100/term.c'`; then
    echo shar: \"'samples/vt100/term.c'\" unpacked with wrong size!
fi
# end of 'samples/vt100/term.c'
fi
if test -f 'tooltool.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'tooltool.c'\"
else
echo shar: Extracting \"'tooltool.c'\" \(6455 characters\)
sed "s/^X//" >'tooltool.c' <<'END_OF_FILE'
X/************************************************************************/
X/*	Copyright 1988 by Chuck Musciano and Harris Corporation		*/
X/*									*/
X/*	Permission to use, copy, modify, and distribute this software	*/
X/*	and its documentation for any purpose and without fee is	*/
X/*	hereby granted, provided that the above copyright notice	*/
X/*	appear in all copies and that both that copyright notice and	*/
X/*	this permission notice appear in supporting documentation, and	*/
X/*	that the name of Chuck Musciano and Harris Corporation not be	*/
X/*	used in advertising or publicity pertaining to distribution	*/
X/*	of the software without specific, written prior permission.	*/
X/*	Chuck Musciano and Harris Corporation make no representations	*/
X/*	about the suitability of this software for any purpose.  It is	*/
X/*	provided "as is" without express or implied warranty.		*/
X/*									*/
X/*	The sale of any product based wholely or in part upon the 	*/
X/*	technology provided by tooltool is strictly forbidden without	*/
X/*	specific, prior written permission from Harris Corporation.	*/
X/*	Tooltool technology includes, but is not limited to, the source	*/
X/*	code, executable binary files, specification language, and	*/
X/*	sample specification files.					*/
X/************************************************************************/
X
X
X#include	<stdio.h>
X#include	<ctype.h>
X
X#include	<sys/file.h>
X
X#include	"tooltool.h"
X
XEXPORT	a_ptr	tt_initial_action = NULL,
X		tt_timer_action = NULL,
X		tt_func_keys[MAX_KEY_SETS][MAX_FUNC_KEYS][MAX_SHIFT_SETS];
X
XEXPORT	char	*tt_application = NULL,
X		*tt_curr_file = "stdin",
X		*tt_icon = NULL,
X		*tt_program;
X
XEXPORT	d_ptr	tt_base_window = NULL;
X
XEXPORT	int	tt_mouse_base = 0,
X		tt_mouse_chars = TRUE,
X		tt_errors_occured = 0,
X		tt_normal_off = FALSE,
X		tt_function_off = FALSE,
X		tt_action_depth = 0,
X		tt_timer_pending = FALSE;
X
XEXPORT	l_ptr	tt_default_mark,
X		tt_default_nomark,
X		tt_default_cycle;
X
XEXPORT	m_data	tt_mouse[MAX_MOUSE_BUTTONS][MAX_SHIFT_SETS];
X
XEXPORT	Menu	tt_ttymenu = NULL;
X
XEXPORT	struct	pixfont	*tt_default_font = NULL,
X			*tt_a_font = NULL;
X
XEXPORT	s_ptr	tt_mouse_x,
X		tt_mouse_y,
X		tt_delimiters;
X
XPRIVATE	short	mark_bits[] = {0x07C0,0x1830,0x2008,0x4384,0x4FE4,0x8FE2,0x9FF2,0x9FF2,
X			       0x9FF2,0x8FE2,0x4FE4,0x4384,0x2008,0x1830,0x07C0,0x0000};
Xmpr_static(tt_mark_image, 15, 15, 1, mark_bits);
X
XPRIVATE	short	nomark_bits[] = {0x07C0,0x1830,0x2008,0x4004,0x4004,0x8002,0x8002,0x8002,
X				 0x8002,0x8002,0x4004,0x4004,0x2008,0x1830,0x07C0,0x0000};
Xmpr_static(tt_nomark_image, 15, 15, 1, nomark_bits);
X
XPRIVATE	short	cycle_bits[] = {0x07C0,0x0FE0,0x1834,0x301C,0x601C,0x203C,0x0000,0x0000,
X				0x7808,0x700C,0x7018,0x5830,0x0FE0,0x07C0,0x0000,0x0000};
Xmpr_static(tt_cycle_image, 16, 16, 1, cycle_bits);
X
X/************************************************************************/
X/* The main driver parses the specification file, builds the window,	*/
X/* and starts up suntools to execute the user application.		*/
X/************************************************************************/
X
X/************************************************************************/
XPRIVATE	check_args(argc, argv, n1, n2, v1, v2)
X
Xint	*argc;
Xchar	**argv;
Xchar	*n1;
Xchar	*n2;
Xint	*v1;
Xint	*v2;
X
X{	int	i, j;
X
X	for (i = 1; i < *argc; i++)
X	   if (strcmp(argv[i], n1) == 0 || strcmp(argv[i], n2) == 0) {
X	      if (i + 1 < *argc)
X	         *v1 = atoi(argv[i + 1]);
X	      else
X	         abend("missing argument after %s", argv[i]);
X	      if (v2)
X	         if (i + 2 < *argc)
X	            *v2 = atoi(argv[i + 2]);
X	         else
X	            abend("missing argument after %s", argv[i]);
X	      for (j = i + (v2? 3 : 2); j < *argc; j++, i++)
X	         argv[i] = argv[j];
X	      *argc -= (v2? 3 : 2);
X	      argv[*argc] = NULL;
X	      break;
X	      }
X}
X
X/************************************************************************/
Xmain(argc, argv)
X
Xint	argc;
Xchar	**argv;
X
X{	int	i, j, k;
X	int	force_height = -1, force_width = -1, force_rows = -1, force_cols = -1;
X
X	tt_program = strsave(argv[0]);
X
X	if (argc > 1 && strcmp(argv[1], POLLING_MAGIC_NUMBER) == 0) { /* is this a gross hack, or what? */
X	   wait_for_window_size(atoi(argv[2]), atoi(argv[3]), POLLING_TIME_OUT);
X	   execv(tt_full_path_of(argv[4], X_OK), &(argv[4]));
X	   fprintf(stderr, "could not exec %s\n", argv[4]);
X	   sleep(20);
X	   exit(1);
X	   }
X
X	for (i = LEFT_KEY_SET; i < MAX_KEY_SETS; i++)
X	   for (j = 0; j < MAX_FUNC_KEYS; j++)
X	      for (k = 0; k < MAX_SHIFT_SETS; k++)
X	         tt_func_keys[i][j][k] = NULL;
X	for (i = MOUSE_LEFT; i < MAX_MOUSE_BUTTONS; i++)
X	   for (j = 0; j < MAX_SHIFT_SETS; j++)
X	      tt_mouse[i][j].defined = MOUSE_UNDEFINED;
X
X	if (argc >= 3 && strcmp(argv[1], "-f") == 0) {
X	   if (freopen(tt_full_path_of(argv[2], R_OK), "r", stdin) == NULL)
X	      abend("could not read %s", argv[2]);
X	   else {
X	      tt_curr_file = argv[2];
X	      for (i = 3; i < argc; i++)
X	         argv[i - 2] = argv[i];
X	      argc -= 2;
X	      }
X	   }
X	check_args(&argc, argv, "-Ww", "-width", &force_cols, NULL);
X	check_args(&argc, argv, "-Wh", "-height", &force_rows, NULL);
X	check_args(&argc, argv, "-Ws", "-size", &force_width, &force_height);
X
X	tt_default_font = pf_default();
X	tt_default_mark = tt_make_label(FALSE, NULL, NULL, &tt_mark_image);
X	tt_default_nomark = tt_make_label(FALSE, NULL, NULL, &tt_nomark_image);
X	tt_default_cycle = tt_make_label(FALSE, NULL, NULL, &tt_cycle_image);
X	tt_a_font = tt_default_font;
X	tt_base_window = tt_make_base_window();
X	tt_make_intrinsic_symbols();
X	yyparse();
X	if (tt_errors_occured)
X	   abend("%d errors.", tt_errors_occured);
X	if (force_height != -1)
X	   if (force_rows != -1 || force_cols != -1)
X	      abend("conflict between window size command line options");
X	   else {
X	      tt_base_window->is_chars = FALSE;
X	      tt_base_window->rows = force_height;
X	      tt_base_window->columns = force_width;
X	      }
X	else {
X	   if (force_rows != -1)
X	      if (tt_base_window->is_chars)
X	         tt_base_window->rows = force_rows;
X	      else
X	         tt_base_window->rows = force_rows * charheight_of(tt_a_font);
X	   if (force_cols != -1)
X	      if (tt_base_window->is_chars)
X	         tt_base_window->columns = force_cols;
X	      else
X	         tt_base_window->columns = force_cols * charwidth_of(tt_a_font);
X	   }
X	if (tt_base_window->g_align == NO_ALIGN)
X	   tt_base_window->g_align = ALIGN_TOP;
X	build_window(argc, argv);
X	window_main_loop(tt_base_window->frame);
X	exit(0);
X}
END_OF_FILE
if test 6455 -ne `wc -c <'tooltool.c'`; then
    echo shar: \"'tooltool.c'\" unpacked with wrong size!
fi
# end of 'tooltool.c'
fi
echo shar: End of archive 3 \(of 13\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 13 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0


Chuck Musciano			ARPA  : chuck@trantor.harris-atd.com
Harris Corporation 		Usenet: ...!uunet!x102a!trantor!chuck
PO Box 37, MS 3A/1912		AT&T  : (407) 727-6131
Melbourne, FL 32902		FAX   : (407) 727-{5118,5227,4004}