[Ttssh2-commit] [6952] logopen でタイムスタンプの種別を指定できるようにした。

scmno****@osdn***** scmno****@osdn*****
2017年 10月 23日 (月) 12:56:48 JST


Revision: 6952
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6952
Author:   doda
Date:     2017-10-23 12:56:48 +0900 (Mon, 23 Oct 2017)
Log Message:
-----------
logopen でタイムスタンプの種別を指定できるようにした。

併せてログフラグ周りを整理。
・SetAppend は AppendFlag 以外も扱うので名称変更
・各フラグのマスク値を直接書いていたので、マクロで隠すようにした
・ログフラグの渡す配列が無意味に長かったので整理

Modified Paths:
--------------
    trunk/doc/en/html/macro/command/logopen.html
    trunk/doc/ja/html/macro/command/logopen.html
    trunk/teraterm/common/ttddecmnd.h
    trunk/teraterm/teraterm/ttdde.c
    trunk/teraterm/ttpmacro/ttl.c
    trunk/teraterm/ttpmacro/ttmdde.c
    trunk/teraterm/ttpmacro/ttmdde.h

-------------- next part --------------
Modified: trunk/doc/en/html/macro/command/logopen.html
===================================================================
--- trunk/doc/en/html/macro/command/logopen.html	2017-10-18 04:06:45 UTC (rev 6951)
+++ trunk/doc/en/html/macro/command/logopen.html	2017-10-23 03:56:48 UTC (rev 6952)
@@ -18,7 +18,7 @@
 </p>
 
 <pre class="macro-syntax">
-logopen &lt;filename&gt; &lt;binary flag&gt; &lt;append flag&gt; [&lt;plain text flag&gt; [&lt;timestamp flag&gt; [&lt;hide dialog flag&gt; [&lt;Include screen buffer flag&gt;]]]]
+logopen &lt;filename&gt; &lt;binary flag&gt; &lt;append flag&gt; [&lt;plain text flag&gt; [&lt;timestamp flag&gt; [&lt;hide dialog flag&gt; [&lt;include screen buffer flag&gt; [&lt;timestamp type]]]]]
 </pre>
 
 <h2>Remarks</h2>
@@ -49,10 +49,40 @@
 </p>
 
 <p>
-If &lt;Include screen buffer flag&gt; is not 0, all current screen buffer is written into a log file in first.  <em>(version 4.80 or later)</em>
+If &lt;include screen buffer flag&gt; is not 0, all current screen buffer is written into a log file in first.  <em>(version 4.80 or later)</em>
 </p>
 
+<p>
+&lt;timestamp type&gt; specifies timestamp type, and can be one of the following: <em>(version 4.97 or later)</em>
+</p>
 
+<table>
+  <tr>
+    <th>value</th>
+    <th>Meaning</ht>
+  </tr>
+
+  <tr>
+    <td>0</td>
+    <td>Local Time</td>
+  </tr>
+
+  <tr>
+    <td>1</td>
+    <td>UTC</td>
+  </tr>
+
+  <tr>
+    <td>2</td>
+    <td>Elapsed Time (Logging)</td>
+  </tr>
+
+  <tr>
+    <td>3</td>
+    <td>Elapsed Time (Connection)</td>
+  </tr>
+</table>
+
 <p>
 If a log file is successfully opened, the system variable "result" is set to 0. Otherwise, the "result" is set to 1. <em>(version 4.62 or later)</em>
 </p>

Modified: trunk/doc/ja/html/macro/command/logopen.html
===================================================================
--- trunk/doc/ja/html/macro/command/logopen.html	2017-10-18 04:06:45 UTC (rev 6951)
+++ trunk/doc/ja/html/macro/command/logopen.html	2017-10-23 03:56:48 UTC (rev 6952)
@@ -18,7 +18,7 @@
 </p>
 
 <pre class="macro-syntax">
-logopen &lt;filename&gt; &lt;binary flag&gt; &lt;append flag&gt; [&lt;plain text flag&gt; [&lt;timestamp flag&gt; [&lt;hide dialog flag&gt; [&lt;Include screen buffer flag&gt;]]]]
+logopen &lt;filename&gt; &lt;binary flag&gt; &lt;append flag&gt; [&lt;plain text flag&gt; [&lt;timestamp flag&gt; [&lt;hide dialog flag&gt; [&lt;include screen buffer flag&gt; [&lt;timestamp type&gt;]]]]]
 </pre>
 
 <h2>\x89\xF0\x90\xE0</h2>
@@ -49,10 +49,41 @@
 </p>
 
 <p>
