[ttssh2-commit] [10344] __ismbblead(), __ismbbtrail() を ttlib_static_cpp.cpp へ移動

Zurück zum Archiv-Index
scmno****@osdn***** scmno****@osdn*****
2022年 11月 2日 (水) 22:43:04 JST


Revision: 10344
          https://osdn.net/projects/ttssh2/scm/svn/commits/10344
Author:   zmatsuo
Date:     2022-11-02 22:43:04 +0900 (Wed, 02 Nov 2022)
Log Message:
-----------
__ismbblead(), __ismbbtrail() を ttlib_static_cpp.cpp へ移動

- vtterm.c から ttlib_static_cpp.cpp へ

Modified Paths:
--------------
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/common/ttlib_static_cpp.cpp
    trunk/teraterm/teraterm/vtterm.c

-------------- next part --------------
Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2022-10-30 15:09:08 UTC (rev 10343)
+++ trunk/teraterm/common/ttlib.h	2022-11-02 13:43:04 UTC (rev 10344)
@@ -209,6 +209,7 @@
 void SaveBmpFromHDC(const wchar_t* fname, HDC hdc, int width, int height);
 wchar_t *RandomFileW(const wchar_t *filespec_src);
 void RandomFile(const char *filespec_src,char *filename, int destlen);
+int __ismbblead(BYTE b, int code_page);
 
 #ifdef __cplusplus
 }

Modified: trunk/teraterm/common/ttlib_static_cpp.cpp
===================================================================
--- trunk/teraterm/common/ttlib_static_cpp.cpp	2022-10-30 15:09:08 UTC (rev 10343)
+++ trunk/teraterm/common/ttlib_static_cpp.cpp	2022-11-02 13:43:04 UTC (rev 10344)
@@ -1672,3 +1672,87 @@
 	}
 	free(filespec_srcW);
 }
+
+/**
+ *	IsDBCSLeadByteEx() \x82Ƃقړ\xAF\x82\xB6
+ *	ismbblead() \x82̊g\x92\xA3
+ *
+ *	@param	b			\x83e\x83X\x83g\x82\xB7\x82镶\x8E\x9A
+ *	@param	code_page	\x83R\x81[\x83h\x83y\x81[\x83W,CP_ACP\x82̎\x9E\x8C\xBB\x8D݂̃R\x81[\x83h\x83y\x81[\x83W
+ */
+int __ismbblead(BYTE b, int code_page)
+{
+	if (code_page == CP_ACP) {
+		code_page = (int)GetACP();
+	}
+	switch (code_page) {
+		case 932:
+			// \x93\xFA\x96{\x8C\xEA shift jis
+			if (((0x81 <= b) && (b <= 0x9f)) || ((0xe0 <= b) && (b <= 0xfc))) {
+				return TRUE;
+			}
+			return FALSE;
+		case 51949:
+			// Korean CP51949
+			if ((0xA1 <= b) && (b <= 0xFE)) {
+				return TRUE;
+			}
+			return FALSE;
+		case 936:
+			// CP936 GB2312
+			if ((0xA1 <= b) && (b <= 0xFE)) {
+				return TRUE;
+			}
+			return FALSE;
+		case 950:
+			// CP950 Big5
+			if (((0xA1 <= b) && (b <= 0xc6)) || ((0xc9 <= b) && (b <= 0xf9))) {
+				return TRUE;
+			}
+			return FALSE;
+		default:
+			break;
+	}
+	return FALSE;
+}
+
+/**
+ *	ismbbtrail() \x82̊g\x92\xA3
+ *
+ *	@param	b			\x83e\x83X\x83g\x82\xB7\x82镶\x8E\x9A
+ *	@param	code_page	\x83R\x81[\x83h\x83y\x81[\x83W,CP_ACP\x82̎\x9E\x8C\xBB\x8D݂̃R\x81[\x83h\x83y\x81[\x83W
+ */
+int __ismbbtrail(BYTE b, int code_page)
+{
+	if (code_page == CP_ACP) {
+		code_page = (int)GetACP();
+	}
+	switch (code_page) {
+		case 932:
+			if (((0x40 <= b) && (b <= 0x7E)) || ((0x80 <= b) && (b <= 0xFC))) {
+				return TRUE;
+			}
+			return FALSE;
+		case 51949:
+			// Korean CP51949
+			if ((0xA1 <= b) && (b <= 0xFE)) {
+				return TRUE;
+			}
+			return FALSE;
+		case 936:
+			// CP936 GB2312
+			if ((0xA1 <= b) && (b <= 0xFE)) {
+				return TRUE;
+			}
+			return FALSE;
+		case 950:
+			// CP950 Big5
+			if (((0x40 <= b) && (b <= 0x7e)) || ((0xa1 <= b) && (b <= 0xfe))) {
+				return TRUE;
+			}
+			return FALSE;
+		default:
+			break;
+	}
+	return FALSE;
+}

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2022-10-30 15:09:08 UTC (rev 10343)
+++ trunk/teraterm/teraterm/vtterm.c	2022-11-02 13:43:04 UTC (rev 10344)
@@ -5598,78 +5598,6 @@
 }
 
 /**
- *	IsDBCSLeadByteEx() \x82Ƃقړ\xAF\x82\xB6
- *	ismbblead() \x82̊g\x92\xA3
- */
-int __ismbblead(BYTE b, int code_page)
-{
-	switch (code_page) {
-		case 932:
-			// \x93\xFA\x96{\x8C\xEA shift jis
-			if (((0x81 <= b) && (b <= 0x9f)) || ((0xe0 <= b) && (b <= 0xfc))) {
-				return TRUE;
-			}
-			return FALSE;
-		case 51949:
-			// Korean CP51949
-			if ((0xA1 <= b) && (b <= 0xFE)) {
-				return TRUE;
-			}
-			return FALSE;
-		case 936:
-			// CP936 GB2312
-			if ((0xA1 <= b) && (b <= 0xFE)) {
-				return TRUE;
-			}
-			return FALSE;
-		case 950:
-			// CP950 Big5
-			if (((0xA1 <= b) && (b <= 0xc6)) || ((0xc9 <= b) && (b <= 0xf9))) {
-				return TRUE;
-			}
-			return FALSE;
-		default:
-			break;
-	}
-	return FALSE;
-}
-
-/**
- *	ismbbtrail() \x82̊g\x92\xA3
- */
-int __ismbbtrail(BYTE b, int code_page)
-{
-	switch (code_page) {
-		case 932:
-			if (((0x40 <= b) && (b <= 0x7E)) || ((0x80 <= b) && (b <= 0xFC))) {
-				return TRUE;
-			}
-			return FALSE;
-		case 51949:
-			// Korean CP51949
-			if ((0xA1 <= b) && (b <= 0xFE)) {
-				return TRUE;
-			}
-			return FALSE;
-		case 936:
-			// CP936 GB2312
-			if ((0xA1 <= b) && (b <= 0xFE)) {
-				return TRUE;
-			}
-			return FALSE;
-		case 950:
-			// CP950 Big5
-			if (((0x40 <= b) && (b <= 0x7e)) || ((0xa1 <= b) && (b <= 0xfe))) {
-				return TRUE;
-			}
-			return FALSE;
-		default:
-			break;
-	}
-	return FALSE;
-}
-
-/**
  *	1byte\x96ڃ`\x83F\x83b\x83N
  */
 static BOOL CheckFirstByte(BYTE b, int lang, int kanji_code)


ttssh2-commit メーリングリストの案内
Zurück zum Archiv-Index