[Ttssh2-commit] [3505] ファンクションキーの出力等もバッファリングするようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 6月 16日 (火) 18:37:13 JST


Revision: 3505
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3505
Author:   doda
Date:     2009-06-16 18:37:13 +0900 (Tue, 16 Jun 2009)

Log Message:
-----------
ファンクションキーの出力等もバッファリングするようにした。

Modified Paths:
--------------
    trunk/teraterm/common/ttcommon.h
    trunk/teraterm/teraterm/keyboard.c
    trunk/teraterm/ttpcmn/ttcmn.c
    trunk/teraterm/ttpcmn/ttpcmn.def


-------------- next part --------------
Modified: trunk/teraterm/common/ttcommon.h
===================================================================
--- trunk/teraterm/common/ttcommon.h	2009-06-16 08:29:45 UTC (rev 3504)
+++ trunk/teraterm/common/ttcommon.h	2009-06-16 09:37:13 UTC (rev 3505)
@@ -39,6 +39,7 @@
 void FAR PASCAL CommInsert1Byte(PComVar cv, BYTE b);
 int FAR PASCAL CommRawOut(PComVar cv, PCHAR B, int C);
 int FAR PASCAL CommBinaryOut(PComVar cv, PCHAR B, int C);
+int FAR PASCAL CommBinaryBuffOut(PComVar cv, PCHAR B, int C);
 int FAR PASCAL CommTextOut(PComVar cv, PCHAR B, int C);
 int FAR PASCAL CommBinaryEcho(PComVar cv, PCHAR B, int C);
 int FAR PASCAL CommTextEcho(PComVar cv, PCHAR B, int C);

Modified: trunk/teraterm/teraterm/keyboard.c
===================================================================
--- trunk/teraterm/teraterm/keyboard.c	2009-06-16 08:29:45 UTC (rev 3504)
+++ trunk/teraterm/teraterm/keyboard.c	2009-06-16 09:37:13 UTC (rev 3505)
@@ -633,7 +633,7 @@
       case IdBinary:
 	if (TalkStatus==IdTalkKeyb) {
 	  for (i = 1 ; i <= CodeCount ; i++) {
-	    CommBinaryOut(&cv,Code,CodeLength);
+	    CommBinaryBuffOut(&cv,Code,CodeLength);
 	    if (ts.LocalEcho>0)
 	      CommBinaryEcho(&cv,Code,CodeLength);
 	  }
@@ -740,7 +740,7 @@
       case IdBinary:
 	for (i = 1 ; i <= Count ; i++)
 	{
-	  CommBinaryOut(&cv,Code,CodeLength);
+	  CommBinaryBuffOut(&cv,Code,CodeLength);
 	  if (ts.LocalEcho>0)
 	    CommBinaryEcho(&cv,Code,CodeLength);
 	}

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2009-06-16 08:29:45 UTC (rev 3504)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2009-06-16 09:37:13 UTC (rev 3505)
@@ -1096,30 +1096,90 @@
 		d[Len] = B[i];
 		Len++;
 
-		if ( cv->TelFlag && (B[i]=='\x0d') &&
-		     ! cv->TelBinSend ) {
-			d[Len] = '\x00';
-			Len++;
-		};
-
-		if ( cv->TelFlag && (B[i]=='\xff') ) {
-			d[Len] = '\xff';
-			Len++;
+		if ( cv->TelFlag && (B[i]=='\x0d') && ! cv->TelBinSend ) {
+			d[Len++] = '\x00';
 		}
+		else if ( cv->TelFlag && (B[i]=='\xff') ) {
+			d[Len++] = '\xff';
+		}
 
-		if ( OutBuffSize-cv->OutBuffCount-Len >=0 ) {
-			CommRawOut(cv,d,Len);
+		if ( OutBuffSize - cv->OutBuffCount - Len >= 0 ) {
+			CommRawOut(cv, d, Len);
 			a = 1;
 		}
 		else {
 			a = 0;
 		}
 
-		i = i + a;
+		i += a;
 	}
 	return i;
 }
 
+int FAR PASCAL CommBinaryBuffOut(PComVar cv, PCHAR B, int C)
+{
+	int a, i, Len, OutLen;
+	char d[3];
+
+	if ( ! cv->Ready ) {
+		return C;
+	}
+
+	i = 0;
+	a = 1;
+	while ((a>0) && (i<C)) {
+		Len = 0;
+
+		d[Len] = B[i];
+		Len++;
+
+		if (B[i] == CR) {
+			if ( cv->TelFlag && ! cv->TelBinSend ) {
+				d[Len++] = '\x00';
+			}
+			if (cv->TelLineMode) {
+				cv->Flush = TRUE;
+			}
+		}
+		else if ( cv->TelFlag && (B[i]=='\xff') ) {
+			d[Len++] = '\xff';
+		}
+
+		if (cv->TelLineMode) {
+			if (OutBuffSize - cv->LineModeBuffCount - Len >= 0) {
+				memcpy(&(cv->LineModeBuff[cv->LineModeBuffCount]), d, Len);
+				cv->LineModeBuffCount += Len;
+				if (cv->Flush) {
+					cv->FlushLen = cv->LineModeBuffCount;
+				}
+				a = 1;
+			}
+			else {
+				a = 0;
+			}
+			if (cv->FlushLen > 0) {
+				OutLen = CommRawOut(cv, cv->LineModeBuff, cv->FlushLen);
+				cv->FlushLen -= OutLen;
+				cv->LineModeBuffCount -= OutLen;
+				memmove(cv->LineModeBuff, &(cv->LineModeBuff[OutLen]), cv->LineModeBuffCount);
+			}
+			cv->Flush = FALSE;
+		}
+		else {
+			if ( OutBuffSize - cv->OutBuffCount - Len >= 0 ) {
+				CommRawOut(cv, d, Len);
+				a = 1;
+			}
+			else {
+				a = 0;
+			}
+		}
+
+		i += a;
+	}
+	return i;
+}
+
 static int OutputTextUTF8(WORD K, char *TempStr, PComVar cv)
 {
 	unsigned int code;

Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2009-06-16 08:29:45 UTC (rev 3504)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2009-06-16 09:37:13 UTC (rev 3505)
@@ -19,6 +19,7 @@
   CommRead1Byte @22
   CommRawOut @23
   CommBinaryOut @24
+  CommBinaryBuffOut @52
   CommTextOut @25
   CommBinaryEcho @26
   CommTextEcho @27



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