[Ttssh2-commit] [9054] ttpfile.dll のプロトコル関連の関数を使用しないようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2020年 12月 20日 (日) 21:06:33 JST


Revision: 9054
          https://osdn.net/projects/ttssh2/scm/svn/commits/9054
Author:   zmatsuo
Date:     2020-12-20 21:06:32 +0900 (Sun, 20 Dec 2020)
Log Message:
-----------
ttpfile.dll のプロトコル関連の関数を使用しないようにした

- ttpfile_proto.cpp,h へ移動
  - ProtoInit()
  - ProtoParse()
  - ProtoTimeOutProc()
  - ProtoCancel()
- UILanguageFile グローバル変数をなくした
  - ファイル内のグローバル変数を追加 quickvan.c, zmodem.c, kermit.c
- bplus.c でダイアログを開く箇所を常に失敗するようにした

Modified Paths:
--------------
    trunk/teraterm/teraterm/CMakeLists.txt
    trunk/teraterm/teraterm/filesys.h
    trunk/teraterm/teraterm/filesys_proto.cpp
    trunk/teraterm/teraterm/ttermpro.v16.vcxproj
    trunk/teraterm/teraterm/ttermpro.v8.vcproj
    trunk/teraterm/ttpfile/bplus.c
    trunk/teraterm/ttpfile/ftlib.h
    trunk/teraterm/ttpfile/kermit.c
    trunk/teraterm/ttpfile/quickvan.c
    trunk/teraterm/ttpfile/zmodem.c

Added Paths:
-----------
    trunk/teraterm/ttpfile/ttfile_proto.cpp
    trunk/teraterm/ttpfile/ttfile_proto.h

-------------- next part --------------
Modified: trunk/teraterm/teraterm/CMakeLists.txt
===================================================================
--- trunk/teraterm/teraterm/CMakeLists.txt	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/teraterm/CMakeLists.txt	2020-12-20 12:06:32 UTC (rev 9054)
@@ -176,6 +176,32 @@
   REGULAR_EXPRESSION
   "..\/ttpdlg\/")
 
+target_sources(
+  teraterm
+  PRIVATE
+  ../ttpfile/bplus.c
+  ../ttpfile/bplus.h
+  ../ttpfile/ftlib.c
+  ../ttpfile/ftlib.h
+  ../ttpfile/kermit.c
+  ../ttpfile/kermit.h
+  ../ttpfile/quickvan.c
+  ../ttpfile/quickvan.h
+  ../ttpfile/ttfile_proto.cpp
+  ../ttpfile/ttfile_proto.h
+  ../ttpfile/xmodem.c
+  ../ttpfile/xmodem.h
+  ../ttpfile/ymodem.c
+  ../ttpfile/ymodem.h
+  ../ttpfile/zmodem.c
+  ../ttpfile/zmodem.h
+)
+
+source_group(
+  "ttpfile"
+  REGULAR_EXPRESSION
+  "..\/ttpfile\/")
+
 if (MSVC)
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:user32.dll /DELAYLOAD:shell32.dll /MANIFEST:NO")
   if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
@@ -193,6 +219,8 @@
 target_include_directories(
   teraterm
   PRIVATE
+  .
+  ../teraterm
   ../common
   ../ttpfile
   ../ttpdlg
@@ -232,7 +260,7 @@
   teraterm
   common_static
   ttpcmn
-  ttpfile
+  #ttpfile
   ttpset
   ttptek
   ${ONIGURUMA_LIB}

Modified: trunk/teraterm/teraterm/filesys.h
===================================================================
--- trunk/teraterm/teraterm/filesys.h	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/teraterm/filesys.h	2020-12-20 12:06:32 UTC (rev 9054)
@@ -68,10 +68,12 @@
 extern PSetFileVar SetFileVar;
 extern PGetXFname GetXFname;
 #endif
+#if 0
 extern PProtoInit ProtoInit;
 extern PProtoParse ProtoParse;
 extern PProtoTimeOutProc ProtoTimeOutProc;
 extern PProtoCancel ProtoCancel;
+#endif
 #if 0
 extern PTTFILESetUILanguageFile TTFILESetUILanguageFile;
 extern PTTFILESetFileSendFilter TTFILESetFileSendFilter;

Modified: trunk/teraterm/teraterm/filesys_proto.cpp
===================================================================
--- trunk/teraterm/teraterm/filesys_proto.cpp	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/teraterm/filesys_proto.cpp	2020-12-20 12:06:32 UTC (rev 9054)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2005-2020 TeraTerm Project
+ * (C) 2020 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,6 +57,7 @@
 #include "filesys_log_res.h"
 
 #include "filesys.h"
+#include "ttfile_proto.h"
 
 #if 0
 #define FS_BRACKET_NONE  0
@@ -700,7 +700,7 @@
 	pd->Create(hInst, HVTWin, &info);
 	fv->HWin = pd->m_hWnd;
 
-	(*ProtoInit)(ProtoId,FileVar,ProtoVar,&cv,&ts);
+	_ProtoInit(ProtoId,FileVar,ProtoVar,&cv,&ts);
 
 	PtDlg = pd;
 	return TRUE;
@@ -1006,7 +1006,7 @@
 	if (PtDlg==NULL)
 		return P;
 
-	if ((*ProtoParse)(ProtoId,FileVar,ProtoVar,&cv))
+	if (_ProtoParse(ProtoId,FileVar,ProtoVar,&cv))
 		P = 0; /* continue */
 	else {
 		CommSend(&cv);
@@ -1018,13 +1018,13 @@
 void ProtoDlgTimeOut(void)
 {
 	if (PtDlg!=NULL)
-		(*ProtoTimeOutProc)(ProtoId,FileVar,ProtoVar,&cv);
+		_ProtoTimeOutProc(ProtoId,FileVar,ProtoVar,&cv);
 }
 
 void ProtoDlgCancel(void)
 {
 	if ((PtDlg!=NULL) &&
-	    (*ProtoCancel)(ProtoId,FileVar,ProtoVar,&cv))
+	    _ProtoCancel(ProtoId,FileVar,ProtoVar,&cv))
 		ProtoEnd();
 }
 

Modified: trunk/teraterm/teraterm/ttermpro.v16.vcxproj
===================================================================
--- trunk/teraterm/teraterm/ttermpro.v16.vcxproj	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/teraterm/ttermpro.v16.vcxproj	2020-12-20 12:06:32 UTC (rev 9054)
@@ -65,7 +65,7 @@
     <ClCompile>
       <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)..\libs\SFMT;$(SolutionDir)..\libs\oniguruma\src;$(SolutionDir)common;$(SolutionDir)ttpfile;$(SolutionDir)ttpdlg;$(SolutionDir)ttpcmn;$(SolutionDir)susie_plugin;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(SolutionDir)..\libs\SFMT;$(SolutionDir)..\libs\oniguruma\src;$(SolutionDir)teraterm;$(SolutionDir)common;$(SolutionDir)ttpfile;$(SolutionDir)ttpdlg;$(SolutionDir)ttpcmn;$(SolutionDir)susie_plugin;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <BrowseInformation />
@@ -106,7 +106,7 @@
       <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>$(SolutionDir)..\libs\SFMT;$(SolutionDir)..\libs\oniguruma\src;$(SolutionDir)common;$(SolutionDir)ttpfile;$(SolutionDir)ttpdlg;$(SolutionDir)ttpcmn;$(SolutionDir)susie_plugin;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(SolutionDir)..\libs\SFMT;$(SolutionDir)..\libs\oniguruma\src;$(SolutionDir)teraterm;$(SolutionDir)common;$(SolutionDir)ttpfile;$(SolutionDir)ttpdlg;$(SolutionDir)ttpcmn;$(SolutionDir)susie_plugin;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -137,6 +137,14 @@
   <ItemGroup>
     <ClCompile Include="..\common\ttlib.c" />
     <ClCompile Include="..\susie_plugin\libsusieplugin.cpp" />
+    <ClCompile Include="..\ttpfile\bplus.c" />
+    <ClCompile Include="..\ttpfile\ftlib.c" />
+    <ClCompile Include="..\ttpfile\kermit.c" />
+    <ClCompile Include="..\ttpfile\quickvan.c" />
+    <ClCompile Include="..\ttpfile\ttfile_proto.cpp" />
+    <ClCompile Include="..\ttpfile\xmodem.c" />
+    <ClCompile Include="..\ttpfile\ymodem.c" />
+    <ClCompile Include="..\ttpfile\zmodem.c" />
     <ClCompile Include="addsetting.cpp" />
     <ClCompile Include="broadcast.cpp" />
     <ClCompile Include="buffer.c" />
@@ -178,6 +186,15 @@
     <ClCompile Include="../ttpdlg/ttdlg.c" />
     <ClInclude Include="../ttpdlg/ttdlg.h" />
     <ClInclude Include="..\susie_plugin\libsusieplugin.h" />
+    <ClInclude Include="..\ttpfile\bplus.h" />
+    <ClInclude Include="..\ttpfile\file_res.h" />
+    <ClInclude Include="..\ttpfile\ftlib.h" />
+    <ClInclude Include="..\ttpfile\kermit.h" />
+    <ClInclude Include="..\ttpfile\quickvan.h" />
+    <ClInclude Include="..\ttpfile\ttfile_proto.h" />
+    <ClInclude Include="..\ttpfile\xmodem.h" />
+    <ClInclude Include="..\ttpfile\ymodem.h" />
+    <ClInclude Include="..\ttpfile\zmodem.h" />
     <ClInclude Include="broadcast.h" />
     <ClInclude Include="checkeol.h" />
     <ClInclude Include="coding_pp.h" />

Modified: trunk/teraterm/teraterm/ttermpro.v8.vcproj
===================================================================
--- trunk/teraterm/teraterm/ttermpro.v8.vcproj	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/teraterm/ttermpro.v8.vcproj	2020-12-20 12:06:32 UTC (rev 9054)
@@ -48,7 +48,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions="/D"_CRT_SECURE_NO_DEPRECATE""
 				Optimization="0"
-				AdditionalIncludeDirectories="$(SolutionDir)..\libs\SFMT;$(SolutionDir)..\libs\oniguruma\src;$(SolutionDir)common;$(SolutionDir)ttpfile;$(SolutionDir)ttpdlg;$(SolutionDir)ttpcmn;$(SolutionDir)susie_plugin"
+				AdditionalIncludeDirectories=""$(SolutionDir)..\libs\SFMT";"$(SolutionDir)..\libs\oniguruma\src";"$(SolutionDir)teraterm";"$(SolutionDir)common";"$(SolutionDir)ttpfile";"$(SolutionDir)ttpdlg";"$(SolutionDir)ttpcmn";"$(SolutionDir)susie_plugin""
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
 				RuntimeLibrary="1"
 				BrowseInformation="0"
@@ -141,7 +141,7 @@
 				AdditionalOptions="/D"_CRT_SECURE_NO_DEPRECATE""
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="$(SolutionDir)..\libs\SFMT;$(SolutionDir)..\libs\oniguruma\src;$(SolutionDir)common;$(SolutionDir)ttpfile;$(SolutionDir)ttpdlg;$(SolutionDir)ttpcmn;$(SolutionDir)susie_plugin"
+				AdditionalIncludeDirectories=""$(SolutionDir)..\libs\SFMT";"$(SolutionDir)..\libs\oniguruma\src";"$(SolutionDir)teraterm";"$(SolutionDir)common";"$(SolutionDir)ttpfile";"$(SolutionDir)ttpdlg";"$(SolutionDir)ttpcmn";"$(SolutionDir)susie_plugin""
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
 				StringPooling="true"
 				RuntimeLibrary="0"
@@ -695,6 +695,78 @@
 				>
 			</File>
 		</Filter>
+		<Filter
+			Name="ttpfile"
+			>
+			<File
+				RelativePath="..\ttpfile\bplus.c"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\bplus.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\file_res.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\ftlib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\ftlib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\kermit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\kermit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\quickvan.c"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\quickvan.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\ttfile_proto.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\ttfile_proto.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\xmodem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\xmodem.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\ymodem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\ymodem.h"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\zmodem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\ttpfile\zmodem.h"
+				>
+			</File>
+		</Filter>
 	</Files>
 	<Globals>
 		<Global

Modified: trunk/teraterm/ttpfile/bplus.c
===================================================================
--- trunk/teraterm/ttpfile/bplus.c	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/ttpfile/bplus.c	2020-12-20 12:06:32 UTC (rev 9054)
@@ -611,7 +611,8 @@
 	{
 	  /* if file not found, ask user new file name */
 	  fv->FullName[fv->DirLen] = 0;
-	  if (! GetTransFname(fv, NULL, GTF_BP, (PLONG)&i)) 
+	  //if (! GetTransFname(fv, NULL, GTF_BP, (PLONG)&i))
+	  if (FALSE)
 	  {
 	    BPSendFailure(bv,'E');
 	    return;
@@ -818,7 +819,7 @@
 		  /* CCITT CRC-16/32 are not supported */
 		  bv->CheckCalc = 0;
 		  bv->CheckCount = 1;
-		  break;   
+		  break;
 	      }
 	      break;
 	    default:

Modified: trunk/teraterm/ttpfile/ftlib.h
===================================================================
--- trunk/teraterm/ttpfile/ftlib.h	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/ttpfile/ftlib.h	2020-12-20 12:06:32 UTC (rev 9054)
@@ -29,7 +29,7 @@
 
 /* TTFILE.DLL, routines for file transfer protocol */
 
-extern char UILanguageFile[MAX_PATH];
+//extern char UILanguageFile[MAX_PATH];
 
 void GetLongFName(PCHAR FullName, PCHAR LongName, int destlen);
 void FTConvFName(PCHAR FName);

Modified: trunk/teraterm/ttpfile/kermit.c
===================================================================
--- trunk/teraterm/ttpfile/kermit.c	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/ttpfile/kermit.c	2020-12-20 12:06:32 UTC (rev 9054)
@@ -76,6 +76,8 @@
 /* MARK [LEN+SEQ+TYPE+LENX1+LENX2+HCHECK] DATA CHECK */
 #define LONGPKT_HEADNUM 6
 
+static const char *UILanguageFile;
+
 BYTE KmtNum(BYTE b);
 
 
@@ -142,7 +144,7 @@
 			char *p = &buf[4];
 			char t[32];
 
-			_snprintf_s(str, sizeof(str), _TRUNCATE, 
+			_snprintf_s(str, sizeof(str), _TRUNCATE,
 				"  Data: MAXL=%d TIME=%d NPAD=%d PADC=%x EOL=%x QCTL=%c ",
 				KmtNum(p[0]), KmtNum(p[1]), KmtNum(p[2]), p[3]^0x40, p[4], p[5]
 				);
@@ -1116,6 +1118,7 @@
 (PFileVar fv, PKmtVar kv, PComVar cv, PTTSet ts)
 {
 	char uimsg[MAX_UIMSG];
+	UILanguageFile = ts->UILanguageFile;
 
 	strncpy_s(fv->DlgCaption,sizeof(fv->DlgCaption),"Tera Term: Kermit ",_TRUNCATE);
 	switch (kv->KmtMode) {
@@ -1168,8 +1171,8 @@
 	kv->KmtMy.CHKT = DefCHKT;
 	kv->KmtMy.REPT = MyREPT;
 
-	/* CAPAS: a capability of Kermit 
-	 * (2012/1/22 yutaka) 
+	/* CAPAS: a capability of Kermit
+	 * (2012/1/22 yutaka)
 	 */
 	kv->KmtMy.CAPAS = 0x00;
 #ifdef KERMIT_CAPAS
@@ -1199,11 +1202,11 @@
 		fv->LogCount = 0;
 		fv->LogState = 0;
 		fv->FlushLogLineBuf = 0;
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "KERMIT %s start: %s\n", 
-			kv->KmtMode == IdKmtSend ? "Send" : 
+		_snprintf_s(buf, sizeof(buf), _TRUNCATE, "KERMIT %s start: %s\n",
+			kv->KmtMode == IdKmtSend ? "Send" :
 			kv->KmtMode == IdKmtReceive ? "Receive" :
 			kv->KmtMode == IdKmtGet ? "Get" : "Finish",
-			ctime_str 
+			ctime_str
 			);
 		_lwrite(fv->LogFile, buf, strlen(buf));
 	}
@@ -1334,7 +1337,7 @@
 				GetPkt = (kv->PktInCount==0);
 #endif
 				if (GetPkt) kv->PktReadMode = WaitMark;
-				break;  
+				break;
 			}
 
 		if (! GetPkt) c = CommRead1Byte(cv,&b);
@@ -1422,7 +1425,7 @@
 			if (PktNumNew==kv->PktNum)
 				KmtSendPacket(fv,kv,cv);
 			else if (PktNumNew==kv->PktNum+1) {
-				if (kv->KmtMy.CAPAS & KMT_CAP_FILATTR) 
+				if (kv->KmtMy.CAPAS & KMT_CAP_FILATTR)
 					KmtSendNextData(fv,kv,cv);
 				else
 					KmtSendNextData(fv,kv,cv);

Modified: trunk/teraterm/ttpfile/quickvan.c
===================================================================
--- trunk/teraterm/ttpfile/quickvan.c	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/ttpfile/quickvan.c	2020-12-20 12:06:32 UTC (rev 9054)
@@ -55,6 +55,8 @@
 #define NAK 0x15
 #define CAN 0x18
 
+static const char *UILanguageFile;
+
 int QVRead1Byte(PFileVar fv, PQVVar qv, PComVar cv, LPBYTE b)
 {
   if (CommRead1Byte(cv,b) == 0)
@@ -116,6 +118,7 @@
   (PFileVar fv, PQVVar qv, PComVar cv, PTTSet ts)
 {
   char uimsg[MAX_UIMSG];
+  UILanguageFile = ts->UILanguageFile;
 
   qv->WinSize = ts->QVWinSize;
   fv->LogFlag = ((ts->LogFlag & LOG_QV)!=0);
@@ -333,7 +336,7 @@
 	WS = WS*10 + (WORD)n;
 	if (WS < qv->WinSize)
 	  qv->WinSize = WS;
-	break; 
+	break;
     }
   }
   qv->AValue = qv->WinSize / 2;
@@ -402,7 +405,7 @@
   /* year */
   if (QVGetNum2(qv,&i,&w))
   {
-    qv->Year = w * 100; 
+    qv->Year = w * 100;
     if (QVGetNum2(qv,&i,&w))
       qv->Year = qv->Year + w;
     else
@@ -595,7 +598,7 @@
 	  else {
 	    qv->PktState =QVpktSOH;
 	    QVSendVNAK(fv,qv);
-	  }  
+	  }
 	}
 	else if ((qv->QVState==QV_RecvDataRetry) &&
 		 ((b ^ qv->PktIn[1]) == 0xff))
@@ -730,7 +733,7 @@
   qv->PktOut[131] = qv->CheckSum;
   qv->PktOutLen = 132;
   qv->PktOutCount = 132;
-  qv->PktOutPtr = 0;   
+  qv->PktOutPtr = 0;
 }
 
 void QVSendSINIT(PFileVar fv, PQVVar qv)
@@ -782,7 +785,7 @@
 void QVSendVFILE(PFileVar fv, PQVVar qv, PComVar cv)
 {
   int i, j;
-  struct stat stbuf; 
+  struct stat stbuf;
   struct tm tmbuf;
   char fullname_upper[MAX_PATH];
 
@@ -1180,7 +1183,7 @@
 		qv->WinEnd = qv->FileEnd;
 	      qv->EnqFlag = FALSE;
 	      qv->RetryCount = 10;
-	      qv->QVState = QV_SendDataRetry;		   
+	      qv->QVState = QV_SendDataRetry;
 	    }
 	    break;
 	}

Added: trunk/teraterm/ttpfile/ttfile_proto.cpp
===================================================================
--- trunk/teraterm/ttpfile/ttfile_proto.cpp	                        (rev 0)
+++ trunk/teraterm/ttpfile/ttfile_proto.cpp	2020-12-20 12:06:32 UTC (rev 9054)
@@ -0,0 +1,178 @@
+/*
+ * (C) 2020 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* TTFILE.DLL, file transfer, VT window printing */
+#include "teraterm.h"
+#include "tttypes.h"
+#include "ttftypes.h"
+#include <direct.h>
+#include <commdlg.h>
+#include <string.h>
+
+#include "ttlib.h"
+#include "ftlib.h"
+#include "dlglib.h"
+#include "kermit.h"
+#include "xmodem.h"
+#include "ymodem.h"
+#include "zmodem.h"
+#include "bplus.h"
+#include "quickvan.h"
+
+#include "filesys.h"
+#include "ttfile_proto.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <io.h>
+#include <assert.h>
+
+void _ProtoInit(int Proto, PFileVar fv, PCHAR pv, PComVar cv, PTTSet ts)
+{
+	switch (Proto) {
+	case PROTO_KMT:
+		KmtInit(fv,(PKmtVar)pv,cv,ts);
+		break;
+	case PROTO_XM:
+		XInit(fv,(PXVar)pv,cv,ts);
+		break;
+	case PROTO_YM:
+		YInit(fv,(PYVar)pv,cv,ts);
+		break;
+	case PROTO_ZM:
+		ZInit(fv,(PZVar)pv,cv,ts);
+		break;
+	case PROTO_BP:
+		BPInit(fv,(PBPVar)pv,cv,ts);
+		break;
+	case PROTO_QV:
+		QVInit(fv,(PQVVar)pv,cv,ts);
+		break;
+	}
+}
+
+BOOL _ProtoParse(int Proto, PFileVar fv, PCHAR pv, PComVar cv)
+{
+	BOOL Ok;
+
+	Ok = FALSE;
+	switch (Proto) {
+	case PROTO_KMT:
+		Ok = KmtReadPacket(fv,(PKmtVar)pv,cv);
+		break;
+	case PROTO_XM:
+		switch (((PXVar)pv)->XMode) {
+		case IdXReceive:
+			Ok = XReadPacket(fv,(PXVar)pv,cv);
+			break;
+		case IdXSend:
+			Ok = XSendPacket(fv,(PXVar)pv,cv);
+			break;
+		}
+		break;
+	case PROTO_YM:
+		switch (((PYVar)pv)->YMode) {
+		case IdYReceive:
+			Ok = YReadPacket(fv,(PYVar)pv,cv);
+			break;
+		case IdYSend:
+			Ok = YSendPacket(fv,(PYVar)pv,cv);
+			break;
+		}
+		break;
+	case PROTO_ZM:
+		Ok = ZParse(fv,(PZVar)pv,cv);
+		break;
+	case PROTO_BP:
+		Ok = BPParse(fv,(PBPVar)pv,cv);
+		break;
+	case PROTO_QV:
+		switch (((PQVVar)pv)->QVMode) {
+		case IdQVReceive:
+			Ok = QVReadPacket(fv,(PQVVar)pv,cv);
+			break;
+		case IdQVSend:
+			Ok = QVSendPacket(fv,(PQVVar)pv,cv);
+			break;
+		}
+		break;
+	}
+	return Ok;
+}
+
+void _ProtoTimeOutProc(int Proto, PFileVar fv, PCHAR pv, PComVar cv)
+{
+	switch (Proto) {
+	case PROTO_KMT:
+		KmtTimeOutProc(fv,(PKmtVar)pv,cv);
+		break;
+	case PROTO_XM:
+		XTimeOutProc(fv,(PXVar)pv,cv);
+		break;
+	case PROTO_YM:
+		YTimeOutProc(fv,(PYVar)pv,cv);
+		break;
+	case PROTO_ZM:
+		ZTimeOutProc(fv,(PZVar)pv,cv);
+		break;
+	case PROTO_BP:
+		BPTimeOutProc(fv,(PBPVar)pv,cv);
+		break;
+	case PROTO_QV:
+		QVTimeOutProc(fv,(PQVVar)pv,cv);
+		break;
+	}
+}
+
+BOOL _ProtoCancel(int Proto, PFileVar fv, PCHAR pv, PComVar cv)
+{
+	switch (Proto) {
+	case PROTO_KMT:
+		KmtCancel(fv,(PKmtVar)pv,cv);
+		break;
+	case PROTO_XM:
+		XCancel(fv,(PXVar)pv,cv);
+		break;
+	case PROTO_YM:
+		YCancel(fv, (PYVar)pv,cv);
+		break;
+	case PROTO_ZM:
+		ZCancel((PZVar)pv);
+		break;
+	case PROTO_BP:
+		if (((PBPVar)pv)->BPState != BP_Failure) {
+			BPCancel((PBPVar)pv);
+			return FALSE;
+		}
+		break;
+	case PROTO_QV:
+		QVCancel(fv,(PQVVar)pv,cv);
+		break;
+	}
+	return TRUE;
+}

Copied: trunk/teraterm/ttpfile/ttfile_proto.h (from rev 9053, trunk/teraterm/ttpfile/ftlib.h)
===================================================================
--- trunk/teraterm/ttpfile/ttfile_proto.h	                        (rev 0)
+++ trunk/teraterm/ttpfile/ttfile_proto.h	2020-12-20 12:06:32 UTC (rev 9054)
@@ -0,0 +1,40 @@
+/*
+ * (C) 2020 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _ProtoInit(int Proto, PFileVar fv, PCHAR pv, PComVar cv, PTTSet ts);
+BOOL _ProtoParse(int Proto, PFileVar fv, PCHAR pv, PComVar cv);
+void _ProtoTimeOutProc(int Proto, PFileVar fv, PCHAR pv, PComVar cv);
+BOOL _ProtoCancel(int Proto, PFileVar fv, PCHAR pv, PComVar cv);
+
+#ifdef __cplusplus
+}
+#endif

Modified: trunk/teraterm/ttpfile/zmodem.c
===================================================================
--- trunk/teraterm/ttpfile/zmodem.c	2020-12-20 12:06:16 UTC (rev 9053)
+++ trunk/teraterm/ttpfile/zmodem.c	2020-12-20 12:06:32 UTC (rev 9054)
@@ -121,6 +121,7 @@
 
 static char recvbuf[LOGBUFSIZE];
 static char sendbuf[LOGBUFSIZE];
+static const char *UILanguageFile;
 
 static void add_recvbuf(char *fmt, ...)
 {
@@ -646,6 +647,7 @@
 void ZInit(PFileVar fv, PZVar zv, PComVar cv, PTTSet ts) {
 	int Max;
 	char uimsg[MAX_UIMSG];
+	UILanguageFile = ts->UILanguageFile;
 
 	zv->CtlEsc = ((ts->FTFlag & FT_ZESCCTL) != 0);
 	zv->MaxDataLen = ts->ZmodemDataLen;


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