Listing: 1 (* Release 3.10 *) 2 (*-------------------------------------------------------------------------* 3 * * 4 * FTSUPPOR.MOD - COMMS Toolkit FTP support * 5 * * 6 * COPYRIGHT (C) 1988..1992 Clarion Software Corporation. * 7 * All Rights Reserved * 8 * * 9 *--------------------------------------------------------------------------*) 10 11 IMPLEMENTATION MODULE FTSupport; 12 IMPORT CommUtil,ComSetup,Filenames,FIO,IO,Keyboard,Lib,MPRINTF,RS232,Str, 13 Timer,Window; 14 FROM Window IMPORT Color; ***** ^ duplicate identifier 15 FROM CommUtil IMPORT StatusFields; ***** ^ duplicate identifier 16 FROM ComSetup IMPORT CrTypes; ***** ^ duplicate identifier 17 18 CONST 19 FTStatWinDef = Window.WinDef(35,5,69,14,LightCyan,Black,FALSE,FALSE,FALSE,TRUE,Window.SingleFrame,LightGray,Black); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 20 21 VAR 22 SizeIncr,HalfIncr, 23 BaudIncr,HalfBaud : LONGCARD; ***** ^ undeclared identifier 24 StatusWindowOpen, 25 CarrierLost : BOOLEAN; 26 BuffPtr,BuffCnt, 27 TimeCount : CARDINAL; 28 Buffer : ARRAY[0..260] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 29 StatWin : Window.WinType; ***** ^ not supported yet 30 31 (*...............................................*) 32 33 PROCEDURE OpenStatusWindow(Title:ARRAY OF CHAR); ***** ^ not supported yet 34 VAR 35 i : CARDINAL; 36 Def : Window.WinDef; ***** ^ not supported yet 37 BEGIN 38 IF StatusWindowOpen THEN 39 RETURN; 40 END; 41 Def := FTStatWinDef; ***** ^ not supported yet 42 WITH Def DO ***** ^ not supported yet 43 Foreground := CommUtil.Colors.FTStatFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 44 Background := CommUtil.Colors.FTStatBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 45 FrameFore := CommUtil.Colors.FTStatFrFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 46 FrameBack := CommUtil.Colors.FTStatFrBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 47 END; ***** ^ not supported yet 48 StatWin := Window.Open(Def); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 49 Window.SetTitle(StatWin,Title,Window.LeftUpperTitle); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 50 Window.GotoXY(2,1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 51 IO.WrStr('File:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 52 Window.GotoXY(2,2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 53 IO.WrStr('Progress:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 54 Window.GotoXY(2,3); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 55 IO.WrStr('Est Mins:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 56 Window.GotoXY(2,4); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 57 IO.WrStr('Size:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 58 Window.GotoXY(2,5); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 59 IO.WrStr('Mode:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 60 Window.GotoXY(2,6); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 61 IO.WrStr('Bytes:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 62 Window.GotoXY(2,7); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 63 IO.WrStr('Errors:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 64 Window.GotoXY(2,8); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 65 IO.WrStr('Last Msg:'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 66 Window.GotoXY(12,2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 67 IO.WrStr('лллллллллллллллллллл'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 68 BuffPtr := 0; 69 BuffCnt := 0; 70 StatusWindowOpen := TRUE; 71 BaudIncr := LONGCARD(ComSetup.Setup.Serial.Baud)*6; ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 72 HalfBaud := BaudIncr DIV 2; ***** ^ not supported yet ***** ^ not supported yet 73 TimeCount := 0; 74 Window.TextColor(CommUtil.Colors.FTStatHigh); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 75 END OpenStatusWindow; ***** ^ not supported yet 76 77 (*...............................................*) 78 79 PROCEDURE NewFilename; 80 VAR 81 temps,Path : ARRAY[0..80] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 82 Name : ARRAY[0..12] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 83 Drive,Ext : ARRAY[0..3] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 84 BEGIN 85 IF Filenames.ParseFilename(FileSpec,Drive,Path,Name,Ext) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 86 Drive:=''; ***** ^ not supported yet ***** ^ incompatible assignment 87 Path:=''; ***** ^ not supported yet ***** ^ incompatible assignment 88 Filenames.MakeFilename(Drive,Path,Name,Ext,temps); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 89 END; 90 Window.GotoXY(12,1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 91 MPRINTF.PrintF1('%-12s',temps); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 92 END NewFilename; ***** ^ not supported yet 93 94 (*...............................................*) 95 96 PROCEDURE CompleteFilename; 97 VAR 98 Path : ARRAY[0..80] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 99 Name : ARRAY[0..12] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 100 Drive,Ext : ARRAY[0..3] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 101 BEGIN 102 IF Filenames.ParseFilename(FileSpec,Drive,Path,Name,Ext) & (Drive[0]=0C) & (Path[0]=0C) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 103 Filenames.MakeFilename(Drive,ComSetup.Setup.General.DownloadDir,Name,Ext,FileSpec) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 104 END; 105 END CompleteFilename; ***** ^ not supported yet 106 107 (*...............................................*) 108 109 (*# save,check(overflow=>off)*) 110 PROCEDURE ShowProgress; 111 VAR 112 Mins : LONGCARD; ***** ^ undeclared identifier 113 i,RealLnth,Lnth : CARDINAL; 114 Line : ARRAY[0..20] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 115 BEGIN 116 IF SizeInBytes<>0 THEN ***** ^ undeclared identifier 117 Mins := (((SizeInBytes-Transferred)+HalfBaud) DIV BaudIncr)+1; ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 118 Window.GotoXY(12,3); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 119 IO.WrLngCard(Mins,4); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 120 Window.GotoXY(12,2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 121 Window.TextColor(CommUtil.Colors.FTStatFore); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 122 Window.TextBackground(CommUtil.Colors.FTStatBar); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 123 IF SizeIncr <> 0 THEN ***** ^ not supported yet 124 Lnth := CARDINAL((Transferred+HalfIncr) DIV SizeIncr); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 125 IF Lnth>40 THEN 126 Lnth:=40; 127 END; 128 RealLnth := Lnth DIV 2; 129 Lib.Fill(ADR(Line),RealLnth,' '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 130 IF ODD(Lnth) THEN ***** ^ undeclared identifier ***** ^ not supported yet 131 Line[RealLnth]:=CHR(222); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 132 INC(RealLnth); ***** ^ undeclared identifier ***** ^ not supported yet 133 END; 134 Line[RealLnth] := 0C; ***** ^ not supported yet ***** ^ not supported yet 135 IO.WrStr(Line); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 136 END; 137 Window.TextColor(CommUtil.Colors.FTStatHigh); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 138 Window.TextBackground(CommUtil.Colors.FTStatBack); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 139 END; 140 END ShowProgress; ***** ^ not supported yet 141 (*# restore *) 142 143 (*...............................................*) 144 145 PROCEDURE UpdateStatus; 146 BEGIN 147 IF AbortRequested() THEN ***** ^ undeclared identifier ***** ^ not supported yet 148 RETURN; 149 END; 150 Window.GotoXY(12,4); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 151 MPRINTF.PrintF1('%-8u',SizeInBytes); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 152 Window.GotoXY(12,5); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 153 MPRINTF.PrintF1('%-8s',XferMode); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 154 Window.GotoXY(12,6); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 155 MPRINTF.PrintF1('%-8u',Transferred); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 156 Window.GotoXY(12,7); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 157 MPRINTF.PrintF1('%-8u',Errors); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 158 Window.GotoXY(12,8); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 159 MPRINTF.PrintF1('%-20s',LastMessage); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 160 SizeIncr := (SizeInBytes+20) DIV 40; ***** ^ not supported yet ***** ^ undeclared identifier 161 HalfIncr := SizeIncr DIV 2; ***** ^ not supported yet ***** ^ not supported yet 162 ShowProgress; ***** ^ not supported yet 163 CommUtil.StatusLine(time); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 164 Window.Use(StatWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 165 END UpdateStatus; ***** ^ not supported yet 166 167 (*...............................................*) 168 169 PROCEDURE CloseStatusWindow; 170 BEGIN 171 IF NOT StatusWindowOpen THEN 172 RETURN; 173 END; 174 IF Aborted THEN ***** ^ undeclared identifier 175 Window.SetTitle(StatWin,'Aborted',Window.LeftUpperTitle); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 176 END; 177 CommUtil.Alarm; ***** ^ not supported yet ***** ^ not supported yet 178 Aborted := FALSE; ***** ^ undeclared identifier 179 Window.Close(StatWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 180 CommUtil.StatusLine(time); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 181 StatusWindowOpen := FALSE; 182 END CloseStatusWindow; ***** ^ not supported yet 183 184 (*...............................................*) 185 186 PROCEDURE Cancel; 187 VAR 188 i : CARDINAL; 189 CanArray : ARRAY[0..15] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 190 BEGIN 191 FOR i:=0 TO 7 DO 192 CanArray[i]:=CAN; ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 193 END; 194 FOR i:=0 TO 7 DO 195 CanArray[i+8]:=CHR(8); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 196 END; 197 RS232.SerialWrite(CanArray,8); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 198 END Cancel; ***** ^ not supported yet 199 200 (*...............................................*) 201 202 PROCEDURE AbortRequested():BOOLEAN; 203 VAR 204 c : CHAR; 205 BEGIN 206 IF NOT Aborted THEN ***** ^ undeclared identifier 207 WHILE Keyboard.KeyPressed() DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 208 c := Keyboard.RdKey(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 209 IF c=CHR(27) THEN ***** ^ undeclared identifier ***** ^ not supported yet 210 Aborted := TRUE; ***** ^ undeclared identifier 211 END; 212 END; 213 END; 214 RETURN Aborted; ***** ^ undeclared identifier 215 END AbortRequested; ***** ^ not supported yet 216 217 (*...............................................*) 218 219 PROCEDURE FlushInput; 220 VAR 221 c : CHAR; 222 BEGIN 223 WHILE RS232.SerialRead(c,0) DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 224 (* Flush *) 225 END; 226 END FlushInput; ***** ^ not supported yet 227 228 (*...............................................*) 229 230 PROCEDURE ASCIISend(VAR Filename:ARRAY OF CHAR):CARDINAL; ***** ^ not supported yet 231 VAR 232 f : FIO.File; ***** ^ not supported yet 233 Lnth : CARDINAL; 234 235 (*. . . . . . . . . . . . . . . . . . . . . . . . .*) 236 237 PROCEDURE SendLine; 238 VAR 239 i : CARDINAL; 240 BEGIN 241 i:=0; 242 WHILE iSizeInBytes THEN ***** ^ undeclared identifier ***** ^ undeclared identifier 270 Transferred:=SizeInBytes; ***** ^ undeclared identifier ***** ^ undeclared identifier 271 END; 272 FBuff[Lnth]:=CHR(13); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 273 INC(Lnth); ***** ^ undeclared identifier ***** ^ not supported yet 274 IF ComSetup.Setup.General.CROutTranslation=CRLF THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 275 FBuff[Lnth]:=CHR(10); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 276 INC(Lnth); ***** ^ undeclared identifier ***** ^ not supported yet 277 END; 278 SendLine; ***** ^ not supported yet 279 UpdateStatus; ***** ^ not supported yet 280 FlushInput; ***** ^ not supported yet 281 Lib.Delay(ComSetup.Setup.ASCII.LineDelayMS); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 282 END; 283 FIO.Close(f); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 284 CloseStatusWindow; ***** ^ not supported yet 285 RETURN ORD(Aborted) ***** ^ undeclared identifier ***** ^ undeclared identifier 286 ELSE 287 CommUtil.ErrorMessage('No such file.'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 288 RETURN 2; 289 END; 290 END ASCIISend; ***** ^ not supported yet 291 292 (*...............................................*) 293 294 PROCEDURE MakeCRCTable; 295 CONST 296 POLY = 1021H; 297 VAR 298 Entry,i,CRC : CARDINAL; 299 BEGIN 300 FOR Entry:=0 TO 255 DO 301 CRC := Entry<<8; 302 FOR i:=0 TO 7 DO 303 IF 15 IN BITSET(CRC) THEN ***** ^ undeclared identifier ***** ^ not supported yet 304 CRC := CARDINAL(BITSET(CRC<<1) / BITSET(POLY)) ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 305 ELSE 306 CRC := CRC<<1 307 END; 308 END; 309 CRCTable[Entry] := CRC; ***** ^ undeclared identifier ***** ^ not supported yet 310 END; 311 END MakeCRCTable; ***** ^ not supported yet 312 313 (*................................................*) 314 315 BEGIN 316 MakeCRCTable; ***** ^ not supported yet 317 StatusWindowOpen := FALSE; 318 Aborted := FALSE; ***** ^ undeclared identifier 319 HookOnFT := FALSE; ***** ^ undeclared identifier 320 END FTSupport. ***** ^ not supported yet 321 442 errors