[comp.sources.x] v09i042: colxterm -- Color xterm, Part12/14

tomw@orac.esd.sgi.com (Tom Weinstein) (09/14/90)

Submitted-by: Tom Weinstein <tomw@orac.esd.sgi.com>
Posting-number: Volume 9, Issue 42
Archive-name: colxterm/part12

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 12 (of 14)."
# Contents:  xterm/XTerm.ad xterm/ctlseqs.ms xterm/ptyx.h
#   xterm/scrollbar.c
# Wrapped by argv@turnpike on Thu Sep 13 20:42:34 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xterm/XTerm.ad' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xterm/XTerm.ad'\"
else
echo shar: Extracting \"'xterm/XTerm.ad'\" \(2823 characters\)
sed "s/^X//" >'xterm/XTerm.ad' <<'END_OF_FILE'
X*SimpleMenu*BackingStore: NotUseful
X*SimpleMenu*menuLabel.font: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso*-*
X*SimpleMenu*menuLabel.vertSpace: 	100
X*SimpleMenu*HorizontalMargins: 16
X*SimpleMenu*Sme.height:	16
X
X*SimpleMenu*Cursor: left_ptr
X*mainMenu.Label:  Main Options
X*mainMenu*securekbd*Label:  Secure Keyboard
X*mainMenu*allowsends*Label:  Allow SendEvents
X*mainMenu*logging*Label:  Log to File
X*mainMenu*redraw*Label:  Redraw Window
X*mainMenu*suspend*Label:  Send STOP Signal
X*mainMenu*continue*Label:  Send CONT Signal
X*mainMenu*interrupt*Label:  Send INT Signal
X*mainMenu*hangup*Label:  Send HUP Signal
X*mainMenu*terminate*Label:  Send TERM Signal
X*mainMenu*kill*Label:  Send KILL Signal
X*mainMenu*quit*Label:  Quit
X
X*vtMenu.Label:  VT Options
X*vtMenu*scrollbar*Label:  Enable Scrollbar
X*vtMenu*jumpscroll*Label:  Enable Jump Scroll
X*vtMenu*bltscroll*Label:  Enable Blt Scroll
X*vtMenu*reversevideo*Label:  Enable Reverse Video
X*vtMenu*autowrap*Label:  Enable Auto Wraparound
X*vtMenu*reversewrap*Label:  Enable Reverse Wraparound
X*vtMenu*autolinefeed*Label:  Enable Auto Linefeed
X*vtMenu*appcursor*Label:  Enable Application Cursor Keys
X*vtMenu*appkeypad*Label:  Enable Application Keypad
X*vtMenu*scrollkey*Label:  Scroll to Bottom on Key Press
X*vtMenu*scrollttyoutput*Label:  Scroll to Bottom on Tty Output
X*vtMenu*allow132*Label: Allow 80/132 Column Switching
X*vtMenu*cursesemul*Label:  Enable Curses Emulation
X*vtMenu*visualbell*Label:  Enable Visual Bell
X*vtMenu*marginbell*Label:  Enable Margin Bell
X*vtMenu*altscreen*Label:  Show Alternate Screen
X*vtMenu*softreset*Label:  Do Soft Reset
X*vtMenu*hardreset*Label:  Do Full Reset
X*vtMenu*tekshow*Label:  Show Tek Window
X*vtMenu*tekmode*Label:  Switch to Tek Mode
X*vtMenu*vthide*Label:  Hide VT Window
X
X*fontMenu.Label:  VT Fonts
X*fontMenu*fontdefault*Label:	Default
X*fontMenu*font1*Label:	Tiny
X*VT100*font1:		nil2
X*fontMenu*font2*Label:	Small
X*VT100*font2:		6x10
X*fontMenu*font3*Label:	Medium
X*VT100*font3:		8x13
X*fontMenu*font4*Label:	Large
X*VT100*font4:		9x15
X*fontMenu*fontescape*Label:	Escape Sequence
X*fontMenu*fontsel*Label:		Selection
X!fontescape and fontsel overridden by application
X
X*tekMenu.Label:  Tek Options
X*tekMenu*tektextlarge*Label:  Large Characters
X*tekMenu*tektext2*Label:  #2 Size Characters
X*tekMenu*tektext3*Label:  #3 Size Characters
X*tekMenu*tektextsmall*Label:  Small Characters
X*tekMenu*tekpage*Label:  PAGE
X*tekMenu*tekreset*Label:  RESET
X*tekMenu*tekcopy*Label:  COPY
X*tekMenu*vtshow*Label:  Show VT Window
X*tekMenu*vtmode*Label:  Switch to VT Mode
X*tekMenu*tekhide*Label:  Hide Tek Window
X
X*tek4014*fontLarge: 9x15
X*tek4014*font2: 8x13
X*tek4014*font3: 6x13
X*tek4014*fontSmall: 6x10
X
X*color0:    Black
X*color1:      Red
X*color2:    Green
X*color3:   Yellow
X*color4:     Blue
X*color5:  Magenta
X*color6:     Cyan
X*color7:    White
END_OF_FILE
if test 2823 -ne `wc -c <'xterm/XTerm.ad'`; then
    echo shar: \"'xterm/XTerm.ad'\" unpacked with wrong size!
