[Ttssh2-commit] [3407] Language= UTF-8対応

svnno****@sourc***** svnno****@sourc*****
2009年 5月 18日 (月) 14:45:05 JST


Revision: 3407
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3407
Author:   doda
Date:     2009-05-18 14:45:05 +0900 (Mon, 18 May 2009)

Log Message:
-----------
Language=UTF-8対応

Modified Paths:
--------------
    trunk/teraterm/teraterm/buffer.c
    trunk/teraterm/teraterm/vtdisp.c
    trunk/teraterm/teraterm/vtterm.c
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpcmn/ttcmn.c


-------------- next part --------------
Modified: trunk/teraterm/teraterm/buffer.c
===================================================================
--- trunk/teraterm/teraterm/buffer.c	2009-05-17 15:42:43 UTC (rev 3406)
+++ trunk/teraterm/teraterm/buffer.c	2009-05-18 05:45:05 UTC (rev 3407)
@@ -587,7 +587,7 @@
 {
 	NewLine(PageStart+CursorY);
 
-	if (ts.Language==IdJapanese) {
+	if (ts.Language==IdJapanese || ts.Language==IdUtf8) {
 		EraseKanji(1); /* if cursor is on right half of a kanji, erase the kanji */
 	}
 
@@ -630,7 +630,7 @@
 	int i, YEnd;
 
 	NewLine(PageStart+CursorY);
-	if (ts.Language==IdJapanese) {
+	if (ts.Language==IdJapanese || ts.Language==IdUtf8) {
 		EraseKanji(1); /* if cursor is on right half of a kanji, erase the kanji */
 	}
 	offset = CursorX;
@@ -661,7 +661,7 @@
 	int i, YHome;
 
 	NewLine(PageStart+CursorY);
-	if (ts.Language==IdJapanese) {
+	if (ts.Language==IdJapanese || ts.Language==IdUtf8) {
 		EraseKanji(0); /* if cursor is on left half of a kanji, erase the kanji */
 	}
 	offset = NumOfColumns;
@@ -736,7 +736,7 @@
 	}
 #endif /* NO_COPYLINE_FIX */
 
-	if (ts.Language==IdJapanese) {
+	if (ts.Language==IdJapanese || ts.Language==IdUtf8) {
 		EraseKanji(1); /* if cursor is on right half of a kanji, erase the kanji */
 	}
 
@@ -803,7 +803,7 @@
 {
 	NewLine(PageStart+CursorY);
 
-	if (ts.Language==IdJapanese) {
+	if (ts.Language==IdJapanese || ts.Language==IdUtf8) {
 		EraseKanji(0); /* if cursor is on left harf of a kanji, erase the kanji */
 		EraseKanji(1); /* if cursor on right half... */
 	}
@@ -836,7 +836,7 @@
 {
 	NewLine(PageStart+CursorY);
 
-	if (ts.Language==IdJapanese) {
+	if (ts.Language==IdJapanese || ts.Language==IdUtf8) {
 		EraseKanji(0); /* if cursor is on left harf of a kanji, erase the kanji */
 		EraseKanji(1); /* if cursor on right half... */
 	}
@@ -1424,7 +1424,7 @@
 	}
 #endif /* NO_COPYLINE_FIX */
 
-	if (ts.Language==IdJapanese) {
+	if (ts.Language==IdJapanese || ts.Language==IdUtf8) {
 		EraseKanji(1); /* if cursor is on right half of a kanji, erase the kanji */
 		if (! Insert) {
 			EraseKanji(0); /* if cursor on left half... */

Modified: trunk/teraterm/teraterm/vtdisp.c
===================================================================
--- trunk/teraterm/teraterm/vtdisp.c	2009-05-17 15:42:43 UTC (rev 3406)
+++ trunk/teraterm/teraterm/vtdisp.c	2009-05-18 05:45:05 UTC (rev 3407)
@@ -1928,7 +1928,7 @@
 	cv.Language = ts.Language;
 
 	/* reset IME */
-	if ((ts.Language==IdJapanese) || (ts.Language==IdKorean)) //HKS
+	if ((ts.Language==IdJapanese) || (ts.Language==IdKorean) || (ts.Language==IdUtf8)) //HKS
 	{
 		if (ts.UseIME==0)
 			FreeIME();
@@ -2080,7 +2080,7 @@
 	CaretX = (CursorX-WinOrgX)*FontWidth;
 	CaretY = (CursorY-WinOrgY)*FontHeight;
 
-	if ((ts.Language==IdJapanese || ts.Language==IdKorean) &&
+	if ((ts.Language==IdJapanese || ts.Language==IdKorean || ts.Language==IdUtf8) &&
 	    CanUseIME() && (ts.IMEInline>0))
 	{
 		/* set IME conversion window pos. & font */
@@ -3302,7 +3302,7 @@
 		ActiveWin = IdVT;
 	}
 	else {
-		if ((ts.Language==IdJapanese || ts.Language==IdKorean) &&
+		if ((ts.Language==IdJapanese || ts.Language==IdKorean || ts.Language==IdUtf8) &&
 		    CanUseIME())
 		{
 			/* position & font of conv. window -> default */

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2009-05-17 15:42:43 UTC (rev 3406)
+++ trunk/teraterm/teraterm/vtterm.c	2009-05-18 05:45:05 UTC (rev 3407)
@@ -3200,36 +3200,52 @@
 
 void ParseFirst(BYTE b)
 {
-	// UTF-8‚̏ꍇ‚Í“Á•Ê‚ɏˆ—‚·‚é
-	if ((ts.Language==IdKorean && ts.KanjiCode == IdUTF8) &&
-		ParseFirstUTF8(b, 0)) {
+	switch (ts.Language) {
+	  case IdUtf8:
+	  	ParseFirstUTF8(b, ts.KanjiCode == IdUTF8m);
+		return;
+
+	  case IdJapanese:
+	  case IdKorean:
+	  	switch (ts.KanjiCode) {
+		  case IdUTF8:
+		  	if (ParseFirstUTF8(b, 0)) {
+				return;
+			}
+			break;
+		  case IdUTF8m:
+		  	if (ParseFirstUTF8(b, 1)) {
+				return;
+			}
+			break;
+		  default:
+			if (ParseFirstJP(b))  {
+				return;
+			}
+		}
+		break;
+
+	  case IdRussian:
+		if (ParseFirstRus(b)) {
 			return;
-	} else	if ((ts.Language==IdJapanese && ts.KanjiCode == IdUTF8) &&
-		ParseFirstUTF8(b, 0)) {
-			return;
-	} else 	if ((ts.Language==IdJapanese && ts.KanjiCode == IdUTF8m) &&
-		ParseFirstUTF8(b, 1)) {
-			return;
-	} else if ((ts.Language==IdJapanese) &&
-    ParseFirstJP(b)) return;
-  else if ((ts.Language==IdRussian) &&
-    ParseFirstRus(b)) return;
+		}
+		break;
+	}
 
-  if (SSflag)
-  {
-    PutChar(b);
-    SSflag = FALSE;
-    return;
-  }
+	if (SSflag) {
+		PutChar(b);
+		SSflag = FALSE;
+		return;
+	}
 
-  if (b<=US)
-    ParseControl(b);
-  else if ((b>=0x20) && (b<=0x7E))
-    PutChar(b);
-  else if ((b>=0x80) && (b<=0x9F))
-    ParseControl(b);
-  else if (b>=0xA0)
-    PutChar(b);
+	if (b<=US)
+		ParseControl(b);
+	else if ((b>=0x20) && (b<=0x7E))
+		PutChar(b);
+	else if ((b>=0x80) && (b<=0x9F))
+		ParseControl(b);
+	else if (b>=0xA0)
+		PutChar(b);
 }
 
 int VTParse()

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2009-05-17 15:42:43 UTC (rev 3406)
+++ trunk/teraterm/teraterm/vtwin.cpp	2009-05-18 05:45:05 UTC (rev 3407)
@@ -1454,7 +1454,7 @@
 /* called by the [Setup] Terminal command */
 void CVTWindow::SetupTerm()
 {
-	if (ts.Language==IdJapanese || ts.Language==IdKorean) {
+	if (ts.Language==IdJapanese || ts.Language==IdKorean || ts.Language==IdUtf8) {
 		ResetCharSet();
 	}
 	cv.CRSend = ts.CRSend;
@@ -4056,8 +4056,8 @@
 
 	if (Ok) {
 //		ResetKeypadMode(TRUE);
-		if ((ts.Language==IdJapanese) || (ts.Language==IdKorean)) //HKS
-		ResetIME();
+		if ((ts.Language==IdJapanese) || (ts.Language==IdKorean) || (ts.Language==IdUtf8)) //HKS
+			ResetIME();
 	}
 }
 

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2009-05-17 15:42:43 UTC (rev 3406)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2009-05-18 05:45:05 UTC (rev 3407)
@@ -1171,7 +1171,7 @@
 			K = (cv->SendKanjiFirst << 8) + d;
 
 			// UTF-8‚Ö‚Ì•ÏŠ·‚ðs‚¤B1`3ƒoƒCƒg‚܂ł̑Ήž‚È‚Ì‚Å’ˆÓB
-			if (cv->KanjiCodeSend == IdUTF8) {
+			if (cv->KanjiCodeSend == IdUTF8 || cv->Language == IdUTF8) {
 				OutputTextUTF8(K, TempStr, &TempLen, cv);
 
 			} else {
@@ -1288,7 +1288,7 @@
 				TempLen++;
 
 				// ”¼ŠpƒJƒi‚ÍUnicode‚Å‚Í2ƒoƒCƒg‚É‚È‚é (2004.10.4 yutaka)
-				if (cv->KanjiCodeSend==IdUTF8) {
+				if (cv->KanjiCodeSend==IdUTF8 || cv->Language==IdUtf8) {
 					TempLen = 0;
 					K = d;
 					OutputTextUTF8(K, TempStr, &TempLen, cv);
@@ -1513,12 +1513,15 @@
 		return C;
 	}
 
-	if (cv->Language==IdJapanese) {
-		return TextOutJP(cv,B,C);
+	switch (cv->Language) {
+	  case IdJapanese:
+	  case IdUtf8:
+		return TextOutJP(cv, B, C);
+		break;
+	  case IdKorean:
+		return TextOutKR(cv, B, C);
+		break;
 	}
-	if (cv->Language==IdKorean) { // HKS
-		return TextOutKR(cv,B,C);
-	}
 
 	Full = FALSE;
 	i = 0;
@@ -1627,7 +1630,7 @@
 
 			K = (cv->EchoKanjiFirst << 8) + d;
 			// UTF-8‚Ö‚Ì•ÏŠ·‚ðs‚¤B1`3ƒoƒCƒg‚܂ł̑Ήž‚È‚Ì‚Å’ˆÓB
-			if (cv->KanjiCodeSend == IdUTF8) {
+			if (cv->KanjiCodeSend == IdUTF8 || cv->Language==IdUtf8) {
 				OutputTextUTF8(K, TempStr, &TempLen, cv);
 			}
 			else {
@@ -1787,7 +1790,7 @@
 		cv->InPtr = 0;
 	}
 
-	if (cv->Language==IdJapanese) {
+	if (cv->Language==IdJapanese || cv->Language == IdUtf8) {
 		return TextEchoJP(cv,B,C);
 	}
 



Ttssh2-commit メーリングリストの案内