[Ttssh2-commit] [7997] 受信データを表示できるようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 20日 (火) 23:34:24 JST


Revision: 7997
          https://osdn.net/projects/ttssh2/scm/svn/commits/7997
Author:   zmatsuo
Date:     2019-08-20 23:34:24 +0900 (Tue, 20 Aug 2019)
Log Message:
-----------
受信データを表示できるようにした

- カレントフォルダに "teraterm_debug.txt" があるとデバグ用コンソールが開く
- "teraterm_debug.txt" は存在するだけでよい(0byteでもよい)

Modified Paths:
--------------
    branches/unicode_buf/teraterm/teraterm/teraterm.cpp
    branches/unicode_buf/teraterm/teraterm/vtterm.c

-------------- next part --------------
Modified: branches/unicode_buf/teraterm/teraterm/teraterm.cpp
===================================================================
--- branches/unicode_buf/teraterm/teraterm/teraterm.cpp	2019-08-20 14:34:12 UTC (rev 7996)
+++ branches/unicode_buf/teraterm/teraterm/teraterm.cpp	2019-08-20 14:34:24 UTC (rev 7997)
@@ -31,8 +31,10 @@
 
 #include "teraterm_conf.h"
 
+#include <stdio.h>
 #include <crtdbg.h>
 #include <tchar.h>
+#include <io.h>			// for access()
 #include "teraterm.h"
 #include "tttypes.h"
 #include "commlib.h"
@@ -53,6 +55,7 @@
 #include "compat_w95.h"
 #include "dlglib.h"
 #include "teraterml.h"
+#include "unicode_test.h"
 
 #if defined(_DEBUG) && defined(_MSC_VER)
 #define new ::new(_NORMAL_BLOCK, __FILE__, __LINE__)
@@ -271,6 +274,14 @@
 #ifdef _DEBUG
 	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
 #endif
+#if UNICODE_DEBUG
+	if (_access("teraterm_debug.txt", 0) == 0) {
+		FILE* fp;
+		AllocConsole();
+		freopen_s(&fp, "CONOUT$", "w", stdout);
+		freopen_s(&fp, "CONOUT$", "w", stderr);
+	}
+#endif
 
 	LONG lCount = 0;
 	DWORD SleepTick = 1;

Modified: branches/unicode_buf/teraterm/teraterm/vtterm.c
===================================================================
--- branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-08-20 14:34:12 UTC (rev 7996)
+++ branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-08-20 14:34:24 UTC (rev 7997)
@@ -5983,6 +5983,18 @@
 	LockBuffer();
 
 	while ((c>0) && (ChangeEmu==0)) {
+#if UNICODE_DEBUG
+		{
+			static DWORD prev_tick;
+			DWORD now = GetTickCount();
+			if (prev_tick == 0) prev_tick = now;
+			if (now - prev_tick > 1*1000) {
+				printf("\n");
+				prev_tick = now;
+			}
+			printf("%02x(%c) ", b, isprint(b) ? b : '.');
+		}
+#endif
 		if (DebugFlag!=DEBUG_FLAG_NONE)
 			PutDebugChar(b);
 		else {


Ttssh2-commit メーリングリストの案内
Back to archive index