-&lt;Include screen buffer flag&gt; \x82\xAA 0 \x88ȊO\x82̏ꍇ\x81A\x8C\xBB\x8D݂̒[\x96\x96\x83o\x83b\x83t\x83@\x82\xB7\x82ׂĂ\xF0\x90\xE6\x82Ƀt\x83@\x83C\x83\x8B\x82ɏ\x91\x82\xAB\x8D\x9E\x82ށB <em>(\x83o\x81[\x83W\x83\x87\x83\x93 4.80\x88ȍ~)</em>
+&lt;include screen buffer flag&gt; \x82\xAA 0 \x88ȊO\x82̏ꍇ\x81A\x8C\xBB\x8D݂̒[\x96\x96\x83o\x83b\x83t\x83@\x82\xB7\x82ׂĂ\xF0\x90\xE6\x82Ƀt\x83@\x83C\x83\x8B\x82ɏ\x91\x82\xAB\x8D\x9E\x82ށB <em>(\x83o\x81[\x83W\x83\x87\x83\x93 4.80\x88ȍ~)</em>
 </p>
 
 <p>
+&lt;timestamp type&gt; \x82\xCD timestamp \x82̌`\x8E\xAE\x82\xF0\x8Ew\x92肷\x82\xE9\x81B\x88ȉ\xBA\x82̒l\x82\xAA\x8Ew\x92\xE8\x8Fo\x97\x88\x82\xE9\x81B<em>(\x83o\x81[\x83W\x83\x87\x83\x93 4.97\x88ȍ~)</em>
+</p>
+
+<table>
+  <tr>
+    <th>\x92l</th>
+    <th>\x88Ӗ\xA1</ht>
+  </tr>
+
+  <tr>
+    <td>0</td>
+    <td>\x92n\x95\xFB\x8E\x9E</td>
+  </tr>
+
+  <tr>
+    <td>1</td>
+    <td>UTC</td>
+  </tr>
+
+  <tr>
+    <td>2</td>
+    <td>Elapsed Time (Logging)</td>
+  </tr>
+
+  <tr>
+    <td>3</td>
+    <td>Elapsed Time (Connection)</td>
+  </tr>
+</table>
+
+<p>
 \x83\x8D\x83O\x83t\x83@\x83C\x83\x8B\x82\xF0\x8AJ\x82\xAF\x82\xBD\x8Fꍇ\x81Aresult \x82\xC9 0 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B\x8AJ\x82\xAF\x82Ȃ\xA9\x82\xC1\x82\xBD\x8Fꍇ\x82\xCD 1 \x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82\xE9\x81B<em>(\x83o\x81[\x83W\x83\x87\x83\x93 4.62 \x88ȍ~)</em>
 </p>
 

Modified: trunk/teraterm/common/ttddecmnd.h
===================================================================
--- trunk/teraterm/common/ttddecmnd.h	2017-10-18 04:06:45 UTC (rev 6951)
+++ trunk/teraterm/common/ttddecmnd.h	2017-10-23 03:56:48 UTC (rev 6952)
@@ -31,7 +31,7 @@
 #define CmdSetHWnd          ' '
 #define CmdSetFile          '!'
 #define CmdSetBinary        '"'
-#define CmdSetAppend        '#'
+#define CmdSetLogOpt        '#'
 #define CmdSetXmodemOpt     '$'
 #define CmdSetSync          '%'
 
@@ -88,3 +88,12 @@
 #define CmdLogAutoClose     'X'
 #define CmdGetModemStatus   'Y'
 #define CmdSetFlowCtrl      'Z'
+
+#define LogOptBinary        1
+#define LogOptAppend        2
+#define LogOptPlainText     3
+#define LogOptTimestamp     4
+#define LogOptHideDialog    5
+#define LogOptIncScrBuff    6
+#define LogOptTimestampType 7
+#define LogOptMax           LogOptTimestampType

Modified: trunk/teraterm/teraterm/ttdde.c
===================================================================
--- trunk/teraterm/teraterm/ttdde.c	2017-10-18 04:06:45 UTC (rev 6951)
+++ trunk/teraterm/teraterm/ttdde.c	2017-10-23 03:56:48 UTC (rev 6952)
@@ -77,7 +77,6 @@
 
 static char ParamFileName[MaxStrLen];
 static WORD ParamBinaryFlag;
-static WORD ParamAppendFlag;
 static WORD ParamXmodemOpt;
 static char ParamSecondFileName[MaxStrLen];
 
@@ -361,12 +360,14 @@
 	case CmdSetBinary:
 		ParamBinaryFlag = Command[1] & 1;
 		break;
-	case CmdSetAppend:
-		ParamAppendFlag     = Command[1] & 1;
-		ts.LogTypePlainText = Command[13] & 1;
-		ts.LogTimestamp     = Command[14] & 1;
-		ts.LogHideDialog    = Command[15] & 1;
-		ts.LogAllBuffIncludedInFirst    = Command[16] & 1;
+	case CmdSetLogOpt:
+		ts.LogBinary        = Command[LogOptBinary] - 0x30;
+		ts.Append           = Command[LogOptAppend] - 0x30;
+		ts.LogTypePlainText = Command[LogOptPlainText] - 0x30;
+		ts.LogTimestamp     = Command[LogOptTimestamp] - 0x30;
+		ts.LogHideDialog    = Command[LogOptHideDialog] - 0x30;
+		ts.LogAllBuffIncludedInFirst = Command[LogOptIncScrBuff] - 0x30;
+		ts.LogTimestampType = Command[LogOptTimestampType] - 0x30;
 		break;
 	case CmdSetXmodemOpt:
 		ParamXmodemOpt = Command[1] & 3;
@@ -543,8 +544,6 @@
 			LogVar->NoMsg = TRUE;
 			strncpy_s(LogVar->FullName, sizeof(LogVar->FullName),ParamFileName, _TRUNCATE);
 			ParseStrftimeFileName(LogVar->FullName, sizeof(LogVar->FullName));
-			ts.LogBinary = ParamBinaryFlag;
-			ts.Append = ParamAppendFlag;
 			ret = LogStart();
 			if (ret) {
 				strncpy_s(ParamFileName, sizeof(ParamFileName),"1", _TRUNCATE);

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2017-10-18 04:06:45 UTC (rev 6951)
+++ trunk/teraterm/ttpmacro/ttl.c	2017-10-23 03:56:48 UTC (rev 6952)
@@ -3131,53 +3131,49 @@
 {
 	TStrVal Str;
 	WORD Err;
-	int BinFlag, AppendFlag;
-	int TmpFlag, TmpOpt;
+	int LogFlags[LogOptMax+1] = { 0 };
+	int TmpFlag;
 	char ret[2];
 
 	Err = 0;
-	GetStrVal(Str,&Err);
-	GetIntVal(&BinFlag,&Err);
-	GetIntVal(&AppendFlag,&Err);
+	GetStrVal(Str, &Err);
+	GetIntVal(&LogFlags[LogOptBinary], &Err);
+	GetIntVal(&LogFlags[LogOptAppend], &Err);
 
-	if (CheckParameterGiven()) { // plain text
-		GetIntVal(&TmpFlag, &Err);
-		if (Err!=0) return Err;
-		TmpOpt = (TmpFlag == 0) ? 0 : 1;
-		AppendFlag |= TmpOpt * 0x1000;
+	// plain text
+	if (!CheckParameterGiven()) goto EndLogOptions;
+	GetIntVal(&LogFlags[LogOptPlainText], &Err);
+	if (Err!=0) return Err;
 
-		if (CheckParameterGiven()) { // timestamp
-			GetIntVal(&TmpFlag, &Err);
-			if (Err!=0) return Err;
-			TmpOpt = (TmpFlag == 0) ? 0 : 1;
-			AppendFlag |= TmpOpt * 0x2000;
+	// timestamp
+	if (!CheckParameterGiven()) goto EndLogOptions;
+	GetIntVal(&LogFlags[LogOptTimestamp], &Err);
+	if (Err!=0) return Err;
 
-			if (CheckParameterGiven()) { // hide file transfer dialog
-				GetIntVal(&TmpFlag, &Err);
-				if (Err!=0) return Err;
-				TmpOpt = (TmpFlag == 0) ? 0 : 1;
-				AppendFlag |= TmpOpt * 0x4000;
+	// hide file transfer dialog
+	if (!CheckParameterGiven()) goto EndLogOptions;
+	GetIntVal(&LogFlags[LogOptHideDialog], &Err);
+	if (Err!=0) return Err;
 
-				if (CheckParameterGiven()) { // Include screen buffer
-					GetIntVal(&TmpFlag, &Err);
-					if (Err!=0) return Err;
-					TmpOpt = (TmpFlag == 0) ? 0 : 1;
-					AppendFlag |= TmpOpt * 0x8000;
-				}
+	// Include screen buffer
+	if (!CheckParameterGiven()) goto EndLogOptions;
+	GetIntVal(&LogFlags[LogOptIncScrBuff], &Err);
+	if (Err!=0) return Err;
 
-			}
-		}
-	}
+	// Timestamp Type
+	if (!CheckParameterGiven()) goto EndLogOptions;
+	GetIntVal(&TmpFlag, &Err);
+	if (Err!=0) return Err;
+	if (TmpFlag < 0 || TmpFlag > 3)
+		return ErrSyntax;
+	LogFlags[LogOptTimestampType] = TmpFlag;
 
-	if ((Err==0) &&
-	    ((strlen(Str)==0) || (GetFirstChar()!=0)))
-		Err = ErrSyntax;
+EndLogOptions:
+	if (strlen(Str) == 0 || GetFirstChar() != 0)
+		return ErrSyntax;
 
-	if (Err!=0) return Err;
-
 	SetFile(Str);
-	SetBinary(BinFlag);
-	SetAppend(AppendFlag);
+	SetLogOption(LogFlags);
 
 	memset(ret, 0, sizeof(ret));
 	Err = GetTTParam(CmdLogOpen,ret,sizeof(ret));

Modified: trunk/teraterm/ttpmacro/ttmdde.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmdde.c	2017-10-18 04:06:45 UTC (rev 6951)
+++ trunk/teraterm/ttpmacro/ttmdde.c	2017-10-23 03:56:48 UTC (rev 6952)
@@ -920,29 +920,20 @@
   DdeClientTransaction(Cmd,strlen(Cmd)+1,ConvH,0,CF_OEMTEXT,XTYP_EXECUTE,1000,NULL);
 }
 
-void SetAppend(int AppendFlag)
+void SetLogOption(int *LogFlags)
 {
-	char Cmd[18];
+	char Cmd[LogOptMax+2];
 
-	Cmd[0]  = CmdSetAppend;
-	Cmd[1]  = 0x30 + (AppendFlag & 1);
-	Cmd[2]  = 0x30;
-	Cmd[3]  = 0x30;
-	Cmd[4]  = 0x30;
-	Cmd[5]  = 0x30;
-	Cmd[6]  = 0x30;
-	Cmd[7]  = 0x30;
-	Cmd[8]  = 0x30;
-	Cmd[9]  = 0x30;
-	Cmd[10] = 0x30;
-	Cmd[11] = 0x30;
-	Cmd[12] = 0x30;
-	Cmd[13] = 0x30 + ((AppendFlag & 0x1000) != 0);
-	Cmd[14] = 0x30 + ((AppendFlag & 0x2000) != 0);
-	Cmd[15] = 0x30 + ((AppendFlag & 0x4000) != 0);
-	Cmd[16] = 0x30 + ((AppendFlag & 0x8000) != 0);
-	Cmd[17] = 0;
-	DdeClientTransaction(Cmd,strlen(Cmd)+1,ConvH,0,CF_OEMTEXT,XTYP_EXECUTE,1000,NULL);
+	Cmd[0]                   = CmdSetLogOpt;
+	Cmd[LogOptBinary]        = 0x30 + (LogFlags[LogOptBinary] != 0);
+	Cmd[LogOptAppend]        = 0x30 + (LogFlags[LogOptAppend] != 0);
+	Cmd[LogOptPlainText]     = 0x30 + (LogFlags[LogOptPlainText] != 0);
+	Cmd[LogOptTimestamp]     = 0x30 + (LogFlags[LogOptTimestamp] != 0);
+	Cmd[LogOptHideDialog]    = 0x30 + (LogFlags[LogOptHideDialog] != 0);
+	Cmd[LogOptIncScrBuff]    = 0x30 + (LogFlags[LogOptIncScrBuff] != 0);
+	Cmd[LogOptTimestampType] = 0x30 + LogFlags[LogOptTimestampType];
+	Cmd[LogOptMax+1]         = 0;
+	DdeClientTransaction(Cmd, sizeof(Cmd), ConvH, 0, CF_OEMTEXT, XTYP_EXECUTE, 1000, NULL);
 }
 
 void SetXOption(int XOption)

Modified: trunk/teraterm/ttpmacro/ttmdde.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmdde.h	2017-10-18 04:06:45 UTC (rev 6951)
+++ trunk/teraterm/ttpmacro/ttmdde.h	2017-10-23 03:56:48 UTC (rev 6952)
@@ -57,7 +57,7 @@
 void SetSecondFile(PCHAR FN);
 void SetBinary(int BinFlag);
 void SetDebug(int DebugFlag);
-void SetAppend(int AppendFlag);
+void SetLogOption(int *LogFlags);
 void SetXOption(int XOption);
 void SendSync();
 void SetSync(BOOL OnFlag);



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