fi
# end of 'xterm/XTerm.ad'
fi
if test -f 'xterm/ctlseqs.ms' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xterm/ctlseqs.ms'\"
else
echo shar: Extracting \"'xterm/ctlseqs.ms'\" \(16552 characters\)
sed "s/^X//" >'xterm/ctlseqs.ms' <<'END_OF_FILE'
X.\"#! troff -Q -ms $1
X.\" This is the "Xterm Control Sequences" document, originally written by
X.\" Edward Moy, University of California, Berkeley, for the X.V10R4 xterm.
X.\" Some minor edits have been made to begin to reconcile this document with
X.\" the current sources, but it still has a long way to go:
X.\"
X.\"	1) I don't guarantee that this is 100% correct.  I tried most of
X.\"	   the things that seemed to be different, and this document
X.\"	   reflects what I saw.  Stuff that appears to be in the X10R4
X.\"	   document and missing from this document is so because it
X.\"	   appears not to be present in the X11 version of "xterm" (e.g.,
X.\"	   the "Alternate Character ROM" character sets and the Sun TTY
X.\"	   emulation).
X.\"
X.\"	2) It is definitely not 100% complete; some escape sequences
X.\"	   that do something that's either unobservable - at least in
X.\"	   the current state of the code - or not useful aren't
X.\"	   documented.  An example of the former are the Locking Shift
X.\"	   sequences that modify the interpretation of the GR
X.\"	   characters; at present, it sets a state variable that's
X.\"	   unused, but perhaps some future version will use it (perhaps
X.\"	   for displaying characters in the range 0200-0377?).  An
X.\"	   example of the latter is the sequence to set DECANM mode
X.\"	   (ANSI/VT52 mode): it doesn't do what it does on a VT100,
X.\"	   namely get the terminal to emulate a VT100, it only seems to
X.\"	   fiddle the current character set a bit.
X.\"
X.\"	3) It doesn't document any of the mouse-related stuff, such as
X.\"	   what the "Track Mouse" escape sequence does, or what the
X.\"	   different mouse modes (MIT, VT220, "VT220 Hilite") do; I
X.\"	   leave that to somebody familiar with that part of the code....
X.\"
X.\" Run this file through troff and use the -ms macro package.
X.ND
X.de St
X.sp
X.nr PD 0
X.nr PI 1.5i
X.nr VS 16
X..
X.de Ed
X.nr PD .3v
X.nr VS 12
X..
X.rm CH
X.ds LH Xterm Control Sequences
X.nr s 6*\n(PS/10
X.ds L \s\nsBEL\s0
X.ds E \s\nsESC\s0
X.ds T \s\nsTAB\s0
X.ds X \s\nsETX\s0
X.ds N \s\nsENQ\s0
X.ds e \s\nsETB\s0
X.ds C \s\nsCAN\s0
X.ds S \s\nsSUB\s0
X.nr [W \w'\*L'u
X.nr w \w'\*E'u
X.if \nw>\n([W .nr [W \nw
X.nr w \w'\*T'u
X.if \nw>\n([W .nr [W \nw
X.nr w \w'\*X'u
X.if \nw>\n([W .nr [W \nw
X.nr w \w'\*N'u
X.if \nw>\n([W .nr [W \nw
X.nr w \w'\*e'u
X.if \nw>\n([W .nr [W \nw
X.nr w \w'\*C'u
X.if \nw>\n([W .nr [W \nw
X.nr w \w'\*S'u
X.if \nw>\n([W .nr [W \nw
X.nr [W +\w'\|\|'u
X.de []
X.nr w \w'\\$2'
X.nr H \\n([Wu-\\nwu
X.nr h \\nHu/2u
X.ds \\$1 \(br\v'-1p'\(br\v'1p'\h'\\nhu'\\$2\h'\\nHu-\\nhu'\(br\l'-\\n([Wu\(ul'\v'-1p'\(br\l'-\\n([Wu\(rn'\v'1p'\|
X..
X.[] Et \v'-1p'\*X\v'1p'
X.[] En \v'-1p'\*N\v'1p'
X.[] Be \v'-1p'\*L\v'1p'
X.[] Bs \v'-1p'\s\nsBS\s0\v'1p'
X.[] Ta \v'-1p'\*T\v'1p'
X.[] Lf \v'-1p'\s\nsLF\s0\v'1p'
X.[] Vt \v'-1p'\s\nsVT\s0\v'1p'
X.[] Ff \v'-1p'\s\nsFF\s0\v'1p'
X.[] Cr \v'-1p'\s\nsCR\s0\v'1p'
X.[] So \v'-1p'\s\nsSO\s0\v'1p'
X.[] Si \v'-1p'\s\nsSI\s0\v'1p'
X.[] Eb \v'-1p'\*e\v'1p'
X.[] Ca \v'-1p'\*C\v'1p'
X.[] Su \v'-1p'\*S\v'1p'
X.[] Es \v'-1p'\*E\v'1p'
X.[] Fs \v'-1p'\s\nsFS\s0\v'1p'
X.[] Gs \v'-1p'\s\nsGS\s0\v'1p'
X.[] Rs \v'-1p'\s\nsRS\s0\v'1p'
X.[] Us \v'-1p'\s\nsUS\s0\v'1p'
X.[] # #
X.[] (( (
X.[] ) )
X.[] * *
X.[] + +
X.[] 0 0
X.[] 1 1
X.[] 2 2
X.[] 3 3
X.[] 4 4
X.[] 5 5
X.[] 6 6
X.[] 7 7
X.[] 8 8
X.[] 9 9
X.[] : :
X.[] ; ;
X.[] = =
X.[] > >
X.[] ? ?
X.[] @ @
X.[] A A
X.[] cB B
X.[] C C
X.[] D D
X.[] E E
X.[] F F
X.[] H H
X.[] J J
X.[] K K
X.[] L L
X.[] M M
X.[] N N
X.[] O O
X.[] P P
X.[] R R
X.[] S S
X.[] T T
X.[] Z Z
X.[] [[ [
X.[] ] ]
X.[] ` \`
X.[] a a
X.[] b b
X.[] c c
X.[] d d
X.[] f f
X.[] g g
X.[] h h
X.[] i i
X.[] j j
X.[] k k
X.[] l l
X.[] m m
X.[] n n
X.[] o o
X.[] p p
X.[] q q
X.[] r r
X.[] s s
X.[] t t
X.[] x x
X.[] | |
X.[] } }
X.[] c~ ~
X.ds Cc \fIC\fP
X.ds Ps \fIP\v'.3m'\h'-.2m'\s-2s\s0\v'-.3m'\fP
X.ds Pm \fIP\v'.3m'\h'-.2m'\s-2m\s0\v'-.3m'\fP
X.ds Pt \fIP\v'.3m'\h'-.2m'\s-2t\s0\v'-.3m'\fP
X.ds Ix \fIx\fP
X.ds Iy \fIy\fP
X.ds Iw \fIw\fP
X.ds Ih \fIh\fP
X.ds Ir \fIr\fP
X.ds Ic \fIc\fP
X.nr LL 6.5i
X.TL
XXterm Control Sequences
X.am NP
X.ds CF %
X..
X.SH
XDefinitions
X.IP \*(Cc
XA single (required) character.
X.IP \*(Ps
XA single (usually optional) numeric parameter, composed of one of more digits.
X.IP \*(Pm
XA multiple numeric parameter composed of any number of single numeric
Xparameters, separated by \*; character(s).
X.IP \*(Pt
XA text parameter composed of printable characters.
X.SH
XVT102 Mode
X.ds RH VT102 Mode
X.LP
XMost of these control sequences are standard VT102 control sequences.
XThere are, however, additional ones to provide control of
X.I xterm
Xdependent functions, like the scrollbar or window size.
X.St
X.IP \\*(Be
XBell (Ctrl-G)
X.IP \\*(Bs
XBackspace (Ctrl-H)
X.IP \\*(Ta
XHorizontal Tab (Ctrl-I)
X.IP \\*(Lf
XLine Feed or New Line (Ctrl-J)
X.IP \\*(Vt
XVertical Tab (Ctrl-K)
X.IP \\*(Ff
XForm Feed or New Page (Ctrl-L)
X.IP \\*(Cr
XCarriage Return (Ctrl-M)
X.IP \\*(So
XShift Out (Ctrl-N) \(-> Switch to Alternate Character Set
X.IP \\*(Si
XShift In (Ctrl-O) \(-> Switch to Standard Character Set
X.IP \\*(Es\\*#\\*8
XDEC Screen Alignment Test (DECALN)
X.IP \\*(Es\\*(((\\*(Cc
XSelect G0 Character Set (SCS)
X  \*(Cc = \*0 \(-> Special Character and Line Drawing Set
X  \*(Cc = \*A \(-> United Kingdom (UK)
X  \*(Cc = \*(cB \(-> United States (USASCII)
X.IP \\*(Es\\*)\\*(Cc
XSelect G1 Character Set (SCS)
X  \*(Cc = \*0 \(-> Special Character and Line Drawing Set
X  \*(Cc = \*A \(-> United Kingdom (UK)
X  \*(Cc = \*(cB \(-> United States (USASCII)
X.IP \\*(Es\\**\\*(Cc
XSelect G2 Character Set (SCS)
X  \*(Cc = \*0 \(-> Special Character and Line Drawing Set
X  \*(Cc = \*A \(-> United Kingdom (UK)
X  \*(Cc = \*(cB \(-> United States (USASCII)
X.IP \\*(Es\\*+\\*(Cc
XSelect G3 Character Set (SCS)
X  \*(Cc = \*0 \(-> Special Character and Line Drawing Set
X  \*(Cc = \*A \(-> United Kingdom (UK)
X  \*(Cc = \*(cB \(-> United States (USASCII)
X.IP \\*(Es\\*7
XSave Cursor (DECSC)
X.IP \\*(Es\\*8
XRestore Cursor (DECRC)
X.IP \\*(Es\\*=
XApplication Keypad (DECPAM)
X.IP \\*(Es\\*>
XNormal Keypad (DECPNM)
X.IP \\*(Es\\*D
XIndex (IND)
X.IP \\*(Es\\*E
XNext Line (NEL)
X.IP \\*(Es\\*H
XTab Set (HTS)
X.IP \\*(Es\\*M
XReverse Index (RI)
X.IP \\*(Es\\*N
XSingle Shift Select of G2 Character Set (SS2)
X.IP \\*(Es\\*O
XSingle Shift Select of G3 Character Set (SS3)
X.IP \\*(Es\\*Z
XReturn Terminal ID (DECID)
X.IP \\*(Es\\*([[\\*(Ps\|\\*@
XInsert \*(Ps (Blank) Character(s) (default = 1) (ICH)
X.IP \\*(Es\\*([[\\*(Ps\|\\*A
XCursor Up \*(Ps Times (default = 1) (CUU)
X.IP \\*(Es\\*([[\\*(Ps\|\\*(cB
XCursor Down \*(Ps Times (default = 1) (CUD)
X.IP \\*(Es\\*([[\\*(Ps\|\\*C
XCursor Forward \*(Ps Times (default = 1) (CUF)
X.IP \\*(Es\\*([[\\*(Ps\|\\*D
XCursor Backward \*(Ps Times (default = 1) (CUB)
X.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*H
XCursor Position [row;column] (default = [1,1]) (CUP)
X.IP \\*(Es\\*([[\\*(Ps\|\\*J
XErase in Display (ED)
X  \*(Ps = \*0 \(-> Clear Below (default)
X  \*(Ps = \*1 \(-> Clear Above
X  \*(Ps = \*2 \(-> Clear All
X.IP \\*(Es\\*([[\\*(Ps\|\\*K
XErase in Line (EL)
X  \*(Ps = \*0 \(-> Clear to Right (default)
X  \*(Ps = \*1 \(-> Clear to Left
X  \*(Ps = \*2 \(-> Clear All
X.IP \\*(Es\\*([[\\*(Ps\|\\*L
XInsert \*(Ps Line(s) (default = 1) (IL)
X.IP \\*(Es\\*([[\\*(Ps\|\\*M
XDelete \*(Ps Line(s) (default = 1) (DL)
X.IP \\*(Es\\*([[\\*(Ps\|\\*P
XDelete \*(Ps Character(s) (default = 1) (DCH)
X.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*;\\*(Ps\|\\*;\\*(Ps\|\\*;\\*(Ps\|\\*T
XTrack Mouse [func;startcol;startrow;firstrow;lastrow] XXX - describe
X.IP \\*(Es\\*([[\\*(Ps\|\\*c
XDevice Attributes (default 0) (DA)
X.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*f
XHorizontal and Vertical Position [row;column] (default = [1,1]) (HVP)
X.IP \\*(Es\\*([[\\*(Ps\|\\*g
XTab Clear
X  \*(Ps = \*0 \(-> Clear Current Column (default)
X  \*(Ps = \*3 \(-> Clear All
X.IP \\*(Es\\*([[\\*(Ps\|\\*h
XMode Set (SET)
X  \*(Ps = \*4 \(-> Insert Mode (IRM)
X  \*(Ps = \*2\*0 \(-> Automatic Linefeed (LNM)
X.IP \\*(Es\\*([[\\*(Ps\|\\*l
XMode Reset (RST)
X  \*(Ps = \*4 \(-> Insert Mode (IRM)
X  \*(Ps = \*2\*0 \(-> Automatic Linefeed (LNM)
X.IP \\*(Es\\*([[\\*(Pm\|\\*m
XCharacter Attributes (SGR)
X  \*(Ps = \*0 \(-> Normal (default)
X  \*(Ps = \*1 \(-> Blink (appears as Bold)
X  \*(Ps = \*4 \(-> Underscore
X  \*(Ps = \*5 \(-> Bold
X  \*(Ps = \*7 \(-> Inverse
X  \*(Ps = \*30 \(-> Black Foreground
X  \*(Ps = \*31 \(-> Red Foreground
X  \*(Ps = \*32 \(-> Green Foreground
X  \*(Ps = \*33 \(-> Yellow Foreground
X  \*(Ps = \*34 \(-> Blue Foreground
X  \*(Ps = \*35 \(-> Magenta Foreground
X  \*(Ps = \*36 \(-> Cyan Foreground
X  \*(Ps = \*37 \(-> White Foreground
X  \*(Ps = \*40 \(-> Black Background
X  \*(Ps = \*41 \(-> Red Background
X  \*(Ps = \*42 \(-> Green Background
X  \*(Ps = \*43 \(-> Yellow Background
X  \*(Ps = \*44 \(-> Blue Background
X  \*(Ps = \*45 \(-> Magenta Background
X  \*(Ps = \*46 \(-> Cyan Background
X  \*(Ps = \*47 \(-> White Background
X.IP \\*(Es\\*([[\\*(Ps\|\\*n
XDevice Status Report (DSR)
X  \*(Ps = 5 \(-> Status Report \*(Es\*([[\*0\*n \(-> OK
X  \*(Ps = 6 \(-> Report Cursor Position (CPR) [row;column] as
X\*(Es\*([[\*(Ir\|\*;\*(Ic\|\*R
X.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*r
XSet Scrolling Region [top;bottom] (default = full size of window) (DECSTBM)
X.IP \\*(Es\\*([[\\*(Ps\|\\*x
XRequest Terminal Parameters (DECREQTPARM)
X.IP \\*(Es\\*([[\\*?\\*(Ps\|\\*h
XDEC Private Mode Set (DECSET)
X  \*(Ps = \*1 \(-> Application Cursor Keys (DECCKM)
X  \*(Ps = \*3 \(-> 132 Column Mode (DECCOLM)
X  \*(Ps = \*4 \(-> Smooth (Slow) Scroll (DECSCLM)
X  \*(Ps = \*5 \(-> Reverse Video (DECSCNM)
X  \*(Ps = \*6 \(-> Origin Mode (DECOM)
X  \*(Ps = \*7 \(-> Wraparound Mode (DECAWM)
X  \*(Ps = \*8 \(-> Auto-repeat Keys (DECARM)
X  \*(Ps = \*9 \(-> Send MIT Mouse Row & Column on Button Press
X  \*(Ps = \*3\*8 \(-> Enter Tektronix Mode (DECTEK)
X  \*(Ps = \*4\*0 \(-> Allow 80 \z\(<-\(-> 132 Mode
X  \*(Ps = \*4\*1 \(-> \fIcurses\fP(5) fix
X  \*(Ps = \*4\*4 \(-> Turn On Margin Bell
X  \*(Ps = \*4\*5 \(-> Reverse-wraparound Mode
X  \*(Ps = \*4\*6 \(-> Start Logging
X  \*(Ps = \*4\*7 \(-> Use Alternate Screen Buffer
X  \*(Ps = \*1\*0\*0\*0 \(-> Send VT200 Mouse Row & Column on Button Press
X  \*(Ps = \*1\*0\*0\*3 \(-> Send VT200 Hilite Mouse Row & Column on Button Press
X.IP \\*(Es\\*([[\\*?\\*(Ps\|\\*l
XDEC Private Mode Reset (DECRST)
X  \*(Ps = \*1 \(-> Normal Cursor Keys (DECCKM)
X  \*(Ps = \*3 \(-> 80 Column Mode (DECCOLM)
X  \*(Ps = \*4 \(-> Jump (Fast) Scroll (DECSCLM)
X  \*(Ps = \*5 \(-> Normal Video (DECSCNM)
X  \*(Ps = \*6 \(-> Normal Cursor Mode (DECOM)
X  \*(Ps = \*7 \(-> No Wraparound Mode (DECAWM)
X  \*(Ps = \*8 \(-> No Auto-repeat Keys (DECARM)
X  \*(Ps = \*9 \(-> Don't Send Mouse Row & Column on Button Press
X  \*(Ps = \*4\*0 \(-> Disallow 80 \z\(<-\(-> 132 Mode
X  \*(Ps = \*4\*1 \(-> No \fIcurses\fP(5) fix
X  \*(Ps = \*4\*4 \(-> Turn Off Margin Bell
X  \*(Ps = \*4\*5 \(-> No Reverse-wraparound Mode
X  \*(Ps = \*4\*6 \(-> Stop Logging
X  \*(Ps = \*4\*7 \(-> Use Normal Screen Buffer
X  \*(Ps = \*1\*0\*0\*0 \(-> Don't Send Mouse Row & Column on Button Press
X  \*(Ps = \*1\*0\*0\*3 \(-> Don't Send Mouse Row & Column on Button Press
X.IP \\*(Es\\*([[\\*?\\*(Ps\|\\*r
XRestore DEC Private Mode
X  \*(Ps = \*1 \(-> Normal/Application Cursor Keys (DECCKM)
X  \*(Ps = \*3 \(-> 80/132 Column Mode (DECCOLM)
X  \*(Ps = \*4 \(-> Jump (Fast)/Smooth (Slow) Scroll (DECSCLM)
X  \*(Ps = \*5 \(-> Normal/Reverse Video (DECSCNM)
X  \*(Ps = \*6 \(-> Normal/Origin Cursor Mode (DECOM)
X  \*(Ps = \*7 \(-> No Wraparound/Wraparound Mode (DECAWM)
X  \*(Ps = \*8 \(-> Auto-repeat/No Auto-repeat Keys (DECARM)
X  \*(Ps = \*9 \(-> Don't Send/Send MIT Mouse Row & Column on Button Press
X  \*(Ps = \*4\*0 \(-> Disallow/Allow 80 \z\(<-\(-> 132 Mode
X  \*(Ps = \*4\*1 \(-> Off/On \fIcurses\fP(5) fix
X  \*(Ps = \*4\*4 \(-> Turn Off/On Margin Bell
X  \*(Ps = \*4\*5 \(-> No Reverse-wraparound/Reverse-wraparound Mode
X  \*(Ps = \*4\*6 \(-> Stop/Start Logging
X  \*(Ps = \*4\*7 \(-> Use Normal/Alternate Screen Buffer
X  \*(Ps = \*1\*0\*0\*0 \(-> Don't Send/Send VT220 Mouse Row & Column on Button Press
X  \*(Ps = \*1\*0\*0\*3 \(-> Don't Send/Send VT220 Hilite Mouse Row & Column on Button Press
X.IP \\*(Es\\*([[\\*?\\*(Ps\|\\*s
XSave DEC Private Mode
X  \*(Ps = \*1 \(-> Normal/Application Cursor Keys (DECCKM)
X  \*(Ps = \*3 \(-> 80/132 Column Mode (DECCOLM)
X  \*(Ps = \*4 \(-> Jump (Fast)/Smooth (Slow) Scroll (DECSCLM)
X  \*(Ps = \*5 \(-> Normal/Reverse Video (DECSCNM)
X  \*(Ps = \*6 \(-> Normal/Origin Cursor Mode (DECOM)
X  \*(Ps = \*7 \(-> No Wraparound/Wraparound Mode (DECAWM)
X  \*(Ps = \*8 \(-> Auto-repeat/No Auto-repeat Keys (DECARM)
X  \*(Ps = \*9 \(-> Don't Send/Send MIT Mouse Row & Column on Button Press
X  \*(Ps = \*4\*0 \(-> Disallow/Allow 80 \z\(<-\(-> 132 Mode
X  \*(Ps = \*4\*1 \(-> Off/On \fIcurses\fP(5) fix
X  \*(Ps = \*4\*4 \(-> Turn Off/On Margin Bell
X  \*(Ps = \*4\*5 \(-> No Reverse-wraparound/Reverse-wraparound Mode
X  \*(Ps = \*4\*6 \(-> Stop/Start Logging
X  \*(Ps = \*4\*7 \(-> Use Normal/Alternate Screen Buffer
X  \*(Ps = \*1\*0\*0\*0 \(-> Don't Send/Send VT220 Mouse Row & Column on Button Press
X  \*(Ps = \*1\*0\*0\*3 \(-> Don't Send/Send VT220 Hilite Mouse Row & Column on Button Press
X.IP \\*(Es\\*]\\*(Ps\|\\*;\\*(Pt\|\\*(Be
XSet Text Parameters
X  \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
X  \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
X  \*(Ps = \*2 \(-> Change Window Title to \*(Pt
X  \*(Ps = \*1\*0 \(-> Change VT102 Foreground color to \*(Pt
X  \*(Ps = \*1\*1 \(-> Change VT102 Background color to \*(Pt
X  \*(Ps = \*1\*2 \(-> Change VT102 Text Cursor color to \*(Pt
X  \*(Ps = \*1\*3 \(-> Change VT102 Mouse Foreground color to \*(Pt
X  \*(Ps = \*1\*4 \(-> Change VT102 Mouse Background color to \*(Pt
X  \*(Ps = \*1\*5 \(-> Change Tektronix Foreground color to \*(Pt
X  \*(Ps = \*1\*6 \(-> Change Tektronix Background color to \*(Pt
X  \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt
X.LP
XThe string arguments to the Change color sequences may be
Xany legal X color specification -- either name or numeric 
Xspecification.  The index value for the Change Color sequences 
Xis the starting index of the colors to change.   You may change any
Xnumber of sequential colors in a single sequence.  For example:
X.br
X\\*(Es\\*]10;White\!\\*;Firebrick\!\\*;#ffff00\\*(Be
X.br
XSets the VT102 primary rendition foreground color to White, the
Xthe primary rendition backtround color to Firebrick and the
XText Cursor color to a bright yellow color.
X.IP \\*(Es\\*c
XFull Reset (RIS)
X.IP \\*(Es\\*n
XLocking Shift Select of G2 Character Set (LS2)
X.IP \\*(Es\\*o
XLocking Shift Select of G3 Character Set (LS3)
X.Ed
X.SH
XTektronix 4015 Mode
X.ds RH Tektronix 4015 Mode
X.LP
XMost of these sequences are standard Tektronix 4015 control sequences.
XThe major features missing are the alternate (APL) character set and
Xthe write-thru and defocused modes.
X.St
X.IP \\*(Be
XBell (Ctrl-G)
X.IP \\*(Bs
XBackspace (Ctrl-H)
X.IP \\*(Ta
XHorizontal Tab (Ctrl-I)
X.IP \\*(Lf
XLine Feed or New Line (Ctrl-J)
X.IP \\*(Vt
XVertical Tab (Ctrl-K)
X.IP \\*(Ff
XForm Feed or New Page (Ctrl-L)
X.IP \\*(Cr
XCarriage Return (Ctrl-M)
X.IP \\*(Es\\*(Et
XSwitch to VT102 Mode
X.IP \\*(Es\\*(En
XReturn Terminal Status
X.IP \\*(Es\\*(Lf
XPAGE (Clear Screen)
X.IP \\*(Es\\*(Eb
XCOPY (Save Tektronix Codes to File)
X.IP \\*(Es\\*(Ca
XBypass Condition
X.IP \\*(Es\\*(Su
XGIN mode
X.IP \\*(Es\\*(Fs
XSpecial Point Plot Mode
X.IP \\*(Es\\*(Gs
XGraph Mode (same as \*(Gs)
X.IP \\*(Es\\*(Rs
XIncremental Plot Mode (same as \*(Rs)
X.IP \\*(Es\\*(Us
XAlpha Mode (same as \*(Us)
X.IP \\*(Es\\*8
XSelect Large Character Set
X.IP \\*(Es\\*9
XSelect #2 Character Set
X.IP \\*(Es\\*:
XSelect #3 Character Set
X.IP \\*(Es\\*;
XSelect Small Character Set
X.IP \\*(Es\\*]\\*(Ps\|\\*;\\*(Pt\|\\*(Be
XSet Text Parameters
X  \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
X  \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
X  \*(Ps = \*2 \(-> Change Window Title to \*(Pt
X  \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt
X.IP \\*(Es\\*`
XNormal Z Axis and Normal (solid) Vectors
X.IP \\*(Es\\*a
XNormal Z Axis and Dotted Line Vectors
X.IP \\*(Es\\*b
XNormal Z Axis and Dot-Dashed Vectors
X.IP \\*(Es\\*c
XNormal Z Axis and Short-Dashed Vectors
X.IP \\*(Es\\*d
XNormal Z Axis and Long-Dashed Vectors
X.IP \\*(Es\\*h
XDefocused Z Axis and Normal (solid) Vectors
X.IP \\*(Es\\*i
XDefocused Z Axis and Dotted Line Vectors
X.IP \\*(Es\\*j
XDefocused Z Axis and Dot-Dashed Vectors
X.IP \\*(Es\\*k
XDefocused Z Axis and Short-Dashed Vectors
X.IP \\*(Es\\*l
XDefocused Z Axis and Long-Dashed Vectors
X.IP \\*(Es\\*p
XWrite-Thru Mode and Normal (solid) Vectors
X.IP \\*(Es\\*q
XWrite-Thru Mode and Dotted Line Vectors
X.IP \\*(Es\\*r
XWrite-Thru Mode and Dot-Dashed Vectors
X.IP \\*(Es\\*s
XWrite-Thru Mode and Short-Dashed Vectors
X.IP \\*(Es\\*t
XWrite-Thru Mode and Long-Dashed Vectors
X.IP \\*(Fs
XPoint Plot Mode
X.IP \\*(Gs
XGraph Mode
X.IP \\*(Rs
XIncremental Plot Mode
X.IP \\*(Us
XAlpha Mode
X.Ed
END_OF_FILE
if test 16552 -ne `wc -c <'xterm/ctlseqs.ms'`; then
    echo shar: \"'xterm/ctlseqs.ms'\" unpacked with wrong size!
fi
# end of 'xterm/ctlseqs.ms'
fi
if test -f 'xterm/ptyx.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xterm/ptyx.h'\"
else
echo shar: Extracting \"'xterm/ptyx.h'\" \(17296 characters\)
sed "s/^X//" >'xterm/ptyx.h' <<'END_OF_FILE'
X/*
X *	$XConsortium: ptyx.h,v 1.43 90/06/07 15:49:49 jim Exp $
X */
X
X#include <X11/copyright.h>
X
X/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
X/* ptyx.h */
X/* @(#)ptyx.h	X10/6.6	11/10/86 */
X
X#include <X11/IntrinsicP.h>
X#include <X11/Xmu/Misc.h>	/* For Max() and Min(). */
X#include <signal.h>		/* for SIGTSTP */
X
X/* Extra Xlib definitions */
X#define AllButtonsUp(detail, ignore)  (\
X		((ignore) == Button1) ? \
X				(((detail)&(Button2Mask|Button3Mask)) == 0) \
X				: \
X		 (((ignore) == Button2) ? \
X		  		(((detail)&(Button1Mask|Button3Mask)) == 0) \
X				: \
X		  		(((detail)&(Button1Mask|Button2Mask)) == 0)) \
X		)
X
X#define MAX_COLS	200
X#define MAX_ROWS	128
X
X/*
X** System V definitions
X*/
X
X#ifdef SYSV
X
X#define	killpg(x,sig)	kill(-x,sig)
X
X#if !defined CRAY && ! defined sgi
X#define	dup2(fd1,fd2)	((fd1 == fd2) ? fd1 : \
X				(close(fd2), fcntl(fd1, F_DUPFD, fd2)))
X#endif
X
X#endif	/* !SYSV */
X
X/*
X** allow for mobility of the pty master/slave directories
X*/
X#ifndef PTYDEV
X#ifdef hpux
X#define	PTYDEV		"/dev/ptym/ptyxx"
X#else	/* !hpux */
X#define	PTYDEV		"/dev/ptyxx"
X#endif	/* !hpux */
X#endif	/* !PTYDEV */
X
X#ifndef TTYDEV
X#ifdef hpux
X#define TTYDEV		"/dev/pty/ttyxx"
X#else	/* !hpux */
X#define	TTYDEV		"/dev/ttyxx"
X#endif	/* !hpux */
X#endif	/* !TTYDEV */
X
X#ifndef PTYCHAR1
X#ifdef hpux
X#define PTYCHAR1	"zyxwvutsrqp"
X#else	/* !hpux */
X#define	PTYCHAR1	"pqrstuvwxyz"
X#endif	/* !hpux */
X#endif	/* !PTYCHAR1 */
X
X#ifndef PTYCHAR2
X#ifdef hpux
X#define	PTYCHAR2	"fedcba9876543210"
X#else	/* !hpux */
X#define	PTYCHAR2	"0123456789abcdef"
X#endif	/* !hpux */
X#endif	/* !PTYCHAR2 */
X
X/* Until the translation manager comes along, I have to do my own translation of
X * mouse events into the proper routines. */
X
Xtypedef enum {NORMAL, LEFTEXTENSION, RIGHTEXTENSION} EventMode;
X
X/*
X * The origin of a screen is 0, 0.  Therefore, the number of rows
X * on a screen is screen->max_row + 1, and similarly for columns.
X */
X
Xtypedef unsigned char Char;		/* to support 8 bit chars */
Xtypedef Char **ScrnBuf;
X
X/*
X * ANSI emulation.
X */
X#define INQ	0x05
X#define	FF	0x0C			/* C0, C1 control names		*/
X#define	LS1	0x0E
X#define	LS0	0x0F
X#define	CAN	0x18
X#define	SUB	0x1A
X#define	ESC	0x1B
X#define US	0x1F
X#define	DEL	0x7F
X#define HTS     ('H'+0x40)
X#define	SS2	0x8E
X#define	SS3	0x8F
X#define	DCS	0x90
X#define	OLDID	0x9A			/* ESC Z			*/
X#define	CSI	0x9B
X#define	ST	0x9C
X#define	OSC	0x9D
X#define	PM	0x9E
X#define	APC	0x9F
X#define	RDEL	0xFF
X
X#define NMENUFONTS 7			/* entries in fontMenu */
X
X#define	NBOX	5			/* Number of Points in box	*/
X#define	NPARAM	10			/* Max. parameters		*/
X
X#define	MINHILITE	32
X
Xtypedef struct {
X	unsigned char	a_type;
X	unsigned char	a_pintro;
X	unsigned char	a_final;
X	unsigned char	a_inters;
X	char	a_nparam;		/* # of parameters		*/
X	char	a_dflt[NPARAM];		/* Default value flags		*/
X	short	a_param[NPARAM];	/* Parameters			*/
X	char	a_nastyf;		/* Error flag			*/
X} ANSI;
X
Xtypedef struct {
X	int		row;
X	int		col;
X	unsigned	flags;	/* Vt100 saves graphics rendition. Ugh! */
X	char		curgl;
X	char		curgr;
X	char		gsets[4];
X} SavedCursor;
X
X#define TEK_FONT_LARGE 0
X#define TEK_FONT_2 1
X#define TEK_FONT_3 2
X#define TEK_FONT_SMALL 3
X#define	TEKNUMFONTS 4
X
X/* Actually there are 5 types of lines, but four are non-solid lines */
X#define	TEKNUMLINES	4
X
Xtypedef struct {
X	int	x;
X	int	y;
X	int	fontsize;
X	int	linetype;
X} Tmodes;
X
Xtypedef struct {
X	int Twidth;
X	int Theight;
X} T_fontsize;
X
Xtypedef struct {
X	short *bits;
X	int x;
X	int y;
X	int width;
X	int height;
X} BitmapBits;
X
X#define	SAVELINES		64      /* default # lines to save      */
X#define SCROLLLINES 1			/* default # lines to scroll    */
X
X/***====================================================================***/
X
X#define	TEXT_FG		0
X#define	TEXT_BG		1
X#define	TEXT_CURSOR	2
X#define	MOUSE_FG	3
X#define	MOUSE_BG	4
X#define	TEK_FG		5
X#define	TEK_BG		6
X#define	NCOLORS		7
X
X#define	COLOR_DEFINED(s,w)	((s)->which&(1<<(w)))
X#define	COLOR_VALUE(s,w)	((s)->colors[w])
X#define	SET_COLOR_VALUE(s,w,v)	(((s)->colors[w]=(v)),((s)->which|=(1<<(w))))
X
X#define	COLOR_NAME(s,w)		((s)->names[w])
X#define	SET_COLOR_NAME(s,w,v)	(((s)->names[w]=(v)),((s)->which|=(1<<(w))))
X
X#define	UNDEFINE_COLOR(s,w)	((s)->which&=(~((w)<<1)))
X#define	OPPOSITE_COLOR(n)	(((n)==TEXT_FG?TEXT_BG:\
X				 ((n)==TEXT_BG?TEXT_FG:\
X				 ((n)==MOUSE_FG?MOUSE_BG:\
X				 ((n)==MOUSE_BG?MOUSE_FG:\
X				 ((n)==TEK_FG?TEK_BG:\
X				 ((n)==TEXT_BG?TEK_FG:(n))))))))
X
Xtypedef struct {
X	unsigned	which;
X	Pixel		colors[NCOLORS];
X	char		*names[NCOLORS];
X} ScrnColors;
X
X/***====================================================================***/
X
X#define MAXCOLORS 8
X#define COLOR_0		0
X#define COLOR_1		1
X#define COLOR_2		2
X#define COLOR_3		3
X#define COLOR_4		4
X#define COLOR_5		5
X#define COLOR_6		6
X#define COLOR_7		7
X
Xtypedef struct {
X/* These parameters apply to both windows */
X	Display		*display;	/* X display for screen		*/
X	int		respond;	/* socket for responses
X					   (position report, etc.)	*/
X	long		pid;		/* pid of process on far side   */
X	int		uid;		/* user id of actual person	*/
X	int		gid;		/* group id of actual person	*/
X	GC		normalGC;	/* normal painting		*/
X	GC		reverseGC;	/* reverse painting		*/
X	GC		normalboldGC;	/* normal painting, bold font	*/
X	GC		reverseboldGC;	/* reverse painting, bold font	*/
X	GC		cursorGC;	/* normal cursor painting	*/
X	GC		reversecursorGC;/* reverse cursor painting	*/
X	GC		cursoroutlineGC;/* for painting lines around    */
X	Pixel		foreground;	/* foreground color		*/
X	Pixel		cursorcolor;	/* Cursor color			*/
X	Pixel		mousecolor;	/* Mouse color			*/
X	Pixel		mousecolorback;	/* Mouse color background	*/
X	Pixel		colors[MAXCOLORS]; /* ANSI color emulation	*/
X	int		border;		/* inner border			*/
X	Cursor		arrow;		/* arrow cursor			*/
X	unsigned short	send_mouse_pos;	/* user wants mouse transition  */
X					/* and position information	*/
X	int		select;		/* xterm selected		*/
X	Boolean		visualbell;	/* visual bell mode		*/
X	int		logging;	/* logging mode			*/
X	Boolean		allowSendEvents;/* SendEvent mode		*/
X	Boolean		grabbedKbd;	/* keyboard is grabbed		*/
X	int		logfd;		/* file descriptor of log	*/
X	char		*logfile;	/* log file name		*/
X	unsigned char	*logstart;	/* current start of log buffer	*/
X	int		inhibit;	/* flags for inhibiting changes	*/
X
X/* VT window parameters */
X	struct {
X		Window	window;		/* X window id			*/
X		int	width;		/* width of columns		*/
X		int	height;		/* height of rows		*/
X		int	fullwidth;	/* full width of window		*/
X		int	fullheight;	/* full height of window	*/
X		int	f_width;	/* width of fonts in pixels	*/
X		int	f_height;	/* height of fonts in pixels	*/
X	} fullVwin;
X	Cursor pointer_cursor;		/* pointer cursor in window	*/
X
X	/* Terminal fonts must be of the same size and of fixed width */
X	XFontStruct	*fnt_norm;	/* normal font of terminal	*/
X	XFontStruct	*fnt_bold;	/* bold font of terminal	*/
X	int		enbolden;	/* overstrike for bold font	*/
X	XPoint		*box;		/* draw unselected cursor	*/
X
X	int		cursor_state;	/* ON or OFF			*/
X	int		cursor_set;	/* requested state		*/
X	int		cursor_col;	/* previous cursor column	*/
X	int		cursor_row;	/* previous cursor row		*/
X	int		cur_col;	/* current cursor column	*/
X	int		cur_row;	/* current cursor row		*/
X	int		max_col;	/* rightmost column		*/
X	int		max_row;	/* bottom row			*/
X	int		top_marg;	/* top line of scrolling region */
X	int		bot_marg;	/* bottom line of  "	    "	*/
X	Widget		scrollWidget;	/* pointer to scrollbar struct	*/
X	int		scrollbar;	/* if > 0, width of scrollbar, and
X						scrollbar is showing	*/
X	int		topline;	/* line number of top, <= 0	*/
X	int		savedlines;     /* number of lines that've been saved */
X	int		savelines;	/* number of lines off top to save */
X	int		scrolllines;	/* number of lines to button scroll */
X	Boolean		scrollttyoutput; /* scroll to bottom on tty output */
X	Boolean		scrollkey;	/* scroll to bottom on key	*/
X	
X	ScrnBuf		buf;		/* screen buffer (main)		*/
X	ScrnBuf		allbuf;		/* screen buffer (may include
X					   lines scrolled off top	*/
X	char		*sbuf_address;	/* main screen memory address   */
X	ScrnBuf		altbuf;		/* alternate screen buffer	*/
X	char		*abuf_address;	/* alternate screen memory address */
X	Boolean		alternate;	/* true if using alternate buf	*/
X	unsigned short	do_wrap;	/* true if cursor in last column
X					   and character just output    */
X	int		incopy;		/* 0 if no RasterCopy exposure
X					   event processed since last
X					   RasterCopy			*/
X	Boolean		c132;		/* allow change to 132 columns	*/
X	Boolean		curses;		/* cludge-ups for more and vi	*/
X	Boolean		marginbell;	/* true if margin bell on	*/
X	int		nmarginbell;	/* columns from right margin	*/
X	int		bellarmed;	/* cursor below bell margin	*/
X	Boolean 	multiscroll;	/* true if multi-scroll		*/
X	int		scrolls;	/* outstanding scroll count	*/
X	SavedCursor	sc;		/* data for restore cursor	*/
X	int		save_modes[19];	/* save dec private modes	*/
X
X	/* Improved VT100 emulation stuff.				*/
X	char		gsets[4];	/* G0 through G3.		*/
X	char		curgl;		/* Current GL setting.		*/
X	char		curgr;		/* Current GR setting.		*/
X	char		curss;		/* Current single shift.	*/
X	int		scroll_amt;	/* amount to scroll		*/
X	int		refresh_amt;	/* amount to refresh		*/
X	Boolean		jumpscroll;	/* whether we should jumpscroll */
X	Boolean		bltscroll;	/* whether we should bltscroll  */
X	Boolean         always_highlight; /* whether to highlight cursor */
X
X/* Tektronix window parameters */
X	GC		TnormalGC;	/* normal painting		*/
X	GC		TcursorGC;	/* normal cursor painting	*/
X	Pixel		Tforeground;	/* foreground color		*/
X	Pixel		Tbackground;	/* Background color		*/
X	Pixel		Tcursorcolor;	/* Cursor color			*/
X	int		Tcolor;		/* colors used			*/
X	Boolean		Vshow;		/* VT window showing		*/
X	Boolean		Tshow;		/* Tek window showing		*/
X	Boolean		waitrefresh;	/* postpone refresh		*/
X	struct {
X		Window	window;		/* X window id			*/
X		int	width;		/* width of columns		*/
X		int	height;		/* height of rows		*/
X		int	fullwidth;	/* full width of window		*/
X		int	fullheight;	/* full height of window	*/
X		double	tekscale;	/* scale factor Tek -> vs100	*/
X	} fullTwin;
X	XPoint		**Tbox;		/* draw unselected cursor	*/
X	int		xorplane;	/* z plane for inverts		*/
X	GC		linepat[TEKNUMLINES]; /* line patterns		*/
X	Boolean		TekEmu;		/* true if Tektronix emulation	*/
X	int		cur_X;		/* current x			*/
X	int		cur_Y;		/* current y			*/
X	Tmodes		cur;		/* current tek modes		*/
X	Tmodes		page;		/* starting tek modes on page	*/
X	int		margin;		/* 0 -> margin 1, 1 -> margin 2	*/
X	int		pen;		/* current Tektronix pen 0=up, 1=dn */
X	char		*TekGIN;	/* nonzero if Tektronix GIN mode*/
X	int		multiClickTime;	 /* time between multiclick selects */
X	char		*charClass;	/* for overriding word selection */
X	Boolean		cutNewline;	/* whether or not line cut has \n */
X	Boolean		cutToBeginningOfLine;  /* line cuts to BOL? */
X	char		*selection;	/* the current selection */
X	int		selection_size; /* size of allocated buffer */
X	int		selection_length; /* number of significant bytes */
X	int		selection_time;	/* latest event timestamp */
X	int		startHRow, startHCol, /* highlighted text */
X			endHRow, endHCol,
X			startHCoord, endHCoord;
X	Atom*		selection_atoms; /* which selections we own */
X	Cardinal	sel_atoms_size;	/*  how many atoms allocated */
X	Cardinal	selection_count; /* how many atoms in use */
X	Boolean		input_eight_bits;/* use 8th bit instead of ESC prefix */
X	Boolean		output_eight_bits; /* honor all bits or strip */
X	Pixmap		menu_item_bitmap;	/* mask for checking items */
X	Widget		mainMenu, vtMenu, tekMenu, fontMenu;
X	char*		menu_font_names[NMENUFONTS];
X	int		menu_font_number;
X} TScreen;
X
Xtypedef struct _TekPart {
X    XFontStruct *Tfont[TEKNUMFONTS];
X    int		tobaseline[TEKNUMFONTS]; /* top to baseline for each font */
X    char	*initial_font;		/* large, 2, 3, small */
X} TekPart;
X
X
X
X/* meaning of bits in screen.select flag */
X#define	INWINDOW	01	/* the mouse is in one of the windows */
X#define	FOCUS		02	/* one of the windows is the focus window */
X
X#define MULTICLICKTIME 250	/* milliseconds */
X
Xtypedef struct
X{
X	unsigned	flags;
X} TKeyboard;
X
Xtypedef struct _Misc {
X    char *geo_metry;
X    char *T_geometry;
X    char *f_n;
X    char *f_b;
X    Boolean log_on;
X    Boolean login_shell;
X    Boolean re_verse;
X    Boolean reverseWrap;
X    Boolean autoWrap;
X    Boolean logInhibit;
X    Boolean signalInhibit;
X    Boolean tekInhibit;
X    Boolean scrollbar;
X    Boolean titeInhibit;
X    Boolean tekSmall;	/* start tek window in small size */
X    Boolean dynamicColors;
X} Misc;
X
Xtypedef struct {int foo;} XtermClassPart, TekClassPart;
X
Xtypedef struct _XtermClassRec {
X    CoreClassPart  core_class;
X    XtermClassPart xterm_class;
X} XtermClassRec;
X
Xtypedef struct _TekClassRec {
X    CoreClassPart core_class;
X    TekClassPart tek_class;
X} TekClassRec;
X
X/* define masks for flags */
X#define CAPS_LOCK	0x01
X#define KYPD_APL	0x02
X#define CURSOR_APL	0x04
X
X
X#define N_MARGINBELL	10
X#define MAX_TABS	320
X#define TAB_ARRAY_SIZE	10	/* number of ints to provide MAX_TABS bits */
X
Xtypedef unsigned Tabs [TAB_ARRAY_SIZE];
X
Xtypedef struct _XtermWidgetRec {
X    CorePart	core;
X    TKeyboard	keyboard;	/* terminal keyboard		*/
X    TScreen	screen;		/* terminal screen		*/
X    unsigned	flags;		/* mode flags			*/
X    unsigned    cur_foreground;	/* current foreground color	*/
X    unsigned    cur_background;	/* current background color	*/
X    unsigned	initflags;	/* initial mode flags		*/
X    Tabs	tabs;		/* tabstops of the terminal	*/
X    Misc	misc;		/* miscelaneous parameters	*/
X} XtermWidgetRec, *XtermWidget;
X
Xtypedef struct _TekWidgetRec {
X    CorePart core;
X    TekPart tek;
X} TekWidgetRec, *TekWidget;
X
X#define BUF_SIZE 4096
X
X/* masks for terminal flags */
X
X#define INVERSE		0x01	/* invert the characters to be output */
X#define UNDERLINE	0x02	/* true if underlining */
X#define BOLD		0x04
X#define WRAPAROUND	0x08
X#define FG_COLOR	0x10  /* true if foreground set */
X#define BG_COLOR	0x20  /* true if background set */
X#define DIM		0x40
X
X#define REVERSE_VIDEO	0x80	/* true if screen white on black */
X#define ORIGIN		0x100	/* true if in origin mode */
X#define INSERT		0x200	/* true if in insert mode */
X#define ENDLINE		0x400	/*
X				 * always false in term->flags, used to
X				 * indicate the end of a line in the
X				 * screen->buf attributes so we can tell the
X				 * difference between lines that have wrapped
X				 * around and lines that have ended naturally
X				 * with a CR at column max_col.
X				 */
X#define SMOOTHSCROLL	0x800	/* true if in smooth scroll mode */
X#define IN132COLUMNS	0x1000	/* true if in 132 column mode */
X#define LINEFEED	0x2000
X#define	REVERSEWRAP	0x4000	/* true if reverse wraparound mode */
X
X#define	ATTRIBUTES	0x37	/* attributes mask */
X#define CHAR		0177
X
X#define VWindow(screen)		(screen->fullVwin.window)
X#define VShellWindow		term->core.parent->core.window
X#define TextWindow(screen)      (screen->fullVwin.window)
X#define TWindow(screen)		(screen->fullTwin.window)
X#define TShellWindow		tekWidget->core.parent->core.window
X#define Width(screen)		(screen->fullVwin.width)
X#define Height(screen)		(screen->fullVwin.height)
X#define FullWidth(screen)	(screen->fullVwin.fullwidth)
X#define FullHeight(screen)	(screen->fullVwin.fullheight)
X#define FontWidth(screen)	(screen->fullVwin.f_width)
X#define FontHeight(screen)	(screen->fullVwin.f_height)
X#define TWidth(screen)		(screen->fullTwin.width)
X#define THeight(screen)		(screen->fullTwin.height)
X#define TFullWidth(screen)	(screen->fullTwin.fullwidth)
X#define TFullHeight(screen)	(screen->fullTwin.fullheight)
X#define TekScale(screen)	(screen->fullTwin.tekscale)
X
X#define CursorX(screen,col) ((col) * FontWidth(screen) + screen->border \
X			+ screen->scrollbar)
X#define CursorY(screen,row) ((((row) - screen->topline) * FontHeight(screen)) \
X			+ screen->border)
X
X#define	TWINDOWEVENTS	(KeyPressMask | ExposureMask | ButtonPressMask |\
X			 ButtonReleaseMask | StructureNotifyMask |\
X			 EnterWindowMask | LeaveWindowMask | FocusChangeMask)
X
X#define	WINDOWEVENTS	(TWINDOWEVENTS | PointerMotionMask)
X
X
X#define TEK_LINK_BLOCK_SIZE 1024
X
Xtypedef struct Tek_Link
X{
X	struct Tek_Link	*next;	/* pointer to next TekLink in list
X				   NULL <=> this is last TekLink */
X	short count;
X	char *ptr;
X	char data [TEK_LINK_BLOCK_SIZE];
X} TekLink;
X
X/* flags for cursors */
X#define	OFF		0
X#define	ON		1
X#define	CLEAR		0
X#define	TOGGLE		1
X
X/* flags for inhibit */
X#define	I_LOG		0x01
X#define	I_SIGNAL	0x02
X#define	I_TEK		0x04
X
Xextern Cursor make_colored_cursor();
END_OF_FILE
if test 17296 -ne `wc -c <'xterm/ptyx.h'`; then
    echo shar: \"'xterm/ptyx.h'\" unpacked with wrong size!
fi
# end of 'xterm/ptyx.h'
fi
if test -f 'xterm/scrollbar.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xterm/scrollbar.c'\"
else
echo shar: Extracting \"'xterm/scrollbar.c'\" \(15280 characters\)
sed "s/^X//" >'xterm/scrollbar.c' <<'END_OF_FILE'
X/*
X *	$XConsortium: scrollbar.c,v 1.36 90/06/06 15:06:56 jim Exp $
X */
X
X#include <X11/copyright.h>
X
X/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
X#include <stdio.h>
X#include <ctype.h>
X#include <setjmp.h>
X#include <X11/Xatom.h>
X
X#include "ptyx.h"		/* X headers included here. */
X
X#include <X11/StringDefs.h>
X#include <X11/Shell.h>
X
X#include <X11/Xaw/Scrollbar.h>
X
X#include "data.h"
X#include "error.h"
X#include "menu.h"
X
Xextern void bcopy();
X
X#ifndef lint
Xstatic char rcs_id[] = "$XConsortium: scrollbar.c,v 1.36 90/06/06 15:06:56 jim Exp $";
X#endif	/* lint */
X
X/* Event handlers */
X
Xstatic void ScrollTextTo();
Xstatic void ScrollTextUpDownBy();
X
X
X/* resize the text window for a terminal screen, modifying the
X * appropriate WM_SIZE_HINTS and taking advantage of bit gravity.
X */
X
Xstatic void ResizeScreen(xw, min_width, min_height )
X	register XtermWidget xw;
X	int min_width, min_height;
X{
X	register TScreen *screen = &xw->screen;
X#ifndef nothack
X	XSizeHints sizehints;
X	long supp;
X#endif
X	XtGeometryResult geomreqresult;
X	Dimension oldWidth, oldHeight;
X	Dimension reqWidth, reqHeight, repWidth, repHeight;
X
X	/*
X	 * I'm going to try to explain, as I understand it, why we
X	 * have to do XGetWMNormalHints and XSetWMNormalHints here,
X	 * although I can't guarantee that I've got it right.
X	 *
X	 * In a correctly written toolkit program, the Shell widget
X	 * parses the user supplied geometry argument.  However,
X	 * because of the way xterm does things, the VT100 widget does
X	 * the parsing of the geometry option, not the Shell widget.
X	 * The result of this is that the Shell widget doesn't set the
X	 * correct window manager hints, and doesn't know that the
X	 * user has specified a geometry.
X	 *
X	 * The XtVaSetValues call below tells the Shell widget to
X	 * change its hints.  However, since it's confused about the
X	 * hints to begin with, it doesn't get them all right when it
X	 * does the SetValues -- it undoes some of what the VT100
X	 * widget did when it originally set the hints.
X	 *
X	 * To fix this, we do the following:
X	 *
X	 * 1. Get the sizehints directly from the window, going around
X	 *    the (confused) shell widget.
X	 * 2. Call XtVaSetValues to let the shell widget know which
X	 *    hints have changed.  Note that this may not even be
X	 *    necessary, since we're going to right ahead after that
X	 *    and set the hints ourselves, but it's good to put it
X	 *    here anyway, so that when we finally do fix the code so
X	 *    that the Shell does the right thing with hints, we
X	 *    already have the XtVaSetValues in place.
X	 * 3. We set the sizehints directly, this fixing up whatever
X	 *    damage was done by the Shell widget during the
X	 *    XtVaSetValues.
X	 *
X	 * Gross, huh?
X	 *
X	 * The correct fix is to redo VTRealize, VTInitialize and
X	 * VTSetValues so that font processing happens early enough to
X	 * give back responsibility for the size hints to the Shell.
X	 *
X	 * Someday, we hope to have time to do this.  Someday, we hope
X	 * to have time to completely rewrite xterm.
X	 */
X
X#ifndef nothack
X	/*
X	 * NOTE: If you change the way any of the hints are calculated
X	 * below, make sure you change the calculation both in the
X	 * sizehints assignments and in the XtVaSetValues.
X	 */
X
X	if (! XGetWMNormalHints(screen->display, XtWindow(XtParent(xw)),
X				&sizehints, &supp))
X	     sizehints.flags = 0;
X	sizehints.base_width = min_width;
X	sizehints.base_height = min_height;
X	sizehints.width_inc = FontWidth(screen);
X	sizehints.height_inc = FontHeight(screen);
X	sizehints.min_width = sizehints.base_width + sizehints.width_inc;
X	sizehints.min_height = sizehints.base_height + sizehints.height_inc;
X	sizehints.flags |= (PBaseSize|PMinSize|PResizeInc);
X	/* These are obsolete, but old clients may use them */
X	sizehints.width = (screen->max_col + 1) * FontWidth(screen)
X	     + min_width;
X	sizehints.height = (screen->max_row + 1) * FontHeight(screen)
X	     + min_height;
X#endif
X	
X	/*
X	 * Note: width and height are not set here because they are 
X	 * obsolete. 						
X	 */
X	XtVaSetValues(XtParent(xw),
X		      XtNbaseWidth, min_width,
X		      XtNbaseHeight, min_height,
X		      XtNwidthInc, FontWidth(screen),
X		      XtNheightInc, FontHeight(screen),
X		      XtNminWidth, min_width + FontWidth(screen),
X		      XtNminHeight, min_height + FontHeight(screen),
X		      NULL);
X
X	oldWidth = xw->core.width;
X	oldHeight = xw->core.height;
X	reqWidth = (screen->max_col + 1) * FontWidth(screen) + min_width;
X	reqHeight = FontHeight(screen) * (screen->max_row + 1) + min_height;
X	geomreqresult = XtMakeResizeRequest ((Widget)xw, reqWidth, reqHeight,
X					     &repWidth, &repHeight);
X
X	if (geomreqresult == XtGeometryAlmost) {
X	     geomreqresult = XtMakeResizeRequest ((Widget)xw, repWidth,
X						  repHeight, NULL, NULL);
X	}
X
X#ifndef nothack
X	XSetWMNormalHints(screen->display, XtWindow(XtParent(xw)), &sizehints);
X#endif
X}
X
Xvoid DoResizeScreen (xw)
X    register XtermWidget xw;
X{
X    int border = 2 * xw->screen.border;
X    ResizeScreen (xw, border + xw->screen.scrollbar, border);
X}
X
X
Xstatic Widget CreateScrollBar(xw, x, y, height)
X	XtermWidget xw;
X	int x, y, height;
X{
X	Widget scrollWidget;
X
X	static Arg argList[] = {
X	   {XtNx,		(XtArgVal) 0},
X	   {XtNy,		(XtArgVal) 0},
X	   {XtNheight,		(XtArgVal) 0},
X	   {XtNreverseVideo,	(XtArgVal) 0},
X	   {XtNorientation,	(XtArgVal) XtorientVertical},
X	   {XtNborderWidth,	(XtArgVal) 1},
X	};   
X
X	argList[0].value = (XtArgVal) x;
X	argList[1].value = (XtArgVal) y;
X	argList[2].value = (XtArgVal) height;
X	argList[3].value = (XtArgVal) xw->misc.re_verse;
X
X	scrollWidget = XtCreateWidget("scrollbar", scrollbarWidgetClass, 
X	  (Widget)xw, argList, XtNumber(argList));
X        XtAddCallback (scrollWidget, XtNscrollProc, ScrollTextUpDownBy, 0);
X        XtAddCallback (scrollWidget, XtNjumpProc, ScrollTextTo, 0);
X	return (scrollWidget);
X}
X
Xstatic void RealizeScrollBar (sbw, screen)
X    Widget sbw;
X    TScreen *screen;
X{
X    XtRealizeWidget (sbw);
X}
X
X
XScrollBarReverseVideo(scrollWidget)
X	register Widget scrollWidget;
X{
X	Arg args[4];
X	int nargs = XtNumber(args);
X	unsigned long bg, fg, bdr;
X	Pixmap bdpix;
X
X	XtSetArg(args[0], XtNbackground, &bg);
X	XtSetArg(args[1], XtNforeground, &fg);
X	XtSetArg(args[2], XtNborderColor, &bdr);
X	XtSetArg(args[3], XtNborderPixmap, &bdpix);
X	XtGetValues (scrollWidget, args, nargs);
X	args[0].value = (XtArgVal) fg;
X	args[1].value = (XtArgVal) bg;
X	nargs--;				/* don't set border_pixmap */
X	if (bdpix == XtUnspecifiedPixmap) {	/* if not pixmap then pixel */
X	    args[2].value = args[1].value;	/* set border to new fg */
X	} else {				/* ignore since pixmap */
X	    nargs--;				/* don't set border pixel */
X	}
X	XtSetValues (scrollWidget, args, nargs);
X}
X
X
X
XScrollBarDrawThumb(scrollWidget)
X	register Widget scrollWidget;
X{
X	register TScreen *screen = &term->screen;
X	register int thumbTop, thumbHeight, totalHeight;
X	
X	thumbTop    = screen->topline + screen->savedlines;
X	thumbHeight = screen->max_row + 1;
X	totalHeight = thumbHeight + screen->savedlines;
X
X	XawScrollbarSetThumb(scrollWidget,
X	 ((float)thumbTop) / totalHeight,
X	 ((float)thumbHeight) / totalHeight);
X	
X}
X
XResizeScrollBar(scrollWidget, x, y, height)
X	register Widget scrollWidget;
X	int x, y;
X	unsigned height;
X{
X	XtConfigureWidget(scrollWidget, x, y, scrollWidget->core.width,
X	    height, scrollWidget->core.border_width);
X	ScrollBarDrawThumb(scrollWidget);
X}
X
XWindowScroll(screen, top)
X	register TScreen *screen;
X	int top;
X{
X	register int i, lines;
X	register int scrolltop, scrollheight, refreshtop;
X	register int x = 0;
X
X	if (top < -screen->savedlines)
X		top = -screen->savedlines;
X	else if (top > 0)
X		top = 0;
X	if((i = screen->topline - top) == 0) {
X		ScrollBarDrawThumb(screen->scrollWidget);
X		return;
X	}
X
X	ScrollSelection(screen, i);
X
X	if(screen->cursor_state)
X		HideCursor();
X	lines = i > 0 ? i : -i;
X	if(lines > screen->max_row + 1)
X		lines = screen->max_row + 1;
X	scrollheight = screen->max_row - lines + 1;
X	if(i > 0)
X		refreshtop = scrolltop = 0;
X	else {
X		scrolltop = lines;
X		refreshtop = scrollheight;
X	}
X	x = screen->scrollbar +	screen->border;
X	if(scrollheight > 0) {
X		if (screen->multiscroll && scrollheight == 1 &&
X		 screen->topline == 0 && screen->top_marg == 0 &&
X		 screen->bot_marg == screen->max_row) {
X			if (screen->incopy < 0 && screen->scrolls == 0)
X				CopyWait (screen);
X			if (screen->bltscroll)
X				screen->scrolls++;
X		} else {
X			if (screen->incopy)
X				CopyWait (screen);
X			if (screen->bltscroll)
X				screen->incopy = -1;
X		}
X		if (screen->bltscroll)
X			XCopyArea(
X			    screen->display, 
X			    TextWindow(screen), TextWindow(screen),
X			    screen->normalGC,
X			    (int) x,
X			    (int) scrolltop * FontHeight(screen) + screen->border, 
X			    (unsigned) Width(screen),
X			    (unsigned) scrollheight * FontHeight(screen),
X			    (int) x,
X			    (int) (scrolltop + i) * FontHeight(screen)
X				+ screen->border);
X	}
X	screen->topline = top;
X	if (screen->bltscroll) {
X		XClearArea(
X		    screen->display,
X		    TextWindow(screen), 
X		    (int) x,
X		    (int) refreshtop * FontHeight(screen) + screen->border, 
X		    (unsigned) Width(screen),
X		    (unsigned) lines * FontHeight(screen),
X		    FALSE);
X		ScrnRefresh(screen, refreshtop, 0, lines, screen->max_col + 1, False);
X	} else {
X		ScrnRefresh(screen, 0, 0, screen->max_row + 1,
X			    screen->max_col + 1, True);
X	}
X	ScrollBarDrawThumb(screen->scrollWidget);
X}
X
X
XScrollBarOn (xw, init, doalloc)
X    XtermWidget xw;
X    int init, doalloc;
X{
X	register TScreen *screen = &xw->screen;
X	register int border = 2 * screen->border;
X	register int i;
X	Char *realloc(), *calloc();
X
X	if(screen->scrollbar)
X		return;
X
X	if (init) {			/* then create it only */
X	    if (screen->scrollWidget) return;
X
X	    /* make it a dummy size and resize later */
X	    if ((screen->scrollWidget = CreateScrollBar (xw, -1, - 1, 5))
X		== NULL) {
X		Bell();
X		return;
X	    }
X
X	    return;
X
X	}
X
X	if (!screen->scrollWidget) {
X	    Bell ();
X	    Bell ();
X	    return;
X	}
X
X	if (doalloc && screen->allbuf) {
X	    if((screen->allbuf =
X		(ScrnBuf) realloc((char *) screen->buf,
X				  (unsigned) 4*(screen->max_row + 2 +
X						screen->savelines) *
X				  sizeof(char *)))
X	       == NULL)
X	      Error (ERROR_SBRALLOC);
X	    screen->buf = &screen->allbuf[4 * screen->savelines];
X	    bcopy ((char *)screen->allbuf, (char *)screen->buf,
X		   4 * (screen->max_row + 2) * sizeof (char *));
X	    for(i = 4 * screen->savelines - 1 ; i >= 0 ; i--)
X	      if((screen->allbuf[i] =
X		  calloc((unsigned) screen->max_col + 1, sizeof(char))) ==
X		 NULL)
X		Error (ERROR_SBRALLOC2);
X	}
X
X	ResizeScrollBar (screen->scrollWidget, -1, -1, 
X			 Height (screen) + border);
X	RealizeScrollBar (screen->scrollWidget, screen);
X	screen->scrollbar = screen->scrollWidget->core.width +
X	     screen->scrollWidget->core.border_width;
X
X	ScrollBarDrawThumb(screen->scrollWidget);
X	DoResizeScreen (xw);
X	XtMapWidget(screen->scrollWidget);
X	update_scrollbar ();
X	if (screen->buf) {
X	    XClearWindow (screen->display, XtWindow (term));
X	    Redraw ();
X	}
X}
X
XScrollBarOff(screen)
X	register TScreen *screen;
X{
X	if(!screen->scrollbar)
X		return;
X	XtUnmapWidget(screen->scrollWidget);
X	screen->scrollbar = 0;
X	DoResizeScreen (term);
X	update_scrollbar ();
X	if (screen->buf) {
X	    XClearWindow (screen->display, XtWindow (term));
X	    Redraw ();
X	}
X}
X
X/*ARGSUSED*/
Xstatic void ScrollTextTo(scrollbarWidget, closure, topPercent)
X	Widget scrollbarWidget;
X	caddr_t closure;
X	float *topPercent;
X{
X	register TScreen *screen = &term->screen;
X	int thumbTop;	/* relative to first saved line */
X	int newTopLine;
X
X/*
X   screen->savedlines : Number of offscreen text lines,
X   screen->maxrow + 1 : Number of onscreen  text lines,
X   screen->topline    : -Number of lines above the last screen->max_row+1 lines
X*/
X
X	thumbTop = *topPercent * (screen->savedlines + screen->max_row+1);
X	newTopLine = thumbTop - screen->savedlines;
X	WindowScroll(screen, newTopLine);
X}
X
X/*ARGSUSED*/
Xstatic void ScrollTextUpDownBy(scrollbarWidget, closure, pixels)
X	Widget scrollbarWidget;
X	Opaque closure;
X	int pixels;
X{
X	register TScreen *screen = &term->screen;
X	register int rowOnScreen, newTopLine;
X
X	rowOnScreen = pixels / FontHeight(screen);
X	if (rowOnScreen == 0) {
X		if (pixels < 0)
X			rowOnScreen = -1;
X		else if (pixels > 0)
X			rowOnScreen = 1;
X	}
X	newTopLine = screen->topline + rowOnScreen;
X	WindowScroll(screen, newTopLine);
X}
X
X
X/*
X * assume that b is lower case and allow plural
X */
Xstatic int specialcmplowerwiths (a, b)
X    char *a, *b;
X{
X    register char ca, cb;
X
X    if (!a || !b) return 0;
X
X    while (1) {
X	ca = *a;
X	cb = *b;
X	if (isascii(ca) && isupper(ca)) {		/* lowercasify */
X#ifdef _tolower
X	    ca = _tolower (ca);
X#else
X	    ca = tolower (ca);
X#endif
X	}
X	if (ca != cb || ca == '\0') break;  /* if not eq else both nul */
X	a++, b++;
X    }
X    if (cb == '\0' && (ca == '\0' || (ca == 's' && a[1] == '\0')))
X      return 1;
X
X    return 0;
X}
X
Xstatic int params_to_pixels (screen, params, n)
X    TScreen *screen;
X    String *params;
X    int n;
X{
X    register mult = 1;
X    register char *s;
X
X    switch (n > 2 ? 2 : n) {
X      case 2:
X	s = params[1];
X	if (specialcmplowerwiths (s, "page")) {
X	    mult = (screen->max_row + 1) * FontHeight(screen);
X	} else if (specialcmplowerwiths (s, "halfpage")) {
X	    mult = ((screen->max_row + 1) * FontHeight(screen)) >> 1;
X	} else if (specialcmplowerwiths (s, "pixel")) {
X	    mult = 1;
X	} /* else assume that it is Line */
X	mult *= atoi (params[0]);
X	break;
X      case 1:
X	mult = atoi (params[0]) * FontHeight(screen);	/* lines */
X	break;
X      default:
X	mult = screen->scrolllines * FontHeight(screen);
X	break;
X    }
X
X    return mult;
X}
X
X
X/*ARGSUSED*/
Xvoid HandleScrollForward (gw, event, params, nparams)
X    Widget gw;
X    XEvent *event;
X    String *params;
X    Cardinal *nparams;
X{
X    XtermWidget w = (XtermWidget) gw;
X    register TScreen *screen = &w->screen;
X
X    ScrollTextUpDownBy (gw, (Opaque) NULL,
X			params_to_pixels (screen, params, (int) *nparams));
X    return;
X}
X
X
X/*ARGSUSED*/
Xvoid HandleScrollBack (gw, event, params, nparams)
X    Widget gw;
X    XEvent *event;
X    String *params;
X    Cardinal *nparams;
X{
X    XtermWidget w = (XtermWidget) gw;
X    register TScreen *screen = &w->screen;
X
X    ScrollTextUpDownBy (gw, (Opaque) NULL,
X			-params_to_pixels (screen, params, (int) *nparams));
X    return;
X}
X
X
END_OF_FILE
if test 15280 -ne `wc -c <'xterm/scrollbar.c'`; then
    echo shar: \"'xterm/scrollbar.c'\" unpacked with wrong size!
fi
# end of 'xterm/scrollbar.c'
fi
echo shar: End of archive 12 \(of 14\).
cp /dev/null ark12isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 14 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
dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.