From leeym@utopia.leeym.com  Sun Mar 18 06:11:34 2001
Return-Path: <leeym@utopia.leeym.com>
Received: from utopia.leeym.com (utopia.leeym.com [211.72.162.194])
	by hub.freebsd.org (Postfix) with ESMTP
	id BFC7837B719; Sun, 18 Mar 2001 06:11:31 -0800 (PST)
	(envelope-from leeym@utopia.leeym.com)
Received: (from leeym@localhost)
	by utopia.leeym.com (8.11.1/8.11.3) id f2IEBIx41325;
	Sun, 18 Mar 2001 22:11:19 +0800 (CST)
	(envelope-from leeym)
Message-Id: <200103181411.f2IEBIx41325@utopia.leeym.com>
Date: Sun, 18 Mar 2001 22:11:19 +0800 (CST)
From: leeym@bsd.ce.ntu.edu.tw
Reply-To: leeym@bsd.ce.ntu.edu.tw
To: FreeBSD-gnats-submit@freebsd.org
Cc: keichii@freebsd.org
Subject: Add Big5 multibyte support for tcsh
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         25895
>Category:       bin
>Synopsis:       Add Big5 multibyte support for tcsh
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    keichii
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 18 06:20:01 PST 2001
>Closed-Date:    Mon Sep 10 13:41:24 PDT 2001
>Last-Modified:  Mon Sep 10 13:41:59 PDT 2001
>Originator:     Yen-Ming Lee
>Release:        FreeBSD 4.3-BETA i386
>Organization:
Ga-Ga-Wu-La-La, Blah-Blah-Walah-Walah... Nothing.
>Environment:
System: FreeBSD utopia.leeym.com 4.3-BETA FreeBSD 4.3-BETA #2: Wed Mar 14 13:10:32 CST 2001 root@utopia.leeym.com:/home/system/obj/home/system/src/sys/UTOPIA i386

	
>Description:

Add Big5 multibyte support for tcsh.
To enable Big5 code, please set dspmbyte to big5

$ set dspmbyte = "big5"

>How-To-Repeat:
	
>Fix:

--- sh.char.c.orig	Sun Mar 18 20:52:40 2001
+++ sh.char.c	Sun Mar 18 21:19:55 2001
@@ -813,6 +813,61 @@
     _MB1|_MB2,	0,		0,		0,
 };
 
