xterm-24.patch.txt

XFree86 3.1.2Ee - xterm patch #24 - 1996/8/11 - T.Dickey
 
This patch does several things.  In effect, xterm can (I think) do a reasonably
good job of emulating vt220 and vt320 terminals (as well as it was doing
vt100, at any rate ;-).
 
It does NOT do:
 
        + soft fonts
 
        + rigel or sixel graphics
 
Anyway, I:
 
        + added ECH, CPL, CNL, SU, SD, CBT, CHT controls
 
        + added popup-menu for switching between DEC and Sun function keys.
          (corrected alignment err wrt logging entry at that point).
 
        + make xterm recognize both 8-bit and 7-bit controls (including
          popup menu for switching modes).
 
        + add user-definable function keys (aka DECUDK)
 
        + support concealed text
 
        + support protected text (both ISO compatible and DEC compatible -
          that's not the same thing, btw), with SPA, EPA, DECSCA, DECSED,
          DECSEL controls.
 
        + implement DECSCL.
 
I'll be continuing to test this patch for a while, but don't expect to add any
new functionality (it passes all of the current tests I've built in vttest, but
I need to make more tests)..
 
--------------------------------------------------------------------------------
 doc/specs/xterm/ctlseqs.ms |  464 ++!!!!!!!
 programs/xterm/Tekproc.c   |   36 
 programs/xterm/VTPrsTbl.c  | 2186 ++++++++++++++++++++!!!!!!!!!!!!!!!!!!!!!!!!
 programs/xterm/VTparse.def |   28 
 programs/xterm/VTparse.h   |   54 +
 programs/xterm/XTerm.ad    |    1 
 programs/xterm/button.c    |   56 !
 programs/xterm/charproc.c  |  532 ++++!!!!!!
 programs/xterm/cursor.c    |   30 
 programs/xterm/data.c      |    4 
 programs/xterm/data.h      |    3 
 programs/xterm/input.c     |   31 
 programs/xterm/main.c      |    2 
 programs/xterm/menu.c      |   62 !
 programs/xterm/menu.h      |   44 
 programs/xterm/misc.c      |  238 +++!
 programs/xterm/os2main.c   |    1 
 programs/xterm/ptyx.h      |   23 
 programs/xterm/screen.c    |   32 
 programs/xterm/tabs.c      |   59 +
 programs/xterm/terminfo    |    1 
 programs/xterm/util.c      |  421 +++!!!!!
 programs/xterm/xterm.h     |   26 
 programs/xterm/xterm.man   |   21 
 24 files changed, 1927 insertions, 61 deletions, 2367 modifications
--------------------------------------------------------------------------------
Index: ctlseqs.ms
*** /build/x11r6/XFree86-3.1.2Ee/xc/doc/specs/xterm/ctlseqs.ms  Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/doc/specs/xterm/ctlseqs.ms  Sun Aug 11 22:20:52 1996
***************
*** 91,103 ****
--- 91,110 ----
  .[] Et \v'-1p'\*X\v'1p'
  .[] En \v'-1p'\*N\v'1p'
  .[] Be \v'-1p'\*L\v'1p'
+ .[] AP \v'-1p'\s\nsAPC\s0\v'1p'
  .[] Bs \v'-1p'\s\nsBS\s0\v'1p'
+ .[] Cs \v'-1p'\s\nsCSI\s0\v'1p'
+ .[] Dc \v'-1p'\s\nsDCS\s0\v'1p'
+ .[] Os \v'-1p'\s\nsOSC\s0\v'1p'
+ .[] PM \v'-1p'\s\nsPM\s0\v'1p'
+ .[] ST \v'-1p'\s\nsST\s0\v'1p'
  .[] Ta \v'-1p'\*T\v'1p'
  .[] Lf \v'-1p'\s\nsLF\s0\v'1p'
  .[] Vt \v'-1p'\s\nsVT\s0\v'1p'
  .[] Ff \v'-1p'\s\nsFF\s0\v'1p'
  .[] Cr \v'-1p'\s\nsCR\s0\v'1p'
  .[] So \v'-1p'\s\nsSO\s0\v'1p'
+ .[] Sp \v'-1p'\s\nsSP\s0\v'1p'
  .[] Si \v'-1p'\s\nsSI\s0\v'1p'
  .[] Eb \v'-1p'\*e\v'1p'
  .[] Ca \v'-1p'\*C\v'1p'
***************
*** 107,112 ****
--- 114,121 ----
  .[] Gs \v'-1p'\s\nsGS\s0\v'1p'
  .[] Rs \v'-1p'\s\nsRS\s0\v'1p'
  .[] Us \v'-1p'\s\nsUS\s0\v'1p'
+ .[] XX \v'-1p'\s\nsXX\s0\v'1p'
+ .[] $ $
  .[] ! !
  .[] # #
  .[] (( (
***************
*** 137,142 ****
--- 146,152 ----
  .[] F F
  .[] G G
  .[] H H
+ .[] I I
  .[] J J
  .[] K K
  .[] L L
***************
*** 147,154 ****
--- 157,168 ----
  .[] R R
  .[] S S
  .[] T T
+ .[] V V
+ .[] W W
+ .[] XX X
  .[] Z Z
  .[] [[ [
+ .[] ]] ]
  .[] bS \\e
  .[] ] ]
  .[] ^ ^
***************
*** 176,181 ****
--- 190,196 ----
  .[] x x
  .[] | |
  .[] } }
+ .[] c" \(lq
  .[] c~ ~
  .[] Sc \fIc\fP
  .ds Cc \fIC\fP
***************
*** 205,211 ****
  .AU
  Stephen Gildea
  .AI
! X Consortium
  
  .am BT                  \" add page numbers after first page
  .ds CF %
--- 220,231 ----
  .AU
  Stephen Gildea
  .AI
! X Consortium (1994)
! .AU
! Thomas Dickey
! .AI
! XFree86 Project (1996)
! .AU
  
  .am BT                  \" add page numbers after first page
  .ds CF %
