[Ttssh2-commit] [8534] タイトルバー専用文字コード変換関数を移動

scmno****@osdn***** scmno****@osdn*****
2020年 2月 9日 (日) 14:55:29 JST


Revision: 8534
          https://osdn.net/projects/ttssh2/scm/svn/commits/8534
Author:   zmatsuo
Date:     2020-02-09 14:55:29 +0900 (Sun, 09 Feb 2020)
Log Message:
-----------
タイトルバー専用文字コード変換関数を移動

- ttwinman.c から vtterm.c へ
- ConvertToCP932()
- static 関数に変更

Modified Paths:
--------------
    trunk/teraterm/teraterm/ttwinman.c
    trunk/teraterm/teraterm/ttwinman.h
    trunk/teraterm/teraterm/vtterm.c

-------------- next part --------------
Modified: trunk/teraterm/teraterm/ttwinman.c
===================================================================
--- trunk/teraterm/teraterm/ttwinman.c	2020-02-09 05:55:20 UTC (rev 8533)
+++ trunk/teraterm/teraterm/ttwinman.c	2020-02-09 05:55:29 UTC (rev 8534)
@@ -69,68 +69,6 @@
   SetFocus(HVTWin);
 }
 
-
-// \x83^\x83C\x83g\x83\x8B\x83o\x81[\x82\xCCCP932\x82ւ̕ϊ\xB7\x82\xF0\x8Ds\x82\xA4
-// \x8C\xBB\x8D݁ASJIS\x81AEUC\x82݂̂ɑΉ\x9E\x81B
-// (2005.3.13 yutaka)
-void ConvertToCP932(char *str, int destlen)
-{
-#define IS_SJIS(n) (ts.KanjiCode == IdSJIS && IsDBCSLeadByte(n))
-#define IS_EUC(n) (ts.KanjiCode == IdEUC && (n & 0x80))
-	extern WORD PASCAL JIS2SJIS(WORD KCode);
-	size_t len = strlen(str);
-	char *cc = _alloca(len + 1);
-	char *c = cc;
-	int i;
-	unsigned char b;
-	WORD word;
-
-	if (_stricmp(ts.Locale, DEFAULT_LOCALE) == 0) {
-		for (i = 0 ; i < len ; i++) {
-			b = str[i];
-			if (IS_SJIS(b) || IS_EUC(b)) {
-				word = b<<8;
-
-				if (i == len - 1) {
-					*c++ = b;
-					continue;
-				}
-
-				b = str[i + 1];
-				word |= b;
-				i++;
-
-				if (ts.KanjiCode == IdSJIS) {
-					// SJIS\x82͂\xBB\x82̂܂\xDCCP932\x82Ƃ\xB5\x82ďo\x97͂\xB7\x82\xE9
-
-				} else if (ts.KanjiCode == IdEUC) {
-					// EUC -> SJIS
-					word &= ~0x8080;
-					word = JIS2SJIS(word);
-
-				} else if (ts.KanjiCode == IdJIS) {
-
-				} else if (ts.KanjiCode == IdUTF8) {
-
-				} else if (ts.KanjiCode == IdUTF8m) {
-
-				} else {
-
-				}
-
-				*c++ = word >> 8;
-				*c++ = word & 0xff;
-
-			} else {
-				*c++ = b;
-			}
-		}
-
-		*c = '\0';
-		strncpy_s(str, destlen, cc, _TRUNCATE);
-	}
-}
-
 // \x83L\x83\x83\x83v\x83V\x83\x87\x83\x93\x82̕ύX
 //
 // (2005.2.19 yutaka) format ID=13\x82̐V\x8BK\x92lj\xC1\x81ACOM5\x88ȏ\xE3\x82̕\\x8E\xA6\x82ɑΉ\x9E

Modified: trunk/teraterm/teraterm/ttwinman.h
===================================================================
--- trunk/teraterm/teraterm/ttwinman.h	2020-02-09 05:55:20 UTC (rev 8533)
+++ trunk/teraterm/teraterm/ttwinman.h	2020-02-09 05:55:29 UTC (rev 8534)
@@ -34,7 +34,6 @@
 
 /* prototypes */
 void VTActivate();
-void ConvertToCP932(char *str, int len);
 void ChangeTitle();
 void SwitchMenu();
 void SwitchTitleBar();

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2020-02-09 05:55:20 UTC (rev 8533)
+++ trunk/teraterm/teraterm/vtterm.c	2020-02-09 05:55:29 UTC (rev 8534)
@@ -5038,6 +5038,68 @@
 	}
 }
 
+
+// \x83^\x83C\x83g\x83\x8B\x83o\x81[\x82\xCCCP932\x82ւ̕ϊ\xB7\x82\xF0\x8Ds\x82\xA4
+// \x8C\xBB\x8D݁ASJIS\x81AEUC\x82݂̂ɑΉ\x9E\x81B
+// (2005.3.13 yutaka)
+static void ConvertToCP932(char *str, int destlen)
+{
+#define IS_SJIS(n) (ts.KanjiCode == IdSJIS && IsDBCSLeadByte(n))
+#define IS_EUC(n) (ts.KanjiCode == IdEUC && (n & 0x80))
+	extern WORD PASCAL JIS2SJIS(WORD KCode);
+	size_t len = strlen(str);
+	char *cc = _alloca(len + 1);
+	char *c = cc;
+	size_t i;
+	unsigned char b;
+	WORD word;
+
+	if (_stricmp(ts.Locale, DEFAULT_LOCALE) == 0) {
+		for (i = 0 ; i < len ; i++) {
+			b = str[i];
+			if (IS_SJIS(b) || IS_EUC(b)) {
+				word = b<<8;
+
+				if (i == len - 1) {
+					*c++ = b;
+					continue;
+				}
+
+				b = str[i + 1];
+				word |= b;
+				i++;
+
+				if (ts.KanjiCode == IdSJIS) {
+					// SJIS\x82͂\xBB\x82̂܂\xDCCP932\x82Ƃ\xB5\x82ďo\x97͂\xB7\x82\xE9
+
+				} else if (ts.KanjiCode == IdEUC) {
+					// EUC -> SJIS
+					word &= ~0x8080;
+					word = JIS2SJIS(word);
+
+				} else if (ts.KanjiCode == IdJIS) {
+
+				} else if (ts.KanjiCode == IdUTF8) {
+
+				} else if (ts.KanjiCode == IdUTF8m) {
+
+				} else {
+
+				}
+
+				*c++ = word >> 8;
+				*c++ = word & 0xff;
+
+			} else {
+				*c++ = b;
+			}
+		}
+
+		*c = '\0';
+		strncpy_s(str, destlen, cc, _TRUNCATE);
+	}
+}
+
 void XSequence(BYTE b)
 {
 	static char *StrBuff = NULL;


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