svnno****@sourc*****
svnno****@sourc*****
2009年 10月 9日 (金) 01:38:28 JST
Revision: 3637 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3637 Author: yutakapon Date: 2009-10-09 01:38:28 +0900 (Fri, 09 Oct 2009) Log Message: ----------- setdebug ãã¯ãã³ãã³ãã追å ããã å¶å¾¡ã³ã¼ãã wait ãããã¨ãã§ããããã«ãªããã¾ããts.Debug ãç«ã¦ããã¨ãªãããããã°ã¢ã¼ããåãæ¿ããããã Modified Paths: -------------- trunk/teraterm/common/helpid.h trunk/teraterm/teraterm/keyboard.c trunk/teraterm/teraterm/keyboard.h trunk/teraterm/teraterm/ttdde.c trunk/teraterm/teraterm/vtterm.c trunk/teraterm/ttpmacro/ttl.c trunk/teraterm/ttpmacro/ttmdde.c trunk/teraterm/ttpmacro/ttmdde.h trunk/teraterm/ttpmacro/ttmparse.c trunk/teraterm/ttpmacro/ttmparse.h -------------- next part -------------- Modified: trunk/teraterm/common/helpid.h =================================================================== --- trunk/teraterm/common/helpid.h 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/common/helpid.h 2009-10-08 16:38:28 UTC (rev 3637) @@ -251,12 +251,14 @@ #define HlpMacroCommandSendbreak 92075 #define HlpMacroCommandSendbroadcast 92144 #define HlpMacroCommandSendlnbroadcast 92147 +#define HlpMacroCommandSendlnt 92174 #define HlpMacroCommandSendfile 92076 #define HlpMacroCommandSendkcode 92077 #define HlpMacroCommandSendln 92078 #define HlpMacroCommandSendmulticast 92145 #define HlpMacroCommandSetbaud 92134 #define HlpMacroCommandSetdate 92079 +#define HlpMacroCommandSetDebug 92175 #define HlpMacroCommandSetdir 92080 #define HlpMacroCommandSetdlgpos 92081 #define HlpMacroCommandSetdtr 92137 @@ -290,6 +292,7 @@ #define HlpMacroCommandWait 92100 #define HlpMacroCommandWait4all 92148 #define HlpMacroCommandWaitevent 92101 +#define HlpMacroCommandWaitInt 92173 #define HlpMacroCommandWaitln 92102 #define HlpMacroCommandWaitn 92143 #define HlpMacroCommandWaitrecv 92103 Modified: trunk/teraterm/teraterm/keyboard.c =================================================================== --- trunk/teraterm/teraterm/keyboard.c 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/teraterm/keyboard.c 2009-10-08 16:38:28 UTC (rev 3637) @@ -21,7 +21,7 @@ BOOL AutoRepeatMode; BOOL AppliKeyMode, AppliCursorMode; BOOL Send8BitMode; -BOOL DebugFlag = FALSE; +BYTE DebugFlag = DEBUG_FLAG_NONE; static char FuncKeyStr[NumOfUDK][FuncKeyStrMax]; static int FuncKeyLen[NumOfUDK]; @@ -544,7 +544,7 @@ /* debug mode */ if ((ts.Debug>0) && (VKey == VK_ESCAPE) && ShiftKey()) { MessageBeep(0); - DebugFlag = ! DebugFlag; + DebugFlag = (DebugFlag+1)%DEBUG_FLAG_MAXD; CodeCount = 0; PeekMessage((LPMSG)&M,HWin,WM_CHAR,WM_CHAR,PM_REMOVE); return KEYDOWN_CONTROL; Modified: trunk/teraterm/teraterm/keyboard.h =================================================================== --- trunk/teraterm/teraterm/keyboard.h 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/teraterm/keyboard.h 2009-10-08 16:38:28 UTC (rev 3637) @@ -12,6 +12,12 @@ #define KEYDOWN_CONTROL 2 /* Ctrl,ShiftÈÇ */ #define KEYDOWN_OTHER 0 /* »Ì¼ */ +#define DEBUG_FLAG_NONE 0 +#define DEBUG_FLAG_NORM 1 +#define DEBUG_FLAG_HEXD 2 +#define DEBUG_FLAG_NOUT 3 +#define DEBUG_FLAG_MAXD 4 + void SetKeyMap(); void ClearUserKey(); void DefineUserKey(int NewKeyId, PCHAR NewKeyStr, int NewKeyLen); @@ -29,7 +35,7 @@ extern BOOL AutoRepeatMode; extern BOOL AppliKeyMode, AppliCursorMode; extern BOOL Send8BitMode; -extern BOOL DebugFlag; +extern BYTE DebugFlag; #ifdef __cplusplus } Modified: trunk/teraterm/teraterm/ttdde.c =================================================================== --- trunk/teraterm/teraterm/ttdde.c 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/teraterm/ttdde.c 2009-10-08 16:38:28 UTC (rev 3637) @@ -15,6 +15,7 @@ #include "ttsetup.h" #include "telnet.h" #include "ttlib.h" +#include "keyboard.h" #include "ttdde.h" #include "commlib.h" @@ -329,6 +330,7 @@ #define CmdSendBroadcast 'O' #define CmdSendMulticast 'P' #define CmdSetMulticastName 'Q' +#define CmdSetDebug 'R' HDDEDATA AcceptExecute(HSZ TopicHSz, HDDEDATA Data) { @@ -584,6 +586,9 @@ if (cv.Ready && cv.TelFlag && (ts.TelEcho>0)) TelChangeEcho(); break; + case CmdSetDebug: + DebugFlag = (Command[1]-'0')%DEBUG_FLAG_MAXD; + break; case CmdSetTitle: strncpy_s(ts.Title, sizeof(ts.Title),ParamFileName, _TRUNCATE); if (ts.AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite) { Modified: trunk/teraterm/teraterm/vtterm.c =================================================================== --- trunk/teraterm/teraterm/vtterm.c 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/teraterm/vtterm.c 2009-10-08 16:38:28 UTC (rev 3637) @@ -603,9 +603,22 @@ void PutDebugChar(BYTE b) { + static BYTE buff[3]; + int i = 0; + + if (DebugFlag!=DEBUG_FLAG_NONE) { InsertMode = FALSE; AutoWrapMode = TRUE; + if (DebugFlag==DEBUG_FLAG_HEXD) { + _snprintf(buff,3,"%02X",(unsigned int) b); + + for (;i<2;i++) + PutChar(buff[i]); + PutChar(' '); + } + else if (DebugFlag==DEBUG_FLAG_NORM) { + if ((b & 0x80) == 0x80) { UpdateStr(); @@ -628,12 +641,14 @@ } else PutChar(b); + } if (CharAttr.Attr != AttrDefault) { UpdateStr(); CharAttr.Attr = AttrDefault; } + } } void PrnParseControl(BYTE b) // printer mode @@ -3480,7 +3495,7 @@ while ((c>0) && (ChangeEmu==0)) { - if (DebugFlag) + if (DebugFlag!=DEBUG_FLAG_NONE) PutDebugChar(b); else { switch (ParseMode) { Modified: trunk/teraterm/ttpmacro/ttl.c =================================================================== --- trunk/teraterm/ttpmacro/ttl.c 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/ttpmacro/ttl.c 2009-10-08 16:38:28 UTC (rev 3637) @@ -219,6 +219,27 @@ return Err; } + +WORD TTLCommCmdDeb() +{ + int Val; + WORD Err; + + Err = 0; + GetIntVal(&Val,&Err); + + if ((Err==0) && + (GetFirstChar()!=0)) + Err = ErrSyntax; + if ((Err==0) && (! Linked)) + Err = ErrLinkFirst; + if (Err==0) + { + SetDebug(Val); + } + return Err; +} + WORD TTLCommCmdInt(char Cmd, int Wait) { int Val; @@ -3967,6 +3988,9 @@ Err = TTLCommCmdInt(CmdSetDtr,0); break; case RsvSetEcho: Err = TTLCommCmdBin(CmdSetEcho,0); break; + + case RsvSetDebug: + Err = TTLCommCmdDeb(); break; case RsvSetEnv: Err = TTLSetEnv(); break; case RsvSetExitCode: Modified: trunk/teraterm/ttpmacro/ttmdde.c =================================================================== --- trunk/teraterm/ttpmacro/ttmdde.c 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/ttpmacro/ttmdde.c 2009-10-08 16:38:28 UTC (rev 3637) @@ -855,6 +855,29 @@ DdeClientTransaction(Cmd,strlen(Cmd)+1,ConvH,0,CF_OEMTEXT,XTYP_EXECUTE,1000,NULL); } +/* +Besides I created a setdebug command to set the debug flag of teraterm. +Usage: +setdebug <int> +It sets the debug flag to <int> value. <int> can be: +0: no debug: output as usual +1: usual teraterm debug mode (described in http://ttssh2.sourceforge.jp/manual/en/ ... -term.html) +2: hex output. Received bytes are printed in hex format (capital letters) separated by a space +3: disable output completely + +cf. http://logmett.com/forum/viewtopic.php?f=3&t=999 + http://logmett.com/forum/viewtopic.php?f=3&t=996 +*/ +void SetDebug(int DebugFlag) +{ + char Cmd[3]; + + Cmd[0] = CmdSetDebug; + Cmd[1] = DebugFlag+'0'; + Cmd[2] = 0; + DdeClientTransaction(Cmd,strlen(Cmd)+1,ConvH,0,CF_OEMTEXT,XTYP_EXECUTE,1000,NULL); +} + void SetAppend(int AppendFlag) { char Cmd[18]; Modified: trunk/teraterm/ttpmacro/ttmdde.h =================================================================== --- trunk/teraterm/ttpmacro/ttmdde.h 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/ttpmacro/ttmdde.h 2009-10-08 16:38:28 UTC (rev 3637) @@ -55,6 +55,7 @@ #define CmdSendBroadcast 'O' #define CmdSendMulticast 'P' #define CmdSetMulticastName 'Q' +#define CmdSetDebug 'R' #ifdef __cplusplus extern "C" { @@ -81,6 +82,7 @@ void SetFile(PCHAR FN); void SetSecondFile(PCHAR FN); void SetBinary(int BinFlag); +void SetDebug(int DebugFlag); void SetAppend(int AppendFlag); void SetXOption(int XOption); void SendSync(); Modified: trunk/teraterm/ttpmacro/ttmparse.c =================================================================== --- trunk/teraterm/ttpmacro/ttmparse.c 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/ttpmacro/ttmparse.c 2009-10-08 16:38:28 UTC (rev 3637) @@ -264,6 +264,7 @@ else if (_stricmp(Str,"sendln")==0) *WordId = RsvSendLn; else if (_stricmp(Str,"setbaud")==0) *WordId = RsvSetBaud; else if (_stricmp(Str,"setdate")==0) *WordId = RsvSetDate; + else if (_stricmp(Str,"setdebug")==0) *WordId = RsvSetDebug; else if (_stricmp(Str,"setdir")==0) *WordId = RsvSetDir; else if (_stricmp(Str,"setdlgpos")==0) *WordId = RsvSetDlgPos; else if (_stricmp(Str,"setdtr")==0) *WordId = RsvSetDtr; // add 'setdtr' (2008.3.12 maya) Modified: trunk/teraterm/ttpmacro/ttmparse.h =================================================================== --- trunk/teraterm/ttpmacro/ttmparse.h 2009-10-07 15:57:33 UTC (rev 3636) +++ trunk/teraterm/ttpmacro/ttmparse.h 2009-10-08 16:38:28 UTC (rev 3637) @@ -214,6 +214,10 @@ #define RsvALShift 171 // arithmetic left shift #define RsvLRShift 172 // logical right shift +#define RsvWaitInt 173 +#define RsvSendInt 174 +#define RsvSetDebug 175 + // integer type for buffer pointer typedef DWORD BINT;