v12i086: kterm - kanji xterm, Part05/18

mleisher at NMSU.Edu mleisher at NMSU.Edu
Wed May 8 12:38:29 AEST 1991


Submitted-by: mleisher at NMSU.Edu
Posting-number: Volume 12, Issue 86
Archive-name: kterm/part05

#!/bin/sh
# this is kt412.05 (part 5 of kterm-4.1.2)
# do not concatenate these parts, unpack them in order with /bin/sh
# file kterm-4.1.2/VTPrsTbl.c continued
#
if test ! -r _shar_seq_.tmp; then
	echo 'Please unpack part 1 first!'
	exit 1
fi
(read Scheck
 if test "$Scheck" != 5; then
	echo Please unpack part "$Scheck" next!
	exit 1
 else
	exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
	echo 'x - still skipping kterm-4.1.2/VTPrsTbl.c'
else
echo 'x - continuing file kterm-4.1.2/VTPrsTbl.c'
sed 's/^X//' << 'SHAR_EOF' >> 'kterm-4.1.2/VTPrsTbl.c' &&
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,
};
X
int scstable[] = {
/*	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,
#ifdef KTERM_CTEXT
CASE_GSETS,               /* ESC - C Right part of ISO8859-3 */
#else /* !KTERM_CTEXT */
CASE_GROUND_STATE,
#endif /* !KTERM_CTEXT */
/*	D		E		F		G	*/
#ifdef KTERM_CTEXT
CASE_GSETS,               /* ESC - D Right part of ISO8859-4 */
#else /* !KTERM_CTEXT */
CASE_GROUND_STATE,
#endif /* !KTERM_CTEXT */
CASE_GROUND_STATE,
#ifdef KTERM_CTEXT
CASE_GSETS,               /* ESC - F Right part of ISO8859-7 */
CASE_GSETS,               /* ESC - G Right part of ISO8859-6 */
#else /* !KTERM_CTEXT */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
#endif /* !KTERM_CTEXT */
/*	H		I		J		K	*/
#ifdef KTERM_CTEXT
CASE_GSETS,               /* ESC - H Right part of ISO8859-8 */
#else /* !KTERM_CTEXT */
CASE_GROUND_STATE,
#endif /* !KTERM_CTEXT */
#ifdef KTERM
CASE_GSETS,
CASE_GSETS,
#else /* !KTERM */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
#endif /* !KTERM */
CASE_GROUND_STATE,
/*	L		M		N		O	*/
#ifdef KTERM_CTEXT
CASE_GSETS,               /* ESC - L Right part of ISO8859-5 */
CASE_GSETS,               /* ESC - M Right part of ISO8859-9 */
#else /* !KTERM_CTEXT */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
#endif /* !KTERM_CTEXT */
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,
/*      0x99            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,
};
X
#ifdef KTERM_KANJI
int mbcstable[] = {
/*	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_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_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_GSETS,	/* ESC-$-@ (JIS-78) */
#ifdef KTERM_HANZI
CASE_GSETS,     /* ESC-$-A (GB-80) */
#else /* !KTERM_HANZI */
CASE_GROUND_STATE,
#endif /* KTERM_HANZI */
CASE_GSETS,	/* ESC-$-B (JIS-83) */
#ifdef KTERM_HANGUL
CASE_GSETS,	/* ESC-$-C (KS-87) */
#else /* !KTERM_HANGUL */
CASE_GROUND_STATE,
#endif /* KTERM_HANGUL */
/*	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_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_IGNORE_STATE,
CASE_IGNORE_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,
/*      0x99            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,
};
#endif /* KTERM_KANJI */
SHAR_EOF
echo 'File kterm-4.1.2/VTPrsTbl.c is complete' &&
chmod 0664 kterm-4.1.2/VTPrsTbl.c ||
echo 'restore of kterm-4.1.2/VTPrsTbl.c failed'
Wc_c="`wc -c < 'kterm-4.1.2/VTPrsTbl.c'`"
test 75504 -eq "$Wc_c" ||
	echo 'kterm-4.1.2/VTPrsTbl.c: original size 75504, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= kterm-4.1.2/VTparse.def ==============
if test -f 'kterm-4.1.2/VTparse.def' -a X"$1" != X"-c"; then
	echo 'x - skipping kterm-4.1.2/VTparse.def (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting kterm-4.1.2/VTparse.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'kterm-4.1.2/VTparse.def' &&
#
# $XConsortium: VTparse.def,v 1.3 89/01/04 13:37:48 jim Exp $
#
# List of symbols that need to be defined for VTparse.h.  If you need to 
# change any of the CASE_ macros, make the change here and rerun the command
# shown in VTparse.h.
#
X
CASE_GROUND_STATE
CASE_IGNORE_STATE
CASE_IGNORE_ESC
CASE_IGNORE
CASE_BELL
CASE_BS
CASE_CR
CASE_ESC
CASE_VMOT
CASE_TAB
CASE_SI
CASE_SO
CASE_SCR_STATE
CASE_SCS0_STATE
CASE_SCS1_STATE
CASE_SCS2_STATE
CASE_SCS3_STATE
CASE_ESC_IGNORE
CASE_ESC_DIGIT
CASE_ESC_SEMI
CASE_DEC_STATE
CASE_ICH
CASE_CUU
CASE_CUD
CASE_CUF
CASE_CUB
CASE_CUP
CASE_ED
CASE_EL
CASE_IL
CASE_DL
CASE_DCH
CASE_DA1
CASE_TRACK_MOUSE
CASE_TBC
CASE_SET
CASE_RST
CASE_SGR
CASE_CPR
CASE_DECSTBM
CASE_DECREQTPARM
CASE_DECSET
CASE_DECRST
CASE_DECALN
CASE_GSETS
CASE_DECSC
CASE_DECRC
CASE_DECKPAM
CASE_DECKPNM
CASE_IND
CASE_NEL
CASE_HTS
CASE_RI
CASE_SS2
CASE_SS3
CASE_CSI_STATE
CASE_OSC
CASE_RIS
CASE_LS2
CASE_LS3
CASE_LS3R
CASE_LS2R
CASE_LS1R
CASE_PRINT
CASE_XTERM_SAVE
CASE_XTERM_RESTORE
CASE_XTERM_TITLE
CASE_DECID
CASE_MBCS
CASE_TO_STATUS
CASE_FROM_STATUS
CASE_SHOW_STATUS
CASE_HIDE_STATUS
CASE_ERASE_STATUS
SHAR_EOF
chmod 0664 kterm-4.1.2/VTparse.def ||
echo 'restore of kterm-4.1.2/VTparse.def failed'
Wc_c="`wc -c < 'kterm-4.1.2/VTparse.def'`"
test 1108 -eq "$Wc_c" ||
	echo 'kterm-4.1.2/VTparse.def: original size 1108, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= kterm-4.1.2/VTparse.h ==============
if test -f 'kterm-4.1.2/VTparse.h' -a X"$1" != X"-c"; then
	echo 'x - skipping kterm-4.1.2/VTparse.h (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting kterm-4.1.2/VTparse.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'kterm-4.1.2/VTparse.h' &&
/*
X *	$XConsortium: VTparse.h,v 1.4 89/01/04 13:37:49 jim Exp $
X *	$Header: /usr/src.yoshi/X/KTerm/4.1.0/RCS/VTparse.h,v 1.1 90/06/27 09:38:28 kagotani Rel $
X */
#include "kterm.h"
X
X
#include <X11/copyright.h>
X
/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
/* @(#)VTparse.h	X10/6.6	11/6/86 */
X
/*
X * The following list of definitions is generated from VTparse.def using the
X * following command line:
X *
X *     egrep -v '^CASE_' VTparse.def | \
X *     awk 'BEGIN {n = 0;} {printf "#define %s %d\n", $1, n; n++}'
X *
X * You you need to change something, change VTparse.def and regenerate the
X * definitions.  This would have been automatic, but since this doesn't change
X * very often, it isn't worth the makefile hassle.
X */
X
#define CASE_GROUND_STATE 0
#define CASE_IGNORE_STATE 1
#define CASE_IGNORE_ESC 2
#define CASE_IGNORE 3
#define CASE_BELL 4
#define CASE_BS 5
#define CASE_CR 6
#define CASE_ESC 7
#define CASE_VMOT 8
#define CASE_TAB 9
#define CASE_SI 10
#define CASE_SO 11
#define CASE_SCR_STATE 12
#define CASE_SCS0_STATE 13
#define CASE_SCS1_STATE 14
#define CASE_SCS2_STATE 15
#define CASE_SCS3_STATE 16
#define CASE_ESC_IGNORE 17
#define CASE_ESC_DIGIT 18
#define CASE_ESC_SEMI 19
#define CASE_DEC_STATE 20
#define CASE_ICH 21
#define CASE_CUU 22
#define CASE_CUD 23
#define CASE_CUF 24
#define CASE_CUB 25
#define CASE_CUP 26
#define CASE_ED 27
#define CASE_EL 28
#define CASE_IL 29
#define CASE_DL 30
#define CASE_DCH 31
#define CASE_DA1 32
#define CASE_TRACK_MOUSE 33
#define CASE_TBC 34
#define CASE_SET 35
#define CASE_RST 36
#define CASE_SGR 37
#define CASE_CPR 38
#define CASE_DECSTBM 39
#define CASE_DECREQTPARM 40
#define CASE_DECSET 41
#define CASE_DECRST 42
#define CASE_DECALN 43
#define CASE_GSETS 44
#define CASE_DECSC 45
#define CASE_DECRC 46
#define CASE_DECKPAM 47
#define CASE_DECKPNM 48
#define CASE_IND 49
#define CASE_NEL 50
#define CASE_HTS 51
#define CASE_RI 52
#define CASE_SS2 53
#define CASE_SS3 54
#define CASE_CSI_STATE 55
#define CASE_OSC 56
#define CASE_RIS 57
#define CASE_LS2 58
#define CASE_LS3 59
#define CASE_LS3R 60
#define CASE_LS2R 61
#define CASE_LS1R 62
#define CASE_PRINT 63
#define CASE_XTERM_SAVE 64
#define CASE_XTERM_RESTORE 65
#define CASE_XTERM_TITLE 66
#define CASE_DECID 67
#define CASE_MBCS 68
#define CASE_TO_STATUS 69
#define CASE_FROM_STATUS 70
#define CASE_SHOW_STATUS 71
#define CASE_HIDE_STATUS 72
#define CASE_ERASE_STATUS 73
#define CASE_SJIS1 (0x80) /* must have only one bit set */
SHAR_EOF
chmod 0664 kterm-4.1.2/VTparse.h ||
echo 'restore of kterm-4.1.2/VTparse.h failed'
Wc_c="`wc -c < 'kterm-4.1.2/VTparse.h'`"
test 3502 -eq "$Wc_c" ||
	echo 'kterm-4.1.2/VTparse.h: original size 3502, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= kterm-4.1.2/b2g ==============
if test -f 'kterm-4.1.2/b2g' -a X"$1" != X"-c"; then
	echo 'x - skipping kterm-4.1.2/b2g (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting kterm-4.1.2/b2g (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'kterm-4.1.2/b2g' &&
xbtoa Begin
,75Y<#t&WMH#dV3BQP@^+>Gl93%QdE3&rNE3B8c9 at X0(cF`(h77P5fWARuu2+Auo`CO%%*AT_m'+:9
>#$7/#17kHnp64+&c0f1R,5qt;e$DF/gXJ)A^USFueY+rV(\td$8TqTAtXeDYfXJ)A`XpUr,UV!;4U
VERtU\pmhU\pmhU\pnEU%P,PUSsreUSnNpWMB?crLrnXoqA[bZ_@&coqB*n^S1=ooqAgf\"WI%U%P+
dTs^TeU%P+hTt-liU%P+jTt@#kU%P1ZUT"S-5qtY[+ at ._K7LGpfU]$mlTsLGqTs(/oTs:AeUS=OAUS
jl^USaaX$DI9hm%LAOn=fBGpS%AUntGKFn"K?HoV(rOp7_/Qoa2$n2Dm026T-eU$G>g7$:-L+1a#(@
2)GZ]r<`lu2+0bR68_.t$J+tZ
xbtoa End N 332 14c E 28 S aaba R 65c70f48
SHAR_EOF
chmod 0664 kterm-4.1.2/b2g ||
echo 'restore of kterm-4.1.2/b2g failed'
Wc_c="`wc -c < 'kterm-4.1.2/b2g'`"
test 476 -eq "$Wc_c" ||
	echo 'kterm-4.1.2/b2g: original size 476, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= kterm-4.1.2/button.c ==============
if test -f 'kterm-4.1.2/button.c' -a X"$1" != X"-c"; then
	echo 'x - skipping kterm-4.1.2/button.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting kterm-4.1.2/button.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'kterm-4.1.2/button.c' &&
/*
X *	$XConsortium: button.c,v 1.50 90/03/05 11:46:57 keith Exp $
X *	$Kagotani: /usr/src.yoshi/X/KTerm/4.1.0/RCS/button.c,v 1.1 90/06/27 09:38:29 kagotani Rel $
X *
X * $Header: /usr/local/src/X11/contrib/clients/kterm-4.1.2/RCS/button.c,v 1.6 1991/03/17 23:47:18 mleisher Exp $
X */
X
/*
X * Modified for Hanzi support:
X * Mark Leisher mleisher at nmsu.edu Fri Nov  9 09:22:33 1990
X */
X
#include <X11/copyright.h>
X
/*
X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
X *
X *                         All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of Digital Equipment
X * Corporation not be used in advertising or publicity pertaining to
X * distribution of the software without specific, written prior permission.
X *
X *
X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X */
X
/*
button.c	Handles button events in the terminal emulator.
X		does cut/paste operations, change modes via menu,
X		passes button events through to some applications.
X				J. Gettys.
*/
#ifndef lint
static char rcs_id[] = "$XConsortium: button.c,v 1.50 90/03/05 11:46:57 keith Exp $";
#endif	/* lint */
X
#include "ptyx.h"		/* Xlib headers included here. */
#include <X11/Xatom.h>
#include <stdio.h>
#include <setjmp.h>
#include <ctype.h>
X
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/StdSel.h>
X
#include "data.h"
#include "error.h"
#include "menu.h"
X
#ifdef KTERM_HANZI
#include "hzutil.h"
#endif /* KTERM_HANZI */
X
#ifdef KTERM_HANGUL
#include "hgutil.h"
#endif /* KTERM_HANGUL */
X
extern char *malloc();
X
#define KeyState(x) (((x) & (ShiftMask|ControlMask)) + (((x) & Mod1Mask) ? 2 : 0))
X    /* adds together the bits:
X        shift key -> 1
X        meta key  -> 2
X        control key -> 4 */
X  
#define TEXTMODES 4
#define NBUTS 3
#define DIRS 2
#define UP 1
#define DOWN 0
#define SHIFTS 8		/* three keys, so eight combinations */
#define	Coordinate(r,c)		((r) * (term->screen.max_col+1) + (c))
X
#ifdef KTERM
Ichr *SaveText();
#else /* !KTERM */
char *SaveText();
#endif /* !KTERM */
extern EditorButton();
X
extern char *xterm_name;
extern Bogus();
X
static PointToRowCol();
X
extern XtermWidget term;
X
/* Selection/extension variables */
X
/* Raw char position where the selection started */
static int rawRow, rawCol;
X
/* Selected area before CHAR, WORD, LINE selectUnit processing */
static int startRRow, startRCol, endRRow, endRCol = 0;
X
/* Selected area after CHAR, WORD, LINE selectUnit processing */
static int startSRow, startSCol, endSRow, endSCol = 0;
X
/* Valid rows for selection clipping */
static int firstValidRow, lastValidRow;
X
/* Start, end of extension */
static int startERow, startECol, endERow, endECol;
X
/* Saved values of raw selection for extend to restore to */
static int saveStartRRow, saveStartRCol, saveEndRRow, saveEndRCol;
X
/* Multi-click handling */
static int numberOfClicks = 0;
static long int lastButtonUpTime = 0;
typedef int SelectUnit;
#define SELECTCHAR 0
#define SELECTWORD 1
#define SELECTLINE 2
#define NSELECTUNITS 3
static SelectUnit selectUnit;
X
/* Send emacs escape code when done selecting or extending? */
static int replyToEmacs;
X
#if defined(KTERM) && defined(MB_WSEL)
/*
X * by Kiyoshi KANAZAWA, Nov. 29, 1990.
X * Support word-select for MBCS.
X *
X * Modified by Mark Leisher Sat Mar 16 23:58:58 1991
X * Modified to support Chinese and Korean character classes.
X */
static int mbcsCharClass ();
#endif	/* KTERM && MB_WSEL */
X
Boolean SendMousePosition(w, event)
Widget w;
XXEvent* event;
{
X    register TScreen *screen = &((XtermWidget)w)->screen;
X    static TrackDown();
X    
X    if (screen->send_mouse_pos == 0) return False;
X
X    if (event->type != ButtonPress && event->type != ButtonRelease)
X	return False;
X
#define KeyModifiers \
X    (event->xbutton.state & (ShiftMask | LockMask | ControlMask | Mod1Mask | \
X			     Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask ))
X
#define ButtonModifiers \
X    (event->xbutton.state & (ShiftMask | LockMask | ControlMask | Mod1Mask | \
X			     Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask ))
X
X    switch (screen->send_mouse_pos) {
X      case 1: /* X10 compatibility sequences */
X
X	if (KeyModifiers == 0) {
X	    if (event->type == ButtonPress)
X		EditorButton(event);
X	    return True;
X	}
X	return False;
X
X      case 2: /* DEC vt200 compatible */
X
X	if (KeyModifiers == 0 || KeyModifiers == ControlMask) {
X	    EditorButton(event);
X	    return True;
X	}
X	return False;
X
X      case 3: /* DEC vt200 hilite tracking */
X	if (  event->type == ButtonPress &&
X	      KeyModifiers == 0 &&
X	      event->xbutton.button == Button1 ) {
X	    TrackDown(event);
X	    return True;
X	}
X	if (KeyModifiers == 0 || KeyModifiers == ControlMask) {
X	    EditorButton(event);
X	    return True;
X	}
X	/* fall through */
X
X      default:
X	return False;
X    }
#undef KeyModifiers
}
X
X
/*ARGSUSED*/
void HandleSelectExtend(w, event, params, num_params)
Widget w;
XXEvent *event;			/* must be XMotionEvent */
String *params;			/* unused */
Cardinal *num_params;		/* unused */
{
X	register TScreen *screen = &((XtermWidget)w)->screen;
X	int row, col;
X
X	screen->selection_time = event->xmotion.time;
X	switch (eventMode) {
X		case LEFTEXTENSION :
X		case RIGHTEXTENSION :
X			PointToRowCol (event->xmotion.y, event->xmotion.x, 
X				       &row, &col);
X			ExtendExtend (row, col);
X			break;
X		case NORMAL :
X			/* will get here if send_mouse_pos != 0 */
X		        break;
X	}
}
X
X
/*ARGSUSED*/
static void do_select_end (w, event, params, num_params, use_cursor_loc)
Widget w;
XXEvent *event;			/* must be XButtonEvent */
String *params;			/* selections */
Cardinal *num_params;
Bool use_cursor_loc;
{
X	((XtermWidget)w)->screen.selection_time = event->xbutton.time;
X	switch (eventMode) {
X		case NORMAL :
X		        (void) SendMousePosition(w, event);
X			break;
X		case LEFTEXTENSION :
X		case RIGHTEXTENSION :
X			EndExtend(event, params, *num_params, use_cursor_loc);
X			break;
X	}
}
X
X
void HandleSelectEnd(w, event, params, num_params)
Widget w;
XXEvent *event;			/* must be XButtonEvent */
String *params;			/* selections */
Cardinal *num_params;
{
X	do_select_end (w, event, params, num_params, False);
}
X
X
void HandleKeyboardSelectEnd(w, event, params, num_params)
Widget w;
XXEvent *event;			/* must be XButtonEvent */
String *params;			/* selections */
Cardinal *num_params;
{
X	do_select_end (w, event, params, num_params, True);
}
X
X
X
X
struct _SelectionList {
X    String *params;
X    Cardinal count;
X    Time time;
};
X
#ifdef KTERM
SelAtomInitialize()
{
X    /* kagotani
X    _XA_COMPOUND_TEXT = XmuMakeAtom("COMPOUND_TEXT");
X    */
}
#endif /* KTERM */
X
static void _GetSelection(w, time, params, num_params)
Widget w;
Time time;
String *params;			/* selections in precedence order */
Cardinal num_params;
{
X    static void SelectionReceived();
X    Atom selection;
X    int buffer;
X
X    XmuInternStrings(XtDisplay(w), params, (Cardinal)1, &selection);
X    switch (selection) {
X      case XA_CUT_BUFFER0: buffer = 0; break;
X      case XA_CUT_BUFFER1: buffer = 1; break;
X      case XA_CUT_BUFFER2: buffer = 2; break;
X      case XA_CUT_BUFFER3: buffer = 3; break;
X      case XA_CUT_BUFFER4: buffer = 4; break;
X      case XA_CUT_BUFFER5: buffer = 5; break;
X      case XA_CUT_BUFFER6: buffer = 6; break;
X      case XA_CUT_BUFFER7: buffer = 7; break;
X      default:	       buffer = -1;
X    }
X    if (buffer >= 0) {
X	register TScreen *screen = &((XtermWidget)w)->screen;
X	int inbytes;
X	unsigned long nbytes;
X	int fmt8 = 8;
X	Atom type = XA_STRING;
X	char *line = XFetchBuffer(screen->display, &inbytes, buffer);
X	nbytes = (unsigned long) inbytes;
X	if (nbytes > 0)
X	    SelectionReceived(w, NULL, &selection, &type, (caddr_t)line,
X			      &nbytes, &fmt8);
X	else if (num_params > 1)
X	    _GetSelection(w, time, params+1, num_params-1);
X    } else {
X	struct _SelectionList* list;
X	if (--num_params) {
X	    list = XtNew(struct _SelectionList);
X	    list->params = params + 1;
X	    list->count = num_params;
X	    list->time = time;
X	} else list = NULL;
#ifdef KTERM
X	XtGetSelectionValue(w, selection, XA_TEXT(XtDisplay(w)), SelectionReceived,
X			    (caddr_t)list, time);
#else /* !KTERM */
X	XtGetSelectionValue(w, selection, XA_STRING, SelectionReceived,
X			    (caddr_t)list, time);
#endif /* !KTERM */
X    }
}
X
X
/* ARGSUSED */
static void SelectionReceived(w, client_data, selection, type,
X			      value, length, format)
Widget w;
caddr_t client_data;
Atom *selection, *type;
caddr_t value;
unsigned long *length;
int *format;
{
X    int pty = ((XtermWidget)w)->screen.respond;	/* file descriptor of pty */
X    register char *lag, *cp, *end;
X    char *line = (char*)value;
#ifdef KTERM
X    char lbuf[256 + 1];
#endif /* KTERM */
X				  
X    if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0) {
X	struct _SelectionList* list = (struct _SelectionList*)client_data;
X	if (list != NULL) {
X	    _GetSelection(w, list->time, list->params, list->count);
X	    XtFree(client_data);
X	}
X	return;
X    }
#ifdef KTERM
X    if (*type == XA_COMPOUND_TEXT(XtDisplay(w))) {
X	Char *ct = (Char *)value;
X	Ichr *cs;
X	int (*func)();
X	int n;
X	int convCStoJIS();
# ifdef KTERM_KANJI
X	int convCStoEUC(), convCStoSJIS();
# endif /* KTERM_KANJI */
# ifdef KTERM_HANZI
X        int convCStoGB(), convCStoSGB(), convCStoBIG5();
# endif /* KTERM_HANZI */
# ifdef KTERM_HANGUL
X        int convCStoKS();
# endif /* KTERM_HANGUL */
X	Ichr cbuf[256 + 1];
X
X	n = convCTtoCS(ct, *length, NULL);
X	if (n < 0) { /* data broken */
X	    XtFree(client_data);
X	    XtFree(value);
X	    return;
X	}
X	cs = (n > 256) ? (Ichr *)XtMalloc((n + 1) * sizeof(Ichr)) : cbuf;
X	(void)convCTtoCS(ct, *length, cs);
X
#if defined(KTERM_HANZI) || defined(KTERM_HANGUL)
X	switch (((XtermWidget)w)->flags &
X                (EUC_KANJI|SJIS_KANJI|GUOBIAO_HANZI|SGB_HANZI|BIG5_HANZI|KS_HANGUL|NBYTE_HANGUL)) {
#ifdef KTERM_HANGUL
X            /*
X             * Once we have converted N-byte code to KS code,
X             * keep the converted text as KS code so we don't
X             * have to do more work to convert N-byte back
X             * to KS code again.
X             */
X          case KS_HANGUL:
X          case NBYTE_HANGUL:
X            func = convCStoKS;
X            break;
#endif /* KTERM_HANGUL */
#ifdef KTERM_HANZI
X          case GUOBIAO_HANZI:
X            func = convCStoGB;
X            break;
X          case SGB_HANZI:
X            func = convCStoSGB;
X            break;
X          case BIG5_HANZI:
X            func = convCStoBIG5;
X            break;
#endif /* KTERM_HANZI */
X          case EUC_KANJI:
X	    func = convCStoEUC;
X	    break;
X          case SJIS_KANJI:
X	    func = convCStoSJIS;
X	    break;
X          default:
X	    func = convCStoJIS;
X	    break;
X        }
#else /* !KTERM_HANZI && !KTERM_HANGUL */
# ifdef KTERM_KANJI
X	switch (((XtermWidget)w)->flags & (EUC_KANJI|SJIS_KANJI)) {
X	case EUC_KANJI:
X	    func = convCStoEUC;
X	    break;
X	case SJIS_KANJI:
X	    func = convCStoSJIS;
X	    break;
X	default:
X	    func = convCStoJIS;
X	    break;
X	}
# else /* !KTERM_KANJI */
X	func = convCStoJIS;
# endif /* !KTERM_KANJI */
#endif /* !KTERM_HANZI && !KTERM_HANGUL */
X
X	n = (*func)(cs, NULL);
X	line = (n > 256) ? XtMalloc(n + 1) : lbuf;
X	(void)(*func)(cs, line);
X	end = line + n;
X	if (cs != cbuf) XtFree(cs);
X    } else { /* must be XA_STRING */
X	char *p, *q;
X	int n = *length;
X
X	line = (n > 256) ? XtMalloc(n + 1) : lbuf;
X	bcopy((char *)value, line, n);
X	line[n] = '\0';
X	p = (char *) value;
X	q = line;
X	while (n-- > 0) {
X	    if (!(*p & 0x80)) {
X		*q++ = *p;
X	    }
X	    p++;
X	}
X	end = q;
X    }
#else /* !KTERM */
X    end = &line[*length];
#endif /* !KTERM */
X    lag = line;
X    for (cp = line; cp != end; cp++)
X	{
X	    if (*cp != '\n') continue;
X	    *cp = '\r';
X	    v_write(pty, lag, cp - lag + 1);
X	    lag = cp + 1;
X	}
X    if (lag != end)
X	v_write(pty, lag, end - lag);
X
#ifdef KTERM
X    if (line != lbuf) XtFree(line);
#endif /* KTERM */
X    XtFree(client_data);
X    XtFree(value);
}
X
X
HandleInsertSelection(w, event, params, num_params)
Widget w;
XXEvent *event;			/* assumed to be XButtonEvent* */
String *params;			/* selections in precedence order */
Cardinal *num_params;
{
X    if (SendMousePosition(w, event)) return;
X    _GetSelection(w, event->xbutton.time, params, *num_params);
}
X
X
SetSelectUnit(buttonDownTime, defaultUnit)
unsigned long buttonDownTime;
SelectUnit defaultUnit;
{
/* Do arithmetic as integers, but compare as unsigned solves clock wraparound */
X	if ((long unsigned)((long int)buttonDownTime - lastButtonUpTime)
X	 > term->screen.multiClickTime) {
X		numberOfClicks = 1;
X		selectUnit = defaultUnit;
X	} else {
X		++numberOfClicks;
X		selectUnit = ((selectUnit + 1) % NSELECTUNITS);
X	}
}
X
static void do_select_start (w, event, startrow, startcol)
Widget w;
XXEvent *event;			/* must be XButtonEvent* */
int startrow, startcol;
{
X	if (SendMousePosition(w, event)) return;
X	SetSelectUnit(event->xbutton.time, SELECTCHAR);
X	replyToEmacs = FALSE;
X	StartSelect(startrow, startcol);
}
X
/* ARGSUSED */
HandleSelectStart(w, event, params, num_params)
Widget w;
XXEvent *event;			/* must be XButtonEvent* */
String *params;			/* unused */
Cardinal *num_params;		/* unused */
{
X	register TScreen *screen = &((XtermWidget)w)->screen;
X	int startrow, startcol;
X
X	firstValidRow = 0;
X	lastValidRow  = screen->max_row;
X	PointToRowCol(event->xbutton.y, event->xbutton.x, &startrow, &startcol);
X	do_select_start (w, event, startrow, startcol);
}
X
X
/* ARGSUSED */
HandleKeyboardSelectStart(w, event, params, num_params)
Widget w;
XXEvent *event;			/* must be XButtonEvent* */
String *params;			/* unused */
Cardinal *num_params;		/* unused */
{
X	register TScreen *screen = &((XtermWidget)w)->screen;
X
X	do_select_start (w, event, screen->cursor_row, screen->cursor_col);
}
X
X
static TrackDown(event)
register XButtonEvent *event;
{
X	int startrow, startcol;
X
X	SetSelectUnit(event->time, SELECTCHAR);
X	if (numberOfClicks > 1 ) {
X		PointToRowCol(event->y, event->x, &startrow, &startcol);
X		replyToEmacs = TRUE;
X		StartSelect(startrow, startcol);
X	} else {
X		waitingForTrackInfo = 1;
X		EditorButton(event);
X	}
}
X
X
#define boundsCheck(x)	if (x < 0) \
X			    x = 0; \
X			else if (x >= screen->max_row) \
X			    x = screen->max_row;
X
TrackMouse(func, startrow, startcol, firstrow, lastrow)
int func, startrow, startcol, firstrow, lastrow;
{
X	TScreen *screen = &term->screen;
X
X	if (!waitingForTrackInfo) {	/* Timed out, so ignore */
X		return;
X	}
X	waitingForTrackInfo = 0;
X	if (func == 0) return;
X	boundsCheck (startrow)
X	boundsCheck (firstrow)
X	boundsCheck (lastrow)
X	firstValidRow = firstrow;
X	lastValidRow  = lastrow;
X	replyToEmacs = TRUE;
X	StartSelect(startrow, startcol);
}
X
StartSelect(startrow, startcol)
int startrow, startcol;
{
X	TScreen *screen = &term->screen;
X
X	if (screen->cursor_state)
X	    HideCursor ();
X	if (numberOfClicks == 1) {
X		/* set start of selection */
X		rawRow = startrow;
X		rawCol = startcol;
X		
X	} /* else use old values in rawRow, Col */
X
X	saveStartRRow = startERow = rawRow;
X	saveStartRCol = startECol = rawCol;
X	saveEndRRow   = endERow   = rawRow;
X	saveEndRCol   = endECol   = rawCol;
X	if (Coordinate(startrow, startcol) < Coordinate(rawRow, rawCol)) {
X		eventMode = LEFTEXTENSION;
X		startERow = startrow;
X		startECol = startcol;
X	} else {
X		eventMode = RIGHTEXTENSION;
X		endERow = startrow;
X		endECol = startcol;
X	}
X	ComputeSelect(startERow, startECol, endERow, endECol, False);
X
}
X
EndExtend(event, params, num_params, use_cursor_loc)
XXEvent *event;			/* must be XButtonEvent */
String *params;			/* selections */
Cardinal num_params;
Bool use_cursor_loc;
{
X	int	row, col;
X	TScreen *screen = &term->screen;
X	char line[9];
X
X	if (use_cursor_loc) {
X	    row = screen->cursor_row;
X	    col = screen->cursor_col;
X	} else {
X	    PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col);
X	}
X	ExtendExtend (row, col);
X	lastButtonUpTime = event->xbutton.time;
X	if (startSRow != endSRow || startSCol != endSCol) {
X		if (replyToEmacs) {
X			if (rawRow == startSRow && rawCol == startSCol 
X			 && row == endSRow && col == endSCol) {
X			 	/* Use short-form emacs select */
X				strcpy(line, "\033[t");
X				line[3] = ' ' + endSCol + 1;
X				line[4] = ' ' + endSRow + 1;
X				v_write(screen->respond, line, 5);
X			} else {
X				/* long-form, specify everything */
X				strcpy(line, "\033[T");
X				line[3] = ' ' + startSCol + 1;
X				line[4] = ' ' + startSRow + 1;
X				line[5] = ' ' + endSCol + 1;
X				line[6] = ' ' + endSRow + 1;
X				line[7] = ' ' + col + 1;
X				line[8] = ' ' + row + 1;
X				v_write(screen->respond, line, 9);
X			}
X			TrackText(0, 0, 0, 0);
X		}
X	}
X	SelectSet(event, params, num_params);
X	eventMode = NORMAL;
}
X
HandleSelectSet(w, event, params, num_params)
Widget w;
XXEvent *event;
String *params;
Cardinal *num_params;
{
X	SelectSet (event, params, *num_params);
}
X
SelectSet (event, params, num_params)
XXEvent	*event;
String	*params;
Cardinal    num_params;
{
X	/* Only do select stuff if non-null select */
X	if (startSRow != endSRow || startSCol != endSCol) {
X		SaltTextAway(startSRow, startSCol, endSRow, endSCol,
X			     params, num_params);
X	} else
X		DisownSelection(term);
}
X
#define Abs(x)		((x) < 0 ? -(x) : (x))
X
/* ARGSUSED */
static void do_start_extend (w, event, params, num_params, use_cursor_loc)
Widget w;
XXEvent *event;			/* must be XButtonEvent* */
String *params;			/* unused */
Cardinal *num_params;		/* unused */
Bool use_cursor_loc;
{
X	TScreen *screen = &((XtermWidget)w)->screen;
X	int row, col, coord;
X
X	if (SendMousePosition(w, event)) return;
X	firstValidRow = 0;
X	lastValidRow  = screen->max_row;
X	SetSelectUnit(event->xbutton.time, selectUnit);
X	replyToEmacs = FALSE;
X
X	if (numberOfClicks == 1) {
X		/* Save existing selection so we can reestablish it if the guy
X		   extends past the other end of the selection */
X		saveStartRRow = startERow = startRRow;
X		saveStartRCol = startECol = startRCol;
X		saveEndRRow   = endERow   = endRRow;
X		saveEndRCol   = endECol   = endRCol;
X	} else {
X		/* He just needed the selection mode changed, use old values. */
X		startERow = startRRow = saveStartRRow;
X		startECol = startRCol = saveStartRCol;
X		endERow   = endRRow   = saveEndRRow;
X		endECol   = endRCol   = saveEndRCol;
X
X	}
X	if (use_cursor_loc) {
X	    row = screen->cursor_row;
X	    col = screen->cursor_col;
X	} else {
X	    PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col);
X	}
X	coord = Coordinate(row, col);
X
X	if (Abs(coord - Coordinate(startSRow, startSCol))
X	     < Abs(coord - Coordinate(endSRow, endSCol))
X	    || coord < Coordinate(startSRow, startSCol)) {
X	 	/* point is close to left side of selection */
X		eventMode = LEFTEXTENSION;
X		startERow = row;
X		startECol = col;
X	} else {
X	 	/* point is close to left side of selection */
X		eventMode = RIGHTEXTENSION;
X		endERow = row;
X		endECol = col;
X	}
X	ComputeSelect(startERow, startECol, endERow, endECol, True);
}
X
ExtendExtend (row, col)
int row, col;
{
X	int coord = Coordinate(row, col);
X	
X	if (eventMode == LEFTEXTENSION 
X	 && (coord + (selectUnit!=SELECTCHAR)) > Coordinate(endSRow, endSCol)) {
X		/* Whoops, he's changed his mind.  Do RIGHTEXTENSION */
X		eventMode = RIGHTEXTENSION;
X		startERow = saveStartRRow;
X		startECol = saveStartRCol;
X	} else if (eventMode == RIGHTEXTENSION
X	 && coord < Coordinate(startSRow, startSCol)) {
X	 	/* Whoops, he's changed his mind.  Do LEFTEXTENSION */
X		eventMode = LEFTEXTENSION;
X		endERow   = saveEndRRow;
X		endECol   = saveEndRCol;
X	}
X	if (eventMode == LEFTEXTENSION) {
X		startERow = row;
X		startECol = col;
X	} else {
X		endERow = row;
X		endECol = col;
X	}
X	ComputeSelect(startERow, startECol, endERow, endECol, False);
}
X
X
void HandleStartExtend(w, event, params, num_params)
Widget w;
XXEvent *event;			/* must be XButtonEvent* */
String *params;			/* unused */
Cardinal *num_params;		/* unused */
{
X    do_start_extend (w, event, params, num_params, False);
}
X
void HandleKeyboardStartExtend(w, event, params, num_params)
Widget w;
XXEvent *event;			/* must be XButtonEvent* */
String *params;			/* unused */
Cardinal *num_params;		/* unused */
{
X    do_start_extend (w, event, params, num_params, True);
}
X
X
X
X
X
ScrollSelection(screen, amount)
register TScreen* screen;
register int amount;
{
X    register int minrow = -screen->savedlines;
X
X    /* Sent by scrollbar stuff, so amount never takes selection out of
X       saved text */
X
X    /* XXX - the preceeding is false; cat /etc/termcap (or anything
X       larger than the number of saved lines plus the screen height) and then
X       hit extend select */
X
X    startRRow += amount; endRRow += amount;
X    startSRow += amount; endSRow += amount;
X    rawRow += amount;
X    screen->startHRow += amount;
X    screen->endHRow += amount;
X
X    if (startRRow < minrow) {
X	startRRow = minrow;
X	startRCol = 0;
X    }
X    if (endRRow < minrow) {
X	endRRow = minrow;
X        endRCol = 0;
X    }
X    if (startSRow < minrow) {
X	startSRow = minrow;
X	startSCol = 0;
X    }
X    if (endSRow < minrow) {
X	endSRow = minrow;
X	endSCol = 0;
X    }
X    if (rawRow < minrow) {
X	rawRow = minrow;
X	rawCol = 0;
X    }
X    if (screen->startHRow < minrow) {
X	screen->startHRow = minrow;
X	screen->startHCol = 0;
X    }
X    if (screen->endHRow < minrow) {
X	screen->endHRow = minrow;
X	screen->endHCol = 0;
X    }
X    screen->startHCoord = Coordinate (screen->startHRow, screen->startHCol);
X    screen->endHCoord = Coordinate (screen->endHRow, screen->endHCol);
}
X
X
/*ARGSUSED*/
ResizeSelection (screen, rows, cols)
X    TScreen *screen;
X    int rows, cols;
{
X    rows--;				/* decr to get 0-max */
X    cols--;
X
X    if (startRRow > rows) startRRow = rows;
X    if (startSRow > rows) startSRow = rows;
X    if (endRRow > rows) endRRow = rows;
X    if (endSRow > rows) endSRow = rows;
X    if (rawRow > rows) rawRow = rows;
X
X    if (startRCol > cols) startRCol = cols;
X    if (startSCol > cols) startSCol = cols;
X    if (endRCol > cols) endRCol = cols;
X    if (endSCol > cols) endSCol = cols;
X    if (rawCol > cols) rawCol = cols;
}
X
static PointToRowCol(y, x, r, c)
register int y, x;
int *r, *c;
/* Convert pixel coordinates to character coordinates.
X   Rows are clipped between firstValidRow and lastValidRow.
X   Columns are clipped between to be 0 or greater, but are not clipped to some
X       maximum value. */
{
X	register TScreen *screen = &term->screen;
X	register row, col;
X
X	row = (y - screen->border) / FontHeight(screen);
X	if(row < firstValidRow)
X		row = firstValidRow;
X	else if(row > lastValidRow)
X		row = lastValidRow;
X	col = (x - screen->border - screen->scrollbar) / FontWidth(screen);
X	if(col < 0)
X		col = 0;
X	else if(col > screen->max_col+1) {
X		col = screen->max_col+1;
X	}
X	*r = row;
X	*c = col;
}
X
int LastTextCol(row)
register int row;
{
X	register TScreen *screen =  &term->screen;
X	register int i;
#ifdef KTERM
X	register Bchr *ch;
#else /* !KTERM */
X	register Char *ch;
#endif /* !KTERM */
X
X	for(i = screen->max_col,
#ifdef KTERM
X	 ch = screen->buf[row + screen->topline] + i ;
X	 i > 0 && (ch->code == ' ' || ch->code == 0); ch--, i--);
#else /* !KTERM */
X	 ch = screen->buf[2 * (row + screen->topline)] + i ;
X	 i > 0 && (*ch == ' ' || *ch == 0); ch--, i--);
#endif /* !KTERM */
X	return(i);
}	
X
static int charClass[128] = {
/* NUL  SOH  STX  ETX  EOT  ENQ  ACK  BEL */
X    32,   1,   1,   1,   1,   1,   1,   1,
/*  BS   HT   NL   VT   NP   CR   SO   SI */
X     1,  32,   1,   1,   1,   1,   1,   1,
/* DLE  DC1  DC2  DC3  DC4  NAK  SYN  ETB */
X     1,   1,   1,   1,   1,   1,   1,   1,
/* CAN   EM  SUB  ESC   FS   GS   RS   US */
X     1,   1,   1,   1,   1,   1,   1,   1,
/*  SP    !    "    #    $    %    &    ' */
X    32,  33,  34,  35,  36,  37,  38,  39,
/*   (    )    *    +    ,    -    .    / */
X    40,  41,  42,  43,  44,  45,  46,  47,
/*   0    1    2    3    4    5    6    7 */
X    48,  48,  48,  48,  48,  48,  48,  48,
/*   8    9    :    ;    <    =    >    ? */
X    48,  48,  58,  59,  60,  61,  62,  63,
/*   @    A    B    C    D    E    F    G */
X    64,  48,  48,  48,  48,  48,  48,  48,
/*   H    I    J    K    L    M    N    O */
X    48,  48,  48,  48,  48,  48,  48,  48,
/*   P    Q    R    S    T    U    V    W */ 
X    48,  48,  48,  48,  48,  48,  48,  48,
/*   X    Y    Z    [    \    ]    ^    _ */
X    48,  48,  48,  91,  92,  93,  94,  48,
/*   `    a    b    c    d    e    f    g */
X    96,  48,  48,  48,  48,  48,  48,  48,
SHAR_EOF
true || echo 'restore of kterm-4.1.2/button.c failed'
fi
echo 'End of kterm-4.1.2 part 5'
echo 'File kterm-4.1.2/button.c is continued in part 6'
echo 6 > _shar_seq_.tmp
exit 0


-----------------------------------------------------------------------------
mleisher at nmsu.edu                      "I laughed.
Mark Leisher                                I cried.
Computing Research Lab                          I fell down.
New Mexico State University                        It changed my life."
Las Cruces, NM                     - Rich [Cowboy Feng's Space Bar and Grille]

--
Dan Heller
O'Reilly && Associates       Z-Code Software    Comp-sources-x:
Senior Writer                President          comp-sources.x at uunet.uu.net
argv at ora.com                 argv at zipcode.com



More information about the Comp.sources.x mailing list