***************
*** 223,372 ****
  parameters, separated by \*; character(s).
  .IP \*(Pt
  A text parameter composed of printable characters.
  .SH
  VT100 Mode
  .ds RH VT100 Mode
  .LP
  Most of these control sequences are standard VT102 control sequences,
! but there are some sequences here from later DEC VT terminals, too.
! VT102 features not supported are smooth scrolling, double size
  characters, blinking characters, and VT52 mode.
  There are additional control sequences to provide
! \fIxterm-\fPdependent functions, like the scrollbar or window size.
  Where the function is specified by DEC or ISO 6429, the code assigned
  to it is given in parentheses.  The escape codes to designate and invoke
  character sets are specified by ISO 2022; see that document for a
  discussion of character sets.
  .St
  .IP \\*(Be
  Bell (Ctrl-G)
  .IP \\*(Bs
  Backspace (Ctrl-H)
! .IP \\*(Ta
! Horizontal Tab (HT) (Ctrl-I)
! .IP \\*(Lf
! Line Feed or New Line (NL) (Ctrl-J)
! .IP \\*(Vt
! Vertical Tab (Ctrl-K) same as LF
! .IP \\*(Ff
! Form Feed or New Page (NP) (Ctrl-L) same as LF
  .IP \\*(Cr
  Carriage Return (Ctrl-M)
  .IP \\*(So
  Shift Out (Ctrl-N) \(-> Switch to Alternate Character Set: invokes the
  G1 character set.
  .IP \\*(Si
  Shift In (Ctrl-O) \(-> Switch to Standard Character Set: invokes the
  G0 character set (the default).
  .IP \\*(Es\\*#\\*8
  DEC Screen Alignment Test (DECALN)
  .IP \\*(Es\\*(((\\*(Cc
  Designate G0 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
  .IP \\*(Es\\*)\\*(Cc
  Designate G1 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
  .IP \\*(Es\\**\\*(Cc
  Designate G2 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
  .IP \\*(Es\\*+\\*(Cc
  Designate G3 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
  .IP \\*(Es\\*7
  Save Cursor (DECSC)
  .IP \\*(Es\\*8
  Restore Cursor (DECRC)
  .IP \\*(Es\\*=
  Application Keypad (DECPAM)
  .IP \\*(Es\\*>
  Normal Keypad (DECPNM)
! .IP \\*(Es\\*D
! Index (IND)
! .IP \\*(Es\\*E
! Next Line (NEL)
  .IP \\*(Es\\*F
  Cursor to lower left corner of screen (if
  enabled by the \fBhpLowerleftBugCompat\fP resource).
! .IP \\*(Es\\*H
! Tab Set (HTS)
! .IP \\*(Es\\*M
! Reverse Index (RI)
! .IP \\*(Es\\*N
! Single Shift Select of G2 Character Set (SS2): affects next character only
! .IP \\*(Es\\*O
! Single Shift Select of G3 Character Set (SS3): affects next character only
! .IP \\*(Es\\*P\\*(Pt\\*s\\*(Es\\*(bS
! Device Control String (DCS)
!   \fIxterm\fP implements no DCS functions; \*(Pt is ignored.
  \*(Pt need not be printable characters.
! .IP \\*(Es\\*Z
! Return Terminal ID (DECID).  Obsolete form of \*(Es\*([[\*c (DA).
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*@
  Insert \*(Ps (Blank) Character(s) (default = 1) (ICH)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*A
  Cursor Up \*(Ps Times (default = 1) (CUU)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*(cB
  Cursor Down \*(Ps Times (default = 1) (CUD)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*C
  Cursor Forward \*(Ps Times (default = 1) (CUF)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*D
  Cursor Backward \*(Ps Times (default = 1) (CUB)
! .IP \\*(Es\\*([[\\*(Pm\\*s\\*G
  Cursor Character Absolute  [column] (default = [row,1]) (CHA)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*;\\*(Ps\\*s\\*H
  Cursor Position [row;column] (default = [1,1]) (CUP)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*J
  Erase in Display (ED)
!   \*(Ps = \*0 \(-> Clear Below (default)
!   \*(Ps = \*1 \(-> Clear Above
!   \*(Ps = \*2 \(-> Clear All
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*K
  Erase in Line (EL)
!   \*(Ps = \*0 \(-> Clear to Right (default)
!   \*(Ps = \*1 \(-> Clear to Left
!   \*(Ps = \*2 \(-> Clear All
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*L
  Insert \*(Ps Line(s) (default = 1) (IL)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*M
  Delete \*(Ps Line(s) (default = 1) (DL)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*P
  Delete \*(Ps Character(s) (default = 1) (DCH)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*T
  Initiate hilite mouse tracking.
  Parameters are [func;startx;starty;firstrow;lastrow].
  See the section \fBMouse Tracking\fP.
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*c
  Send Device Attributes (DA)
    \*(Ps = \*0 or omitted \(-> request attributes from terminal
!   \(-> \*(Es\*([[\*?\*1\*;\*2\*c (``I am a VT100 with Advanced
! Video Option.'')
! .IP \\*(Es\\*([[\\*(Pm\\*s\\*d
  Line Position Absolute  [row] (default = [1,column]) (VPA)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*;\\*(Ps\\*s\\*f
  Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*g
  Tab Clear (TBC)
    \*(Ps = \*0 \(-> Clear Current Column (default)
    \*(Ps = \*3 \(-> Clear All
! .IP \\*(Es\\*([[\\*(Pm\\*s\\*h
  Set Mode (SM)
    \*(Ps = \*4 \(-> Insert Mode (IRM)
    \*(Ps = \*2\*0 \(-> Automatic Newline (LNM)
! .IP \\*(Es\\*([[\\*(Pm\\*s\\*`
  Character Position Absolute  [column] (default = [row,1]) (HPA)
! .IP \\*(Es\\*([[\\*(Pm\\*s\\*l
  Reset Mode (RM)
    \*(Ps = \*4 \(-> Replace Mode (IRM)
    \*(Ps = \*2\*0 \(-> Normal Linefeed (LNM)
! .IP \\*(Es\\*([[\\*(Pm\\*s\\*m
  Character Attributes (SGR)
    \*(Ps = \*0 \(-> Normal (default)
    \*(Ps = \*1 \(-> Bold
--- 243,591 ----
  parameters, separated by \*; character(s).
  .IP \*(Pt
  A text parameter composed of printable characters.
+ .
+ .SH
+ C1 (8-Bit) Control Characters
+ .ds RH C1 (8-Bit) Control Characters
+ .LP
+ The \fIxterm\fP program recognizes both 8-bit and 7-bit control characters.
+ It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled.
+ The following pairs of 7-bit and 8-bit control characters are equivalent:
+ .St
+ .IP \\*(Es\\*D
+ Index (IND: 0x84)
+ .IP \\*(Es\\*E
+ Next Line (NEL: 0x85)
+ .IP \\*(Es\\*H
+ Tab Set (HTS: 0x88)
+ .IP \\*(Es\\*M
+ Reverse Index (RI: 0x8d)
+ .IP \\*(Es\\*N
+ Single Shift Select of G2 Character Set (SS2: 0x8e): affects next character only
+ .IP \\*(Es\\*O
+ Single Shift Select of G3 Character Set (SS3: 0x8f): affects next character only
+ .IP \\*(Es\\*P
+ Device Control String (DCS: 0x90)
+ .IP \\*(Es\\*V
+ Start of Guarded Area (SPA: 0x96)
+ .IP \\*(Es\\*W
+ End of Guarded Area (EPA: 0x97)
+ .IP \\*(Es\\(*X
+ Start of String (SOS: 0x98)
+ .IP \\*(Es\\*Z
+ Return Terminal ID (DECID: 0x9a).  Obsolete form of \*(Cs\*c (DA).
+ .IP \\*(Es\\*([[ 
+ Control Sequence Introducer (CSI: 0x9b)
+ .IP \\*(Es\\*(bS
+ String Terminator (ST: 0x9c)
+ .IP \\*(Es\\*(]] 
+ Operating System Command (OSC: 0x9d)
+ .IP \\*(Es\\*^ 
+ Privacy Message (PM: 0x9e)
+ .IP \\*(Es\\*_
+ Application Program Command (APC: 0x9f)
+ .Ed
+ .sp
+ .LP
+ These control characters are used in the vtXXX emulation.
+ .
  .SH
  VT100 Mode
  .ds RH VT100 Mode
  .LP
  Most of these control sequences are standard VT102 control sequences,
! but there is support for later DEC VT terminals (i.e., VT220 and VT320), too.
! VT102 features not supported are double size
  characters, blinking characters, and VT52 mode.
  There are additional control sequences to provide
! \fIxterm-\fPdependent functions, such as the scrollbar or window size.
  Where the function is specified by DEC or ISO 6429, the code assigned
  to it is given in parentheses.  The escape codes to designate and invoke
  character sets are specified by ISO 2022; see that document for a
  discussion of character sets.
+ .
  .St
+ .\"
+ .\" Single-character functions
+ .\"
  .IP \\*(Be
  Bell (Ctrl-G)
+ .
  .IP \\*(Bs
  Backspace (Ctrl-H)
! .
  .IP \\*(Cr
  Carriage Return (Ctrl-M)
+ .
+ .IP \\*(En
+ Return Terminal Status (Ctrl-E).
+ Response is the terminal name, e.g., "xterm".
+ .
+ .IP \\*(Ff
+ Form Feed or New Page (NP) (Ctrl-L) same as LF
+ .
+ .IP \\*(Lf
+ Line Feed or New Line (NL) (Ctrl-J)
+ .
  .IP \\*(So
  Shift Out (Ctrl-N) \(-> Switch to Alternate Character Set: invokes the
  G1 character set.
+ .
+ .IP \\*(Sp
+ Space.
+ .
+ .IP \\*(Ta
+ Horizontal Tab (HT) (Ctrl-I)
+ .
+ .IP \\*(Vt
+ Vertical Tab (Ctrl-K) same as LF
+ .
  .IP \\*(Si
  Shift In (Ctrl-O) \(-> Switch to Standard Character Set: invokes the
  G0 character set (the default).
+ .sp
+ .\"
+ .\" Controls beginning with ESC (other than those where ESC is part of a 7-bit
+ .\" equivalent to 8-bit C1 controls), ordered by the final character(s).
+ .\"
+ .IP \\*(Es\\*(Sp\\*F
+ 7-bit controls (S7C1T).
+ .
+ .IP \\*(Es\\*(Sp\\*G
+ 8-bit controls (S8C1T).
+ .
+ .IP \\*(Es\\*(Sp\\*L
+ Set ANSI conformance level 1 (vt100, 7-bit controls).
+ .
+ .IP \\*(Es\\*(Sp\\*M
+ Set ANSI conformance level 2 (vt200).
+ .
+ .IP \\*(Es\\*(Sp\\*N
+ Set ANSI conformance level 3 (vt300).
+ .
  .IP \\*(Es\\*#\\*8
  DEC Screen Alignment Test (DECALN)
+ .
  .IP \\*(Es\\*(((\\*(Cc
  Designate G0 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
+ .
  .IP \\*(Es\\*)\\*(Cc
  Designate G1 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
+ .
  .IP \\*(Es\\**\\*(Cc
  Designate G2 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
+ .
  .IP \\*(Es\\*+\\*(Cc
  Designate G3 Character Set (ISO 2022)
    \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
    \*(Cc = \*A \(-> United Kingdom (UK)
    \*(Cc = \*(cB \(-> United States (USASCII)
+ .
  .IP \\*(Es\\*7
  Save Cursor (DECSC)
+ .
  .IP \\*(Es\\*8
  Restore Cursor (DECRC)
+ .
  .IP \\*(Es\\*=
  Application Keypad (DECPAM)
+ .
  .IP \\*(Es\\*>
  Normal Keypad (DECPNM)
! .
  .IP \\*(Es\\*F
  Cursor to lower left corner of screen (if
  enabled by the \fBhpLowerleftBugCompat\fP resource).
! .
! .IP \\*(Es\\*c
! Full Reset (RIS)
! .
! .IP \\*(Es\\*l
! Memory Lock (per HP terminals).  Locks memory above the cursor.
! .
! .IP \\*(Es\\*m
! Memory Unlock (per HP terminals)
! .
! .IP \\*(Es\\*n
! Invoke the G2 Character Set (LS2)
! .
! .IP \\*(Es\\*o
! Invoke the G3 Character Set (LS3)
! .
! .IP \\*(Es\\*|
! Invoke the G3 Character Set as GR (LS3R).  Has no visible effect in \fIxterm\fP.
! .
! .IP \\*(Es\\*}
! Invoke the G2 Character Set as GR (LS2R).  Has no visible effect in \fIxterm\fP.
! .
! .IP \\*(Es\\*(c~
! Invoke the G1 Character Set as GR (LS1R).  Has no visible effect in \fIxterm\fP.
! .
! .sp
! .IP \\*(AP\\*(Pt\\*s\\*(ST
! \fIxterm\fP implements no APC functions; \*(Pt is ignored.
  \*(Pt need not be printable characters.
! .
! .sp
! .\"
! .\" Device-Control functions
! .\"
! .IP \\*(Dc\\*(Ps\\*;\\*(Ps\\*|\\*(Pt\\*s\\*(ST
! User-Defined Keys (DECUDK).
! The first parameter:
!   \*(Ps = \*0 \(-> Clear all UDK definitions before starting (default)
!   \*(Ps = \*1 \(-> Erase Below (default)
! .br
! The second parameter:
!   \*(Ps = \*0 \(-> Lock the keys (default)
!   \*(Ps = \*1 \(-> Do not lock.
! .br
! The third parameter is a ';'-separated list of strings denoting
! the key-code separated by a '/' from the hex-encoded key value.
! The key codes correspond to the DEC function-key codes (e.g., F6=17).
! .
! .IP \\*(Dc\\*$\\*q\\*(Pt\\*s\\*(ST
! Request Status String (DECRQSS).
! The string following the "q" is one of the following:
!   \*(c"\*q    \(-> DECSCA
!   \*(c"\*p    \(-> DECSCL
!   \*r         \(-> DECSTBM
!   \*m         \(-> SGR
! .br
! \fIxterm\fP responds with
! \*(Dc\*0\*$\*r\*(Pt\*s\*(ST
! for valid requests, replacing the \*(Pt with the corresponding \*(Cs
! string,
! or
! \*(Dc\*1\*$\*r\*(Pt\*s\*(ST
! for invalid requests.
! .
! .sp
! .\"
! .\" Functions using CSI, ordered by the final character(s)
! .\"
! .IP \\*(Cs\\*(Ps\\*s\\*@
  Insert \*(Ps (Blank) Character(s) (default = 1) (ICH)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*A
  Cursor Up \*(Ps Times (default = 1) (CUU)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*(cB
  Cursor Down \*(Ps Times (default = 1) (CUD)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*C
  Cursor Forward \*(Ps Times (default = 1) (CUF)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*D
  Cursor Backward \*(Ps Times (default = 1) (CUB)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*E
! Cursor Next Line \*(Ps Times (default = 1) (CNL)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*F
! Cursor Preceding Line \*(Ps Times (default = 1) (CPL)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*G
  Cursor Character Absolute  [column] (default = [row,1]) (CHA)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*H
  Cursor Position [row;column] (default = [1,1]) (CUP)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*I
! Cursor Forward Tabulation \*(Ps tab stops (default = 1) (CHT)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*J
  Erase in Display (ED)
!   \*(Ps = \*0 \(-> Erase Below (default)
!   \*(Ps = \*1 \(-> Erase Above
!   \*(Ps = \*2 \(-> Erase All
! .
! .IP \\*(Cs\\*(Ps\\*s\\*?\\*s\\*J
! Erase in Display (DECSED)
!   \*(Ps = \*0 \(-> Selective Erase Below (default)
!   \*(Ps = \*1 \(-> Selective Erase Above
!   \*(Ps = \*2 \(-> Selective Erase All
! .
! .IP \\*(Cs\\*(Ps\\*s\\*K
  Erase in Line (EL)
!   \*(Ps = \*0 \(-> Erase to Right (default)
!   \*(Ps = \*1 \(-> Erase to Left
!   \*(Ps = \*2 \(-> Erase All
! .
! .IP \\*(Cs\\*(Ps\\*s\\*?\\*s\\*K
! Erase in Line (DECSEL)
!   \*(Ps = \*0 \(-> Selective Erase to Right (default)
!   \*(Ps = \*1 \(-> Selective Erase to Left
!   \*(Ps = \*2 \(-> Selective Erase All
! .
! .IP \\*(Cs\\*(Ps\\*s\\*L
  Insert \*(Ps Line(s) (default = 1) (IL)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*M
  Delete \*(Ps Line(s) (default = 1) (DL)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*P
  Delete \*(Ps Character(s) (default = 1) (DCH)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*S
! Scroll up \*(Ps lines (default = 1) (SU)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*\\*T
! Scroll down \*(Ps lines (default = 1) (SD, according to DEC)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*T
  Initiate hilite mouse tracking.
  Parameters are [func;startx;starty;firstrow;lastrow].
  See the section \fBMouse Tracking\fP.
! .
! .IP \\*(Cs\\*(Ps\\*s\\*(XX
! Erase \*(Ps Character(s) (default = 1) (ECH)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*Z
! Cursor Backward Tabulation \*(Ps tab stops (default = 1) (CBT)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*\\*^
! Scroll down \*(Ps lines (default = 1) (SD, according to ISO)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*c
  Send Device Attributes (DA)
    \*(Ps = \*0 or omitted \(-> request attributes from terminal
!   \(-> \*(Cs\*?\*1\*;\*2\*c (``I am a VT100 with Advanced Video Option.'')
! .
! .IP \\*(Cs\\*(Pm\\*s\\*d
  Line Position Absolute  [row] (default = [1,column]) (VPA)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*f
  Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*g
  Tab Clear (TBC)
    \*(Ps = \*0 \(-> Clear Current Column (default)
    \*(Ps = \*3 \(-> Clear All
! .
! .IP \\*(Cs\\*(Pm\\*s\\*h
  Set Mode (SM)
    \*(Ps = \*4 \(-> Insert Mode (IRM)
    \*(Ps = \*2\*0 \(-> Automatic Newline (LNM)
! .
! .IP \\*(Cs\\*(Pm\\*s\\*`
  Character Position Absolute  [column] (default = [row,1]) (HPA)
! .
! .IP \\*(Cs\\*(Pm\\*s\\*l
  Reset Mode (RM)
    \*(Ps = \*4 \(-> Replace Mode (IRM)
    \*(Ps = \*2\*0 \(-> Normal Linefeed (LNM)
! .
! .IP \\*(Cs\\*(Pm\\*s\\*m
  Character Attributes (SGR)
    \*(Ps = \*0 \(-> Normal (default)
    \*(Ps = \*1 \(-> Bold
***************
*** 396,409 ****
    \*(Ps = \*4\*7 \(-> Set background color to White
    \*(Ps = \*4\*9 \(-> Set background color to default (original).
    \*(Ps = \*1\*0\*0 \(-> Set foreground and background color to default
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*n
  Device Status Report (DSR)
!   \*(Ps = \*5 \(-> Status Report \*(Es\*([[\*0\*n (``OK'')
    \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column] as
! \*(Es\*([[\*(Ir\*s\*;\*(Ic\*s\*R
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*;\\*(Ps\\*s\\*r
  Set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM)
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*;\\*s\\*(Ps\\*s\\*;\\*(Ps\\*s\\*t
  Window manipulation (from \fIdtterm\fP).
  Valid values for the first (and any additional parameters) are:
    \*(Ps = \*1 \(-> Restore (de-iconify) window.
--- 615,665 ----
    \*(Ps = \*4\*7 \(-> Set background color to White
    \*(Ps = \*4\*9 \(-> Set background color to default (original).
    \*(Ps = \*1\*0\*0 \(-> Set foreground and background color to default
! .
! .IP \\*(Cs\\*(Ps\\*s\\*n
  Device Status Report (DSR)
!   \*(Ps = \*5 \(-> Status Report \*(Cs\*0\*n (``OK'')
    \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column] as
! \*(Cs\*(Ir\*s\*;\*(Ic\*s\*R
! .
! .IP \\*(Cs\\*(Ps\\*s\\*?\\*n
! Device Status Report (DSR, DEC-specific)
!   \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column] as
! \*(Cs\*?\*(Ir\*s\*;\*(Ic\*s\*R
! (assumes page is zero).
!   \*(Ps = \*1\*5 \(-> Report Printer status as
! \*(Cs\*?\*1\*0\*s\*n (ready)
! or
! \*(Cs\*?\*1\*1\*s\*n (not ready)
!   \*(Ps = \*2\*5 \(-> Report UDK status as
! \*(Cs\*?\*2\*0\*s\*n (unlocked)
! or
! \*(Cs\*?\*2\*1\*s\*n (locked)
!   \*(Ps = \*2\*6 \(-> Report Keyboard status as
! \*(Cs\*?\*2\*7\*s\*;\*s\*1\*s\*;\*s\*0\*s\*;\*s\*0\*s\*n (North American)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*(c"\\*p
! Set conformance level (DECSCL)
! Valid values for the first parameter:
!   \*(Ps = \*6\*1 \(-> VT100
!   \*(Ps = \*6\*2 \(-> VT200
!   \*(Ps = \*6\*3 \(-> VT300
! Valid values for the second parameter:
!   \*(Ps = \*0 \(-> 8-bit controls
!   \*(Ps = \*1 \(-> 7-bit controls (always set for VT100)
!   \*(Ps = \*2 \(-> 8-bit controls
! .
! .IP \\*(Cs\\*(Ps\\*s\\*(c"\\*q
! Select character protection attribute (DECSCA).
! Valid values for the parameter:
!   \*(Ps = \*0 \(-> DECSED and DECSEL can erase (default)
!   \*(Ps = \*1 \(-> DECSED and DECSEL cannot erase
!   \*(Ps = \*2 \(-> DECSED and DECSEL can erase
! .
! .IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*r
  Set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*;\\*s\\*(Ps\\*s\\*;\\*(Ps\\*s\\*t
  Window manipulation (from \fIdtterm\fP).
  Valid values for the first (and any additional parameters) are:
    \*(Ps = \*1 \(-> Restore (de-iconify) window.
***************
*** 415,435 ****
    \*(Ps = \*7 \(-> Refresh the xterm window.
    \*(Ps = \*8 ; \fIheight ; width\fP \(-> Resize the text area to [height;width] in characters.
    \*(Ps = \*1\*1 \(-> Report xterm window state.
! If the xterm window is open (non-iconified), it returns \*(Es\*([[\*1\*t.
! If the xterm window is iconified, it returns \*(Es\*([[\*2\*t.
    \*(Ps = \*1\*3 \(-> Report xterm window position as
! \*(Es\*([[\*3\*;\*(Ix\*;\*(Iy\*t
    \*(Ps = \*1\*4 \(-> Report xterm window in pixels as
! \*(Es\*s\*([[\*s\*4\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t
    \*(Ps = \*1\*8 \(-> Report the size of the text area in characters as
! \*(Es\*s\*([[\*s\*8\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*t
    \*(Ps = \*2\*0 \(-> Report xterm window's icon label as
! \*(Es\*s\*]\*s\*L\*s\fIlabel\fP\*s\*(Es\*s\*(bS
    \*(Ps = \*2\*1 \(-> Report xterm window's title as
! \*(Es\*s\*]\*s\*l\*s\fItitle\fP\*s\*(Es\*s\*(bS
! .IP \\*(Es\\*([[\\*(Ps\\*s\\*x
  Request Terminal Parameters (DECREQTPARM)
! .IP \\*(Es\\*([[\\*?\\*(Pm\\*s\\*h
  DEC Private Mode Set (DECSET)
    \*(Ps = \*1 \(-> Application Cursor Keys (DECCKM)
    \*(Ps = \*2 \(-> Designate USASCII for character sets G0-G3.
--- 671,694 ----
    \*(Ps = \*7 \(-> Refresh the xterm window.
    \*(Ps = \*8 ; \fIheight ; width\fP \(-> Resize the text area to [height;width] in characters.
    \*(Ps = \*1\*1 \(-> Report xterm window state.
! If the xterm window is open (non-iconified), it returns \*(Cs\*1\*t.
! If the xterm window is iconified, it returns \*(Cs\*2\*t.
    \*(Ps = \*1\*3 \(-> Report xterm window position as
! \*(Cs\*3\*;\*(Ix\*;\*(Iy\*t
    \*(Ps = \*1\*4 \(-> Report xterm window in pixels as
! \*(Cs\*s\*4\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t
    \*(Ps = \*1\*8 \(-> Report the size of the text area in characters as
! \*(Cs\*s\*8\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*t
    \*(Ps = \*2\*0 \(-> Report xterm window's icon label as
! \*(Os\*s\*L\*s\fIlabel\fP\*s\*(ST
    \*(Ps = \*2\*1 \(-> Report xterm window's title as
! \*(Os\*s\*l\*s\fItitle\fP\*s\*(ST
!   \*(Ps >= \*2\*4 \(-> Resize to \*(Ps lines (DECSLPP)
! .
! .IP \\*(Cs\\*(Ps\\*s\\*x
  Request Terminal Parameters (DECREQTPARM)
! .
! .IP \\*(Cs\\*?\\*(Pm\\*s\\*h
  DEC Private Mode Set (DECSET)
    \*(Ps = \*1 \(-> Application Cursor Keys (DECCKM)
    \*(Ps = \*2 \(-> Designate USASCII for character sets G0-G3.
***************
*** 443,449 ****
    \*(Ps = \*8 \(-> Auto-repeat Keys (DECARM)
    \*(Ps = \*9 \(-> Send Mouse X & Y on button press.
  See the section \fBMouse Tracking\fP.
!   \*(Ps = \*2\*5 \(-> Show Cursor like VT200.
    \*(Ps = \*3\*8 \(-> Enter Tektronix Mode (DECTEK)
    \*(Ps = \*4\*0 \(-> Allow 80 \z\(<-\(-> 132 Mode
    \*(Ps = \*4\*1 \(-> \fImore\fP(1) fix (see \fIcurses\fP resource)
--- 702,708 ----
    \*(Ps = \*8 \(-> Auto-repeat Keys (DECARM)
    \*(Ps = \*9 \(-> Send Mouse X & Y on button press.
  See the section \fBMouse Tracking\fP.
!   \*(Ps = \*2\*5 \(-> Show Cursor (DECTCEM)
    \*(Ps = \*3\*8 \(-> Enter Tektronix Mode (DECTEK)
    \*(Ps = \*4\*0 \(-> Allow 80 \z\(<-\(-> 132 Mode
    \*(Ps = \*4\*1 \(-> \fImore\fP(1) fix (see \fIcurses\fP resource)
***************
*** 457,463 ****
  See the section \fBMouse Tracking\fP.
    \*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking.
  See the section \fBMouse Tracking\fP.
! .IP \\*(Es\\*([[\\*?\\*(Pm\\*s\\*l
  DEC Private Mode Reset (DECRST)
    \*(Ps = \*1 \(-> Normal Cursor Keys (DECCKM)
    \*(Ps = \*3 \(-> 80 Column Mode (DECCOLM)
--- 716,723 ----
  See the section \fBMouse Tracking\fP.
    \*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking.
  See the section \fBMouse Tracking\fP.
! .
! .IP \\*(Cs\\*?\\*(Pm\\*s\\*l
  DEC Private Mode Reset (DECRST)
    \*(Ps = \*1 \(-> Normal Cursor Keys (DECCKM)
    \*(Ps = \*3 \(-> 80 Column Mode (DECCOLM)
***************
*** 467,473 ****
    \*(Ps = \*7 \(-> No Wraparound Mode (DECAWM)
    \*(Ps = \*8 \(-> No Auto-repeat Keys (DECARM)
    \*(Ps = \*9 \(-> Don't Send Mouse X & Y on button press
!   \*(Ps = \*2\*5 \(-> Hide Cursor like VT200.
    \*(Ps = \*4\*0 \(-> Disallow 80 \z\(<-\(-> 132 Mode
    \*(Ps = \*4\*1 \(-> No \fImore\fP(1) fix (see \fIcurses\fP resource)
    \*(Ps = \*4\*4 \(-> Turn Off Margin Bell
--- 727,733 ----
    \*(Ps = \*7 \(-> No Wraparound Mode (DECAWM)
    \*(Ps = \*8 \(-> No Auto-repeat Keys (DECARM)
    \*(Ps = \*9 \(-> Don't Send Mouse X & Y on button press
!   \*(Ps = \*2\*5 \(-> Hide Cursor (DECTCEM)
    \*(Ps = \*4\*0 \(-> Disallow 80 \z\(<-\(-> 132 Mode
    \*(Ps = \*4\*1 \(-> No \fImore\fP(1) fix (see \fIcurses\fP resource)
    \*(Ps = \*4\*4 \(-> Turn Off Margin Bell
***************
*** 478,489 ****
    \*(Ps = \*1\*0\*0\*0 \(-> Don't Send Mouse X & Y on button press and
  release
    \*(Ps = \*1\*0\*0\*1 \(-> Don't Use Hilite Mouse Tracking
! .IP \\*(Es\\*([[\\*?\\*(Pm\\*s\\*r
  Restore DEC Private Mode Values.  The value of \*(Ps previously saved is
  restored.  \*(Ps values are the same as for DECSET.
! .IP \\*(Es\\*([[\\*?\\*(Pm\\*s\\*(cs
  Save DEC Private Mode Values.  \*(Ps values are the same as for DECSET.
! .IP \\*(Es\\*]\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be
  Set Text Parameters
    \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
    \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
--- 738,754 ----
    \*(Ps = \*1\*0\*0\*0 \(-> Don't Send Mouse X & Y on button press and
  release
    \*(Ps = \*1\*0\*0\*1 \(-> Don't Use Hilite Mouse Tracking
! .
! .IP \\*(Cs\\*?\\*(Pm\\*s\\*r
  Restore DEC Private Mode Values.  The value of \*(Ps previously saved is
  restored.  \*(Ps values are the same as for DECSET.
! .
! .IP \\*(Cs\\*?\\*(Pm\\*s\\*(cs
  Save DEC Private Mode Values.  \*(Ps values are the same as for DECSET.
! .
! .sp
! .IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(ST
! .IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be
  Set Text Parameters
    \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
    \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
***************
*** 499,529 ****
    \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt (normally disabled by a
  compile-time option)
    \*(Ps = \*5\*0 \(-> Set Font to \*(Pt
! .IP \\*(Es\\*^\\*(Pt\\*s\\*(Es\\*(bS
! Privacy Message (PM)
!   \fIxterm\fP implements no PM functions; \*(Pt is ignored.
! \*(Pt need not be printable characters.
! .IP \\*(Es\\*_\\*(Pt\\*s\\*(Es\\*(bS
! Application Program Command (APC)
!   \fIxterm\fP implements no APC functions; \*(Pt is ignored.
  \*(Pt need not be printable characters.
! .IP \\*(Es\\*c
! Full Reset (RIS)
! .IP \\*(Es\\*l
! Memory Lock (per HP terminals).  Locks memory above the cursor.
! .IP \\*(Es\\*m
! Memory Unlock (per HP terminals)
! .IP \\*(Es\\*n
! Invoke the G2 Character Set (LS2)
! .IP \\*(Es\\*o
! Invoke the G3 Character Set (LS3)
! .IP \\*(Es\\*|
! Invoke the G3 Character Set as GR (LS3R).  Has no visible effect in \fIxterm\fP.
! .IP \\*(Es\\*}
! Invoke the G2 Character Set as GR (LS2R).  Has no visible effect in \fIxterm\fP.
! .IP \\*(Es\\*(c~
! Invoke the G1 Character Set as GR (LS1R).  Has no visible effect in \fIxterm\fP.
  .Ed
  .SH
  Mouse Tracking
  .LP
--- 764,777 ----
    \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt (normally disabled by a
  compile-time option)
    \*(Ps = \*5\*0 \(-> Set Font to \*(Pt
! .
! .sp
! .IP \\*(PM\\*(Pt\\*s\\*(ST
! \fIxterm\fP implements no PM functions; \*(Pt is ignored.
  \*(Pt need not be printable characters.
! .
  .Ed
+ .
  .SH
  Mouse Tracking
  .LP
***************
*** 543,549 ****
  encoding the location and the mouse button pressed.
  It is enabled by specifying parameter 9 to DECSET.
  On button press, \fIxterm\fP sends
! \*(Es\*([[\*M\*(Cb\*(Cx\*(Cy (6 characters).  \*(Cb is button\-1.
  \*(Cx and \*(Cy are the x and y coordinates of the mouse when the
  button was pressed.
  .LP
--- 791,797 ----
  encoding the location and the mouse button pressed.
  It is enabled by specifying parameter 9 to DECSET.
  On button press, \fIxterm\fP sends
! \*(Cs\*M\*(Cb\*(Cx\*(Cy (6 characters).  \*(Cb is button\-1.
  \*(Cx and \*(Cy are the x and y coordinates of the mouse when the
  button was pressed.
  .LP
***************
*** 551,557 ****
  release.  Modifier information is also sent.
  It is enabled by specifying parameter 1000 to DECSET.
  On button press or release, \fIxterm\fP sends
! \*(Es\*([[\*M\*(Cb\*(Cx\*(Cy.
  The low two bits of \*(Cb encode button information:
  0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.
  The upper bits encode what modifiers were down when the button was
--- 799,805 ----
  release.  Modifier information is also sent.
  It is enabled by specifying parameter 1000 to DECSET.
  On button press or release, \fIxterm\fP sends
! \*(Cs\*M\*(Cb\*(Cx\*(Cy.
  The low two bits of \*(Cb encode button information:
  0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.
  The upper bits encode what modifiers were down when the button was
***************
*** 571,577 ****
  tracking information.
  \fIAll X events are ignored until the proper escape sequence is
  received from the pty:\fP
! \*(Es\*([[\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*T.
  The parameters are \fIfunc, startx, starty, firstrow,\fP and \fIlastrow.\fP
  \fIfunc\fP is non-zero to initiate hilite tracking and zero to abort.
  \fIstartx\fP and \fIstarty\fP give the starting x and y location for
--- 819,825 ----
  tracking information.
  \fIAll X events are ignored until the proper escape sequence is
  received from the pty:\fP
! \*(Cs\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*T.
  The parameters are \fIfunc, startx, starty, firstrow,\fP and \fIlastrow.\fP
  \fIfunc\fP is non-zero to initiate hilite tracking and zero to abort.
  \fIstartx\fP and \fIstarty\fP give the starting x and y location for
***************
*** 580,588 ****
  \fIlastrow.\fP  (The top of the screen is row 1.)
  When the button is released, \fIxterm\fP reports the ending position
  one of two ways: if the start and end coordinates are valid text
! locations: \*(Es\*([[\*t\*(Cx\*(Cy.  If either coordinate is past
  the end of the line:
! \*(Es\*([[\*T\*(Cx\*(Cy\*(Cx\*(Cy\*(Cx\*(Cy.
  The parameters are \fIstartx, starty, endx, endy, mousex,\fP and \fImousey.\fP
  \fIstartx, starty, endx, \fPand\fI endy\fP give the starting and
  ending character positions of the region.  \fImousex\fP and \fImousey\fP
--- 828,836 ----
  \fIlastrow.\fP  (The top of the screen is row 1.)
  When the button is released, \fIxterm\fP reports the ending position
  one of two ways: if the start and end coordinates are valid text
! locations: \*(Cs\*t\*(Cx\*(Cy.  If either coordinate is past
  the end of the line:
! \*(Cs\*T\*(Cx\*(Cy\*(Cx\*(Cy\*(Cx\*(Cy.
  The parameters are \fIstartx, starty, endx, endy, mousex,\fP and \fImousey.\fP
  \fIstartx, starty, endx, \fPand\fI endy\fP give the starting and
  ending character positions of the region.  \fImousex\fP and \fImousey\fP
***************
*** 596,602 ****
  Most of these sequences are standard Tektronix 4014 control sequences.
  Graph mode supports the 12-bit addressing of the Tektronix 4014.
  The major features missing are
! the write-thru and defocused modes.
  This document does not describe the commands used in the various
  Tektronix plotting modes but does describe the commands to switch modes.
  .St
--- 844,850 ----
  Most of these sequences are standard Tektronix 4014 control sequences.
  Graph mode supports the 12-bit addressing of the Tektronix 4014.
  The major features missing are
! the write-through and defocused modes.
  This document does not describe the commands used in the various
  Tektronix plotting modes but does describe the commands to switch modes.
  .St
***************
*** 640,646 ****
  Select #3 Character Set
  .IP \\*(Es\\*;
  Select Small Character Set
! .IP \\*(Es\\*]\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be
  Set Text Parameters of VT window
    \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
    \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
--- 888,894 ----
  Select #3 Character Set
  .IP \\*(Es\\*;
  Select Small Character Set
! .IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be
  Set Text Parameters of VT window
    \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
    \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
Index: Tekproc.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/Tekproc.c    Sun Mar 17 13:33:40 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/Tekproc.c    Sun Aug 11 22:20:52 1996
***************
*** 66,71 ****
--- 66,72 ----
  #include <X11/Xmu/CharSet.h>
  
  #include <stdio.h>
+ #include <ctype.h>
  #include <errno.h>
  #include <setjmp.h>
  #include <signal.h>
***************
*** 124,142 ****
  
  /* Tek defines */
  
- #define       BEL             07
- #define       CANCEL          030
  #define       DOTDASHEDLINE   2
  #define       DOTTEDLINE      1
  #define       EAST            01
- #define       ETX             03
  #define       LINEMASK        07
  #define       LONGDASHEDLINE  4
  #define       MARGIN1         0
  #define       MARGIN2         1
  #define MAX_PTS               150
  #define MAX_VTX               300
- #define       NAK             025
  #define       NORTH           04
  #define       PENDOWN         1
  #define       PENUP           0
--- 125,139 ----
***************
*** 194,201 ****
  extern int Tpttable[];
  extern int Tspttable[];
  
- extern XtAppContext app_con;
- 
  static int *curstate = Talptable;
  static int *Tparsestate = Talptable;
  
--- 191,196 ----
***************
*** 649,658 ****
                        if(screen->TekGIN)
                                TekGINoff();
                        TCursorDown();
!                       if (!TekRefresh &&
!                           (XtAppPending(app_con) ||
!                            GetBytesAvailable (ConnectionNumber(screen->display)) > 0))
!                         xevents();
                        break;
  
                 case CASE_SP:
--- 644,651 ----
                        if(screen->TekGIN)
                                TekGINoff();
                        TCursorDown();
!                       if (!TekRefresh)
!                               do_xevents();
                        break;
  
                 case CASE_SP:
***************
*** 676,683 ****
                        TCursorForward();
                        break;
                 case CASE_OSC:
                        /* do osc escape */
!                       do_osc(Tinput);
                        Tparsestate = curstate;
                        break;
                }
--- 669,690 ----
                        TCursorForward();
                        break;
                 case CASE_OSC:
+                       /* FIXME:  someone should disentangle the input queues
+                        * of this code so that it can be state-driven.
+                        */
                        /* do osc escape */
!                       {
!                               Char buf2[512];
!                               int c2, len = 0;
!                               while ((c2 = Tinput()) != BEL) {
!                                       if (!isprint(c2 & 0x7f)
!                                        || len+2 >= sizeof(buf2))
!                                               break;
!                                       buf2[len++] = c2;
!                               }
!                               if (c2 == BEL)
!                                       do_osc(buf2, len);
!                       }
                        Tparsestate = curstate;
                        break;
                }
***************
*** 1132,1138 ****
        if(GINcursor)
                XFreeCursor(screen->display, GINcursor);
        if(screen->TekGIN) {
!               *screen->TekGIN = CANCEL;       /* modify recording */
                screen->TekGIN = NULL;
        }
  }
--- 1139,1145 ----
        if(GINcursor)
                XFreeCursor(screen->display, GINcursor);
        if(screen->TekGIN) {
!               *screen->TekGIN = CAN;  /* modify recording */
                screen->TekGIN = NULL;
        }
  }
***************
*** 1764,1771 ****
            tekcopyfd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0666);
            if (tekcopyfd < 0)
                _exit(1);
!           sprintf(initbuf, "\033%c\033%c", screen->page.fontsize + '8',
!                   screen->page.linetype + '`');
            write(tekcopyfd, initbuf, 4);
            Tp = &Tek0; 
            do {
--- 1771,1779 ----
            tekcopyfd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0666);
            if (tekcopyfd < 0)
                _exit(1);
!           sprintf(initbuf, "%c%c%c%c",
!               ESC, screen->page.fontsize + '8',
!               ESC, screen->page.linetype + '`');
            write(tekcopyfd, initbuf, 4);
            Tp = &Tek0; 
            do {
Index: VTPrsTbl.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/VTPrsTbl.c   Sat Aug 10 14:59:48 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/VTPrsTbl.c   Sun Aug 11 22:20:52 1996
***************
*** 28,45 ****
  
  #include "VTparse.h"
  
- #ifdef __STDC__
- #define Const const
- #else
- #define Const /**/
- #endif
- 
  /*
   * Stupid Apollo C preprocessor can't handle long lines.  So... To keep
   * it happy, we put each onto a separate line....  Sigh...
   */
  
! Const int groundtable[] =
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
--- 28,39 ----
  
  #include "VTparse.h"
  
  /*
   * Stupid Apollo C preprocessor can't handle long lines.  So... To keep
   * it happy, we put each onto a separate line....  Sigh...
   */
  
! Const PARSE_T groundtable[] =
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
***************
*** 48,54 ****
  CASE_PRINT,
  /*    EOT             ENQ             ACK             BEL     */
  CASE_PRINT,
! CASE_PRINT,
  CASE_PRINT,
  CASE_BELL,
  /*    BS              HT              NL              VT      */
--- 42,48 ----
  CASE_PRINT,
  /*    EOT             ENQ             ACK             BEL     */
  CASE_PRINT,
! CASE_ENQ,
  CASE_PRINT,
  CASE_BELL,
  /*    BS              HT              NL              VT      */
***************
*** 207,246 ****
  CASE_PRINT,
  CASE_PRINT,
  /*      0x84            0x85            0x86            0x87    */
! CASE_PRINT,
! CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
  /*      0x88            0x89            0x8a            0x8b    */
! CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
  /*      0x8c            0x8d            0x8e            0x8f    */
  CASE_PRINT,
! CASE_PRINT,
! CASE_PRINT,
! CASE_PRINT,
  /*      0x90            0x91            0x92            0x93    */
! CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
  /*      0x94            0x95            0x96            0x97    */
  CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
! CASE_PRINT,
! /*      0x99            0x99            0x9a            0x9b    */
! CASE_PRINT,
! CASE_PRINT,
! CASE_PRINT,
! CASE_PRINT,
  /*      0x9c            0x9d            0x9e            0x9f    */
! CASE_PRINT,
! CASE_PRINT,
! CASE_PRINT,
! CASE_PRINT,
  /*      nobreakspace    exclamdown      cent            sterling        */
  CASE_PRINT,
  CASE_PRINT,
--- 201,240 ----
  CASE_PRINT,
  CASE_PRINT,
  /*      0x84            0x85            0x86            0x87    */
! CASE_IND,
! CASE_NEL,
  CASE_PRINT,
  CASE_PRINT,
  /*      0x88            0x89            0x8a            0x8b    */
! CASE_HTS,
  CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
  /*      0x8c            0x8d            0x8e            0x8f    */
  CASE_PRINT,
! CASE_RI,
! CASE_SS2,
! CASE_SS3,
  /*      0x90            0x91            0x92            0x93    */
! CASE_DCS,
  CASE_PRINT,
  CASE_PRINT,
  CASE_PRINT,
  /*      0x94            0x95            0x96            0x97    */
  CASE_PRINT,
  CASE_PRINT,
+ CASE_SPA,
+ CASE_EPA,
+ /*      0x98            0x99            0x9a            0x9b    */
+ CASE_SOS,
  CASE_PRINT,
! CASE_DECID,
! CASE_CSI_STATE,
  /*      0x9c            0x9d            0x9e            0x9f    */
! CASE_ST,
! CASE_OSC,
! CASE_PM,
! CASE_APC,
  /*      nobreakspace    exclamdown      cent            sterling        */
  CASE_PRINT,
  CASE_PRINT,
***************
*** 363,369 ****
  CASE_PRINT,
  };
  
! Const int csitable[] =                /* ESC [ */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
--- 357,363 ----
  CASE_PRINT,
  };
  
! Const PARSE_T csi_table[] =           /* ESC [ */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
***************
*** 408,414 ****
  /*    SP              !               "               #       */
  CASE_ESC_IGNORE,
  CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  CASE_ESC_IGNORE,
  /*    $               %               &               '       */
  CASE_ESC_IGNORE,
--- 402,408 ----
  /*    SP              !               "               #       */
  CASE_ESC_IGNORE,
  CASE_ESC_IGNORE,
! CASE_CSI_QUOTE_STATE,
  CASE_ESC_IGNORE,
  /*    $               %               &               '       */
  CASE_ESC_IGNORE,
***************
*** 452,463 ****
  CASE_CUF,
  /*    D               E               F               G       */
  CASE_CUB,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_HPA,
  /*    H               I               J               K       */
  CASE_CUP,
! CASE_GROUND_STATE,
  CASE_ED,
  CASE_EL,
  /*    L               M               N               O       */
--- 446,457 ----
  CASE_CUF,
  /*    D               E               F               G       */
  CASE_CUB,
! CASE_CNL,
! CASE_CPL,
  CASE_HPA,
  /*    H               I               J               K       */
  CASE_CUP,
! CASE_CHT,
  CASE_ED,
  CASE_EL,
  /*    L               M               N               O       */
***************
*** 469,489 ****
  CASE_DCH,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    T               U               V               W       */
  CASE_TRACK_MOUSE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    X               Y               Z               [       */
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    \               ]               ^               _       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    `               a               b               c       */
  CASE_HPA,
--- 463,483 ----
  CASE_DCH,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_SU,
  /*    T               U               V               W       */
  CASE_TRACK_MOUSE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    X               Y               Z               [       */
+ CASE_ECH,
  CASE_GROUND_STATE,
! CASE_CBT,
  CASE_GROUND_STATE,
  /*    \               ]               ^               _       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_SD,
  CASE_GROUND_STATE,
  /*    `               a               b               c       */
  CASE_HPA,
***************
*** 497,503 ****
  CASE_TBC,
  /*    h               i               j               k       */
  CASE_SET,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
--- 491,497 ----
  CASE_TBC,
  /*    h               i               j               k       */
  CASE_SET,
! CASE_MC,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
***************
*** 555,561 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 549,555 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 687,693 ****
  CASE_GROUND_STATE,
  };
  
! Const int dectable[] =                /* ESC [ ? */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
--- 681,687 ----
  CASE_GROUND_STATE,
  };
  
! Const PARSE_T csi_quo_table[] =               /* CSI ... " */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
***************
*** 765,776 ****
  CASE_IGNORE,
  CASE_ESC_SEMI,
  /*    <               =               >               ?       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    @               A               B               C       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 759,770 ----
  CASE_IGNORE,
  CASE_ESC_SEMI,
  /*    <               =               >               ?       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    @               A               B               C       */
! CASE_ESC_IGNORE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 820,839 ****
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_DECSET,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_DECRST,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    p               q               r               s       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
- CASE_XTERM_RESTORE,
- CASE_XTERM_SAVE,
  /*    t               u               v               w       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 814,833 ----
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    p               q               r               s       */
+ CASE_DECSCL,
+ CASE_DECSCA,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    t               u               v               w       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 879,885 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 873,879 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 1011,1017 ****
  CASE_GROUND_STATE,
  };
  
! Const int eigtable[] =                /* CASE_ESC_IGNORE */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
--- 1005,1011 ----
  CASE_GROUND_STATE,
  };
  
! Const PARSE_T dec_table[] =           /* ESC [ ? */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
***************
*** 1054,1093 ****
  CASE_IGNORE,
  CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    $               %               &               '       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    (               )               *               +       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    ,               -               .               /       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    0               1               2               3       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    4               5               6               7       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    8               9               :               ;       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    <               =               >               ?       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 1048,1087 ----
  CASE_IGNORE,
  CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    $               %               &               '       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    (               )               *               +       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    ,               -               .               /       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    0               1               2               3       */
! CASE_ESC_DIGIT,
! CASE_ESC_DIGIT,
! CASE_ESC_DIGIT,
! CASE_ESC_DIGIT,
  /*    4               5               6               7       */
! CASE_ESC_DIGIT,
! CASE_ESC_DIGIT,
! CASE_ESC_DIGIT,
! CASE_ESC_DIGIT,
  /*    8               9               :               ;       */
! CASE_ESC_DIGIT,
! CASE_ESC_DIGIT,
! CASE_IGNORE,
! CASE_ESC_SEMI,
  /*    <               =               >               ?       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 1106,1113 ****
  /*    H               I               J               K       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    L               M               N               O       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 1100,1107 ----
  /*    H               I               J               K       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_DECSED,
! CASE_DECSEL,
  /*    L               M               N               O       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 1144,1163 ****
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    p               q               r               s       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    t               u               v               w       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 1138,1157 ----
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_DECSET,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
+ CASE_DECRST,
  CASE_GROUND_STATE,
! CASE_DSR,
  CASE_GROUND_STATE,
  /*    p               q               r               s       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_XTERM_RESTORE,
! CASE_XTERM_SAVE,
  /*    t               u               v               w       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 1203,1209 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 1197,1203 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 1335,1341 ****
  CASE_GROUND_STATE,
  };
  
! Const int esctable[] =                /* ESC */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
--- 1329,1335 ----
  CASE_GROUND_STATE,
  };
  
! Const PARSE_T eigtable[] =            /* CASE_ESC_IGNORE */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
***************
*** 1378,1402 ****
  CASE_IGNORE,
  CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_SCR_STATE,
  /*    $               %               &               '       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    (               )               *               +       */
! CASE_SCS0_STATE,
! CASE_SCS1_STATE,
! CASE_SCS2_STATE,
! CASE_SCS3_STATE,
  /*    ,               -               .               /       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    0               1               2               3       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 1372,1396 ----
  CASE_IGNORE,
  CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    $               %               &               '       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    (               )               *               +       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    ,               -               .               /       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    0               1               2               3       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 1406,1421 ****
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_DECSC,
  /*    8               9               :               ;       */
! CASE_DECRC,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    <               =               >               ?       */
  CASE_GROUND_STATE,
! CASE_DECKPAM,
! CASE_DECKPNM,
  CASE_GROUND_STATE,
  /*    @               A               B               C       */
  CASE_GROUND_STATE,
--- 1400,1415 ----
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    8               9               :               ;       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    <               =               >               ?       */
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    @               A               B               C       */
  CASE_GROUND_STATE,
***************
*** 1423,1467 ****
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    D               E               F               G       */
! CASE_IND,
! CASE_NEL,
! CASE_HP_BUGGY_LL,
  CASE_GROUND_STATE,
  /*    H               I               J               K       */
! CASE_HTS,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    L               M               N               O       */
  CASE_GROUND_STATE,
! CASE_RI,
! CASE_SS2,
! CASE_SS3,
  /*    P               Q               R               S       */
! CASE_IGNORE_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    T               U               V               W       */
! CASE_XTERM_TITLE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    X               Y               Z               [       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_DECID,
! CASE_CSI_STATE,
  /*    \               ]               ^               _       */
  CASE_GROUND_STATE,
! CASE_OSC,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    `               a               b               c       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_RIS,
  /*    d               e               f               g       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 1417,1461 ----
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    D               E               F               G       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    H               I               J               K       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    L               M               N               O       */
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    P               Q               R               S       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    T               U               V               W       */
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    X               Y               Z               [       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    \               ]               ^               _       */
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    `               a               b               c       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    d               e               f               g       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 1473,1482 ****
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_HP_MEM_LOCK,
! CASE_HP_MEM_UNLOCK,
! CASE_LS2,
! CASE_LS3,
  /*    p               q               r               s       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
--- 1467,1476 ----
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    p               q               r               s       */
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
***************
*** 1493,1501 ****
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    |               }               ~               DEL     */
! CASE_LS3R,
! CASE_LS2R,
! CASE_LS1R,
  CASE_GROUND_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
--- 1487,1495 ----
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*    |               }               ~               DEL     */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
***************
*** 1527,1533 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 1521,1527 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 1659,1826 ****
  CASE_GROUND_STATE,
  };
  
! Const int iestable[] =                /* CASE_IGNORE_ESC */
  {
  /*    NUL             SOH             STX             ETX     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    EOT             ENQ             ACK             BEL     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    BS              HT              NL              VT      */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    NP              CR              SO              SI      */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    DLE             DC1             DC2             DC3     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    DC4             NAK             SYN             ETB     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    CAN             EM              SUB             ESC     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! /*    FS              GS              RS              US      */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    SP              !               "               #       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    $               %               &               '       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    (               )               *               +       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    ,               -               .               /       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    0               1               2               3       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    4               5               6               7       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    8               9               :               ;       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    <               =               >               ?       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    @               A               B               C       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    D               E               F               G       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    H               I               J               K       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    L               M               N               O       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    P               Q               R               S       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    T               U               V               W       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    X               Y               Z               [       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! /*    \               ]               ^               _       */
  CASE_GROUND_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    `               a               b               c       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    d               e               f               g       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    h               i               j               k       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    l               m               n               o       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    p               q               r               s       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    t               u               v               w       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    x               y               z               {       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    |               }               ~               DEL     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
--- 1653,1820 ----
  CASE_GROUND_STATE,
  };
  
! Const PARSE_T esc_table[] =           /* ESC */
  {
  /*    NUL             SOH             STX             ETX     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    EOT             ENQ             ACK             BEL     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_BELL,
  /*    BS              HT              NL              VT      */
! CASE_BS,
! CASE_TAB,
! CASE_VMOT,
! CASE_VMOT,
  /*    NP              CR              SO              SI      */
! CASE_VMOT,
! CASE_CR,
! CASE_SO,
! CASE_SI,
  /*    DLE             DC1             DC2             DC3     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    DC4             NAK             SYN             ETB     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    CAN             EM              SUB             ESC     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_ESC,
! /*    FS              GS              RS              US      */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_ESC_SP_STATE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_SCR_STATE,
  /*    $               %               &               '       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    (               )               *               +       */
! CASE_SCS0_STATE,
! CASE_SCS1_STATE,
! CASE_SCS2_STATE,
! CASE_SCS3_STATE,
  /*    ,               -               .               /       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    0               1               2               3       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    4               5               6               7       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_DECSC,
  /*    8               9               :               ;       */
! CASE_DECRC,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    <               =               >               ?       */
! CASE_GROUND_STATE,
! CASE_DECKPAM,
! CASE_DECKPNM,
! CASE_GROUND_STATE,
  /*    @               A               B               C       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    D               E               F               G       */
! CASE_IND,
! CASE_NEL,
! CASE_HP_BUGGY_LL,
! CASE_GROUND_STATE,
  /*    H               I               J               K       */
! CASE_HTS,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    L               M               N               O       */
! CASE_GROUND_STATE,
! CASE_RI,
! CASE_SS2,
! CASE_SS3,
  /*    P               Q               R               S       */
! CASE_DCS,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    T               U               V               W       */
! CASE_XTERM_TITLE,
! CASE_GROUND_STATE,
! CASE_SPA,
! CASE_EPA,
  /*    X               Y               Z               [       */
! CASE_SOS,
  CASE_GROUND_STATE,
! CASE_DECID,
! CASE_CSI_STATE,
! /*    \               ]               ^               _       */
! CASE_ST,
! CASE_OSC,
! CASE_PM,
! CASE_APC,
  /*    `               a               b               c       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_RIS,
  /*    d               e               f               g       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_HP_MEM_LOCK,
! CASE_HP_MEM_UNLOCK,
! CASE_LS2,
! CASE_LS3,
  /*    p               q               r               s       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    t               u               v               w       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    x               y               z               {       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    |               }               ~               DEL     */
! CASE_LS3R,
! CASE_LS2R,
! CASE_LS1R,
! CASE_GROUND_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 1851,1857 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 1845,1851 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 1983,1989 ****
  CASE_GROUND_STATE,
  };
  
! Const int igntable[] =                /* CASE_IGNORE_STATE */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
--- 1977,1983 ----
  CASE_GROUND_STATE,
  };
  
! Const PARSE_T esc_sp_table[] =                /* ESC SP */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
***************
*** 1994,2010 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! CASE_IGNORE,
  /*    BS              HT              NL              VT      */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    NP              CR              SO              SI      */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    DLE             DC1             DC2             DC3     */
  CASE_IGNORE,
  CASE_IGNORE,
--- 1988,2004 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! CASE_BELL,
  /*    BS              HT              NL              VT      */
! CASE_BS,
! CASE_TAB,
! CASE_VMOT,
! CASE_VMOT,
  /*    NP              CR              SO              SI      */
! CASE_VMOT,
! CASE_CR,
! CASE_SO,
! CASE_SI,
  /*    DLE             DC1             DC2             DC3     */
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2016,2150 ****
  CASE_IGNORE,
  CASE_IGNORE,
  /*    CAN             EM              SUB             ESC     */
- CASE_GROUND_STATE, 
- CASE_IGNORE,
- CASE_GROUND_STATE,
- CASE_IGNORE_ESC,
- /*    FS              GS              RS              US      */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! CASE_IGNORE,
! /*    SP              !               "               #       */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
  /*    $               %               &               '       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    (               )               *               +       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    ,               -               .               /       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    0               1               2               3       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    4               5               6               7       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    8               9               :               ;       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    <               =               >               ?       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    @               A               B               C       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    D               E               F               G       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    H               I               J               K       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    L               M               N               O       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    P               Q               R               S       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    T               U               V               W       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    X               Y               Z               [       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    \               ]               ^               _       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    `               a               b               c       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    d               e               f               g       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    h               i               j               k       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    l               m               n               o       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    p               q               r               s       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    t               u               v               w       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    x               y               z               {       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    |               }               ~               DEL     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
--- 2010,2144 ----
  CASE_IGNORE,
  CASE_IGNORE,
  /*    CAN             EM              SUB             ESC     */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! CASE_ESC,
! /*    FS              GS              RS              US      */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
+ /*    SP              !               "               #       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
  /*    $               %               &               '       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    (               )               *               +       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    ,               -               .               /       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    0               1               2               3       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    4               5               6               7       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    8               9               :               ;       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    <               =               >               ?       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    @               A               B               C       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    D               E               F               G       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_S7C1T,
! CASE_S8C1T,
  /*    H               I               J               K       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    L               M               N               O       */
! CASE_ANSI_LEVEL_1,
! CASE_ANSI_LEVEL_2,
! CASE_ANSI_LEVEL_3,
! CASE_GROUND_STATE,
  /*    P               Q               R               S       */
! CASE_IGNORE_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    T               U               V               W       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    X               Y               Z               [       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    \               ]               ^               _       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    `               a               b               c       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    d               e               f               g       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    p               q               r               s       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    t               u               v               w       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    x               y               z               {       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    |               }               ~               DEL     */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2175,2181 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 2169,2175 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2307,2474 ****
  CASE_GROUND_STATE,
  };
  
! Const int scrtable[] =                /* ESC # */
  {
  /*    NUL             SOH             STX             ETX     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    EOT             ENQ             ACK             BEL     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_BELL,
  /*    BS              HT              NL              VT      */
! CASE_BS,
! CASE_TAB,
! CASE_VMOT,
! CASE_VMOT,
  /*    NP              CR              SO              SI      */
! CASE_VMOT,
! CASE_CR,
! CASE_SO,
! CASE_SI,
  /*    DLE             DC1             DC2             DC3     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    DC4             NAK             SYN             ETB     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    CAN             EM              SUB             ESC     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_ESC,
  /*    FS              GS              RS              US      */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    $               %               &               '       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    (               )               *               +       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    ,               -               .               /       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    0               1               2               3       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    4               5               6               7       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    8               9               :               ;       */
! CASE_DECALN,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    <               =               >               ?       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    @               A               B               C       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    D               E               F               G       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    H               I               J               K       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    L               M               N               O       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    P               Q               R               S       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    T               U               V               W       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    X               Y               Z               [       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    \               ]               ^               _       */
  CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    `               a               b               c       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    d               e               f               g       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    p               q               r               s       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    t               u               v               w       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    x               y               z               {       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    |               }               ~               DEL     */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
--- 2301,2468 ----
  CASE_GROUND_STATE,
  };
  
! Const PARSE_T iestable[] =            /* CASE_IGNORE_ESC */
  {
  /*    NUL             SOH             STX             ETX     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    EOT             ENQ             ACK             BEL     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    BS              HT              NL              VT      */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    NP              CR              SO              SI      */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    DLE             DC1             DC2             DC3     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    DC4             NAK             SYN             ETB     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    CAN             EM              SUB             ESC     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    FS              GS              RS              US      */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    SP              !               "               #       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    $               %               &               '       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    (               )               *               +       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    ,               -               .               /       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    0               1               2               3       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    4               5               6               7       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    8               9               :               ;       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    <               =               >               ?       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    @               A               B               C       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    D               E               F               G       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    H               I               J               K       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    L               M               N               O       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    P               Q               R               S       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    T               U               V               W       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    X               Y               Z               [       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    \               ]               ^               _       */
  CASE_GROUND_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    `               a               b               c       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    d               e               f               g       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    h               i               j               k       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    l               m               n               o       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    p               q               r               s       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    t               u               v               w       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    x               y               z               {       */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*    |               }               ~               DEL     */
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
! CASE_IGNORE_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2499,2505 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 2493,2499 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2631,2637 ****
  CASE_GROUND_STATE,
  };
  
! Const int scstable[] =                /* ESC ( etc. */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
--- 2625,2631 ----
  CASE_GROUND_STATE,
  };
  
! Const PARSE_T igntable[] =            /* CASE_IGNORE_STATE */
  {
  /*    NUL             SOH             STX             ETX     */
  CASE_IGNORE,
***************
*** 2642,2658 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! CASE_BELL,
  /*    BS              HT              NL              VT      */
! CASE_BS,
! CASE_TAB,
! CASE_VMOT,
! CASE_VMOT,
  /*    NP              CR              SO              SI      */
! CASE_VMOT,
! CASE_CR,
! CASE_SO,
! CASE_SI,
  /*    DLE             DC1             DC2             DC3     */
  CASE_IGNORE,
  CASE_IGNORE,
--- 2636,2652 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! CASE_IGNORE,
  /*    BS              HT              NL              VT      */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    NP              CR              SO              SI      */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    DLE             DC1             DC2             DC3     */
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2664,2798 ****
  CASE_IGNORE,
  CASE_IGNORE,
  /*    CAN             EM              SUB             ESC     */
  CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_ESC,
  /*    FS              GS              RS              US      */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    $               %               &               '       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    (               )               *               +       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    ,               -               .               /       */
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
! CASE_ESC_IGNORE,
  /*    0               1               2               3       */
! CASE_GSETS,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GROUND_STATE,
  /*    4               5               6               7       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    8               9               :               ;       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    <               =               >               ?       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    @               A               B               C       */
! CASE_GROUND_STATE,
! CASE_GSETS,
! CASE_GSETS,
! CASE_GROUND_STATE,
  /*    D               E               F               G       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    H               I               J               K       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    L               M               N               O       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    P               Q               R               S       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    T               U               V               W       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    X               Y               Z               [       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    \               ]               ^               _       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    `               a               b               c       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    d               e               f               g       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    h               i               j               k       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    l               m               n               o       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    p               q               r               s       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    t               u               v               w       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    x               y               z               {       */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*    |               }               ~               DEL     */
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
! CASE_GROUND_STATE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
--- 2658,2792 ----
  CASE_IGNORE,
  CASE_IGNORE,
  /*    CAN             EM              SUB             ESC     */
+ CASE_GROUND_STATE, 
  CASE_IGNORE,
! CASE_GROUND_STATE,
! CASE_IGNORE_ESC,
  /*    FS              GS              RS              US      */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
  /*    SP              !               "               #       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    $               %               &               '       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    (               )               *               +       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    ,               -               .               /       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    0               1               2               3       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    4               5               6               7       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    8               9               :               ;       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    <               =               >               ?       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    @               A               B               C       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    D               E               F               G       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    H               I               J               K       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    L               M               N               O       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    P               Q               R               S       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    T               U               V               W       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    X               Y               Z               [       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    \               ]               ^               _       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    `               a               b               c       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    d               e               f               g       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    h               i               j               k       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    l               m               n               o       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    p               q               r               s       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    t               u               v               w       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    x               y               z               {       */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*    |               }               ~               DEL     */
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
! CASE_IGNORE,
  /*      0x80            0x81            0x82            0x83    */
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2823,2829 ****
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x99            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
--- 2817,2823 ----
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
! /*      0x98            0x99            0x9a            0x9b    */
  CASE_IGNORE,
  CASE_IGNORE,
  CASE_IGNORE,
***************
*** 2953,2956 ****
--- 2947,3926 ----
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
  CASE_GROUND_STATE,
+ };
+ 
+ Const PARSE_T scrtable[] =            /* ESC # */
+ {
+ /*    NUL             SOH             STX             ETX     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    EOT             ENQ             ACK             BEL     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_BELL,
+ /*    BS              HT              NL              VT      */
+ CASE_BS,
+ CASE_TAB,
+ CASE_VMOT,
+ CASE_VMOT,
+ /*    NP              CR              SO              SI      */
+ CASE_VMOT,
+ CASE_CR,
+ CASE_SO,
+ CASE_SI,
+ /*    DLE             DC1             DC2             DC3     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    DC4             NAK             SYN             ETB     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    CAN             EM              SUB             ESC     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_ESC,
+ /*    FS              GS              RS              US      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    SP              !               "               #       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    $               %               &               '       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    (               )               *               +       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    ,               -               .               /       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    0               1               2               3       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    4               5               6               7       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    8               9               :               ;       */
+ CASE_DECALN,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    <               =               >               ?       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    @               A               B               C       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    D               E               F               G       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    H               I               J               K       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    L               M               N               O       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    P               Q               R               S       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    T               U               V               W       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    X               Y               Z               [       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    \               ]               ^               _       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    `               a               b               c       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    d               e               f               g       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    h               i               j               k       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    l               m               n               o       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    p               q               r               s       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    t               u               v               w       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    x               y               z               {       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    |               }               ~               DEL     */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      0x80            0x81            0x82            0x83    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x84            0x85            0x86            0x87    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x88            0x89            0x8a            0x8b    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x8c            0x8d            0x8e            0x8f    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x90            0x91            0x92            0x93    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x94            0x95            0x96            0x97    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x98            0x99            0x9a            0x9b    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x9c            0x9d            0x9e            0x9f    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      nobreakspace    exclamdown      cent            sterling        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      currency        yen             brokenbar       section         */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      diaeresis       copyright       ordfeminine     guillemotleft   */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      notsign         hyphen          registered      macron          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      degree          plusminus       twosuperior     threesuperior   */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      acute           mu              paragraph       periodcentered  */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      cedilla         onesuperior     masculine       guillemotright  */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      onequarter      onehalf         threequarters   questiondown    */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Agrave          Aacute          Acircumflex     Atilde          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Adiaeresis      Aring           AE              Ccedilla        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Egrave          Eacute          Ecircumflex     Ediaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Igrave          Iacute          Icircumflex     Idiaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Eth             Ntilde          Ograve          Oacute          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Ocircumflex     Otilde          Odiaeresis      multiply        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Ooblique        Ugrave          Uacute          Ucircumflex     */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Udiaeresis      Yacute          Thorn           ssharp          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      agrave          aacute          acircumflex     atilde          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      adiaeresis      aring           ae              ccedilla        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      egrave          eacute          ecircumflex     ediaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      igrave          iacute          icircumflex     idiaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      eth             ntilde          ograve          oacute          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      ocircumflex     otilde          odiaeresis      division        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      oslash          ugrave          uacute          ucircumflex     */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      udiaeresis      yacute          thorn           ydiaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ };
+ 
+ Const PARSE_T scstable[] =            /* ESC ( etc. */
+ {
+ /*    NUL             SOH             STX             ETX     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    EOT             ENQ             ACK             BEL     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_BELL,
+ /*    BS              HT              NL              VT      */
+ CASE_BS,
+ CASE_TAB,
+ CASE_VMOT,
+ CASE_VMOT,
+ /*    NP              CR              SO              SI      */
+ CASE_VMOT,
+ CASE_CR,
+ CASE_SO,
+ CASE_SI,
+ /*    DLE             DC1             DC2             DC3     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    DC4             NAK             SYN             ETB     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    CAN             EM              SUB             ESC     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_ESC,
+ /*    FS              GS              RS              US      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    SP              !               "               #       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    $               %               &               '       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    (               )               *               +       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    ,               -               .               /       */
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ CASE_ESC_IGNORE,
+ /*    0               1               2               3       */
+ CASE_GSETS,
+ CASE_GSETS,
+ CASE_GSETS,
+ CASE_GROUND_STATE,
+ /*    4               5               6               7       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    8               9               :               ;       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    <               =               >               ?       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    @               A               B               C       */
+ CASE_GROUND_STATE,
+ CASE_GSETS,
+ CASE_GSETS,
+ CASE_GROUND_STATE,
+ /*    D               E               F               G       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    H               I               J               K       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    L               M               N               O       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    P               Q               R               S       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    T               U               V               W       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    X               Y               Z               [       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    \               ]               ^               _       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    `               a               b               c       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    d               e               f               g       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    h               i               j               k       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    l               m               n               o       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    p               q               r               s       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    t               u               v               w       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    x               y               z               {       */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*    |               }               ~               DEL     */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      0x80            0x81            0x82            0x83    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x84            0x85            0x86            0x87    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x88            0x89            0x8a            0x8b    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x8c            0x8d            0x8e            0x8f    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x90            0x91            0x92            0x93    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x94            0x95            0x96            0x97    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x98            0x99            0x9a            0x9b    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x9c            0x9d            0x9e            0x9f    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      nobreakspace    exclamdown      cent            sterling        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      currency        yen             brokenbar       section         */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      diaeresis       copyright       ordfeminine     guillemotleft   */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      notsign         hyphen          registered      macron          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      degree          plusminus       twosuperior     threesuperior   */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      acute           mu              paragraph       periodcentered  */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      cedilla         onesuperior     masculine       guillemotright  */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      onequarter      onehalf         threequarters   questiondown    */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Agrave          Aacute          Acircumflex     Atilde          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Adiaeresis      Aring           AE              Ccedilla        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Egrave          Eacute          Ecircumflex     Ediaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Igrave          Iacute          Icircumflex     Idiaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Eth             Ntilde          Ograve          Oacute          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Ocircumflex     Otilde          Odiaeresis      multiply        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Ooblique        Ugrave          Uacute          Ucircumflex     */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      Udiaeresis      Yacute          Thorn           ssharp          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      agrave          aacute          acircumflex     atilde          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      adiaeresis      aring           ae              ccedilla        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      egrave          eacute          ecircumflex     ediaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      igrave          iacute          icircumflex     idiaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      eth             ntilde          ograve          oacute          */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      ocircumflex     otilde          odiaeresis      division        */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      oslash          ugrave          uacute          ucircumflex     */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ /*      udiaeresis      yacute          thorn           ydiaeresis      */
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ CASE_GROUND_STATE,
+ };
+ 
+ /*
+  * This table is treated specially.  The CASE_IGNORE entries correspond to the
+  * characters that can be accumulated for the string function (e.g., OSC).
+  */
+ Const PARSE_T sos_table[] =           /* OSC, DCS, etc. */
+ {
+ /*    NUL             SOH             STX             ETX     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    EOT             ENQ             ACK             BEL     */
+ CASE_IGNORE,
+ CASE_ENQ,
+ CASE_IGNORE,
+ CASE_BELL,
+ /*    BS              HT              NL              VT      */
+ CASE_BS,
+ CASE_TAB,
+ CASE_VMOT,
+ CASE_VMOT,
+ /*    NP              CR              SO              SI      */
+ CASE_VMOT,
+ CASE_CR,
+ CASE_SO,
+ CASE_SI,
+ /*    DLE             DC1             DC2             DC3     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    DC4             NAK             SYN             ETB     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    CAN             EM              SUB             ESC     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_GROUND_STATE,
+ CASE_ESC,
+ /*    FS              GS              RS              US      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    SP              !               "               #       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    $               %               &               '       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    (               )               *               +       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    ,               -               .               /       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    0               1               2               3       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    4               5               6               7       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    8               9               :               ;       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    <               =               >               ?       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE, 
+ /*    @               A               B               C       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    D               E               F               G       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    H               I               J               K       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    L               M               N               O       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    P               Q               R               S       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    T               U               V               W       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    X               Y               Z               [       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    \               ]               ^               _       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    `               a               b               c       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    d               e               f               g       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    h               i               j               k       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    l               m               n               o       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    p               q               r               s       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    t               u               v               w       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    x               y               z               {       */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*    |               }               ~               DEL     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x80            0x81            0x82            0x83    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x84            0x85            0x86            0x87    */
+ CASE_IND,
+ CASE_NEL,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x88            0x89            0x8a            0x8b    */
+ CASE_HTS,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x8c            0x8d            0x8e            0x8f    */
+ CASE_IGNORE,
+ CASE_RI,
+ CASE_SS2,
+ CASE_SS3,
+ /*      0x90            0x91            0x92            0x93    */
+ CASE_DCS,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      0x94            0x95            0x96            0x97    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_SPA,
+ CASE_EPA,
+ /*      0x98            0x99            0x9a            0x9b    */
+ CASE_SOS,
+ CASE_IGNORE,
+ CASE_DECID,
+ CASE_CSI_STATE,
+ /*      0x9c            0x9d            0x9e            0x9f    */
+ CASE_ST,
+ CASE_OSC,
+ CASE_PM,
+ CASE_APC,
+ /*      nobreakspace    exclamdown      cent            sterling        */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      currency        yen             brokenbar       section         */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      diaeresis       copyright       ordfeminine     guillemotleft   */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      notsign         hyphen          registered      macron          */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      degree          plusminus       twosuperior     threesuperior   */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      acute           mu              paragraph       periodcentered  */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      cedilla         onesuperior     masculine       guillemotright  */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      onequarter      onehalf         threequarters   questiondown    */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Agrave          Aacute          Acircumflex     Atilde          */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Adiaeresis      Aring           AE              Ccedilla        */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Egrave          Eacute          Ecircumflex     Ediaeresis      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Igrave          Iacute          Icircumflex     Idiaeresis      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Eth             Ntilde          Ograve          Oacute          */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Ocircumflex     Otilde          Odiaeresis      multiply        */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Ooblique        Ugrave          Uacute          Ucircumflex     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      Udiaeresis      Yacute          Thorn           ssharp          */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      agrave          aacute          acircumflex     atilde          */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      adiaeresis      aring           ae              ccedilla        */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      egrave          eacute          ecircumflex     ediaeresis      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      igrave          iacute          icircumflex     idiaeresis      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      eth             ntilde          ograve          oacute          */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      ocircumflex     otilde          odiaeresis      division        */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      oslash          ugrave          uacute          ucircumflex     */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ /*      udiaeresis      yacute          thorn           ydiaeresis      */
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
+ CASE_IGNORE,
  };
Index: VTparse.def
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/VTparse.def  Sat Aug 10 14:59:48 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/VTparse.def  Sun Aug 11 22:20:52 1996
***************
*** 80,82 ****
--- 80,110 ----
  CASE_HPA
  CASE_VPA
  CASE_XTERM_WINOPS
+ CASE_ECH
+ CASE_CHT
+ CASE_CPL
+ CASE_CNL
+ CASE_CBT
+ CASE_SU
+ CASE_SD
+ CASE_S7C1T
+ CASE_S8C1T
+ CASE_ESC_SP_STATE
+ CASE_ENQ
+ CASE_DECSCL
+ CASE_DECSCA
+ CASE_DECSED
+ CASE_DECSEL
+ CASE_DCS
+ CASE_PM
+ CASE_SOS
+ CASE_ST
+ CASE_APC
+ CASE_EPA
+ CASE_SPA
+ CASE_CSI_QUOTE_STATE
+ CASE_DSR
+ CASE_ANSI_LEVEL_1
+ CASE_ANSI_LEVEL_2
+ CASE_ANSI_LEVEL_3
+ CASE_MC
Index: VTparse.h
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/VTparse.h    Sat Aug 10 14:59:48 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/VTparse.h    Sun Aug 11 22:20:52 1996
***************
*** 25,37 ****
   * SOFTWARE.
   */
  
  /*
   * The following list of definitions is generated from VTparse.def using the
   * following command line:
   *
   *     grep '^CASE_' VTparse.def | awk '{printf "#define %s %d\n", $1, n++}'
   *
!  * You you need to change something, change VTparse.def and regenerate the
   * definitions.  This would have been automatic, but since this doesn't change
   * very often, it isn't worth the makefile hassle.
   */
--- 25,61 ----
   * SOFTWARE.
   */
  
+ #ifdef __STDC__
+ #define Const const
+ #else
+ #define Const /**/
+ #endif
+ 
+ /*
+  * PARSE_T has to be large enough to handle the number of cases enumerated here.
+  */
+ typedef char PARSE_T;
+ 
+ extern Const PARSE_T csi_quo_table[];
+ extern Const PARSE_T csi_table[];
+ extern Const PARSE_T dec_table[];
+ extern Const PARSE_T eigtable[];
+ extern Const PARSE_T esc_sp_table[];
+ extern Const PARSE_T esc_table[];
+ extern Const PARSE_T groundtable[];
+ extern Const PARSE_T iestable[];
+ extern Const PARSE_T igntable[];
+ extern Const PARSE_T scrtable[];
+ extern Const PARSE_T scstable[];
+ extern Const PARSE_T sos_table[];
+ 
  /*
   * The following list of definitions is generated from VTparse.def using the
   * following command line:
   *
   *     grep '^CASE_' VTparse.def | awk '{printf "#define %s %d\n", $1, n++}'
   *
!  * If you need to change something, change VTparse.def and regenerate the
   * definitions.  This would have been automatic, but since this doesn't change
   * very often, it isn't worth the makefile hassle.
   */
***************
*** 110,112 ****
--- 134,164 ----
  #define CASE_HPA 71
  #define CASE_VPA 72
  #define CASE_XTERM_WINOPS 73
+ #define CASE_ECH 74
+ #define CASE_CHT 75
+ #define CASE_CPL 76
+ #define CASE_CNL 77
+ #define CASE_CBT 78
+ #define CASE_SU 79
+ #define CASE_SD 80
+ #define CASE_S7C1T 81
+ #define CASE_S8C1T 82
+ #define CASE_ESC_SP_STATE 83
+ #define CASE_ENQ 84
+ #define CASE_DECSCL 85
+ #define CASE_DECSCA 86
+ #define CASE_DECSED 87
+ #define CASE_DECSEL 88
+ #define CASE_DCS 89
+ #define CASE_PM 90
+ #define CASE_SOS 91
+ #define CASE_ST 92
+ #define CASE_APC 93
+ #define CASE_EPA 94
+ #define CASE_SPA 95
+ #define CASE_CSI_QUOTE_STATE 96
+ #define CASE_DSR 97
+ #define CASE_ANSI_LEVEL_1 98
+ #define CASE_ANSI_LEVEL_2 99
+ #define CASE_ANSI_LEVEL_3 100
+ #define CASE_MC 101
Index: XTerm.ad
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/XTerm.ad     Wed Feb  9 18:19:54 1994
--- /build/x11r6/XFree86-current/xc/programs/xterm/XTerm.ad     Sun Aug 11 22:20:52 1996
***************
*** 19,24 ****
--- 19,25 ----
  *mainMenu*terminate*Label:  Send TERM Signal
  *mainMenu*kill*Label:  Send KILL Signal
  *mainMenu*quit*Label:  Quit
+ *mainMenu*eightBit*Label: 8-Bit Controls
  
  *vtMenu.Label:  VT Options
  *vtMenu*scrollbar*Label:  Enable Scrollbar
Index: button.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/button.c     Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/button.c     Sun Aug 11 22:20:52 1996
***************
*** 576,584 ****
      Cardinal num_params;
      Bool use_cursor_loc;
  {
!       int     row, col;
        TScreen *screen = &term->screen;
!       char line[9];
  
        if (use_cursor_loc) {
            row = screen->cursor_row;
--- 576,584 ----
      Cardinal num_params;
      Bool use_cursor_loc;
  {
!       int     row, col, count;
        TScreen *screen = &term->screen;
!       unsigned char line[9];
  
        if (use_cursor_loc) {
            row = screen->cursor_row;
***************
*** 590,613 ****
        lastButtonUpTime = event->xbutton.time;
        if (startSRow != endSRow || startSCol != endSCol) {
                if (replyToEmacs) {
                        if (rawRow == startSRow && rawCol == startSCol 
                            && row == endSRow && col == endSCol) {
                                /* Use short-form emacs select */
!                               strcpy(line, "\033[t");
!                               line[3] = ' ' + endSCol + 1;
!                               line[4] = ' ' + endSRow + 1;
!                               v_write(screen->respond, line, 5);
                        } else {
                                /* long-form, specify everything */
!                               strcpy(line, "\033[T");
!                               line[3] = ' ' + startSCol + 1;
!                               line[4] = ' ' + startSRow + 1;
!                               line[5] = ' ' + endSCol + 1;
!                               line[6] = ' ' + endSRow + 1;
!                               line[7] = ' ' + col + 1;
!                               line[8] = ' ' + row + 1;
!                               v_write(screen->respond, line, 9);
                        }
                        TrackText(0, 0, 0, 0);
                }
        }
--- 590,619 ----
        lastButtonUpTime = event->xbutton.time;
        if (startSRow != endSRow || startSCol != endSCol) {
                if (replyToEmacs) {
+                       count = 0;
+                       if (screen->control_eight_bits) {
+                               line[count++] = CSI;
+                       } else {
+                               line[count++] = ESC;
+                               line[count++] = '[';
+                       }
                        if (rawRow == startSRow && rawCol == startSCol 
                            && row == endSRow && col == endSCol) {
                                /* Use short-form emacs select */
!                               line[count++] = 't';
!                               line[count++] = ' ' + endSCol + 1;
!                               line[count++] = ' ' + endSRow + 1;
                        } else {
                                /* long-form, specify everything */
!                               line[count++] = 'T';
!                               line[count++] = ' ' + startSCol + 1;
!                               line[count++] = ' ' + startSRow + 1;
!                               line[count++] = ' ' + endSCol + 1;
!                               line[count++] = ' ' + endSRow + 1;
!                               line[count++] = ' ' + col + 1;
!                               line[count++] = ' ' + row + 1;
                        }
+                       v_write(screen->respond, (char *)line, count);
                        TrackText(0, 0, 0, 0);
                }
        }
***************
*** 1459,1467 ****
  {
        register TScreen *screen = &term->screen;
        int pty = screen->respond;
!       char line[6];
        register unsigned row, col;
!       int button; 
  
        button = event->button - 1; 
  
--- 1465,1473 ----
  {
        register TScreen *screen = &term->screen;
        int pty = screen->respond;
!       char unsigned line[6];
        register unsigned row, col;
!       int button, count = 0;
  
        button = event->button - 1; 
  
***************
*** 1469,1484 ****
         / FontHeight(screen);
        col = (event->x - screen->border - screen->scrollbar)
         / FontWidth(screen);
!       (void) strcpy(line, "\033[M");
        if (screen->send_mouse_pos == 1) {
!               line[3] = ' ' + button;
        } else {
!               line[3] = ' ' + (KeyState(event->state) << 2) + 
                        ((event->type == ButtonPress)? button:3);
        }
!       line[4] = ' ' + col + 1;
!       line[5] = ' ' + row + 1;
!       v_write(pty, line, 6);
  }
  
  
--- 1475,1496 ----
         / FontHeight(screen);
        col = (event->x - screen->border - screen->scrollbar)
         / FontWidth(screen);
!       if (screen->control_eight_bits) {
!               line[count++] = CSI;
!       } else {
!               line[count++] = ESC;
!               line[count++] = '[';
!       }
!       line[count++] = 'M';
        if (screen->send_mouse_pos == 1) {
!               line[count++] = ' ' + button;
        } else {
!               line[count++] = ' ' + (KeyState(event->state) << 2) + 
                        ((event->type == ButtonPress)? button:3);
        }
!       line[count++] = ' ' + col + 1;
!       line[count++] = ' ' + row + 1;
!       v_write(pty, (char *)line, count);
  }
  
  
Index: charproc.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/charproc.c   Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/charproc.c   Sun Aug 11 22:20:52 1996
***************
*** 113,124 ****
  
  extern jmp_buf VTend;
  extern XtermWidget term;
- extern XtAppContext app_con;
  extern Widget toplevel;
  extern char *ProgramName;
  
  static int LoadNewFont PROTO((TScreen *screen, char *nfontname, char *bfontname, Bool doresize, int fontnum));
- static int finput PROTO((void));
  static int in_put PROTO((void));
  static int set_character_class PROTO((char *s));
  static void DoSetSelectedFont PROTO_XT_SEL_CB_ARGS;
--- 113,122 ----
***************
*** 174,179 ****
--- 172,178 ----
  #define XtNcutToBeginningOfLine "cutToBeginningOfLine"
  #define XtNeightBitInput "eightBitInput"
  #define XtNeightBitOutput "eightBitOutput"
+ #define XtNeightBitControl "eightBitControl"
  #define XtNgeometry "geometry"
  #define XtNtekGeometry "tekGeometry"
  #define XtNinternalBorder "internalBorder"
***************
*** 246,251 ****
--- 245,251 ----
  #define XtCCursorBlinkTime "CursorBlinkTime"
  #define XtCEightBitInput "EightBitInput"
  #define XtCEightBitOutput "EightBitOutput"
+ #define XtCEightBitControl "EightBitControl"
  #define XtCGeometry "Geometry"
  #define XtCJumpScroll "JumpScroll"
  #ifdef ALLOWLOGGING
***************
*** 288,303 ****
  static unsigned long ntotal;
  static jmp_buf vtjmpbuf;
  
- extern int groundtable[];
- extern int csitable[];
- extern int dectable[];
- extern int eigtable[];
- extern int esctable[];
- extern int iestable[];
- extern int igntable[];
- extern int scrtable[];
- extern int scstable[];
- 
  /* event handlers */
  static void HandleBell PROTO((Widget w, XEvent *event, String *params, Cardinal *param_count));
  static void HandleIgnore PROTO((Widget w, XEvent *event, String *params, Cardinal *param_count));
--- 288,293 ----
***************
*** 394,399 ****
--- 384,391 ----
      { "redraw",                       HandleRedraw },
      { "send-signal",          HandleSendSignal },
      { "quit",                 HandleQuit },
+     { "set-8-bit-control",    Handle8BitControl },
+     { "set-sun-function-keys",        HandleSunFunctionKeys },
      { "set-scrollbar",                HandleScrollbar },
      { "set-jumpscroll",               HandleJumpscroll },
      { "set-reverse-video",    HandleReverseVideo },
***************
*** 467,472 ****
--- 459,467 ----
  {XtNeightBitOutput, XtCEightBitOutput, XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, screen.output_eight_bits), 
        XtRBoolean, (XtPointer) &defaultTRUE},
+ {XtNeightBitControl, XtCEightBitControl, XtRBoolean, sizeof(Boolean),
+       XtOffsetOf(XtermWidgetRec, screen.control_eight_bits), 
+       XtRBoolean, (XtPointer) &defaultFALSE},
  {XtNgeometry,XtCGeometry, XtRString, sizeof(char *),
        XtOffsetOf(XtermWidgetRec, misc.geo_metry),
        XtRString, (XtPointer) NULL},
***************
*** 781,800 ****
  
  static void VTparse()
  {
        register TScreen *screen = &term->screen;
!       register int *parsestate;
        register unsigned int c;
        register unsigned char *cp;
!       register int row, col, top, bot, scstype;
  
        /* We longjmp back to this point in VTReset() */
        (void)setjmp(vtjmpbuf);
  
        parsestate = groundtable;
        scstype = 0;
  
        for( ; ; ) {
!               switch (parsestate[c = doinput()]) {
                 case CASE_PRINT:
                        /* printable characters */
                        top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
--- 776,820 ----
  
  static void VTparse()
  {
+       /* Buffer for processing strings (e.g., OSC ... ST) */
+       static Char *string_area;
+       static Size_t string_size, string_used;
+ 
        register TScreen *screen = &term->screen;
!       register Const PARSE_T *parsestate;
        register unsigned int c;
        register unsigned char *cp;
!       register int row, col, top, bot, scstype, count;
!       Bool private_function;  /* distinguish private-mode from standard */
!       int string_mode;        /* nonzero iff we're processing a string */
  
        /* We longjmp back to this point in VTReset() */
        (void)setjmp(vtjmpbuf);
  
        parsestate = groundtable;
        scstype = 0;
+       private_function = False;
+       string_mode = 0;
  
        for( ; ; ) {
!           c = doinput();
! 
!           /* Accumulate string for APC, DCS, PM, OSC, SOS controls */
!           if (parsestate == sos_table) {
!               if (string_size == 0) {
!                       string_area = (Char *)malloc(string_size = 256);
!               } else if (string_used+1 >= string_size) {
!                       string_size += string_size;
!                       string_area = (Char *)realloc(string_area, string_size);
!               }
!               string_area[string_used++] = c;
!           } else if (parsestate != esc_table) {
!               /* if we were accumulating, we're not any more */
!               string_mode = 0;
!               string_used = 0;
!           }
! 
!           switch (parsestate[c]) {
                 case CASE_PRINT:
                        /* printable characters */
                        top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
***************
*** 842,850 ****
                        /* Ignore character */
                        break;
  
                 case CASE_BELL:
!                       /* bell */
!                       Bell(XkbBI_TerminalBell,0);
                        break;
  
                 case CASE_BS:
--- 862,882 ----
                        /* Ignore character */
                        break;
  
+                case CASE_ENQ:
+                       for (count = 0; xterm_name[count] != 0; count++)
+                               unparseputc(xterm_name[count], screen->respond);
+                       break;
+ 
                 case CASE_BELL:
!                       if (string_mode == OSC) {
!                               if (string_used)
!                                       string_area[--string_used] = '\0';
!                               do_osc(string_area, string_used);
!                               parsestate = groundtable;
!                       } else {
!                               /* bell */
!                               Bell(XkbBI_TerminalBell,0);
!                       }
                        break;
  
                 case CASE_BS:
***************
*** 860,866 ****
  
                 case CASE_ESC:
                        /* escape */
!                       parsestate = esctable;
                        break;
  
                 case CASE_VMOT:
--- 892,898 ----
  
                 case CASE_ESC:
                        /* escape */
!                       parsestate = esc_table;
                        break;
  
                 case CASE_VMOT:
***************
*** 870,886 ****
                        Index(screen, 1);
                        if (term->flags & LINEFEED)
                                CarriageReturn(screen);
!                       if (XtAppPending(app_con) ||
!                           GetBytesAvailable (ConnectionNumber(screen->display)) > 0)
!                         xevents();
                        parsestate = groundtable;
                        break;
  
                 case CASE_TAB:
                        /* tab */
!                       screen->cur_col = TabNext(term->tabs, screen->cur_col);
!                       if (screen->cur_col > screen->max_col)
!                               screen->cur_col = screen->max_col;
                        break;
  
                 case CASE_SI:
--- 902,932 ----
                        Index(screen, 1);
                        if (term->flags & LINEFEED)
                                CarriageReturn(screen);
!                       do_xevents();
!                       parsestate = groundtable;
!                       break;
! 
!                case CASE_CBT:
!                       /* cursor backward tabulation */
!                       if((count = param[0]) == DEFAULT)
!                               count = 1;
!                       while ((count-- > 0)
!                         &&   (TabToPrevStop()));
!                       parsestate = groundtable;
!                       break;
! 
!                case CASE_CHT:
!                       /* cursor forward tabulation */
!                       if((count = param[0]) == DEFAULT)
!                               count = 1;
!                       while ((count-- > 0)
!                         &&   (TabToNextStop()));
                        parsestate = groundtable;
                        break;
  
                 case CASE_TAB:
                        /* tab */
!                       TabToNextStop();
                        break;
  
                 case CASE_SI:
***************
*** 940,946 ****
  
                 case CASE_DEC_STATE:
                        /* enter dec mode */
!                       parsestate = dectable;
                        break;
  
                 case CASE_ICH:
--- 986,992 ----
  
                 case CASE_DEC_STATE:
                        /* enter dec mode */
!                       parsestate = dec_table;
                        break;
  
                 case CASE_ICH:
***************
*** 1019,1055 ****
  
                 case CASE_ED:
                        /* ED */
!                       switch (param[0]) {
!                        case DEFAULT:
!                        case 0:
!                               ClearBelow(screen);
!                               break;
! 
!                        case 1:
!                               ClearAbove(screen);
!                               break;
! 
!                        case 2:
!                               ClearScreen(screen);
!                               break;
!                       }
                        parsestate = groundtable;
                        break;
  
                 case CASE_EL:
                        /* EL */
!                       switch (param[0]) {
!                        case DEFAULT:
!                        case 0:
!                               ClearRight(screen);
!                               break;
!                        case 1:
!                               ClearLeft(screen);
!                               break;
!                        case 2:
!                               ClearLine(screen);
!                               break;
!                       }
                        parsestate = groundtable;
                        break;
  
--- 1065,1083 ----
  
                 case CASE_ED:
                        /* ED */
!                       do_erase_display(screen, param[0], OFF_PROTECT);
                        parsestate = groundtable;
                        break;
  
                 case CASE_EL:
                        /* EL */
!                       do_erase_line(screen, param[0], OFF_PROTECT);
!                       parsestate = groundtable;
!                       break;
! 
!                case CASE_ECH:
!                       /* ECH */
!                       ClearRight(screen, param[0]);
                        parsestate = groundtable;
                        break;
  
***************
*** 1078,1087 ****
                        break;
  
                 case CASE_TRACK_MOUSE:
!                       /* Track mouse as long as in window and between
!                          specified rows */
!                       TrackMouse(param[0], param[2]-1, param[1]-1,
!                        param[3]-1, param[4]-2);
                        break;
  
                 case CASE_DECID:
--- 1106,1127 ----
                        break;
  
                 case CASE_TRACK_MOUSE:
!                       if (screen->send_mouse_pos == 3
!                        || nparam > 1) {
!                               /* Track mouse as long as in window and between
!                                * specified rows
!                                */
!                               TrackMouse(param[0],
!                                       param[2]-1, param[1]-1,
!                                       param[3]-1, param[4]-2);
!                       } else {
!                               /* SD as per DEC vt400 documentation */
!                               if((count = param[0]) < 1)
!                                       count = 1;
!                               RevScroll(screen, count);
!                               do_xevents();
!                               parsestate = groundtable;
!                       }
                        break;
  
                 case CASE_DECID:
***************
*** 1090,1100 ****
                 case CASE_DA1:
                        /* DA1 */
                        if (param[0] <= 0) {    /* less than means DEFAULT */
                                reply.a_type   = CSI;
                                reply.a_pintro = '?';
!                               reply.a_nparam = 2;
!                               reply.a_param[0] = 1;           /* VT102 */
!                               reply.a_param[1] = 2;           /* VT102 */
                                reply.a_inters = 0;
                                reply.a_final  = 'c';
                                unparseseq(&reply, screen->respond);
--- 1130,1152 ----
                 case CASE_DA1:
                        /* DA1 */
                        if (param[0] <= 0) {    /* less than means DEFAULT */
+                               count = 0;
                                reply.a_type   = CSI;
                                reply.a_pintro = '?';
!                               if (screen->ansi_level >= 1) {
!                                       reply.a_param[count++] = screen->ansi_level + 60;
!                                       reply.a_param[count++] = 1; /* 132-columns */
!                                       reply.a_param[count++] = 2; /* printer */
!                                       if (screen->ansi_level > 1) {
!                                               reply.a_param[count++] = 6; /* selective-erase */
!                                               reply.a_param[count++] = 8; /* user-defined-keys */
!                                       }
!                                       reply.a_param[count++] = 15; /* technical characters */
!                               } else {
!                                       reply.a_param[count++] = 1; /* STP: VT100 */
!                                       reply.a_param[count++] = 2; /* AVO: 132-columns */
!                               }
!                               reply.a_nparam = count;
                                reply.a_inters = 0;
                                reply.a_final  = 'c';
                                unparseseq(&reply, screen->respond);
***************
*** 1136,1142 ****
                                                SGR_Background(-1);
                                        })
                                        term->flags &=
!                                               ~(INVERSE|BOLD|UNDERLINE);
                                        break;
                                 case 1:
                                 case 5:        /* Blink, really.       */
--- 1188,1194 ----
                                                SGR_Background(-1);
                                        })
                                        term->flags &=
!                                               ~(INVERSE|BOLD|UNDERLINE|INVISIBLE);
                                        break;
                                 case 1:
                                 case 5:        /* Blink, really.       */
***************
*** 1166,1171 ****
--- 1218,1226 ----
                                 case 7:
                                        term->flags |= INVERSE;
                                        break;
+                                case 8:
+                                       term->flags |= INVISIBLE;
+                                       break;
                                 case 22:
                                        term->flags &= ~BOLD;
                                        break;
***************
*** 1179,1184 ****
--- 1234,1242 ----
                                 case 27:
                                        term->flags &= ~INVERSE;
                                        break;
+                                case 28:
+                                       term->flags &= ~INVISIBLE;
+                                       break;
                                 case 30:
                                 case 31:
                                 case 32:
***************
*** 1230,1256 ****
                        parsestate = groundtable;
                        break;
  
                 case CASE_CPR:
!                       /* CPR */
!                       if ((row = param[0]) == 5) {
!                               reply.a_type = CSI;
!                               reply.a_pintro = 0;
!                               reply.a_nparam = 1;
!                               reply.a_param[0] = 0;
!                               reply.a_inters = 0;
!                               reply.a_final  = 'n';
!                               unparseseq(&reply, screen->respond);
!                       } else if (row == 6) {
!                               reply.a_type = CSI;
!                               reply.a_pintro = 0;
!                               reply.a_nparam = 2;
!                               reply.a_param[0] = screen->cur_row+1;
!                               reply.a_param[1] = screen->cur_col+1;
!                               reply.a_inters = 0;
                                reply.a_final  = 'R';
!                               unparseseq(&reply, screen->respond);
                        }
                        parsestate = groundtable;
                        break;
  
                 case CASE_HP_MEM_LOCK:
--- 1288,1343 ----
                        parsestate = groundtable;
                        break;
  
+                       /* DSR (except for the '?') is a superset of CPR */
+                case CASE_DSR:
+                       private_function = True;
+ 
+                       /* FALLTHRU */
                 case CASE_CPR:
!                       count = 0;
!                       reply.a_type   = CSI;
!                       reply.a_pintro = private_function ? '?' : 0;
!                       reply.a_inters = 0;
!                       reply.a_final  = 'n';
! 
!                       switch (param[0]) {
!                       case 5:
!                               /* operating status */
!                               reply.a_param[count++] = 0; /* (no malfunction ;-) */
!                               break;
!                       case 6:
!                               /* CPR */
!                               /* DECXCPR (with page=0) */
!                               reply.a_param[count++] = screen->cur_row + 1;
!                               reply.a_param[count++] = screen->cur_col + 1;
                                reply.a_final  = 'R';
!                               break;
!                       case 15:
!                               /* printer status */
!                               reply.a_param[count++] = 13; /* FIXME: implement printer */
!                               break;
!                       case 25:
!                               /* UDK status */
!                               reply.a_param[count++] = 20; /* UDK always unlocked */
!                               break;
!                       case 26:
!                               /* keyboard status */
!                               reply.a_param[count++] = 27;
!                               reply.a_param[count++] = 1; /* North American */
!                               reply.a_param[count++] = 0; /* ready */
!                               reply.a_param[count++] = 0; /* LK201 */
!                               break;
                        }
+ 
+                       if ((reply.a_nparam = count) != 0)
+                               unparseseq(&reply, screen->respond);
+ 
                        parsestate = groundtable;
+                       private_function = False;
+                       break;
+ 
+                case CASE_MC:
+                       /* FIXME: implement media control */
                        break;
  
                 case CASE_HP_MEM_LOCK:
***************
*** 1364,1375 ****
                        parsestate = groundtable;
                        break;
  
                 case CASE_IND:
                        /* IND */
                        Index(screen, 1);
!                       if (XtAppPending(app_con) ||
!                           GetBytesAvailable (ConnectionNumber(screen->display)) > 0)
!                         xevents();
                        parsestate = groundtable;
                        break;
  
--- 1451,1601 ----
                        parsestate = groundtable;
                        break;
  
+                case CASE_CSI_QUOTE_STATE:
+                       parsestate = csi_quo_table;
+                       break;
+ 
+                       /* the ANSI conformance levels are noted in the
+                        * vt400 user's manual (I assume they're the non-DEC
+                        * equivalents of DECSCL - T.Dickey)
+                        */
+                case CASE_ANSI_LEVEL_1:
+                       screen->ansi_level = 1;
+                       screen->control_eight_bits = False;
+                       break;
+                case CASE_ANSI_LEVEL_2:
+                       screen->ansi_level = 2;
+                       break;
+                case CASE_ANSI_LEVEL_3:
+                       screen->ansi_level = 3;
+                       break;
+ 
+                case CASE_DECSCL:
+                       if (param[0] >= 61 && param[0] <= 63) {
+                               screen->ansi_level = param[0] - 60;
+                               if (param[0] > 61) {
+                                       if (param[1] == 1)
+                                               screen->control_eight_bits = False;
+                                       else if (param[1] == 0 || param[1] == 2)
+                                               screen->control_eight_bits = True;
+                               }
+                       }
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_DECSCA:
+                       screen->protected_mode = DEC_PROTECT;
+                       if (param[0] <= 0 || param[0] == 2)
+                               term->flags &= ~PROTECTED;
+                       else if (param[0] == 1)
+                               term->flags |= PROTECTED;
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_DECSED:
+                       /* DECSED */
+                       do_erase_display(screen, param[0], DEC_PROTECT);
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_DECSEL:
+                       /* DECSEL */
+                       do_erase_line(screen, param[0], DEC_PROTECT);
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_ST:
+                       if (!string_used)
+                               break;
+                       string_area[--string_used] = '\0';
+                       switch (string_mode) {
+                       case APC:
+                               /* ignored */
+                               break;
+                       case DCS:
+                               do_dcs(string_area, string_used);
+                               break;
+                       case OSC:
+                               do_osc(string_area, string_used);
+                               break;
+                       case PM:
+                               /* ignored */
+                               break;
+                       case SOS:
+                               /* ignored */
+                               break;
+                       }
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_SOS:
+                       /* Start of String */
+                       string_mode = SOS;
+                       parsestate = sos_table;
+                       break;
+ 
+                case CASE_PM:
+                       /* Privacy Message */
+                       string_mode = PM;
+                       parsestate = sos_table;
+                       break;
+ 
+                case CASE_DCS:
+                       /* Device Control String */
+                       string_mode = DCS;
+                       parsestate = sos_table;
+                       break;
+ 
+                case CASE_APC:
+                       /* Application Program Command */
+                       string_mode = APC;
+                       parsestate = sos_table;
+                       break;
+ 
+                case CASE_SPA:
+                       screen->protected_mode = ISO_PROTECT;
+                       term->flags |= PROTECTED;
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_EPA:
+                       term->flags &= ~PROTECTED;
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_SU:
+                       /* SU */
+                       if((count = param[0]) < 1)
+                               count = 1;
+                       Scroll(screen, count);
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_SD:
+                       /* SD as per ISO 6429 */
+                       if((count = param[0]) < 1)
+                               count = 1;
+                       RevScroll(screen, count);
+                       do_xevents();
+                       parsestate = groundtable;
+                       break;
+ 
                 case CASE_IND:
                        /* IND */
                        Index(screen, 1);
!                       do_xevents();
!                       parsestate = groundtable;
!                       break;
! 
!                case CASE_CPL:
!                       /* cursor prev line */
!                       CursorPrevLine(screen, param[0]);
!                       parsestate = groundtable;
!                       break;
! 
!                case CASE_CNL:
!                       /* cursor next line */
!                       CursorNextLine(screen, param[0]);
                        parsestate = groundtable;
                        break;
  
***************
*** 1377,1386 ****
                        /* NEL */
                        Index(screen, 1);
                        CarriageReturn(screen);
!                       
!                       if (XtAppPending(app_con) ||
!                           GetBytesAvailable (ConnectionNumber(screen->display)) > 0)
!                         xevents();
                        parsestate = groundtable;
                        break;
  
--- 1603,1609 ----
                        /* NEL */
                        Index(screen, 1);
                        CarriageReturn(screen);
!                       do_xevents();
                        parsestate = groundtable;
                        break;
  
***************
*** 1412,1424 ****
                        /* enter csi state */
                        nparam = 1;
                        param[0] = DEFAULT;
!                       parsestate = csitable;
                        break;
  
!                case CASE_OSC:
!                       /* Operating System Command: ESC ] */
!                       do_osc(finput);
                        parsestate = groundtable;
                        break;
  
                 case CASE_RIS:
--- 1635,1662 ----
                        /* enter csi state */
                        nparam = 1;
                        param[0] = DEFAULT;
!                       parsestate = csi_table;
                        break;
  
!                case CASE_ESC_SP_STATE:
!                       /* esc space */
!                       parsestate = esc_sp_table;
!                       break;
! 
!                case CASE_S7C1T:
!                       screen->control_eight_bits = False;
                        parsestate = groundtable;
+                       break;
+ 
+                case CASE_S8C1T:
+                       screen->control_eight_bits = True;
+                       parsestate = groundtable;
+                       break;
+ 
+                case CASE_OSC:
+                       /* Operating System Command */
+                       parsestate = sos_table;
+                       string_mode = OSC;
                        break;
  
                 case CASE_RIS:
***************
*** 1467,1473 ****
                        parsestate = groundtable;
                        break;
  
!               case CASE_XTERM_WINOPS:
                        window_ops(term);
                        parsestate = groundtable;
                        break;
--- 1705,1711 ----
                        parsestate = groundtable;
                        break;
  
!                case CASE_XTERM_WINOPS:
                        window_ops(term);
                        parsestate = groundtable;
                        break;
***************
*** 1475,1486 ****
        }
  }
  
- static int finput()
- {
-       return(doinput());
- }
- 
- 
  static char *v_buffer;                /* pointer to physical buffer */
  static char *v_bufstr = NULL; /* beginning of area to write */
  static char *v_bufptr;                /* end of area to write */
--- 1713,1718 ----
***************
*** 1888,1894 ****
      register int      len;
      unsigned          flags, fg, bg;
  {
-       register int cx, cy;
        register unsigned fgs = flags;
        GC      currentGC;
   
--- 2120,2125 ----
***************
*** 1904,1930 ****
  
                        if(screen->scroll_amt)
                                FlushScroll(screen);
-                       cx = CursorX(screen, screen->cur_col);
-                       cy = CursorY(screen, screen->cur_row)+screen->fnt_norm->ascent;
-                       XDrawImageString(screen->display, TextWindow(screen),
-                               currentGC, cx, cy, str, len);
  
!                       /* Fake boldface by drawing the characters one pixel
!                        * offset, if required.
!                        */
!                       if ((fgs & BOLD)
!                        && screen->enbolden
!                        && (currentGC == screen->normalGC
!                         || screen->reverseGC))
!                               XDrawString(screen->display,
!                                       TextWindow(screen),
!                                       currentGC, cx + 1, cy, str, len);
! 
!                       if((fgs & UNDERLINE) && screen->underline) 
!                               XDrawLine(screen->display,
!                                       TextWindow(screen), currentGC,
!                                       cx, cy+1,
!                                       cx + len * FontWidth(screen), cy+1);
                        /*
                         * The following statements compile data to compute the
                         * average number of characters written on each call to
--- 2135,2150 ----
  
                        if(screen->scroll_amt)
                                FlushScroll(screen);
  
!                       if (fgs & INVISIBLE)
!                               memset(str, ' ', len);
! 
!                       drawXtermText(screen, fgs, currentGC,
!                               CursorX(screen, screen->cur_col),
!                               CursorY(screen, screen->cur_row)
!                                       + screen->fnt_norm->ascent,
!                               str, len);
! 
                        /*
                         * The following statements compile data to compute the
                         * average number of characters written on each call to
***************
*** 1952,1961 ****
--- 2172,2189 ----
  
        for (i=0; i<nparam; ++i) {
                switch (param[i]) {
+               case 2:                 /* KAM (if set, keyboard locked */
+                       /* FIXME */
+                       break;
+ 
                case 4:                 /* IRM                          */
                        (*func)(&termw->flags, INSERT);
                        break;
  
+               case 12:                /* SRM (if set, local echo      */
+                       /* FIXME */
+                       break;
+ 
                case 20:                /* LNM                          */
                        (*func)(&termw->flags, LINEFEED);
                        update_autolinefeed();
***************
*** 2038,2044 ****
                        else
                                screen->send_mouse_pos = 0;
                        break;
!               case 25:                /* Show/hide cursor like VT200  */
                        if(func == bitset)
                                screen->cursor_set = ON;
                        else
--- 2266,2272 ----
                        else
                                screen->send_mouse_pos = 0;
                        break;
!               case 25:                /* DECTCEM: Show/hide cursor (VT200) */
                        if(func == bitset)
                                screen->cursor_set = ON;
                        else
***************
*** 2098,2103 ****
--- 2326,2334 ----
                                FromAlternate(screen);
                        }
                        break;
+               case 67:        /* DECBKM */
+                       /* FIXME: back-arrow mapped to backspace or delete(D)*/
+                       break;
                case 1000:              /* xterm bogus sequence         */
                        if(func == bitset)
                                screen->send_mouse_pos = 2;
***************
*** 2461,2466 ****
--- 2692,2702 ----
                                VShellWindow,
                                &text));
                break;
+ 
+       default: /* DECSLPP (24, 25, 36, 48, 72, 144) */
+               if (param[0] >= 24)
+                       RequestResize(termw, param[0], -1, TRUE);
+               break;
        }
  }
  
***************
*** 2485,2490 ****
--- 2721,2740 ----
  }
  
  void
+ unparseputc1(c, fd)
+       int c;
+       int fd;
+ {
+       if (c >= 0x80 && c <= 0x9F) {
+               if (!term->screen.control_eight_bits) {
+                       unparseputc(ESC, fd);
+                       c -= 0x40;
+               }
+       }
+       unparseputc(c, fd);
+ }
+ 
+ void
  unparseseq(ap, fd)
      register ANSI *ap;
      int fd;
***************
*** 2493,2505 ****
        register int    i;
        register int    inters;
  
!       c = ap->a_type;
!       if (c>=0x80 && c<=0x9F) {
!               unparseputc(ESC, fd);
!               c -= 0x40;
!       }
!       unparseputc(c, fd);
!       c = ap->a_type;
        if (c==ESC || c==DCS || c==CSI || c==OSC || c==PM || c==APC) {
                if (ap->a_pintro != 0)
                        unparseputc((char) ap->a_pintro, fd);
--- 2743,2749 ----
        register int    i;
        register int    inters;
  
!       unparseputc1(c = ap->a_type, fd);
        if (c==ESC || c==DCS || c==CSI || c==OSC || c==PM || c==APC) {
                if (ap->a_pintro != 0)
                        unparseputc((char) ap->a_pintro, fd);
***************
*** 2836,2842 ****
--- 3080,3088 ----
     XtermWidget request = (XtermWidget) wrequest;
     XtermWidget new     = (XtermWidget) wnew;
     int i;
+ #if OPT_ISO_COLORS
     Boolean color_ok;
+ #endif
  
     /* Zero out the entire "screen" component of "new" widget,
        then do field-by-field assigment of "screen" fields
***************
*** 2877,2882 ****
--- 3123,3129 ----
     new->screen.pointer_cursor = request->screen.pointer_cursor;
     new->screen.input_eight_bits = request->screen.input_eight_bits;
     new->screen.output_eight_bits = request->screen.output_eight_bits;
+    new->screen.control_eight_bits = request->screen.control_eight_bits;
     new->screen.allowSendEvents = request->screen.allowSendEvents;
     new->misc.titeInhibit = request->misc.titeInhibit;
     new->misc.dynamicColors = request->misc.dynamicColors;
***************
*** 3397,3414 ****
                }
        }
  
!       x = CursorX(screen, screen->cur_col);
!       y = CursorY(screen, screen->cur_row) + 
!         screen->fnt_norm->ascent;
!       XDrawImageString(screen->display, TextWindow(screen), currentGC,
!               x, y, (char *) &c, 1);
! 
!       if((flags & BOLD) && screen->enbolden) /* no bold font */
!               XDrawString(screen->display, TextWindow(screen), currentGC,
!                       x + 1, y, (char *) &c, 1);
!       if((flags & UNDERLINE) && screen->underline) 
!               XDrawLine(screen->display, TextWindow(screen), currentGC,
!                       x, y+1, x + FontWidth(screen), y+1);
        if (!screen->select && !screen->always_highlight) {
                screen->box->x = x;
                screen->box->y = y - screen->fnt_norm->ascent;
--- 3644,3655 ----
                }
        }
  
!       drawXtermText(screen, flags, currentGC,
!               x = CursorX(screen, screen->cur_col),
!               y = CursorY(screen, screen->cur_row) + 
!                       screen->fnt_norm->ascent,
!               (char *) &c, 1);
! 
        if (!screen->select && !screen->always_highlight) {
                screen->box->x = x;
                screen->box->y = y - screen->fnt_norm->ascent;
***************
*** 3428,3434 ****
  {
        register TScreen *screen = &term->screen;
        GC      currentGC;
!       register int x, y, flags, fg = 0, bg = 0;
        char c;
        Boolean in_selection;
  
--- 3669,3675 ----
  {
        register TScreen *screen = &term->screen;
        GC      currentGC;
!       register int flags, fg = 0, bg = 0;
        char c;
        Boolean in_selection;
  
***************
*** 3457,3474 ****
  
        if (c == 0)
                c = ' ';
!       x = CursorX(screen, screen->cursor_col);
!       y = (((screen->cursor_row - screen->topline) * FontHeight(screen))) +
!        screen->border;
!       y = y+screen->fnt_norm->ascent;
!       XDrawImageString(screen->display, TextWindow(screen), currentGC,
!               x, y, &c, 1);
!       if((flags & BOLD) && screen->enbolden)
!               XDrawString(screen->display, TextWindow(screen), currentGC,
!                       x + 1, y, &c, 1);
!       if((flags & UNDERLINE) && screen->underline) 
!               XDrawLine(screen->display, TextWindow(screen), currentGC,
!                       x, y+1, x + FontWidth(screen), y+1);
        screen->cursor_state = OFF;
        resetXtermGC(screen, flags, in_selection);
  }
--- 3698,3710 ----
  
        if (c == 0)
                c = ' ';
! 
!       drawXtermText(screen, flags, currentGC,
!               CursorX(screen, screen->cursor_col),
!               CursorY(screen, screen->cursor_row)
!                       + screen->fnt_norm->ascent,
!               &c, 1);
! 
        screen->cursor_state = OFF;
        resetXtermGC(screen, flags, in_selection);
  }
Index: cursor.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/cursor.c     Wed Jan 10 12:27:01 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/cursor.c     Sun Aug 11 22:20:52 1996
***************
*** 30,39 ****
  
  #include "ptyx.h"             /* also gets Xlib.h */
  
  #include "xterm.h"
  
- extern XtermWidget term;      /* %%% gross */
- 
  static void _CheckSelection PROTO((TScreen *screen));
  
  static void _CheckSelection(screen)
--- 30,38 ----
  
  #include "ptyx.h"             /* also gets Xlib.h */
  
+ #include "data.h"
  #include "xterm.h"
  
  static void _CheckSelection PROTO((TScreen *screen));
  
  static void _CheckSelection(screen)
***************
*** 210,215 ****
--- 209,215 ----
  
  /*
   * Moves Cursor To First Column In Line
+  * (Note: xterm doesn't implement SLH, SLL which would affect use of this)
   */
  void
  CarriageReturn(screen)
***************
*** 255,258 ****
--- 255,284 ----
        tw->flags |= sc->flags & (BOLD|INVERSE|UNDERLINE|ORIGIN);
        CursorSet (screen, (tw->flags & ORIGIN) ? sc->row - screen->top_marg
                           : sc->row, sc->col, tw->flags);
+ }
+ 
+ /*
+  * Move the cursor to the first column of the n-th next line.
+  */
+ void
+ CursorNextLine(screen, count)
+       TScreen *screen;
+       int count;
+ {
+       CursorDown(screen, count < 1 ? 1 : count);
+       CarriageReturn(screen);         
+       do_xevents();
+ }
+ 
+ /*
+  * Move the cursor to the first column of the n-th previous line.
+  */
+ void
+ CursorPrevLine(screen, count)
+       TScreen *screen;
+       int count;
+ {
+       CursorUp(screen, count < 1 ? 1 : count);
+       CarriageReturn(screen);
+       do_xevents();
  }
Index: data.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/data.c       Tue Jan 30 15:59:20 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/data.c       Sun Aug 11 22:20:52 1996
***************
*** 86,93 ****
--- 86,97 ----
  #ifdef DEBUG
  int debug = 0;                /* true causes error messages to be displayed */
  #endif        /* DEBUG */
+ 
+ XtAppContext app_con;
  XtermWidget term;             /* master data structure for client */
  char *xterm_name;     /* argv[0] */
+ Boolean sunFunctionKeys;
+ 
  int am_slave = 0;     /* set to 1 if running as a slave process */
  int max_plus1;
  fd_set Select_mask;
Index: data.h
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/data.h       Mon Feb 12 12:35:46 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/data.h       Sun Aug 11 22:20:53 1996
***************
*** 32,37 ****
--- 32,39 ----
  #define XFD_COPYSET(src,dst) bcopy((src)->fds_bits, (dst)->fds_bits, sizeof(fd_set))
  #endif
  
+ extern XtAppContext app_con;
+ 
  extern TekLink *TekRefresh;
  extern XPoint T_box2[];
  extern XPoint T_box3[];
***************
*** 49,54 ****
--- 51,57 ----
  extern char *ptydev;
  extern char *ttydev;
  extern char *xterm_name;
+ extern Boolean sunFunctionKeys;
  extern Char buffer[];
  extern int T_lastx;
  extern int T_lasty;
Index: input.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/input.c      Mon May 13 15:15:18 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/input.c      Sun Aug 11 22:20:53 1996
***************
*** 45,52 ****
  static int sunfuncvalue PROTO((KeySym keycode));
  static void AdjustAfterInput PROTO((TScreen *screen));
  
- extern Boolean sunFunctionKeys;
- 
  static void
  AdjustAfterInput (screen)
  register TScreen *screen;
--- 45,50 ----
***************
*** 132,148 ****
                keysym == XK_Prior || keysym == XK_Next ||
                keysym == DXK_Remove || keysym == XK_KP_Delete ||
                keysym == XK_KP_Insert) {
!               reply.a_type = CSI;
!               reply.a_nparam = 1;
!               if (sunFunctionKeys) {
!                   reply.a_param[0] = sunfuncvalue (keysym);
!                   reply.a_final = 'z';
                } else {
!                   reply.a_param[0] = funcvalue (keysym);
!                   reply.a_final = '~';
                }
-               if (reply.a_param[0] > 0)
-                       unparseseq(&reply, pty);
                key = TRUE;
        } else if (IsKeypadKey(keysym)) {
                if (keyboard->flags & KYPD_APL) {
--- 130,151 ----
                keysym == XK_Prior || keysym == XK_Next ||
                keysym == DXK_Remove || keysym == XK_KP_Delete ||
                keysym == XK_KP_Insert) {
!               if ((string = udk_lookup(funcvalue(keysym), &nbytes)) != 0) {
!                       while (nbytes-- > 0)
!                               unparseputc(*string++, pty);
                } else {
!                       reply.a_type = CSI;
!                       reply.a_nparam = 1;
!                       if (sunFunctionKeys) {
!                               reply.a_param[0] = sunfuncvalue (keysym);
!                               reply.a_final = 'z';
!                       } else {
!                               reply.a_param[0] = funcvalue (keysym);
!                               reply.a_final = '~';
!                       }
!                       if (reply.a_param[0] > 0)
!                               unparseseq(&reply, pty);
                }
                key = TRUE;
        } else if (IsKeypadKey(keysym)) {
                if (keyboard->flags & KYPD_APL) {
***************
*** 162,168 ****
                    if (screen->input_eight_bits)
                      *string |= 0x80;  /* turn on eighth bit */
                    else
!                     unparseputc (033, pty);  /* escape */
                }
                while (nbytes-- > 0)
                        unparseputc(*string++, pty);
--- 165,171 ----
                    if (screen->input_eight_bits)
                      *string |= 0x80;  /* turn on eighth bit */
                    else
!                     unparseputc (ESC, pty);  /* escape */
                }
                while (nbytes-- > 0)
                        unparseputc(*string++, pty);
***************
*** 195,200 ****
--- 198,204 ----
                AdjustAfterInput(screen);
  }
  
+ /* These definitions are DEC-style (e.g., vt320) */
  static int funcvalue (keycode)
        KeySym  keycode;
  {
***************
*** 238,244 ****
  
  static int sunfuncvalue (keycode)
        KeySym  keycode;
!   {
        switch (keycode) {
                case XK_F1:     return(224);
                case XK_F2:     return(225);
--- 242,248 ----
  
  static int sunfuncvalue (keycode)
        KeySym  keycode;
! {
        switch (keycode) {
                case XK_F1:     return(224);
                case XK_F2:     return(225);
***************
*** 291,294 ****
                default:        return(-1);
        }
  }
- 
--- 295,297 ----
Index: main.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/main.c       Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/main.c       Sun Aug 11 22:20:53 1996
***************
*** 708,714 ****
  static jmp_buf env;
  
  char *ProgramName;
- Boolean sunFunctionKeys;
  
  static struct _resource {
      char *xterm_name;
--- 708,713 ----
***************
*** 1017,1023 ****
  };
  int number_ourTopLevelShellArgs = 2;
        
- XtAppContext app_con;
  Widget toplevel;
  Bool waiting_for_initial_map;
  
--- 1016,1021 ----
Index: menu.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/menu.c       Tue Jan 30 15:59:20 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/menu.c       Sun Aug 11 22:20:53 1996
***************
*** 52,57 ****
--- 52,58 ----
  static void do_logging PROTO_XT_CALLBACK_ARGS;
  #endif
  
+ static void do_8bit_control    PROTO_XT_CALLBACK_ARGS;
  static void do_allow132        PROTO_XT_CALLBACK_ARGS;
  static void do_allowsends      PROTO_XT_CALLBACK_ARGS;
  static void do_altscreen       PROTO_XT_CALLBACK_ARGS;
***************
*** 76,81 ****
--- 77,83 ----
  static void do_scrollttyoutput PROTO_XT_CALLBACK_ARGS;
  static void do_securekbd       PROTO_XT_CALLBACK_ARGS;
  static void do_softreset       PROTO_XT_CALLBACK_ARGS;
+ static void do_sun_fkeys       PROTO_XT_CALLBACK_ARGS;
  static void do_suspend         PROTO_XT_CALLBACK_ARGS;
  static void do_tekcopy         PROTO_XT_CALLBACK_ARGS;
  static void do_tekhide         PROTO_XT_CALLBACK_ARGS;
***************
*** 95,101 ****
  static void do_vtshow          PROTO_XT_CALLBACK_ARGS;
  
  /*
!  * The order entries MUST match the values given in menu.h
   */
  MenuEntry mainMenuEntries[] = {
      { "securekbd",    do_securekbd, NULL },           /*  0 */
--- 97,103 ----
  static void do_vtshow          PROTO_XT_CALLBACK_ARGS;
  
  /*
!  * The order of entries MUST match the values given in menu.h
   */
  MenuEntry mainMenuEntries[] = {
      { "securekbd",    do_securekbd, NULL },           /*  0 */
***************
*** 105,118 ****
  #endif
      { "redraw",               do_redraw, NULL },              /*  3 */
      { "line1",                NULL, NULL },                   /*  4 */
!     { "suspend",      do_suspend, NULL },             /*  5 */
!     { "continue",     do_continue, NULL },            /*  6 */
!     { "interrupt",    do_interrupt, NULL },           /*  7 */
!     { "hangup",               do_hangup, NULL },              /*  8 */
!     { "terminate",    do_terminate, NULL },           /*  9 */
!     { "kill",         do_kill, NULL },                /* 10 */
!     { "line2",                NULL, NULL },                   /* 11 */
!     { "quit",         do_quit, NULL }};               /* 12 */
  
  MenuEntry vtMenuEntries[] = {
      { "scrollbar",    do_scrollbar, NULL },           /*  0 */
--- 107,123 ----
  #endif
      { "redraw",               do_redraw, NULL },              /*  3 */
      { "line1",                NULL, NULL },                   /*  4 */
!     { "8-bit control",        do_8bit_control, NULL },        /*  5 */
!     { "sun function-keys",do_sun_fkeys, NULL },               /*  6 */
!     { "line2",                NULL, NULL },                   /*  7 */
!     { "suspend",      do_suspend, NULL },             /*  8 */
!     { "continue",     do_continue, NULL },            /*  9 */
!     { "interrupt",    do_interrupt, NULL },           /* 10 */
!     { "hangup",               do_hangup, NULL },              /* 11 */
!     { "terminate",    do_terminate, NULL },           /* 12 */
!     { "kill",         do_kill, NULL },                /* 13 */
!     { "line3",                NULL, NULL },                   /* 14 */
!     { "quit",         do_quit, NULL }};               /* 15 */
  
  MenuEntry vtMenuEntries[] = {
      { "scrollbar",    do_scrollbar, NULL },           /*  0 */
***************
*** 235,240 ****
--- 240,247 ----
  #ifdef ALLOWLOGGING
            update_logging();
  #endif
+           update_8bit_control();
+           update_sun_fkeys();
  #if !defined(SIGTSTP) || defined(AMOEBA)
            set_sensitivity (screen->mainMenu,
                             mainMenuEntries[mainMenu_suspend].widget, FALSE);
***************
*** 461,466 ****
--- 468,490 ----
  }
  
  
+ static void do_8bit_control (gw, closure, data)
+     Widget gw;
+     XtPointer closure, data;
+ {
+     term->screen.control_eight_bits = ! term->screen.control_eight_bits;
+     update_8bit_control();
+ }
+ 
+ static void do_sun_fkeys (gw, closure, data)
+     Widget gw;
+     XtPointer closure, data;
+ {
+     sunFunctionKeys = ! sunFunctionKeys;
+     update_sun_fkeys();
+ }
+ 
+ 
  /*
   * The following cases use the pid instead of the process group so that we
   * don't get hosed by programs that change their process group
***************
*** 1032,1037 ****
--- 1056,1081 ----
      Cardinal *param_count;
  {
      do_quit(w, NULL, NULL);
+ }
+ 
+ void Handle8BitControl(w, event, params, param_count)
+     Widget w;
+     XEvent *event;
+     String *params;
+     Cardinal *param_count;
+ {
+     handle_toggle (do_8bit_control, (int) term->screen.control_eight_bits,
+                  params, *param_count, w, NULL, NULL);
+ }
+ 
+ void HandleSunFunctionKeys(w, event, params, param_count)
+     Widget w;
+     XEvent *event;
+     String *params;
+     Cardinal *param_count;
+ {
+     handle_toggle (do_sun_fkeys, (int) sunFunctionKeys,
+                  params, *param_count, w, NULL, NULL);
  }
  
  void HandleScrollbar(w, event, params, param_count)
Index: menu.h
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/menu.h       Wed Jan 10 12:27:01 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/menu.h       Sun Aug 11 22:20:53 1996
***************
*** 45,50 ****
--- 45,51 ----
  extern MenuEntry fontMenuEntries[];
  extern Arg menuArgs[];
  
+ extern void Handle8BitControl      PROTO_XT_ACTIONS_ARGS;
  extern void HandleAllow132         PROTO_XT_ACTIONS_ARGS;
  extern void HandleAllowSends       PROTO_XT_ACTIONS_ARGS;
  extern void HandleAltScreen        PROTO_XT_ACTIONS_ARGS;
***************
*** 71,76 ****
--- 72,78 ----
  extern void HandleSetTerminalType  PROTO_XT_ACTIONS_ARGS;
  extern void HandleSetVisualBell    PROTO_XT_ACTIONS_ARGS;
  extern void HandleSoftReset        PROTO_XT_ACTIONS_ARGS;
+ extern void HandleSunFunctionKeys  PROTO_XT_ACTIONS_ARGS;
  extern void HandleTekCopy          PROTO_XT_ACTIONS_ARGS;
  extern void HandleTekPage          PROTO_XT_ACTIONS_ARGS;
  extern void HandleTekReset         PROTO_XT_ACTIONS_ARGS;
***************
*** 90,110 ****
  /*
   * items in primary menu
   */
! #define mainMenu_securekbd 0
! #define mainMenu_allowsends 1
  #ifdef ALLOWLOGGING
! #define mainMenu_logging 2
  #endif
! #define mainMenu_redraw 3
! #define mainMenu_line1 4
! #define mainMenu_suspend 5
! #define mainMenu_continue 6
! #define mainMenu_interrupt 7
! #define mainMenu_hangup 8
! #define mainMenu_terminate 9
! #define mainMenu_kill 10
! #define mainMenu_line2 11
! #define mainMenu_quit 12
  
  
  /*
--- 92,118 ----
  /*
   * items in primary menu
   */
! #define mainMenu_securekbd  ( 0)
! #define mainMenu_allowsends ( 1)
  #ifdef ALLOWLOGGING
! #define mainMenu_logging    ( 2)
! #define mainMenu_fix1       ( 0)
! #else
! #define mainMenu_fix1       (-1)
  #endif
! #define mainMenu_redraw     ( 3 + mainMenu_fix1)
! #define mainMenu_line1      ( 4 + mainMenu_fix1)
! #define mainMenu_8bit_ctrl  ( 5 + mainMenu_fix1)
! #define mainMenu_sun_fkeys  ( 6 + mainMenu_fix1)
! #define mainMenu_line2      ( 7 + mainMenu_fix1)
! #define mainMenu_suspend    ( 8 + mainMenu_fix1)
! #define mainMenu_continue   ( 9 + mainMenu_fix1)
! #define mainMenu_interrupt  (10 + mainMenu_fix1)
! #define mainMenu_hangup     (11 + mainMenu_fix1)
! #define mainMenu_terminate  (12 + mainMenu_fix1)
! #define mainMenu_kill       (13 + mainMenu_fix1)
! #define mainMenu_line3      (14 + mainMenu_fix1)
! #define mainMenu_quit       (15 + mainMenu_fix1)
  
  
  /*
***************
*** 204,209 ****
--- 212,227 ----
                    mainMenuEntries[mainMenu_logging].widget, \
                    term->screen.logging)
  #endif
+ 
+ #define update_8bit_control() \
+   update_menu_item (term->screen.mainMenu, \
+                   mainMenuEntries[mainMenu_8bit_ctrl].widget, \
+                   term->screen.control_eight_bits)
+ 
+ #define update_sun_fkeys() \
+   update_menu_item (term->screen.mainMenu, \
+                   mainMenuEntries[mainMenu_sun_fkeys].widget, \
+                   sunFunctionKeys)
  
  #define update_scrollbar() \
    update_menu_item (term->screen.vtMenu, \
Index: misc.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/misc.c       Sun Jun 30 12:03:00 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/misc.c       Sun Aug 11 22:20:53 1996
***************
*** 44,49 ****
--- 44,50 ----
  #include <X11/Xmu/SysUtil.h>
  #include <X11/Xmu/WinUtil.h>
  
+ #include "VTparse.h"
  #include "data.h"
  #include "error.h"
  #include "menu.h"
***************
*** 77,89 ****
  extern char *getenv();
  #endif
  
- extern XtermWidget term;
  extern Widget toplevel;               /* used in 'ChangeGroup()' */
  
  static Boolean AllocateColor PROTO((XtermWidget pTerm, ScrnColors *pNew, int ndx, char *name));
  static Boolean ChangeColorsRequest PROTO((XtermWidget pTerm, int start, char *names));
  static Boolean GetOldColors PROTO(( XtermWidget pTerm));
  static Boolean UpdateOldColors PROTO((XtermWidget pTerm, ScrnColors *pNew));
  static void ChangeGroup PROTO((String attribute, XtArgVal value));
  static void DoSpecialEnterNotify PROTO((XEnterWindowEvent *ev));
  static void DoSpecialLeaveNotify PROTO((XEnterWindowEvent *ev));
--- 78,90 ----
  extern char *getenv();
  #endif
  
  extern Widget toplevel;               /* used in 'ChangeGroup()' */
  
  static Boolean AllocateColor PROTO((XtermWidget pTerm, ScrnColors *pNew, int ndx, char *name));
  static Boolean ChangeColorsRequest PROTO((XtermWidget pTerm, int start, char *names));
  static Boolean GetOldColors PROTO(( XtermWidget pTerm));
  static Boolean UpdateOldColors PROTO((XtermWidget pTerm, ScrnColors *pNew));
+ static int hexvalue PROTO((int c));
  static void ChangeGroup PROTO((String attribute, XtArgVal value));
  static void DoSpecialEnterNotify PROTO((XEnterWindowEvent *ev));
  static void DoSpecialLeaveNotify PROTO((XEnterWindowEvent *ev));
***************
*** 91,97 ****
  static void unselectwindow PROTO((TScreen *screen, int flag));
  static void withdraw_window PROTO((Display *dpy, Window w, int scr));
  
! extern XtAppContext app_con;
  
  void
  xevents()
--- 92,106 ----
  static void unselectwindow PROTO((TScreen *screen, int flag));
  static void withdraw_window PROTO((Display *dpy, Window w, int scr));
  
! void
! do_xevents()
! {
!       register TScreen *screen = &term->screen;
! 
!       if (XtAppPending(app_con)
!       || GetBytesAvailable (ConnectionNumber(screen->display)) > 0)
!               xevents();
! }
  
  void
  xevents()
***************
*** 177,182 ****
--- 186,192 ----
  #endif
        Input (&term->keyboard, screen, &event->xkey, False);
  }
+ 
  /* ARGSUSED */
  void HandleEightBitKeyPressed(w, event, params, nparams)
      Widget w;
***************
*** 374,382 ****
         the bell again? */
      if(screen->bellSuppressTime) {
        if(screen->bellInProgress) {
!           if (XtAppPending(app_con) ||
!               GetBytesAvailable (ConnectionNumber(screen->display)) > 0)
!               xevents();
            if(screen->bellInProgress) { /* even after new events? */
                return;
            }
--- 384,390 ----
         the bell again? */
      if(screen->bellSuppressTime) {
        if(screen->bellInProgress) {
!           do_xevents();
            if(screen->bellInProgress) { /* even after new events? */
                return;
            }
***************
*** 716,757 ****
  #endif /* ALLOWLOGGING */
  
  void
! do_osc(func)
! int (*func) PROTO((void));
  {
!       register int mode, c;
!       register char *cp;
!       char buf[512];
!       char *bufend = &buf[(sizeof buf) - 1];  /* leave room for null */
!       Bool okay = True;
  
        /* 
!        * lines should be of the form <ESC> ] number ; string <BEL>
!        *
!        * where number is one of 0, 1, 2, or 46
         */
        mode = 0;
!       while(isdigit(c = (*func)()))
!               mode = 10 * mode + (c - '0');
!       if (c != ';') okay = False;
!       cp = buf;
!       while(isprint((c = (*func)()) & 0x7f) && cp < bufend)
!               *cp++ = c;
!       if (c != 7) okay = False;
!       *cp = 0;
!       if (okay) switch(mode) {
!        case 0:        /* new icon name and title*/
                Changename(buf);
                Changetitle(buf);
                break;
  
!        case 1:        /* new icon name only */
                Changename(buf);
                break;
  
!        case 2:        /* new title only */
                Changetitle(buf);
                break;
          case 10:       case 11:        case 12:
          case 13:       case 14:        case 15:
          case 16:
--- 724,779 ----
  #endif /* ALLOWLOGGING */
  
  void
! do_osc(oscbuf, len)
! Char *oscbuf;
! int len;
  {
!       register int mode;
!       register Char *cp;
!       int state = 0;
!       char *buf = 0;
  
        /* 
!        * lines should be of the form <OSC> number ; string <ST>
         */
        mode = 0;
!       for (cp = oscbuf; *cp != '\0'; cp++) {
!               switch (state) {
!               case 0:
!                       if (isdigit(*cp)) {
!                               mode = 10 * mode + (*cp - '0');
!                               break;
!                       }
!                       /* FALLTHRU */
!               case 1:
!                       if (*cp != ';')
!                               return;
!                       state = 2;
!                       break;
!               case 2:
!                       buf = (char *)cp;
!                       state = 3;
!                       /* FALLTHRU */
!               default:
!                       if (!isprint(*cp & 0x7f))
!                               return;
!               }
!       }
! 
!       switch(mode) {
!       case 0: /* new icon name and title*/
                Changename(buf);
                Changetitle(buf);
                break;
  
!       case 1: /* new icon name only */
                Changename(buf);
                break;
  
!       case 2: /* new title only */
                Changetitle(buf);
                break;
+ 
          case 10:       case 11:        case 12:
          case 13:       case 14:        case 15:
          case 16:
***************
*** 790,795 ****
--- 812,979 ----
         * but that could potentially open a fairly nasty security hole.
         */
        }
+ }
+ 
+ #define MAX_UDK 35
+ static struct {
+       char *str;
+       int   len;
+       } user_keys[MAX_UDK];
+ 
+ static int
+ hexvalue(c)
+       int c;
+ {
+       if (c >= '0' && c <= '9') return c - '0';
+       if (c >= 'A' && c <= 'F') return c - 'A' + 10;
+       if (c >= 'a' && c <= 'f') return c - 'a' + 10;
+       return -1;
+ }
+ 
+ void
+ do_dcs(dcsbuf, dcslen)
+ Char *dcsbuf;
+ int dcslen;
+ {
+       register TScreen *screen = &term->screen;
+       char *cp = (char *)dcsbuf;
+ 
+       if (*cp == '$') { /* DECRQSS */
+               char reply[BUFSIZ];
+               Bool okay = True;
+ 
+               cp++;
+               if (*cp++ == 'q') {
+                       if (!strcmp(cp, "\"q")) {               /* DECSCA */
+                               sprintf(reply, "%d%s",
+                                       (screen->protected_mode == DEC_PROTECT)
+                                        && (term->flags & PROTECTED) ? 1 : 0,
+                                       cp);
+                       } else if (!strcmp(cp, "\"p")) {        /* DECSCL */
+                               sprintf(reply, "%d%s",
+                                       screen->ansi_level + 60,
+                                       cp);
+                       } else if (!strcmp(cp, "r")) {          /* DECSTBM */
+                               sprintf(reply, "%d;%dr",
+                                       screen->top_marg + 1,
+                                       screen->bot_marg + 1);
+                       } else if (!strcmp(cp, "m")) {          /* SGR */
+                               strcpy(reply, "0");
+                               if (term->flags & BOLD)
+                                       strcat(reply, ";1");
+                               if (term->flags & UNDERLINE)
+                                       strcat(reply, ";4");
+                               if (term->flags & INVERSE)
+                                       strcat(reply, ";7");
+                               if (term->flags & INVISIBLE)
+                                       strcat(reply, ";8");
+                               if_OPT_ISO_COLORS(screen,{
+                               if (term->flags & BG_COLOR)
+                                       sprintf(reply+strlen(reply),
+                                               ";3%d", term->cur_foreground);
+                               if (term->flags & FG_COLOR)
+                                       sprintf(reply+strlen(reply),
+                                               ";4%d", term->cur_background);
+                               })
+                               strcat(reply, "m");
+                       } else
+                               okay = False;
+ 
+                       unparseputc1(DCS, screen->respond);
+                       unparseputc(okay ? '0' : '1', screen->respond);
+                       unparseputc('$', screen->respond);
+                       unparseputc('r', screen->respond);
+                       if (okay)
+                               cp = reply;
+                       while (*cp != '\0')
+                               unparseputc(*cp++, screen->respond);
+                       unparseputc1(ST, screen->respond);
+               } else {
+                       unparseputc(CAN, screen->respond);
+               }
+       } else { /* DECUDK */
+               Bool clear_all = True;
+               Bool lock_keys = True;
+ 
+               if (dcslen != strlen(cp))
+                       /* shouldn't have nulls in the string */
+                       return;
+ 
+               if (*cp == '0') {
+                       cp++;
+               } else if (*cp == '1') {
+                       cp++;
+                       clear_all = False;
+               }
+ 
+               if (*cp == ';')
+                       cp++;
+               else if (*cp != '|')
+                       return;
+ 
+               if (*cp == '0') {
+                       cp++;
+               } else if (*cp == '1') {
+                       cp++;
+                       lock_keys = False;
+               }
+ 
+               if (*cp++ != '|')
+                       return;
+ 
+               if (clear_all) {
+                       int n;
+                       for (n = 0; n < MAX_UDK; n++) {
+                               if (user_keys[n].str != 0) {
+                                       free(user_keys[n].str);
+                                       user_keys[n].str = 0;
+                                       user_keys[n].len = 0;
+                               }
+                       }
+               }
+ 
+               while (*cp) {
+                       char *str = malloc(strlen(cp) + 2);
+                       int key = 0;
+                       int len = 0;
+ 
+                       while (isdigit(*cp))
+                               key = (key * 10) + (*cp++ - '0');
+                       if (*cp == '/') {
+                               cp++;
+                               while (*cp != ';' && *cp != '\0') {
+                                       int hi = hexvalue(*cp++);
+                                       int lo = hexvalue(*cp++);
+                                       if (hi >= 0 && lo >= 0)
+                                               str[len++] = (hi << 4) | lo;
+                                       else
+                                               return;
+                               }
+                       }
+                       if (len > 0 && key < MAX_UDK) {
+                               if (user_keys[key].str != 0)
+                                       free(user_keys[key].str);
+                               user_keys[key].str = str;
+                               user_keys[key].len = len;
+                       } else {
+                               free(str);
+                       }
+                       if (*cp == ';')
+                               cp++;
+               }
+       }
+ }
+ 
+ char *
+ udk_lookup(keycode, len)
+       int keycode;
+       int *len;
+ {
+       if (keycode < MAX_UDK) {
+               *len = user_keys[keycode].len;
+               return user_keys[keycode].str;
+       }
+       return 0;
  }
  
  static void
Index: os2main.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/os2main.c    Mon Mar 11 13:48:46 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/os2main.c    Sun Aug 11 22:20:53 1996
***************
*** 229,235 ****
  static jmp_buf env;
  
  char *ProgramName;
- Boolean sunFunctionKeys;
  
  static struct _resource {
      char *xterm_name;
--- 229,234 ----
Index: ptyx.h
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/ptyx.h       Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/ptyx.h       Sun Aug 11 22:20:53 1996
***************
*** 162,179 ****
--- 162,185 ----
   * ANSI emulation.
   */
  #define INQ   0x05
+ #define BEL   0x07
  #define       FF      0x0C                    /* C0, C1 control names         */
  #define       LS1     0x0E
  #define       LS0     0x0F
+ #define       NAK     0x15
  #define       CAN     0x18
  #define       SUB     0x1A
  #define       ESC     0x1B
  #define US    0x1F
  #define       DEL     0x7F
  #define HTS     ('H'+0x40)
+ #define       RI      0x8D
  #define       SS2     0x8E
  #define       SS3     0x8F
  #define       DCS     0x90
+ #define       SPA     0x96
+ #define       EPA     0x97
+ #define       SOS     0x98
  #define       OLDID   0x9A                    /* ESC Z                        */
  #define       CSI     0x9B
  #define       ST      0x9C
***************
*** 456,463 ****
--- 462,471 ----
        char            curgl;          /* Current GL setting.          */
        char            curgr;          /* Current GR setting.          */
        char            curss;          /* Current single shift.        */
+       int             ansi_level;     /* 0=vt100, 1,2,3 = vt100 ... vt320 */
        int             scroll_amt;     /* amount to scroll             */
        int             refresh_amt;    /* amount to refresh            */
+       int             protected_mode; /* 0=off, 1=DEC, 2=ISO          */
        Boolean         jumpscroll;     /* whether we should jumpscroll */
        Boolean         always_highlight; /* whether to highlight cursor */
        Boolean         underline;      /* whether to underline text    */
***************
*** 510,515 ****
--- 518,524 ----
        Cardinal        selection_count; /* how many atoms in use */
        Boolean         input_eight_bits;/* use 8th bit instead of ESC prefix */
        Boolean         output_eight_bits; /* honor all bits or strip */
+       Boolean         control_eight_bits; /* send CSI as 8-bits */
        Pixmap          menu_item_bitmap;       /* mask for checking items */
        Widget          mainMenu, vtMenu, tekMenu, fontMenu;
        char*           menu_font_names[NMENUFONTS];
***************
*** 644,650 ****
                                   empty parts of the screen when selecting */
  
                        /* mask: user-visible attributes */
! #define       ATTRIBUTES      (INVERSE|UNDERLINE|BOLD|BG_COLOR|FG_COLOR|PROTECTED)
  
  #define WRAPAROUND    0x400   /* true if auto wraparound mode */
  #define       REVERSEWRAP     0x800   /* true if reverse wraparound mode */
--- 653,659 ----
                                   empty parts of the screen when selecting */
  
                        /* mask: user-visible attributes */
! #define       ATTRIBUTES      (INVERSE|UNDERLINE|BOLD|BG_COLOR|FG_COLOR|INVISIBLE|PROTECTED)
  
  #define WRAPAROUND    0x400   /* true if auto wraparound mode */
  #define       REVERSEWRAP     0x800   /* true if reverse wraparound mode */
***************
*** 654,660 ****
--- 663,681 ----
  #define INSERT                0x8000  /* true if in insert mode */
  #define SMOOTHSCROLL  0x10000 /* true if in smooth scroll mode */
  #define IN132COLUMNS  0x20000 /* true if in 132 column mode */
+ #define INVISIBLE     0x40000 /* true if writing invisible text */
  
+ /*
+  * If we've set protected attributes with the DEC-style DECSCA, then we'll have
+  * to use DECSED or DECSEL to erase preserving protected text.  (The normal ED,
+  * EL won't preserve protected-text).  If we've used SPA, then normal ED and EL
+  * will preserve protected-text.  To keep things simple, just remember the last
+  * control that was used to begin protected-text, and use that to determine how
+  * erases are performed (otherwise we'd need 2 bits per protected character).
+  */
+ #define OFF_PROTECT 0
+ #define DEC_PROTECT 1
+ #define ISO_PROTECT 2
  
  #define VWindow(screen)               (screen->fullVwin.window)
  #define VShellWindow          term->core.parent->core.window
Index: screen.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/screen.c     Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/screen.c     Sun Aug 11 22:20:54 1996
***************
*** 228,236 ****
        })
  
        wrappedbit = *attrs & LINEWRAPPED;
        flags &= ATTRIBUTES;
        flags |= CHARDRAWN;
-       memcpy( col,   str,    length);
        memset( attrs, flags,  length);
  
        if_OPT_ISO_COLORS(screen,{
--- 228,243 ----
        })
  
        wrappedbit = *attrs & LINEWRAPPED;
+ 
+       /* write blanks if we're writing invisible text */
+       if (flags & INVISIBLE) {
+               bzero(col,   length);
+       } else {
+               memcpy( col,   str,    length);
+       }
+ 
        flags &= ATTRIBUTES;
        flags |= CHARDRAWN;
        memset( attrs, flags,  length);
  
        if_OPT_ISO_COLORS(screen,{
***************
*** 445,451 ****
           int lastind;
           int flags;
           int fg = 0, bg = 0;
!          int x, n;
           GC gc;
           Boolean hilite;      
  
--- 452,458 ----
           int lastind;
           int flags;
           int fg = 0, bg = 0;
!          int x;
           GC gc;
           Boolean hilite;      
  
***************
*** 517,531 ****
                 || ((flags & BG_COLOR) && (bgs[col] != bg))
  #endif
                 ) {
! 
!                  XDrawImageString(screen->display, TextWindow(screen), 
!                               gc, x, y, (char *) &chars[lastind], n = col - lastind);
!                  if((flags & BOLD) && screen->enbolden)
!                       XDrawString(screen->display, TextWindow(screen), 
!                        gc, x + 1, y, (char *) &chars[lastind], n);
!                  if((flags & UNDERLINE) && screen->underline) 
!                       XDrawLine(screen->display, TextWindow(screen), 
!                        gc, x, y+1, x+n*FontWidth(screen), y+1);
  
                   x += (col - lastind) * FontWidth(screen);
  
--- 524,531 ----
                 || ((flags & BG_COLOR) && (bgs[col] != bg))
  #endif
                 ) {
!                  drawXtermText(screen, flags, gc, x, y,
!                       (char *) &chars[lastind], col - lastind);
  
                   x += (col - lastind) * FontWidth(screen);
  
***************
*** 544,557 ****
                        chars[col] = ' ';
           }
  
!          XDrawImageString(screen->display, TextWindow(screen), gc, 
!                x, y, (char *) &chars[lastind], n = col - lastind);
!          if((flags & BOLD) && screen->enbolden)
!               XDrawString(screen->display, TextWindow(screen), gc,
!               x + 1, y, (char *) &chars[lastind], n);
!          if((flags & UNDERLINE) && screen->underline) 
!               XDrawLine(screen->display, TextWindow(screen), gc, 
!                x, y+1, x + n * FontWidth(screen), y+1);
        }
  
        /*
--- 544,551 ----
                        chars[col] = ' ';
           }
  
!          drawXtermText(screen, flags, gc, x, y,
!               (char *) &chars[lastind], col - lastind);
        }
  
        /*
Index: tabs.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/tabs.c       Wed Jan 10 12:27:01 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/tabs.c       Sun Aug 11 22:20:54 1996
***************
*** 38,43 ****
--- 38,49 ----
   * This file presumes 32bits/word.  This is somewhat of a crock, and should
   * be fixed sometime.
   */
+ #define TAB_INDEX(n) ((n) >> 5)
+ #define TAB_MASK(n)  (1 << ((n) & 31))
+ 
+ #define SET_TAB(tabs,n) tabs[TAB_INDEX(n)] |=  TAB_MASK(n)
+ #define CLR_TAB(tabs,n) tabs[TAB_INDEX(n)] &= ~TAB_MASK(n)
+ #define TST_TAB(tabs,n) tabs[TAB_INDEX(n)] &   TAB_MASK(n)
  
  /*
   * places tabstops at only every 8 columns
***************
*** 64,70 ****
      Tabs      tabs;
      int               col;
  {
!       tabs[col >> 5] |= (1 << (col & 31));
  }
  
  /*
--- 70,76 ----
      Tabs      tabs;
      int               col;
  {
!       SET_TAB(tabs,col);
  }
  
  /*
***************
*** 75,81 ****
      Tabs      tabs;
      int               col;
  {
!       tabs[col >> 5] &= ~(1 << (col & 31));
  }
  
  /*
--- 81,87 ----
      Tabs      tabs;
      int               col;
  {
!       CLR_TAB(tabs,col);
  }
  
  /*
***************
*** 95,104 ****
                col = screen->cur_col = screen->do_wrap = 0;
        }
        for (++col; col<MAX_TABS; ++col)
!               if (tabs[col >> 5] & (1 << (col & 31)))
                        return (col);
  
        return (MAX_TABS - 1);
  }
  
  /*
--- 101,157 ----
                col = screen->cur_col = screen->do_wrap = 0;
        }
        for (++col; col<MAX_TABS; ++col)
!               if (TST_TAB(tabs,col))
                        return (col);
  
        return (MAX_TABS - 1);
+ }
+ 
+ /*
+  * returns the column of the previous tabstop
+  * (or 0 if there are no more).
+  * A tabstop at col is ignored.
+  */
+ int
+ TabPrev (tabs, col)
+     Tabs      tabs;
+     int               col;
+ {
+       for (--col; col >= 0; --col)
+               if (TST_TAB(tabs,col))
+                       return (col);
+ 
+       return (0);
+ }
+ 
+ /*
+  * Tab to the next stop, returning true if the cursor moved
+  */
+ Boolean
+ TabToNextStop()
+ {
+       register TScreen *screen = &term->screen;
+       int saved_column = screen->cur_col;
+ 
+       screen->cur_col = TabNext(term->tabs, screen->cur_col);
+       if (screen->cur_col > screen->max_col)
+               screen->cur_col = screen->max_col;
+ 
+       return (screen->cur_col > saved_column);
+ }
+ 
+ /*
+  * Tab to the previous stop, returning true if the cursor moved
+  */
+ Boolean
+ TabToPrevStop()
+ {
+       register TScreen *screen = &term->screen;
+       int saved_column = screen->cur_col;
+ 
+       screen->cur_col = TabPrev(term->tabs, screen->cur_col);
+ 
+       return (screen->cur_col < saved_column);
  }
  
  /*
Index: terminfo
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/terminfo     Sat Aug 10 14:59:48 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/terminfo     Sun Aug 11 22:20:54 1996
***************
*** 36,41 ****
--- 36,42 ----
        dch1=\E[P,
        dl=\E[%p1%dM,
        dl1=\E[M,
+       ech=\E[%p1%dX,
        ed=\E[J,
        el=\E[K,
        el1=\E[1K,
Index: util.c
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/util.c       Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/util.c       Sun Aug 11 22:20:54 1996
***************
*** 39,45 ****
--- 39,50 ----
  
  extern Bool waiting_for_initial_map;
  
+ static int ClearInLine PROTO((TScreen *screen, int row, int col, int len));
  static int handle_translated_exposure PROTO((TScreen *screen, int rect_x, int rect_y, unsigned int rect_width, unsigned int rect_height));
+ static void ClearAbove PROTO((TScreen *screen));
+ static void ClearBelow PROTO((TScreen *screen));
+ static void ClearLeft PROTO((TScreen *screen));
+ static void ClearLine PROTO((TScreen *screen));
  static void CopyWait PROTO((TScreen *screen));
  static void copy_area PROTO((TScreen *screen, int src_x, int src_y, unsigned int width, unsigned int height, int dest_x, int dest_y));
  static void horizontal_copy_area PROTO((TScreen *screen, int firstchar, int nchars, int amount));
***************
*** 474,481 ****
      register TScreen *screen;
      register int n;
  {
-         register int cx, cy;
- 
        if(screen->cursor_state)
                HideCursor();
        screen->do_wrap = 0;
--- 479,484 ----
***************
*** 493,510 ****
                    horizontal_copy_area(screen, screen->cur_col,
                                         screen->max_col+1 - (screen->cur_col+n),
                                         n);
-       
-               cx = CursorX (screen, screen->cur_col);
-               cy = CursorY (screen, screen->cur_row);
  
!               useCurBackground(TRUE);
!               XFillRectangle(
!                   screen->display,
!                   TextWindow(screen), 
!                   screen->reverseGC,
!                   cx, cy,
!                   (unsigned) n * FontWidth(screen), (unsigned) FontHeight(screen));
!               useCurBackground(FALSE);
            }
        }
        /* adjust screen->buf */
--- 496,508 ----
                    horizontal_copy_area(screen, screen->cur_col,
                                         screen->max_col+1 - (screen->cur_col+n),
                                         n);
  
!               FillCurBackground(
!                       screen,
!                       CursorX (screen, screen->cur_col),
!                       CursorY (screen, screen->cur_row),
!                       (unsigned) n * FontWidth(screen),
!                       (unsigned) FontHeight(screen));
            }
        }
        /* adjust screen->buf */
***************
*** 536,725 ****
                                     screen->max_col+1 - (screen->cur_col+n),
                                     -n);
        
!               useCurBackground(TRUE);
!               XFillRectangle
!                   (screen->display, TextWindow(screen),
!                    screen->reverseGC,
!                    screen->border + screen->scrollbar
!                      + Width(screen) - n*FontWidth(screen),
!                    CursorY (screen, screen->cur_row), n * FontWidth(screen),
!                    FontHeight(screen));
!               useCurBackground(FALSE);
            }
        }
        /* adjust screen->buf */
        ScrnDeleteChar (screen, n, screen->max_col + 1);
- 
  }
  
  /*
   * Clear from cursor position to beginning of display, inclusive.
   */
! void
  ClearAbove (screen)
  register TScreen *screen;
  {
!       register top, height;
  
!       if(screen->cursor_state)
!               HideCursor();
!       if((top = -screen->topline) <= screen->max_row) {
!               if(screen->scroll_amt)
!                       FlushScroll(screen);
!               if((height = screen->cur_row + top) > screen->max_row)
!                       height = screen->max_row;
!               if((height -= top) > 0) {
!                       ClearCurBackground(screen,
!                           top * FontHeight(screen) + screen->border,
!                           screen->border + screen->scrollbar,
!                           height * FontHeight(screen),
!                           Width(screen));
                }
! 
!               if(screen->cur_row - screen->topline <= screen->max_row)
!                       ClearLeft(screen);
        }
!       ClearBufRows(screen, 0, screen->cur_row - 1);
  }
  
  /*
   * Clear from cursor position to end of display, inclusive.
   */
! void
  ClearBelow (screen)
  register TScreen *screen;
  {
!       register top;
  
!       ClearRight(screen);
!       if((top = screen->cur_row - screen->topline) <= screen->max_row) {
!               if(screen->scroll_amt)
!                       FlushScroll(screen);
!               if(++top <= screen->max_row) {
!                       ClearCurBackground(screen,
!                           top * FontHeight(screen) + screen->border,
!                           screen->border + screen->scrollbar,
!                           (screen->max_row - top + 1) * FontHeight(screen),
!                           Width(screen));
                }
        }
-       ClearBufRows(screen, screen->cur_row + 1, screen->max_row);
  }
  
! /* 
!  * Clear last part of cursor's line, inclusive.
   */
! void
! ClearRight (screen)
! register TScreen *screen;
  {
!       int     len = (screen->max_col - screen->cur_col + 1);
!       ScrnBuf buf = screen->buf;
!       Char *attrs = BUF_ATTRS(buf, screen->cur_row) + screen->cur_col;
  
        if(screen->cursor_state)
                HideCursor();
        screen->do_wrap = 0;
!       if(screen->cur_row - screen->topline <= screen->max_row) {
!           if(!AddToRefresh(screen)) {
!       if(screen->scroll_amt)
!               FlushScroll(screen);
!               useCurBackground(TRUE);
!               XFillRectangle(screen->display, TextWindow(screen),
!                 screen->reverseGC,
!                CursorX(screen, screen->cur_col),
!                CursorY(screen, screen->cur_row),
!                Width(screen) - screen->cur_col * FontWidth(screen),
!                FontHeight(screen));
!               useCurBackground(FALSE);
!           }
        }
!       bzero(BUF_CHARS(buf, screen->cur_row) + screen->cur_col, len);
!       memset(attrs, TERM_COLOR_FLAGS, len);
  
        if_OPT_ISO_COLORS(screen,{
!           memset(BUF_FORES(buf, screen->cur_row) + screen->cur_col,
!               (term->flags & FG_COLOR)
!               ? term->cur_foreground : 0, len);
!           memset(BUF_BACKS(buf, screen->cur_row) + screen->cur_col,
!               (term->flags & BG_COLOR)
!               ? term->cur_background : 0, len);
        })
  
        /* with the right part cleared, we can't be wrapping */
!       attrs[0] &= ~LINEWRAPPED;
  }
  
  /*
   * Clear first part of cursor's line, inclusive.
   */
! void
  ClearLeft (screen)
!     register TScreen *screen;
  {
!       int len = screen->cur_col + 1;
!       int flags = CHARDRAWN | TERM_COLOR_FLAGS;
! 
!       if(screen->cursor_state)
!               HideCursor();
!       screen->do_wrap = 0;
!       if(screen->cur_row - screen->topline <= screen->max_row) {
!           if(!AddToRefresh(screen)) {
!               if(screen->scroll_amt)
!                       FlushScroll(screen);
!               useCurBackground(TRUE);
!               XFillRectangle (screen->display, TextWindow(screen),
!                    screen->reverseGC,
!                    screen->border + screen->scrollbar,
!                     CursorY (screen, screen->cur_row),
!                    len * FontWidth(screen),
!                    FontHeight(screen));
!               useCurBackground(FALSE);
!           }
!       }
!       
!       memset(SCRN_BUF_CHARS(screen, screen->cur_row), ' ',   len);
!       memset(SCRN_BUF_ATTRS(screen, screen->cur_row), flags, len);
! 
!       if_OPT_ISO_COLORS(screen,{
!           memset(SCRN_BUF_FORES(screen, screen->cur_row),
!               flags & FG_COLOR ? term->cur_foreground : 0, len);
!           memset(SCRN_BUF_BACKS(screen, screen->cur_row),
!               flags & BG_COLOR ? term->cur_background : 0, len);
!       })
  }
  
  /* 
   * Erase the cursor's line.
   */
! void
  ClearLine(screen)
  register TScreen *screen;
  {
!       if(screen->cursor_state)
!               HideCursor();
!       screen->do_wrap = 0;
!       if(screen->cur_row - screen->topline <= screen->max_row) {
!           if(!AddToRefresh(screen)) {
!               if(screen->scroll_amt)
!                       FlushScroll(screen);
!               useCurBackground(TRUE);
!               XFillRectangle (screen->display, TextWindow(screen), 
!                    screen->reverseGC,
!                    screen->border + screen->scrollbar,
!                     CursorY (screen, screen->cur_row),
!                    Width(screen), FontHeight(screen));
!               useCurBackground(FALSE);
!           }
!       }
! 
!       bzero (SCRN_BUF_CHARS(screen, screen->cur_row), (screen->max_col + 1));
!       bzero (SCRN_BUF_ATTRS(screen, screen->cur_row), (screen->max_col + 1));
! 
!       if_OPT_ISO_COLORS(screen,{
!           bzero (SCRN_BUF_FORES(screen, screen->cur_row), (screen->max_col + 1));
!           bzero (SCRN_BUF_BACKS(screen, screen->cur_row), (screen->max_col + 1));
!       })
  }
  
  void
--- 534,745 ----
                                     screen->max_col+1 - (screen->cur_col+n),
                                     -n);
        
!               FillCurBackground (
!                       screen,
!                       Width(screen) + CursorX(screen, -n),
!                       CursorY (screen, screen->cur_row),
!                       n * FontWidth(screen),
!                       FontHeight(screen));
            }
        }
        /* adjust screen->buf */
        ScrnDeleteChar (screen, n, screen->max_col + 1);
  }
  
  /*
   * Clear from cursor position to beginning of display, inclusive.
   */
! static void
  ClearAbove (screen)
  register TScreen *screen;
  {
!       if (screen->protected_mode != OFF_PROTECT) {
!               register int row;
!               for (row = 0; row <= screen->max_row; row++)
!                       ClearInLine(screen, row, 0, screen->max_col + 1);
!       } else {
!               register int top, height;
  
!               if(screen->cursor_state)
!                       HideCursor();
!               if((top = -screen->topline) <= screen->max_row) {
!                       if(screen->scroll_amt)
!                               FlushScroll(screen);
!                       if((height = screen->cur_row + top) > screen->max_row)
!                               height = screen->max_row;
!                       if((height -= top) > 0) {
!                               ClearCurBackground(screen,
!                                   top * FontHeight(screen) + screen->border,
!                                   screen->border + screen->scrollbar,
!                                   height * FontHeight(screen),
!                                   Width(screen));
!                       }
                }
!               ClearBufRows(screen, 0, screen->cur_row - 1);
        }
! 
!       if(screen->cur_row - screen->topline <= screen->max_row)
!               ClearLeft(screen);
  }
  
  /*
   * Clear from cursor position to end of display, inclusive.
   */
! static void
  ClearBelow (screen)
  register TScreen *screen;
  {
!       ClearRight(screen, -1);
  
!       if (screen->protected_mode != OFF_PROTECT) {
!               register int row;
!               for (row = screen->cur_row + 1; row <= screen->max_row; row++)
!                       ClearInLine(screen, row, 0, screen->max_col + 1);
!       } else {
!               register int top;
! 
!               if((top = screen->cur_row - screen->topline) <= screen->max_row) {
!                       if(screen->scroll_amt)
!                               FlushScroll(screen);
!                       if(++top <= screen->max_row) {
!                               ClearCurBackground(screen,
!                                   top * FontHeight(screen) + screen->border,
!                                   screen->border + screen->scrollbar,
!                                   (screen->max_row - top + 1) * FontHeight(screen),
!                                   Width(screen));
!                       }
                }
+               ClearBufRows(screen, screen->cur_row + 1, screen->max_row);
        }
  }
  
! /*
!  * Clear the given row, for the given range of columns, returning 1 if no
!  * protected characters were found, 0 otherwise.
   */
! static int
! ClearInLine(screen, row, col, len)
!       register TScreen *screen;
!       int row;
!       int col;
!       int len;
  {
!       int rc = 1;
!       int flags = CHARDRAWN | TERM_COLOR_FLAGS;
! 
!       /* If we've marked protected text on the screen, we'll have to
!        * check each time we do an erase.
!        */
!       if (screen->protected_mode != OFF_PROTECT) {
!               register int n;
!               Char *attrs = SCRN_BUF_ATTRS(screen, row) + col;
!               int saved_mode = screen->protected_mode;
!               Bool done;
! 
!               /* disable this branch during recursion */
!               screen->protected_mode = OFF_PROTECT;
! 
!               do {
!                       done = True;
!                       for (n = 0; n < len; n++) {
!                               if (attrs[n] & PROTECTED) {
!                                       rc = 0; /* found a protected segment */
!                                       if (n != 0)
!                                               ClearInLine(screen, row, col, n);
!                                       while ((n < len)
!                                          &&  (attrs[n] & PROTECTED))
!                                               n++;
!                                       done = False;
!                                       break;
!                               }
!                       }
!                       /* setup for another segment, past the protected text */
!                       if (!done) {
!                               attrs += n;
!                               col += n;
!                               len -= n;
!                       }
!               } while (!done);
! 
!               screen->protected_mode = saved_mode;
!               if (len <= 0)
!                       return 0;
!       }
!       /* fall through to the final non-protected segment */
  
        if(screen->cursor_state)
                HideCursor();
        screen->do_wrap = 0;
! 
!       if (row - screen->topline <= screen->max_row) {
!               if(!AddToRefresh(screen)) {
!                       if(screen->scroll_amt)
!                               FlushScroll(screen);
!                       FillCurBackground (
!                               screen,
!                               CursorX (screen, col),
!                               CursorY (screen, row),
!                               len * FontWidth(screen),
!                               FontHeight(screen));
!               }
        }
! 
!       memset(SCRN_BUF_CHARS(screen, row) + col, ' ',   len);
!       memset(SCRN_BUF_ATTRS(screen, row) + col, flags, len);
  
        if_OPT_ISO_COLORS(screen,{
!               memset(SCRN_BUF_FORES(screen, row) + col,
!                       flags & FG_COLOR ? term->cur_foreground : 0, len);
!               memset(SCRN_BUF_BACKS(screen, row) + col,
!                       flags & BG_COLOR ? term->cur_background : 0, len);
        })
  
+       return rc;
+ }
+ 
+ /* 
+  * Clear the next n characters on the cursor's line, including the cursor's
+  * position.
+  */
+ void
+ ClearRight (screen, n)
+ register TScreen *screen;
+ int n;
+ {
+       int     len = (screen->max_col - screen->cur_col + 1);
+ 
+       if (n < 0)      /* the remainder of the line */
+               n = screen->max_col + 1;
+       if (n == 0)     /* default for 'ECH' */
+               n = 1;
+ 
+       if (len > n)
+               len = n;
+ 
+       (void) ClearInLine(screen, screen->cur_row, screen->cur_col, len);
+ 
        /* with the right part cleared, we can't be wrapping */
!       BUF_ATTRS(screen->buf, screen->cur_row)[0] &= ~LINEWRAPPED;
  }
  
  /*
   * Clear first part of cursor's line, inclusive.
   */
! static void
  ClearLeft (screen)
! register TScreen *screen;
  {
!       (void) ClearInLine(screen, screen->cur_row, 0, screen->cur_col + 1);
  }
  
  /* 
   * Erase the cursor's line.
   */
! static void
  ClearLine(screen)
  register TScreen *screen;
  {
!       (void) ClearInLine(screen, screen->cur_row, 0, screen->max_col + 1);
  }
  
  void
***************
*** 743,748 ****
--- 763,862 ----
        ClearBufRows (screen, 0, screen->max_row);
  }
  
+ /*
+  * If we've written protected text DEC-style, and are issuing a non-DEC
+  * erase, temporarily reset the protected_mode flag so that the erase will
+  * ignore the protected flags.
+  */
+ void
+ do_erase_line(screen, param, mode)
+       register TScreen *screen;
+       int param;
+       int mode;
+ {
+       int saved_mode = screen->protected_mode;
+ 
+       if (saved_mode == DEC_PROTECT
+        && saved_mode != mode)
+               screen->protected_mode = OFF_PROTECT;
+ 
+       switch (param) {
+       case -1:        /* DEFAULT */
+       case 0:
+               ClearRight(screen, -1);
+               break;
+       case 1:
+               ClearLeft(screen);
+               break;
+       case 2:
+               ClearLine(screen);
+               break;
+       }
+       screen->protected_mode = saved_mode;
+ }
+ 
+ /*
+  * Just like 'do_erase_line()', except that this intercepts ED controls.  If we
+  * clear the whole screen, we'll get the return-value from ClearInLine, and
+  * find if there were any protected characters left.  If not, reset the
+  * protected mode flag in the screen data (it's slower).
+  */
+ void
+ do_erase_display(screen, param, mode)
+       register TScreen *screen;
+       int param;
+       int mode;
+ {
+       int saved_mode = screen->protected_mode;
+ 
+       if (saved_mode == DEC_PROTECT
+        && saved_mode != mode)
+               screen->protected_mode = OFF_PROTECT;
+ 
+       switch (param) {
+       case -1:        /* DEFAULT */
+       case 0:
+               if (screen->cur_row == 0
+                && screen->cur_col == 0) {
+                       screen->protected_mode = saved_mode;
+                       do_erase_display(screen, 2, mode);
+                       saved_mode = screen->protected_mode;
+               } else
+                       ClearBelow(screen);
+               break;
+ 
+       case 1:
+               if (screen->cur_row == screen->max_row
+                && screen->cur_col == screen->max_col) {
+                       screen->protected_mode = saved_mode;
+                       do_erase_display(screen, 2, mode);
+                       saved_mode = screen->protected_mode;
+               } else
+                       ClearAbove(screen);
+               break;
+ 
+       case 2:
+               /*
+                * We use 'ClearScreen()' throughout the remainder of the
+                * program for places where we don't care if the characters are
+                * protected or not.  So we modify the logic around this call
+                * on 'ClearScreen()' to handle protected characters.
+                */
+               if (screen->protected_mode != OFF_PROTECT) {
+                       register int row;
+                       int rc = 1;
+                       for (row = 0; row <= screen->max_row; row++)
+                               rc &= ClearInLine(screen, row, 0, screen->max_col + 1);
+                       if (rc != 0)
+                               saved_mode = OFF_PROTECT;
+               } else {
+                       ClearScreen(screen);
+               }
+               break;
+       }
+       screen->protected_mode = saved_mode;
+ }
+ 
  static void
  CopyWait(screen)
  register TScreen *screen;
***************
*** 1139,1144 ****
--- 1253,1281 ----
                  colordefs, 2);
      XRecolorCursor (dpy, cursor, colordefs, colordefs+1);
      return;
+ }
+ 
+ /*
+  * Draws text with the specified combination of bold/underline
+  */
+ void
+ drawXtermText(screen, flags, gc, x, y, text, len)
+       register TScreen *screen;
+       unsigned flags;
+       GC gc;
+       int x;
+       int y;
+       char *text;
+       int len;
+ {
+       XDrawImageString(screen->display, TextWindow(screen), gc, 
+               x, y,  text, len);
+       if ((flags & BOLD) && screen->enbolden)
+               XDrawString(screen->display, TextWindow(screen), gc,
+                       x+1, y,  text, len);
+       if ((flags & UNDERLINE) && screen->underline) 
+               XDrawLine(screen->display, TextWindow(screen), gc, 
+                       x, y+1, x + len * FontWidth(screen), y+1);
  }
  
  /*
Index: xterm.h
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/xterm.h      Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/xterm.h      Sun Aug 11 22:20:54 1996
***************
*** 54,59 ****
--- 54,60 ----
  extern void VTReset PROTO((int full));
  extern void VTRun PROTO((void));
  extern void set_cursor_gcs PROTO((TScreen *screen));
+ extern void unparseputc1 PROTO((int c, int fd));
  extern void unparseputc PROTO((int c, int fd));
  extern void unparseseq PROTO((ANSI *ap, int fd));
  
***************
*** 67,72 ****
--- 68,75 ----
  extern void CursorBack PROTO((TScreen *screen, int  n));
  extern void CursorDown PROTO((TScreen *screen, int  n));
  extern void CursorForward PROTO((TScreen *screen, int  n));
+ extern void CursorNextLine PROTO((TScreen *screen, int count));
+ extern void CursorPrevLine PROTO((TScreen *screen, int count));
  extern void CursorRestore PROTO((XtermWidget tw, SavedCursor *sc));
  extern void CursorSave PROTO((XtermWidget tw, SavedCursor *sc));
  extern void CursorSet PROTO((TScreen *screen, int row, int col, unsigned flags));
***************
*** 97,102 ****
--- 100,106 ----
  extern Cursor make_colored_cursor PROTO((unsigned cursorindex, unsigned long fg, unsigned long bg));
  extern char *SysErrorMsg PROTO((int n));
  extern char *strindex PROTO((char *s1, char *s2));
+ extern char *udk_lookup PROTO((int keycode, int *len));
  extern int XStrCmp PROTO((char *s1, char *s2));
  extern int xerror PROTO((Display *d, XErrorEvent *ev));
  extern int xioerror PROTO((Display *dpy));
***************
*** 119,125 ****
  extern void SysError PROTO((int i));
  extern void VisualBell PROTO((void));
  extern void creat_as PROTO((int uid, int gid, char *pathname, int mode));
! extern void do_osc PROTO((int (*func)(void)));
  extern void end_tek_mode PROTO((void));
  extern void end_vt_mode PROTO((void));
  extern void hide_tek_window PROTO((void));
--- 123,131 ----
  extern void SysError PROTO((int i));
  extern void VisualBell PROTO((void));
  extern void creat_as PROTO((int uid, int gid, char *pathname, int mode));
! extern void do_dcs PROTO((Char *buf, int len));
! extern void do_osc PROTO((Char *buf, int len));
! extern void do_xevents PROTO((void));
  extern void end_tek_mode PROTO((void));
  extern void end_vt_mode PROTO((void));
  extern void hide_tek_window PROTO((void));
***************
*** 162,168 ****
--- 168,177 ----
  extern void WindowScroll PROTO((TScreen *screen, int top));
  
  /* tabs.c */
+ extern Boolean TabToNextStop PROTO((void));
+ extern Boolean TabToPrevStop PROTO((void));
  extern int TabNext PROTO((Tabs tabs, int col));
+ extern int TabPrev PROTO((Tabs tabs, int col));
  extern void TabClear PROTO((Tabs tabs, int col));
  extern void TabReset PROTO((Tabs tabs));
  extern void TabSet PROTO((Tabs tabs, int col));
***************
*** 173,183 ****
  extern int AddToRefresh PROTO((TScreen *screen));
  extern int HandleExposure PROTO((TScreen *screen, XEvent *event));
  extern void ChangeColors PROTO((XtermWidget tw, ScrnColors *pNew));
! extern void ClearAbove PROTO((TScreen *screen));
! extern void ClearBelow PROTO((TScreen *screen));
! extern void ClearLeft PROTO((TScreen *screen));
! extern void ClearLine PROTO((TScreen *screen));
! extern void ClearRight PROTO((TScreen *screen));
  extern void ClearScreen PROTO((TScreen *screen));
  extern void DeleteChar PROTO((TScreen *screen, int n));
  extern void DeleteLine PROTO((TScreen *screen, int n));
--- 182,188 ----
  extern int AddToRefresh PROTO((TScreen *screen));
  extern int HandleExposure PROTO((TScreen *screen, XEvent *event));
  extern void ChangeColors PROTO((XtermWidget tw, ScrnColors *pNew));
! extern void ClearRight PROTO((TScreen *screen, int n));
  extern void ClearScreen PROTO((TScreen *screen));
  extern void DeleteChar PROTO((TScreen *screen, int n));
  extern void DeleteLine PROTO((TScreen *screen, int n));
***************
*** 188,193 ****
--- 193,201 ----
  extern void RevScroll PROTO((TScreen *screen, int amount));
  extern void ReverseVideo PROTO((XtermWidget termw));
  extern void Scroll PROTO((TScreen *screen, int amount));
+ extern void do_erase_display PROTO((TScreen *screen, int param, int mode));
+ extern void do_erase_line PROTO((TScreen *screen, int param, int mode));
+ extern void drawXtermText PROTO((TScreen *screen, unsigned flags, GC gc, int x, int y, char *text, int len));
  extern void recolor_cursor PROTO((Cursor cursor, unsigned long fg, unsigned long bg));
  extern void resetXtermGC PROTO((TScreen *screen, int flags, Bool hilite));
  extern void scrolling_copy_area PROTO((TScreen *screen, int firstline, int nlines, int amount));
***************
*** 212,216 ****
--- 220,230 ----
  #define useCurBackground(flag) /*nothing*/
  
  #endif        /* OPT_ISO_COLORS */
+ 
+ #define FillCurBackground(screen, left, top, width, height) \
+       useCurBackground(TRUE); \
+       XFillRectangle (screen->display, TextWindow(screen), \
+               screen->reverseGC, left, top, width, height); \
+       useCurBackground(FALSE)
  
  #endif        /* included_xterm_h */
Index: xterm.man
*** /build/x11r6/XFree86-3.1.2Ee/xc/programs/xterm/xterm.man    Sun Aug 11 14:48:36 1996
--- /build/x11r6/XFree86-current/xc/programs/xterm/xterm.man    Sun Aug 11 22:20:54 1996
***************
*** 57,62 ****
--- 57,63 ----
  .SH EMULATIONS
  The VT102 emulation is fairly complete, but does not support
  VT52 mode,
+ autorepeat,
  the blinking character attribute
  nor the double-wide and double-size character sets.
  .IR Termcap (5)
***************
*** 739,744 ****
--- 740,750 ----
  Specifies whether or not eight-bit characters sent from the host should be
  accepted as is or stripped when printed.  The default is ``true.''
  .TP 8
+ .B "eightBitControl (\fPclass\fB EightBitControl\fP)"
+ Specifies whether or not control sequences sent by the
+ terminal should be eight-bit characters or escape sequences.
+ The default is ``false.''
+ .TP 8
  .B "font (\fPclass\fB Font)"
  Specifies the name of the normal font.  The default is ``fixed.''
  .TP 8
***************
*** 946,951 ****
--- 952,966 ----
  .B "line1 (\fPclass\fB SmeLine)"
  This is a separator.
  .TP 8
+ .B "8-bit-control (\fPclass\fB SmeBSB)"
+ This entry invokes the \fBset-8-bit-control(toggle)\fP action.
+ .TP 8
+ .B "sun-function-keys (\fPclass\fB SmeBSB)"
+ This entry invokes the \fBsun-function-keys(toggle)\fP action.
+ .TP 8
+ .B "line2 (\fPclass\fB SmeLine)"
+ This is a separator.
+ .TP 8
  .B "suspend (\fPclass\fB SmeBSB)"
  This entry invokes the \fBsend-signal(tstp)\fP action on systems that
  support job control.
***************
*** 966,972 ****
  .B "kill (\fPclass\fB SmeBSB)"
  This entry invokes the \fBsend-signal(kill)\fP action.
  .TP 8
! .B "line2 (\fPclass\fB SmeLine)"
  This is a separator.
  .TP 8
  .B "quit (\fPclass\fB SmeBSB)"
--- 981,987 ----
  .B "kill (\fPclass\fB SmeBSB)"
  This entry invokes the \fBsend-signal(kill)\fP action.
  .TP 8
! .B "line3 (\fPclass\fB SmeLine)"
  This is a separator.
  .TP 8
  .B "quit (\fPclass\fB SmeBSB)"
***************
*** 1821,1824 ****
  Mark Vandevoorde (MIT-Athena), Bob McNamara (DEC-MAD),
  Jim Gettys (MIT-Athena), Bob Scheifler (MIT X Consortium), Doug Mink (SAO),
  Steve Pitschke (Stellar), Ron Newman (MIT-Athena), Jim Fulton (MIT X 
! Consortium), Dave Serisky (HP), Jonathan Kamens (MIT-Athena)
--- 1836,1841 ----
  Mark Vandevoorde (MIT-Athena), Bob McNamara (DEC-MAD),
  Jim Gettys (MIT-Athena), Bob Scheifler (MIT X Consortium), Doug Mink (SAO),
  Steve Pitschke (Stellar), Ron Newman (MIT-Athena), Jim Fulton (MIT X 
! Consortium), Dave Serisky (HP), Jonathan Kamens (MIT-Athena),
! David Wexelblat and
! Thomas Dickey (XFree86 Project).