svnno****@sourc*****
svnno****@sourc*****
2010年 8月 9日 (月) 21:07:13 JST
Revision: 3974 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3974 Author: doda Date: 2010-08-09 21:07:13 +0900 (Mon, 09 Aug 2010) Log Message: ----------- ãã¯ãã³ãã³ã dispstr ã追å ã http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=14733 Modified Paths: -------------- trunk/teraterm/teraterm/clipboar.c trunk/teraterm/teraterm/clipboar.h trunk/teraterm/teraterm/ttdde.c trunk/teraterm/ttpmacro/ttl.c trunk/teraterm/ttpmacro/ttmdde.h trunk/teraterm/ttpmacro/ttmparse.c trunk/teraterm/ttpmacro/ttmparse.h -------------- next part -------------- Modified: trunk/teraterm/teraterm/clipboar.c =================================================================== --- trunk/teraterm/teraterm/clipboar.c 2010-08-09 10:40:44 UTC (rev 3973) +++ trunk/teraterm/teraterm/clipboar.c 2010-08-09 12:07:13 UTC (rev 3974) @@ -36,6 +36,7 @@ static BOOL CBRetryEcho; static BOOL CBSendCR; static BOOL CBDDE; +static BOOL CBEchoOnly; static HFONT DlgClipboardFont; @@ -125,6 +126,8 @@ } } + CBEchoOnly = FALSE; + CBMemHandle = NULL; CBMemPtr = NULL; CBMemPtr2 = 0; @@ -158,6 +161,36 @@ } } +void CBStartEcho(PCHAR DataPtr, int DataSize) +{ + if (! cv.Ready) { + return; + } + if (TalkStatus!=IdTalkKeyb) { + return; + } + + CBEchoOnly = TRUE; + CBMemPtr2 = 0; + CBRetryEcho = FALSE; + CBSendCR = FALSE; + + CBDDE = FALSE; + if ((CBMemHandle = GlobalAlloc(GHND, DataSize)) != NULL) { + CBDDE = TRUE; + if ((CBMemPtr = GlobalLock(CBMemHandle)) != NULL) { + memcpy(CBMemPtr, DataPtr, DataSize); + GlobalUnlock(CBMemHandle); + CBMemPtr=NULL; + TalkStatus=IdTalkCB; + } + } + + if (TalkStatus != IdTalkCB) { + CBEndPaste(); + } +} + // ±ÌÖÍNbv{[h¨æÑDDEf[^ð[ÖèÞB // // CBMemHandlenhÍO[oÏÈÌÅA±ÌÖªI¹·éÜÅÍA @@ -183,6 +216,11 @@ return; } + if (CBEchoOnly) { + CBEcho(); + return; + } + now = GetTickCount(); if (now - lastcr < (DWORD)ts.PasteDelayPerLine) { return; @@ -305,6 +343,58 @@ } } +void CBEcho() +{ + if (CBMemHandle==NULL) { + return; + } + + if (CBRetryEcho && CommTextEcho(&cv,(PCHAR)&CBByte,1) == 0) { + return; + } + + if ((CBMemPtr = GlobalLock(CBMemHandle)) == NULL) { + return; + } + + do { + if (CBSendCR && (CBMemPtr[CBMemPtr2]==0x0a)) { + CBMemPtr2++; + } + + if (CBMemPtr[CBMemPtr2] == 0) { + CBRetryEcho = FALSE; + CBEndPaste(); + return; + } + + CBByte = CBMemPtr[CBMemPtr2]; + CBMemPtr2++; + + // Decoding characters which are encoded by MACRO + // to support NUL character sending + // + // [encoded character] --> [decoded character] + // 01 01 --> 00 + // 01 02 --> 01 + if (CBByte==0x01) { /* 0x01 from MACRO */ + CBByte = CBMemPtr[CBMemPtr2]; + CBMemPtr2++; + CBByte = CBByte - 1; // character just after 0x01 + } + + CBSendCR = (CBByte==0x0D); + + } while (CommTextEcho(&cv,(PCHAR)&CBByte,1) > 0); + + CBRetryEcho = TRUE; + + if (CBMemHandle != NULL) { + GlobalUnlock(CBMemHandle); + CBMemPtr=NULL; + } +} + void CBEndPaste() { TalkStatus = IdTalkKeyb; @@ -326,6 +416,7 @@ CBMemPtr = NULL; CBMemPtr2 = 0; CBAddCR = FALSE; + CBEchoOnly = FALSE; } Modified: trunk/teraterm/teraterm/clipboar.h =================================================================== --- trunk/teraterm/teraterm/clipboar.h 2010-08-09 10:40:44 UTC (rev 3973) +++ trunk/teraterm/teraterm/clipboar.h 2010-08-09 12:07:13 UTC (rev 3974) @@ -13,7 +13,9 @@ void CBClose(); void CBStartPaste(HWND HWin, BOOL AddCR, BOOL Bracketed, int BuffSize, PCHAR DataPtr, int DataSize); +void CBStartEcho(PCHAR DataPtr, int DataSize); void CBSend(); +void CBEcho(); void CBEndPaste(); int CBStartPasteConfirmChange(HWND HWin); Modified: trunk/teraterm/teraterm/ttdde.c =================================================================== --- trunk/teraterm/teraterm/ttdde.c 2010-08-09 10:40:44 UTC (rev 3973) +++ trunk/teraterm/teraterm/ttdde.c 2010-08-09 12:07:13 UTC (rev 3974) @@ -333,6 +333,7 @@ #define CmdSetDebug 'R' #define CmdYmodemSend 'S' #define CmdYmodemRecv 'T' +#define CmdDispStr 'U' HDDEDATA AcceptExecute(HSZ TopicHSz, HDDEDATA Data) { @@ -887,6 +888,10 @@ EndDdeCmnd(0); // }NÀsðI¹³¹éB break; + case CmdDispStr: + CBStartEcho(ParamFileName, sizeof(ParamFileName)); + break; + default: return DDE_FNOTPROCESSED; } Modified: trunk/teraterm/ttpmacro/ttl.c =================================================================== --- trunk/teraterm/ttpmacro/ttl.c 2010-08-09 10:40:44 UTC (rev 3973) +++ trunk/teraterm/ttpmacro/ttl.c 2010-08-09 12:07:13 UTC (rev 3974) @@ -697,6 +697,44 @@ return Err; } +WORD TTLDispStr() +{ + TStrVal Str, buff; + WORD Err, ValType; + int Val; + + if (! Linked) + return ErrLinkFirst; + + buff[0] = 0; + + while (TRUE) { + if (GetString(Str, &Err)) { + if (Err) return Err; + strncat_s(buff, MaxStrLen, Str, _TRUNCATE); + } + else if (GetExpression(&ValType, &Val, &Err)) { + if (Err!=0) return Err; + switch (ValType) { + case TypInteger: + Str[0] = LOBYTE(Val); + Str[1] = 0; + strncat_s(buff, MaxStrLen, Str, _TRUNCATE); + case TypString: + strncat_s(buff, MaxStrLen, StrVarPtr((WORD)Val), _TRUNCATE); + break; + default: + return ErrTypeMismatch; + } + } + else { + break; + } + } + SetFile(buff); + return SendCmnd(CmdDispStr, 0); +} + WORD TTLDo() { WORD WId, Err; @@ -3959,6 +3997,8 @@ Err = TTLDelPassword(); break; case RsvDisconnect: Err = TTLDisconnect(); break; + case RsvDispStr: + Err = TTLDispStr(); break; case RsvDo: Err = TTLDo(); break; case RsvElse: Modified: trunk/teraterm/ttpmacro/ttmdde.h =================================================================== --- trunk/teraterm/ttpmacro/ttmdde.h 2010-08-09 10:40:44 UTC (rev 3973) +++ trunk/teraterm/ttpmacro/ttmdde.h 2010-08-09 12:07:13 UTC (rev 3974) @@ -58,6 +58,7 @@ #define CmdSetDebug 'R' #define CmdYmodemSend 'S' #define CmdYmodemRecv 'T' +#define CmdDispStr 'U' #ifdef __cplusplus extern "C" { Modified: trunk/teraterm/ttpmacro/ttmparse.c =================================================================== --- trunk/teraterm/ttpmacro/ttmparse.c 2010-08-09 10:40:44 UTC (rev 3973) +++ trunk/teraterm/ttpmacro/ttmparse.c 2010-08-09 12:07:13 UTC (rev 3974) @@ -149,6 +149,7 @@ case 'd': if (_stricmp(Str,"delpassword")==0) *WordId = RsvDelPassword; else if (_stricmp(Str,"disconnect")==0) *WordId = RsvDisconnect; + else if (_stricmp(Str,"dispstr")==0) *WordId = RsvDispStr; else if (_stricmp(Str,"do")==0) *WordId = RsvDo; break; case 'e': Modified: trunk/teraterm/ttpmacro/ttmparse.h =================================================================== --- trunk/teraterm/ttpmacro/ttmparse.h 2010-08-09 10:40:44 UTC (rev 3973) +++ trunk/teraterm/ttpmacro/ttmparse.h 2010-08-09 12:07:13 UTC (rev 3974) @@ -189,6 +189,7 @@ #define RsvSetMulticastName 146 #define RsvSendlnBroadcast 147 #define RsvWait4all 148 +#define RsvDispStr 149 #define RsvSetDebug 175 #define RsvYmodemRecv 176 #define RsvYmodemSend 177