+/* Add by Yen-Ming Lee <leeym@cae.ce.ntu.edu.tw> */
+unsigned short _mbmap_big5[256] = {
+/* first byte   0xa1 - 0xfe */
+/* second byte  0x40 - 0x7e, 0xa1 - 0xfe */
+/* 0x00-0x3f = 0, 0x40-0x7e = 2, 0x7f-0xa0 = 0, 0xa1-0xfe = 3, 0xff = 0 */
+/* 0x00 - 0x3f = 0 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+/* 0x40 - 0x7e = 2 */
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+    _MB2,	_MB2,		_MB2,		_MB2,
+						/* 0x7f - 0xa0 = 0 */
+    _MB2,	_MB2,		_MB2,		0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+		/* a1 - fe = 3 */
+    0,		_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
+    _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
+    _MB1|_MB2,	_MB1|_MB2,	_MB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GS) && defined(DSPMBYTE)) */
 unsigned short _cmap[256] = {
 /*	  0 nul		  1 soh		  2 stx		  3 etx	*/
--- sh.char.h.orig	Sun Mar 18 21:23:26 2001
+++ sh.char.h	Sun Mar 18 21:23:42 2001
@@ -58,6 +58,7 @@
 extern unsigned short _mbmap[];
 extern unsigned short _mbmap_euc[];
 extern unsigned short _mbmap_sjis[];
+extern unsigned short _mbmap_big5[];
 /* VARIABLE Check str */
 /* same compiler require #define even not define DSPMBYTE */
 #define _MB1	0x0001
--- sh.set.c.orig	Sun Mar 18 20:53:40 2001
+++ sh.set.c	Sun Mar 18 21:29:29 2001
@@ -1103,6 +1103,8 @@
 	    iskcode = 1;
 	else if (eq(dstr1, STRKEUC))
 	    iskcode = 2;
+	else if (eq(dstr1, STRKBIG5))
+	    iskcode = 3;
 	else if ((dstr1[0] - '0') >= 0 && (dstr1[0] - '0') <= 3) {
 	    iskcode = 0;
 	}
@@ -1127,6 +1129,11 @@
 		_cmap[lp] = _cmap_mbyte[lp];
 		_mbmap[lp] = _mbmap_euc[lp];
 		break;
+	    case 3:
+		/* 3 ... big5 */
+		_cmap[lp] = _cmap_mbyte[lp];
+		_mbmap[lp] = _mbmap_big5[lp];
+		break;
 	    default:
 		xprintf(CGETS(18, 3,
 		    "Warning: unknown multibyte code %d; multibyte disabled\n"),
@@ -1204,6 +1211,7 @@
 	{ STRLANGEUCKRB, STRKEUC },
 	{ STRLANGSJIS, STRKSJIS },
 	{ STRLANGSJISB, STRKSJIS },
+	{ STRLANGBIG5, STRKBIG5 },
 	{ NULL, NULL }
     };
 
--- tc.const.c.orig	Sun Mar 18 20:54:26 2001
+++ tc.const.c	Sun Mar 18 21:42:50 2001
@@ -125,6 +125,7 @@
 Char STRmmliteral[]	= { '-', '-', 'l', 'i', 't', 'e', 'r', 'a', 'l', '\0' };
 Char STRKEUC[]		= { 'e', 'u', 'c', '\0' };
 Char STRKSJIS[]		= { 's', 'j', 'i', 's', '\0' };
+Char STRKBIG5[]         = { 'b', 'i', 'g', '5', '\0' };
 #  ifdef MBYTEDEBUG	/* Sorry, use for beta testing */
 Char STRmbytemap[]	= { 'm', 'b', 'y', 't', 'e', 'm', 'a', 'p', '\0' };
 #  endif /* MBYTEMAP */
@@ -153,6 +154,8 @@
 Char STRLANGSJIS[]	= { 'j', 'a', '_', 'J', 'P', '.', 'S', 'J', 'I', 'S',
 			    '\0' };
 Char STRLANGSJISB[]	= { '\0' };
+Char STRLANGBIG5[]	= { 'z', 'h', '_', 'T', 'W', '.', 'B', 'i', 'g', '5',
+			    '\0' };
 #  elif defined(linux)
 Char STRLANGEUC[]	= { 'j', 'a', '_', 'J', 'P', '.', 'e', 'u', 'c', 'J',
 			    'P', '\0' };
@@ -161,6 +164,7 @@
 Char STRLANGSJIS[]	= { 'j', 'a', '_', 'J', 'P', '.', 'S', 'J', 'I', 'S',
 			    '\0' };
 Char STRLANGSJISB[]	= { '\0' };
+Char STRLANGBIG5[]	= { '\0' };
 #  elif defined(__uxpm__)
 Char STRLANGEUCJP[]	= { 'j', 'a', 'p', 'a', 'n', '\0' };
 Char STRLANGEUCKR[]	= { 'k', 'o', 'r', 'e', 'a', '\0' };
@@ -168,6 +172,7 @@
 Char STRLANGEUCKRB[]	= { '\0' };
 Char STRLANGSJIS[]	= { '\0' };
 Char STRLANGSJISB[]	= { '\0' };
+Char STRLANGBIG5[]	= { '\0' };
 #  elif defined(SOLARIS2)
 Char STRLANGEUCJP[]	= { 'j', 'a', '\0' };
 Char STRLANGEUCKR[]	= { 'k', 'o', '\0' };
@@ -175,6 +180,7 @@
 Char STRLANGEUCKRB[]	= { 'k', 'o', 'r', 'e', 'a', 'n', '\0' };
 Char STRLANGSJIS[]	= { '\0' };
 Char STRLANGSJISB[]	= { '\0' };
+Char STRLANGBIG5[]	= { '\0' };
 #  elif defined(hpux)
 Char STRLANGEUCJP[]	= { 'j', 'a', '_', 'J', 'P', '.', 'e', 'u', 'c', 'J', 'P' };
 Char STRLANGEUCKR[]	= { 'k', 'o', '_', 'K', 'R', '.', 'e', 'u', 'c', 'K', 'R' };
@@ -182,6 +188,7 @@
 Char STRLANGEUCKRB[]	= { '\0' };
 Char STRLANGSJIS[]	= { '\0' };
 Char STRLANGSJISB[]	= { '\0' };
+Char STRLANGBIG5[]	= { '\0' };
 #  else
 Char STRLANGEUCJP[]	= { '\0' };
 Char STRLANGEUCKR[]	= { '\0' };
@@ -189,6 +196,7 @@
 Char STRLANGEUCKRB[]	= { '\0' };
 Char STRLANGSJIS[]	= { '\0' };
 Char STRLANGSJISB[]	= { '\0' };
+Char STRLANGBIG5[]	= { '\0' };
 #  endif
 # endif /* defined(DSPMBYTE) */
 #endif
>Release-Note:
>Audit-Trail:

From: "Andrey A. Chernov" <ache@nagual.pp.ru>
To: leeym@bsd.ce.ntu.edu.tw
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, keichii@FreeBSD.ORG
Subject: Re: bin/25895: Add Big5 multibyte support for tcsh
Date: Sun, 18 Mar 2001 17:29:23 +0300

 On Sun, Mar 18, 2001 at 22:11:19 +0800, leeym@bsd.ce.ntu.edu.tw wrote:
 > >Fix:
 > 
 > --- sh.char.c.orig	Sun Mar 18 20:52:40 2001
 > +++ sh.char.c	Sun Mar 18 21:19:55 2001
 
 tcsh is developed externally. Please submit your patches to tcsh author
 instead and they will appearse into FreeBSD automatically with the next
 official tcsh release.
 
 -- 
 Andrey A. Chernov
 http://ache.pp.ru/
State-Changed-From-To: open->analyzed 
State-Changed-By: keichii 
State-Changed-When: Sun Mar 18 10:53:37 PST 2001 
State-Changed-Why:  
The patch has been submitted to the tcsh authors. 
I will watch this one until the patch gets into the FreeBSD basesystem. 


Responsible-Changed-From-To: freebsd-bugs->keichii 
Responsible-Changed-By: keichii 
Responsible-Changed-When: Sun Mar 18 10:53:37 PST 2001 
Responsible-Changed-Why:  
The patch has been submitted to the tcsh authors. 
I will watch this one until the patch gets into the FreeBSD basesystem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25895 
State-Changed-From-To: analyzed->closed 
State-Changed-By: keichii 
State-Changed-When: Mon Sep 10 13:41:24 PDT 2001 
State-Changed-Why:  
new tcsh imported into -current, patch no long necessary 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25895 
>Unformatted:
