Revision: 8978 https://osdn.net/projects/ttssh2/scm/svn/commits/8978 Author: zmatsuo Date: 2020-11-02 00:30:20 +0900 (Mon, 02 Nov 2020) Log Message: ----------- bplus.c のみで使用する構造体を移動 - ttftypes.h から bplus.c へ移動 Modified Paths: -------------- branches/proto_unicode/teraterm/common/ttftypes.h branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp branches/proto_unicode/teraterm/ttpfile/bplus.c branches/proto_unicode/teraterm/ttpfile/bplus.h branches/proto_unicode/teraterm/ttpfile/ttfile_proto.cpp -------------- next part -------------- Modified: branches/proto_unicode/teraterm/common/ttftypes.h =================================================================== --- branches/proto_unicode/teraterm/common/ttftypes.h 2020-11-01 15:30:05 UTC (rev 8977) +++ branches/proto_unicode/teraterm/common/ttftypes.h 2020-11-01 15:30:20 UTC (rev 8978) @@ -265,6 +265,7 @@ #define Z_PktGetCRC 8 #endif +#if 0 /* B Plus */ typedef struct { BYTE WS; @@ -316,6 +317,8 @@ #define BP_PktGetCheck 4 #define BP_PktSending 5 +#endif + /* Quick-VAN */ typedef struct { BYTE PktIn[142], PktOut[142]; Modified: branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp =================================================================== --- branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp 2020-11-01 15:30:05 UTC (rev 8977) +++ branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp 2020-11-01 15:30:20 UTC (rev 8978) @@ -67,6 +67,7 @@ #include "xmodem.h" #include "ymodem.h" #include "zmodem.h" +#include "bplus.h" #if 0 #define FS_BRACKET_NONE 0 @@ -768,7 +769,9 @@ vsize = 0; break; case PROTO_BP: - vsize = sizeof(TBPVar); +// vsize = sizeof(TBPVar); + BPCreate(fv); + vsize = 0; break; case PROTO_QV: vsize = sizeof(TQVVar); @@ -821,7 +824,10 @@ _ProtoSetOpt(fv, ZMODEM_BINFLAG, (Opt1 & 1) != 0); break; case PROTO_BP: +#if 0 ((PBPVar)ProtoVar)->BPMode = Mode; +#endif + _ProtoSetOpt(fv, BPLUS_MODE, Mode); break; case PROTO_QV: ((PQVVar)ProtoVar)->QVMode = Mode; Modified: branches/proto_unicode/teraterm/ttpfile/bplus.c =================================================================== --- branches/proto_unicode/teraterm/ttpfile/bplus.c 2020-11-01 15:30:05 UTC (rev 8977) +++ branches/proto_unicode/teraterm/ttpfile/bplus.c 2020-11-01 15:30:20 UTC (rev 8978) @@ -40,9 +40,62 @@ #include "ttlib.h" #include "win16api.h" +#include "bplus.h" + /* proto type */ //BOOL PASCAL GetTransFname(PFileVarProto fv, PCHAR CurDir, WORD FuncId, LPLONG Option); +/* B Plus */ +typedef struct { + BYTE WS; + BYTE WR; + BYTE B_S; + BYTE CM; + BYTE DQ; + BYTE TL; + BYTE Q[8]; + BYTE DR; + BYTE UR; + BYTE FI; +} TBPParam; + + +typedef struct { + BYTE PktIn[2066], PktOut[2066]; + int PktInCount, CheckCount; + int PktOutLen, PktOutCount, PktOutPtr; + LONG Check, CheckCalc; + BYTE PktNum, PktNumSent; + int PktNumOffset; + int PktSize; + WORD BPMode, BPState, BPPktState; + BOOL GetPacket, EnqSent; + BYTE MaxBS, CM; + BOOL Quoted; + int TimeOut; + BOOL CtlEsc; + BYTE Q[8]; +} TBPVar; +typedef TBPVar far *PBPVar; + + /* B Plus states */ +#define BP_Init 1 +#define BP_RecvFile 2 +#define BP_RecvData 3 +#define BP_SendFile 4 +#define BP_SendData 5 +#define BP_SendClose 6 +#define BP_Failure 7 +#define BP_Close 8 +#define BP_AutoFile 9 + + /* B Plus packet states */ +#define BP_PktGetDLE 1 +#define BP_PktDLESeen 2 +#define BP_PktGetData 3 +#define BP_PktGetCheck 4 +#define BP_PktSending 5 + #define BPTimeOut 10 #define BPTimeOutTCPIP 0 @@ -76,10 +129,10 @@ SetWindowText(fv->HWin,fv->DlgCaption); } -void BPInit - (PFileVarProto fv, PBPVar bv, PComVar cv, PTTSet ts) +void BPInit(PFileVarProto fv, PComVar cv, PTTSet ts) { int i; + PBPVar bv = fv->data; if (bv->BPMode==IdBPAuto) { @@ -191,8 +244,9 @@ return i; } -void BPTimeOutProc(PFileVarProto fv, PBPVar bv, PComVar cv) +void BPTimeOutProc(PFileVarProto fv, PComVar cv) { + PBPVar bv = fv->data; BPWrite(fv,bv,cv,"\005\005",2); /* two ENQ */ FTSetTimeOut(fv,bv->TimeOut); bv->EnqSent = TRUE; @@ -742,10 +796,11 @@ *b = *b + 0x20; } -BOOL BPParse(PFileVarProto fv, PBPVar bv, PComVar cv) +BOOL BPParse(PFileVarProto fv, PComVar cv) { int c; BYTE b; + PBPVar bv = fv->data; do { @@ -893,9 +948,43 @@ return TRUE; } -void BPCancel(PBPVar bv) +void BPCancel(PFileVarProto fv, PComVar cv) { - if ((bv->BPState != BP_Failure) && - (bv->BPState != BP_Close)) - BPSendFailure(bv,'A'); + PBPVar bv = fv->data; + (void)cv; + if ((bv->BPState != BP_Failure) && + (bv->BPState != BP_Close)) + BPSendFailure(bv,'A'); } + +static int SetOptV(PFileVarProto fv, int request, va_list ap) +{ + PBPVar bv = fv->data; + switch(request) { + case BPLUS_MODE: { + int Mode = va_arg(ap, int); + bv->BPMode = Mode; + return 0; + } + } + return -1; +} + +BOOL BPCreate(PFileVarProto fv) +{ + PBPVar bv; + bv = malloc(sizeof(*bv)); + if (bv == NULL) { + return FALSE; + } + memset(bv, 0, sizeof(*bv)); + fv->data = bv; + + fv->Init = BPInit; + fv->Parse = BPParse; + fv->TimeOutProc = BPTimeOutProc; + fv->Cancel = BPCancel; + fv->SetOptV = SetOptV; + + return TRUE; +} Modified: branches/proto_unicode/teraterm/ttpfile/bplus.h =================================================================== --- branches/proto_unicode/teraterm/ttpfile/bplus.h 2020-11-01 15:30:05 UTC (rev 8977) +++ branches/proto_unicode/teraterm/ttpfile/bplus.h 2020-11-01 15:30:20 UTC (rev 8978) @@ -33,11 +33,18 @@ extern "C" { #endif +enum { + BPLUS_MODE, +}; + /* prototypes */ -void BPInit(PFileVarProto fv, PBPVar bv, PComVar cv, PTTSet ts); -void BPTimeOutProc(PFileVarProto fv, PBPVar bv, PComVar cv); -BOOL BPParse(PFileVarProto fv, PBPVar bv, PComVar cv); -void BPCancel(PBPVar bv); +BOOL BPCreate(PFileVarProto fv); +#if 0 +void BPInit(PFileVarProto fv, PComVar cv, PTTSet ts); +void BPTimeOutProc(PFileVarProto fv, PComVar cv); +BOOL BPParse(PFileVarProto fv, PComVar cv); +void BPCancel(PFileVarProto fv, PComVar cv); +#endif #ifdef __cplusplus } Modified: branches/proto_unicode/teraterm/ttpfile/ttfile_proto.cpp =================================================================== --- branches/proto_unicode/teraterm/ttpfile/ttfile_proto.cpp 2020-11-01 15:30:05 UTC (rev 8977) +++ branches/proto_unicode/teraterm/ttpfile/ttfile_proto.cpp 2020-11-01 15:30:20 UTC (rev 8978) @@ -69,7 +69,7 @@ fv->Init(fv,cv,ts); break; case PROTO_BP: - BPInit(fv,(PBPVar)pv,cv,ts); + fv->Init(fv,cv,ts); break; case PROTO_QV: QVInit(fv,(PQVVar)pv,cv,ts); @@ -96,7 +96,7 @@ Ok = fv->Parse(fv, cv); break; case PROTO_BP: - Ok = BPParse(fv,(PBPVar)pv,cv); + Ok = fv->Parse(fv, cv); break; case PROTO_QV: switch (((PQVVar)pv)->QVMode) { @@ -128,7 +128,7 @@ fv->TimeOutProc(fv, cv); break; case PROTO_BP: - BPTimeOutProc(fv,(PBPVar)pv,cv); + fv->TimeOutProc(fv, cv); break; case PROTO_QV: QVTimeOutProc(fv,(PQVVar)pv,cv); @@ -152,10 +152,7 @@ fv->Cancel(fv, cv); break; case PROTO_BP: - if (((PBPVar)pv)->BPState != BP_Failure) { - BPCancel((PBPVar)pv); - return FALSE; - } + fv->Cancel(fv, cv); break; case PROTO_QV: QVCancel(fv,(PQVVar)pv,cv);