YMODEM.LST 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339
  1. Listing:
  2. 1 (* Release 3.10 *)
  3. 2 (*-------------------------------------------------------------------------*
  4. 3 * *
  5. 4 * YMODEM.MOD - COMMS Toolkit YMODEM file protocol *
  6. 5 * *
  7. 6 * COPYRIGHT (C) 1988..1992 Clarion Software Corporation. *
  8. 7 * All Rights Reserved *
  9. 8 * *
  10. 9 *--------------------------------------------------------------------------*)
  11. 10
  12. 11 IMPLEMENTATION MODULE YModem;
  13. 12 IMPORT CommUtil,Filenames,FIO,FTSupport,Lib,RS232,SPRINTF,Str;
  14. 13 FROM FTSupport IMPORT ACK,CAN,CRCREQ,EOT,NAK,SOH,STX;
  15. ***** ^ duplicate identifier
  16. 14 (* This module is basically just a modified XModem module - simple *)
  17. 15 (* Ymodem especially is just Xmodem with 1k blocks. The Seperate *)
  18. 16 (* Xmodem is just for clarity.. *)
  19. 17
  20. 18 VAR
  21. 19 f : FIO.File;
  22. ***** ^ not supported yet
  23. 20 Response : CHAR;
  24. 21 CRCCheck,
  25. 22 ResponseWaiting,
  26. 23 NoACKS : BOOLEAN;
  27. 24 LastBlockNo,BlockNo,
  28. 25 BlockSize : CARDINAL;
  29. 26
  30. 27 (*..................................................*)
  31. 28
  32. 29 PROCEDURE InitVars(VAR Filename:ARRAY OF CHAR);
  33. ***** ^ not supported yet
  34. 30 BEGIN
  35. 31 FTSupport.Errors:=0;
  36. ***** ^ not supported yet
  37. ***** ^ not supported yet
  38. 32 FTSupport.LastMessage:='';
  39. ***** ^ not supported yet
  40. ***** ^ not supported yet
  41. 33 FTSupport.XferMode := 'CRC';
  42. ***** ^ not supported yet
  43. ***** ^ not supported yet
  44. ***** ^ not supported yet
  45. 34 FTSupport.Transferred:=0;
  46. ***** ^ not supported yet
  47. ***** ^ not supported yet
  48. 35 FTSupport.Aborted := FALSE;
  49. ***** ^ not supported yet
  50. ***** ^ not supported yet
  51. 36 FTSupport.SizeInBytes:=0;
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. 37 Str.Copy(FTSupport.FileSpec,Filename);
  55. ***** ^ not supported yet
  56. ***** ^ not supported yet
  57. ***** ^ not supported yet
  58. ***** ^ not supported yet
  59. ***** ^ not supported yet
  60. 38 BlockNo:=1;
  61. 39 LastBlockNo:=0FFFFH;
  62. 40 BlockSize:=128;
  63. 41 CRCCheck:=TRUE;
  64. 42 END InitVars;
  65. ***** ^ not supported yet
  66. 43
  67. 44 (*...............................................*)
  68. 45
  69. 46 PROCEDURE ReceiveData():CARDINAL;
  70. 47 VAR
  71. 48 c : CHAR;
  72. 49 RxBlk,CRC,RxCRC,
  73. 50 CheckSum,Result,
  74. 51 Cnt,CRCIndex : CARDINAL;
  75. 52 RxState : (Blk,Compl,Data,Chk,CRCH,CRCL,Flushing);
  76. ***** ^ not supported yet
  77. 53 BEGIN
  78. 54 (* Already had the first character SOH or STX *)
  79. 55 RxState:=Blk;
  80. ***** ^ not supported yet
  81. ***** ^ not supported yet
  82. 56 CRC:=0;
  83. 57 CheckSum:=0;
  84. 58 Cnt:=0;
  85. 59 Result:=0;
  86. 60 LOOP
  87. 61 IF FTSupport.Aborted THEN
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. 62 RETURN(128+6);
  91. 63 END;
  92. 64 IF NOT RS232.SerialRead(c,50) THEN
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. 65 IF RxState=Flushing THEN
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. 66 RETURN(Result);
  100. 67 ELSE
  101. 68 FTSupport.LastMessage := 'Timeout';
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. 69 RETURN(3);
  106. 70 END;
  107. 71 END;
  108. 72 CASE RxState OF
  109. ***** ^ not supported yet
  110. 73 Blk : RxBlk := ORD(c);
  111. ***** ^ not supported yet
  112. ***** ^ undeclared identifier
  113. ***** ^ not supported yet
  114. 74 RxState := Compl; |
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. 75 Compl : IF 255-ORD(c)<>RxBlk THEN
  118. ***** ^ not supported yet
  119. ***** ^ undeclared identifier
  120. ***** ^ not supported yet
  121. 76 Result:=11;
  122. 77 FTSupport.LastMessage:='Bad Block No';
  123. ***** ^ not supported yet
  124. ***** ^ not supported yet
  125. ***** ^ not supported yet
  126. 78 RxState:=Flushing;
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. 79 ELSIF RxBlk=LastBlockNo THEN
  130. 80 Result := 15;
  131. 81 RxState := Data;
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. 82 ELSIF RxBlk<>BlockNo THEN
  135. 83 Result := 128+10;
  136. 84 FTSupport.LastMessage := 'Sequence Error';
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. 85 RxState := Flushing;
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. 86 ELSE
  144. 87 RxState := Data;
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. 88 END; |
  148. 89 Data : FTSupport.FBuff[Cnt] := c;
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. 90 IF CRCCheck THEN
  154. 91 CRCIndex := CARDINAL(BITSET(CRC>>8)/BITSET(ORD(c)));
  155. ***** ^ undeclared identifier
  156. ***** ^ not supported yet
  157. ***** ^ undeclared identifier
  158. ***** ^ undeclared identifier
  159. ***** ^ not supported yet
  160. 92 CRC := CARDINAL(BITSET(FTSupport.CRCTable[CRCIndex])/BITSET(CRC<<8))
  161. ***** ^ undeclared identifier
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. ***** ^ not supported yet
  165. ***** ^ undeclared identifier
  166. ***** ^ not supported yet
  167. 93 ELSE
  168. 94 CheckSum := (CheckSum+ORD(c)) MOD 100H;
  169. ***** ^ undeclared identifier
  170. ***** ^ not supported yet
  171. 95 END;
  172. 96 INC(Cnt);
  173. ***** ^ undeclared identifier
  174. ***** ^ not supported yet
  175. 97 IF Cnt=BlockSize THEN
  176. 98 IF CRCCheck THEN
  177. 99 RxState:=CRCH;
  178. ***** ^ not supported yet
  179. ***** ^ not supported yet
  180. 100 ELSE
  181. 101 RxState:=Chk;
  182. ***** ^ not supported yet
  183. ***** ^ not supported yet
  184. 102 END;
  185. 103 END; |
  186. 104 Chk : IF ORD(c)=CheckSum THEN
  187. ***** ^ not supported yet
  188. ***** ^ undeclared identifier
  189. ***** ^ not supported yet
  190. 105 RETURN Result;
  191. 106 ELSE
  192. 107 Result := 8;
  193. 108 FTSupport.LastMessage := 'Bad Checksum';
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. ***** ^ not supported yet
  197. 109 RxState := Flushing;
  198. ***** ^ not supported yet
  199. ***** ^ not supported yet
  200. 110 END; |
  201. 111 CRCH : RxCRC := ORD(c)<<8;
  202. ***** ^ not supported yet
  203. ***** ^ undeclared identifier
  204. ***** ^ not supported yet
  205. ***** ^ arithmetic operand must be numeric
  206. 112 RxState := CRCL; |
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. 113 CRCL : RxCRC := RxCRC+ORD(c);
  210. ***** ^ not supported yet
  211. ***** ^ undeclared identifier
  212. ***** ^ not supported yet
  213. 114 IF CRC=RxCRC THEN
  214. 115 RETURN Result;
  215. 116 ELSE
  216. 117 Result := 9;
  217. 118 FTSupport.LastMessage := 'Bad CRC';
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. 119 RxState := Flushing;
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. 120 END; |
  225. 121 Flushing : (* do nothing *) |
  226. ***** ^ not supported yet
  227. 122 END; (* case *)
  228. 123 END; (* loop *)
  229. 124 END ReceiveData;
  230. ***** ^ not supported yet
  231. 125
  232. 126 (*...............................................*)
  233. 127
  234. 128 PROCEDURE YMReceive(OneBlockOnly:BOOLEAN):CARDINAL;
  235. 129 VAR
  236. 130 c : CHAR;
  237. 131 EOTCount,Result : CARDINAL;
  238. 132 IncomingData,
  239. 133 Negotiating,
  240. 134 EndOfFile,Skippit : BOOLEAN;
  241. 135 BEGIN
  242. 136 Negotiating:=TRUE;
  243. 137 EOTCount:=0;
  244. 138 Skippit:=FALSE;
  245. 139 EndOfFile:=FALSE;
  246. 140 REPEAT
  247. 141 IncomingData := FALSE;
  248. 142 REPEAT
  249. 143 FTSupport.UpdateStatus;
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. 144 IF FTSupport.Aborted THEN
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. 145 RETURN(6);
  256. 146 END;
  257. 147 IF (NOT Skippit) AND ((Response<>ACK) OR (NOT NoACKS)) THEN
  258. ***** ^ not supported yet
  259. 148 RS232.SerialWrite(Response,1);
  260. ***** ^ not supported yet
  261. ***** ^ not supported yet
  262. ***** ^ not supported yet
  263. 149 END;
  264. 150 Skippit := FALSE;
  265. 151 LOOP
  266. 152 IF RS232.SerialRead(c,100) THEN
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. ***** ^ not supported yet
  270. 153 IF (c=SOH) OR (c=EOT) OR (c=STX) THEN
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. 154 FTSupport.LastMessage:='';
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. 155 Negotiating:=FALSE;
  278. 156 IncomingData := TRUE;
  279. 157 EXIT;
  280. 158 END;
  281. 159 ELSE
  282. 160 Response := NAK;
  283. ***** ^ not supported yet
  284. 161 IF NOT NoACKS THEN
  285. 162 RS232.SerialWrite(Response,1);
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. 163 END;
  290. 164 FTSupport.LastMessage := 'Timeout';
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. ***** ^ not supported yet
  294. 165 INC(FTSupport.Errors);
  295. ***** ^ undeclared identifier
  296. ***** ^ not supported yet
  297. ***** ^ not supported yet
  298. 166 IF (NoACKS) OR (FTSupport.Errors>1) THEN
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. 167 IF Negotiating THEN
  302. 168 RETURN(1);
  303. 169 ELSE
  304. 170 RETURN(2);
  305. 171 END;
  306. 172 END;
  307. 173 EXIT;
  308. 174 END;
  309. 175 END;
  310. 176 UNTIL IncomingData;
  311. 177 IF c=EOT THEN
  312. ***** ^ not supported yet
  313. 178 FTSupport.LastMessage := 'End of File';
  314. ***** ^ not supported yet
  315. ***** ^ not supported yet
  316. ***** ^ not supported yet
  317. 179 INC(EOTCount);
  318. ***** ^ undeclared identifier
  319. ***** ^ not supported yet
  320. 180 IF (EOTCount=2) OR (NoACKS) THEN
  321. 181 EndOfFile := TRUE;
  322. 182 Response:=ACK;
  323. ***** ^ not supported yet
  324. 183 RS232.SerialWrite(Response,1);
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. ***** ^ not supported yet
  328. 184 ELSE
  329. 185 Response:=NAK
  330. ***** ^ not supported yet
  331. 186 END;
  332. 187 ELSE
  333. 188 EOTCount:=0;
  334. 189 IF (c=SOH) THEN
  335. ***** ^ not supported yet
  336. 190 BlockSize:=128;
  337. 191 ELSE
  338. 192 BlockSize:=1024;
  339. 193 END;
  340. 194 Result := ReceiveData();
  341. ***** ^ not supported yet
  342. ***** ^ not supported yet
  343. 195 IF Result=0 THEN
  344. 196 (* ACK good blocks immediately so that the background receiver can*)
  345. 197 (* be getting the next packet while we write this one to disk. *)
  346. 198 Response := ACK;
  347. ***** ^ not supported yet
  348. 199 IF NOT NoACKS THEN
  349. 200 RS232.SerialWrite(Response,1);
  350. ***** ^ not supported yet
  351. ***** ^ not supported yet
  352. ***** ^ not supported yet
  353. 201 END;
  354. 202 Skippit := TRUE;
  355. 203 LastBlockNo := BlockNo;
  356. 204 BlockNo := (BlockNo+1) MOD 100H;
  357. 205 IF OneBlockOnly THEN
  358. 206 RETURN(0);
  359. 207 END;
  360. 208 IF FTSupport.SizeInBytes>0 THEN
  361. ***** ^ not supported yet
  362. ***** ^ not supported yet
  363. 209 IF FTSupport.Transferred+LONGCARD(BlockSize)>FTSupport.SizeInBytes THEN
  364. ***** ^ not supported yet
  365. ***** ^ not supported yet
  366. ***** ^ undeclared identifier
  367. ***** ^ not supported yet
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. 210 BlockSize := CARDINAL(FTSupport.SizeInBytes-FTSupport.Transferred);
  371. ***** ^ not supported yet
  372. ***** ^ not supported yet
  373. ***** ^ not supported yet
  374. ***** ^ not supported yet
  375. 211 END;
  376. 212 END;
  377. 213 FIO.WrBin(f,FTSupport.FBuff,BlockSize);
  378. ***** ^ not supported yet
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. ***** ^ not supported yet
  382. ***** ^ not supported yet
  383. ***** ^ not supported yet
  384. 214 IF FIO.IOresult()<>0 THEN
  385. ***** ^ not supported yet
  386. ***** ^ not supported yet
  387. ***** ^ not supported yet
  388. 215 FTSupport.LastMessage := 'Disk Write Error';
  389. ***** ^ not supported yet
  390. ***** ^ not supported yet
  391. ***** ^ not supported yet
  392. 216 FTSupport.UpdateStatus;
  393. ***** ^ not supported yet
  394. ***** ^ not supported yet
  395. 217 RETURN(4);
  396. 218 END;
  397. 219 FTSupport.Transferred := FTSupport.Transferred+LONGCARD(BlockSize);
  398. ***** ^ not supported yet
  399. ***** ^ not supported yet
  400. ***** ^ not supported yet
  401. ***** ^ not supported yet
  402. ***** ^ undeclared identifier
  403. ***** ^ not supported yet
  404. 220 FTSupport.Errors:=0;
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. 221 FTSupport.LastMessage:='';
  408. ***** ^ not supported yet
  409. ***** ^ not supported yet
  410. 222 FTSupport.UpdateStatus;
  411. ***** ^ not supported yet
  412. ***** ^ not supported yet
  413. 223 ELSIF Result=15 THEN
  414. 224 (* Sender resent previous block - ACK and ignore *)
  415. 225 Response := ACK;
  416. ***** ^ not supported yet
  417. 226 FTSupport.Errors := 0;
  418. ***** ^ not supported yet
  419. ***** ^ not supported yet
  420. 227 FTSupport.LastMessage := '';
  421. ***** ^ not supported yet
  422. ***** ^ not supported yet
  423. 228 FTSupport.UpdateStatus;
  424. ***** ^ not supported yet
  425. ***** ^ not supported yet
  426. 229 ELSE
  427. 230 INC(FTSupport.Errors);
  428. ***** ^ undeclared identifier
  429. ***** ^ not supported yet
  430. ***** ^ not supported yet
  431. 231 FTSupport.UpdateStatus;
  432. ***** ^ not supported yet
  433. ***** ^ not supported yet
  434. 232 IF (Result>127) OR NoACKS (*fatal*) THEN
  435. 233 FTSupport.Aborted := TRUE;
  436. ***** ^ not supported yet
  437. ***** ^ not supported yet
  438. 234 RETURN(Result MOD 100H);
  439. 235 END;
  440. 236 Response := NAK;
  441. ***** ^ not supported yet
  442. 237 IF FTSupport.Errors>5 (* too many *) THEN
  443. ***** ^ not supported yet
  444. ***** ^ not supported yet
  445. 238 RETURN(Result);
  446. 239 END;
  447. 240 END;
  448. 241 END;
  449. 242 UNTIL EndOfFile OR FTSupport.Aborted;
  450. ***** ^ not supported yet
  451. ***** ^ not supported yet
  452. 243 IF FTSupport.Aborted THEN
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. 244 RETURN(6);
  456. 245 ELSE
  457. 246 RETURN(0);
  458. 247 END;
  459. 248 END YMReceive;
  460. ***** ^ not supported yet
  461. 249
  462. 250 (*...............................................*)
  463. 251
  464. 252 PROCEDURE YModemReceive(VAR Filename:ARRAY OF CHAR):CARDINAL;
  465. ***** ^ not supported yet
  466. 253 VAR
  467. 254 Result : CARDINAL;
  468. 255 HookSave : BOOLEAN;
  469. 256 BEGIN
  470. 257 InitVars(Filename);
  471. ***** ^ not supported yet
  472. ***** ^ not supported yet
  473. 258 FTSupport.CompleteFilename;
  474. ***** ^ not supported yet
  475. ***** ^ not supported yet
  476. 259 f := FIO.Create(FTSupport.FileSpec);
  477. ***** ^ not supported yet
  478. ***** ^ not supported yet
  479. ***** ^ not supported yet
  480. ***** ^ not supported yet
  481. ***** ^ not supported yet
  482. 260 IF FIO.IOresult()=0 THEN
  483. ***** ^ not supported yet
  484. ***** ^ not supported yet
  485. ***** ^ not supported yet
  486. 261 HookSave := RS232.Hooked;
  487. ***** ^ not supported yet
  488. ***** ^ not supported yet
  489. 262 RS232.Hooked := FTSupport.HookOnFT;
  490. ***** ^ not supported yet
  491. ***** ^ not supported yet
  492. ***** ^ not supported yet
  493. ***** ^ not supported yet
  494. 263 FTSupport.OpenStatusWindow('YModem Download');
  495. ***** ^ not supported yet
  496. ***** ^ not supported yet
  497. ***** ^ not supported yet
  498. 264 FTSupport.NewFilename;
  499. ***** ^ not supported yet
  500. ***** ^ not supported yet
  501. 265 Response := CRCREQ;
  502. ***** ^ not supported yet
  503. 266 Result := YMReceive(FALSE);
  504. ***** ^ not supported yet
  505. ***** ^ not supported yet
  506. 267 IF Result=1 THEN
  507. 268 CRCCheck:=FALSE;
  508. 269 FTSupport.XferMode:='CHK';
  509. ***** ^ not supported yet
  510. ***** ^ not supported yet
  511. ***** ^ not supported yet
  512. 270 Response := NAK;
  513. ***** ^ not supported yet
  514. 271 Result := YMReceive(FALSE);
  515. ***** ^ not supported yet
  516. ***** ^ not supported yet
  517. 272 END;
  518. 273 FIO.Close(f);
  519. ***** ^ not supported yet
  520. ***** ^ not supported yet
  521. ***** ^ not supported yet
  522. 274 IF FTSupport.Aborted THEN
  523. ***** ^ not supported yet
  524. ***** ^ not supported yet
  525. 275 FTSupport.Cancel;
  526. ***** ^ not supported yet
  527. ***** ^ not supported yet
  528. 276 END;
  529. 277 FTSupport.CloseStatusWindow;
  530. ***** ^ not supported yet
  531. ***** ^ not supported yet
  532. 278 RS232.Hooked := HookSave;
  533. ***** ^ not supported yet
  534. ***** ^ not supported yet
  535. 279 RETURN Result;
  536. 280 ELSE
  537. 281 CommUtil.ErrorMessage('Could not open file!');
  538. ***** ^ not supported yet
  539. ***** ^ not supported yet
  540. ***** ^ not supported yet
  541. 282 RETURN 12;
  542. 283 END;
  543. 284 END YModemReceive;
  544. ***** ^ not supported yet
  545. 285
  546. 286 (*..................................................*)
  547. 287
  548. 288 PROCEDURE GetFileDetails(VAR Filename:ARRAY OF CHAR; VAR Size:LONGCARD);
  549. ***** ^ not supported yet
  550. ***** ^ undeclared identifier
  551. 289 VAR
  552. 290 i : CARDINAL;
  553. 291 c : CHAR;
  554. 292 BEGIN
  555. 293 i := 0;
  556. 294 REPEAT
  557. 295 c := FTSupport.FBuff[i];
  558. ***** ^ not supported yet
  559. ***** ^ not supported yet
  560. ***** ^ not supported yet
  561. 296 Filename[i] := c;
  562. ***** ^ not supported yet
  563. ***** ^ not supported yet
  564. 297 INC(i);
  565. ***** ^ undeclared identifier
  566. ***** ^ not supported yet
  567. 298 UNTIL c = 0C;
  568. 299 Size := 0;
  569. ***** ^ not supported yet
  570. 300 c := FTSupport.FBuff[i];
  571. ***** ^ not supported yet
  572. ***** ^ not supported yet
  573. ***** ^ not supported yet
  574. 301 WHILE (c>='0') AND (c<='9') DO
  575. 302 Size := Size*10 + LONGCARD(ORD(c)-48);
  576. ***** ^ not supported yet
  577. ***** ^ not supported yet
  578. ***** ^ undeclared identifier
  579. ***** ^ undeclared identifier
  580. ***** ^ not supported yet
  581. ***** ^ not supported yet
  582. 303 INC(i);
  583. ***** ^ undeclared identifier
  584. ***** ^ not supported yet
  585. 304 c := FTSupport.FBuff[i];
  586. ***** ^ not supported yet
  587. ***** ^ not supported yet
  588. ***** ^ not supported yet
  589. 305 END;
  590. 306 END GetFileDetails;
  591. ***** ^ not supported yet
  592. 307
  593. 308 (*...............................................*)
  594. 309
  595. 310 PROCEDURE YModemBatchReceive():CARDINAL;
  596. 311 VAR
  597. 312 c : CHAR;
  598. 313 Result : CARDINAL;
  599. 314 HookSave : BOOLEAN;
  600. 315 BEGIN
  601. 316 HookSave := RS232.Hooked;
  602. ***** ^ not supported yet
  603. ***** ^ not supported yet
  604. 317 RS232.Hooked := FTSupport.HookOnFT;
  605. ***** ^ not supported yet
  606. ***** ^ not supported yet
  607. ***** ^ not supported yet
  608. ***** ^ not supported yet
  609. 318 FTSupport.OpenStatusWindow('YModem Batch Download');
  610. ***** ^ not supported yet
  611. ***** ^ not supported yet
  612. ***** ^ not supported yet
  613. 319 REPEAT
  614. 320 FTSupport.FileSpec:='';
  615. ***** ^ not supported yet
  616. ***** ^ not supported yet
  617. 321 InitVars(FTSupport.FileSpec);
  618. ***** ^ not supported yet
  619. ***** ^ not supported yet
  620. ***** ^ not supported yet
  621. 322 BlockNo := 0;
  622. 323 IF NoACKS THEN
  623. 324 Response:='G';
  624. 325 Result := YMReceive(TRUE);
  625. ***** ^ not supported yet
  626. ***** ^ not supported yet
  627. 326 END;
  628. 327 IF (NOT NoACKS) OR (Result=1) THEN
  629. 328 NoACKS := FALSE;
  630. 329 Response := CRCREQ;
  631. ***** ^ not supported yet
  632. 330 Result := YMReceive(TRUE);
  633. ***** ^ not supported yet
  634. ***** ^ not supported yet
  635. 331 IF Result=1 THEN
  636. 332 CRCCheck:=FALSE;
  637. 333 FTSupport.XferMode:='CHK';
  638. ***** ^ not supported yet
  639. ***** ^ not supported yet
  640. ***** ^ not supported yet
  641. 334 Response := NAK;
  642. ***** ^ not supported yet
  643. 335 Result := YMReceive(TRUE);
  644. ***** ^ not supported yet
  645. ***** ^ not supported yet
  646. 336 END;
  647. 337 END;
  648. 338 IF Result=0 THEN
  649. 339 IF NOT NoACKS THEN
  650. 340 RS232.SerialWrite(ACK,1);
  651. ***** ^ not supported yet
  652. ***** ^ not supported yet
  653. ***** ^ not supported yet
  654. ***** ^ not supported yet
  655. 341 END;
  656. 342 GetFileDetails(FTSupport.FileSpec,FTSupport.SizeInBytes);
  657. ***** ^ not supported yet
  658. ***** ^ not supported yet
  659. ***** ^ not supported yet
  660. ***** ^ not supported yet
  661. ***** ^ not supported yet
  662. 343 IF FTSupport.FileSpec[0]<>0C THEN
  663. ***** ^ not supported yet
  664. ***** ^ not supported yet
  665. ***** ^ not supported yet
  666. 344 FTSupport.CompleteFilename;
  667. ***** ^ not supported yet
  668. ***** ^ not supported yet
  669. 345 f := FIO.Create(FTSupport.FileSpec);
  670. ***** ^ not supported yet
  671. ***** ^ not supported yet
  672. ***** ^ not supported yet
  673. ***** ^ not supported yet
  674. ***** ^ not supported yet
  675. 346 IF FIO.IOresult()<>0 THEN
  676. ***** ^ not supported yet
  677. ***** ^ not supported yet
  678. ***** ^ not supported yet
  679. 347 RS232.Hooked := HookSave;
  680. ***** ^ not supported yet
  681. ***** ^ not supported yet
  682. 348 RETURN(12);
  683. 349 END;
  684. 350 FTSupport.NewFilename;
  685. ***** ^ not supported yet
  686. ***** ^ not supported yet
  687. 351 Response := CRCREQ;
  688. ***** ^ not supported yet
  689. 352 BlockNo := 1;
  690. 353 Result := YMReceive(FALSE);
  691. ***** ^ not supported yet
  692. ***** ^ not supported yet
  693. 354 IF Result=1 THEN
  694. 355 CRCCheck:=FALSE;
  695. 356 FTSupport.XferMode:='CHK';
  696. ***** ^ not supported yet
  697. ***** ^ not supported yet
  698. ***** ^ not supported yet
  699. 357 Response := NAK;
  700. ***** ^ not supported yet
  701. 358 Result := YMReceive(FALSE);
  702. ***** ^ not supported yet
  703. ***** ^ not supported yet
  704. 359 END;
  705. 360 FIO.Close(f);
  706. ***** ^ not supported yet
  707. ***** ^ not supported yet
  708. ***** ^ not supported yet
  709. 361 END;
  710. 362 END;
  711. 363 UNTIL (Result<>0) OR FTSupport.Aborted OR (FTSupport.FileSpec[0]=0C);
  712. ***** ^ not supported yet
  713. ***** ^ not supported yet
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. ***** ^ not supported yet
  717. 364 IF FTSupport.Aborted THEN
  718. ***** ^ not supported yet
  719. ***** ^ not supported yet
  720. 365 FTSupport.Cancel;
  721. ***** ^ not supported yet
  722. ***** ^ not supported yet
  723. 366 END;
  724. 367 FTSupport.CloseStatusWindow;
  725. ***** ^ not supported yet
  726. ***** ^ not supported yet
  727. 368 RS232.Hooked := HookSave;
  728. ***** ^ not supported yet
  729. ***** ^ not supported yet
  730. 369 RETURN Result;
  731. 370 END YModemBatchReceive;
  732. ***** ^ not supported yet
  733. 371
  734. 372 (*..................................................*)
  735. 373
  736. 374 PROCEDURE YModemGReceive():CARDINAL;
  737. 375 VAR
  738. 376 Result : CARDINAL;
  739. 377 BEGIN
  740. 378 NoACKS := TRUE;
  741. 379 FTSupport.OpenStatusWindow('YModem-g Batch Download');
  742. ***** ^ not supported yet
  743. ***** ^ not supported yet
  744. ***** ^ not supported yet
  745. 380 Result := YModemBatchReceive();
  746. ***** ^ not supported yet
  747. ***** ^ not supported yet
  748. 381 NoACKS := FALSE;
  749. 382 RETURN Result;
  750. 383 END YModemGReceive;
  751. ***** ^ not supported yet
  752. 384
  753. 385 (*..................................................*)
  754. 386
  755. 387 PROCEDURE GetResponse(VAR c:CHAR):CARDINAL;
  756. 388 VAR
  757. 389 CANCount : CARDINAL;
  758. 390 GotResponse : BOOLEAN;
  759. 391 BEGIN
  760. 392 CANCount := 0;
  761. 393 REPEAT
  762. 394 IF FTSupport.AbortRequested() THEN
  763. ***** ^ not supported yet
  764. ***** ^ not supported yet
  765. ***** ^ not supported yet
  766. 395 RETURN(6);
  767. 396 END;
  768. 397 IF ResponseWaiting THEN
  769. 398 c:=Response;
  770. 399 GotResponse:=TRUE;
  771. 400 ResponseWaiting:=FALSE;
  772. 401 ELSE
  773. 402 GotResponse := RS232.SerialRead(c,100);
  774. ***** ^ not supported yet
  775. ***** ^ not supported yet
  776. ***** ^ not supported yet
  777. 403 END;
  778. 404 IF GotResponse THEN
  779. 405 IF c=CAN THEN
  780. ***** ^ not supported yet
  781. 406 INC(CANCount);
  782. ***** ^ undeclared identifier
  783. ***** ^ not supported yet
  784. 407 IF CANCount=3 THEN
  785. 408 RETURN(13);
  786. 409 END;
  787. 410 END;
  788. 411 ELSE
  789. 412 FTSupport.LastMessage := 'Timeout';
  790. ***** ^ not supported yet
  791. ***** ^ not supported yet
  792. ***** ^ not supported yet
  793. 413 INC(FTSupport.Errors);
  794. ***** ^ undeclared identifier
  795. ***** ^ not supported yet
  796. ***** ^ not supported yet
  797. 414 FTSupport.UpdateStatus;
  798. ***** ^ not supported yet
  799. ***** ^ not supported yet
  800. 415 IF FTSupport.Errors=5 THEN
  801. ***** ^ not supported yet
  802. ***** ^ not supported yet
  803. 416 RETURN(2);
  804. 417 END;
  805. 418 END;
  806. 419 UNTIL GotResponse AND ((c=NAK) OR (c=ACK) OR (c=CRCREQ));
  807. ***** ^ not supported yet
  808. ***** ^ not supported yet
  809. ***** ^ not supported yet
  810. 420 FTSupport.LastMessage := '';
  811. ***** ^ not supported yet
  812. ***** ^ not supported yet
  813. 421 FTSupport.UpdateStatus;
  814. ***** ^ not supported yet
  815. ***** ^ not supported yet
  816. 422 RETURN 0;
  817. 423 END GetResponse;
  818. ***** ^ not supported yet
  819. 424
  820. 425 (*..................................................*)
  821. 426
  822. 427 PROCEDURE SendBlock(VAR c:CHAR):CARDINAL;
  823. 428 VAR
  824. 429 Result,i,Lnth,
  825. 430 CRC,CheckSum,
  826. 431 CRCIndex : CARDINAL;
  827. 432 Header : ARRAY[0..2] OF CHAR;
  828. ***** ^ not supported yet
  829. ***** ^ not supported yet
  830. 433 BEGIN
  831. 434 CRC:=0;
  832. 435 CheckSum:=0;
  833. 436 Lnth:=BlockSize;
  834. 437 IF Lnth=128 THEN
  835. 438 Header[0]:=SOH;
  836. ***** ^ not supported yet
  837. ***** ^ not supported yet
  838. ***** ^ not supported yet
  839. 439 ELSE
  840. 440 Header[0]:=STX;
  841. ***** ^ not supported yet
  842. ***** ^ not supported yet
  843. ***** ^ not supported yet
  844. 441 END;
  845. 442 Header[1]:=CHR(BlockNo);
  846. ***** ^ not supported yet
  847. ***** ^ not supported yet
  848. ***** ^ undeclared identifier
  849. ***** ^ not supported yet
  850. 443 Header[2]:=CHR(255-BlockNo);
  851. ***** ^ not supported yet
  852. ***** ^ not supported yet
  853. ***** ^ undeclared identifier
  854. ***** ^ not supported yet
  855. 444 RS232.SerialWrite(Header,3);
  856. ***** ^ not supported yet
  857. ***** ^ not supported yet
  858. ***** ^ not supported yet
  859. ***** ^ not supported yet
  860. 445 IF CRCCheck THEN
  861. 446 FOR i:=0 TO Lnth-1 DO
  862. 447 RS232.SerialWrite(FTSupport.FBuff[i],1);
  863. ***** ^ not supported yet
  864. ***** ^ not supported yet
  865. ***** ^ not supported yet
  866. ***** ^ not supported yet
  867. ***** ^ not supported yet
  868. ***** ^ not supported yet
  869. 448 CRCIndex := CARDINAL(BITSET(CRC>>8)/BITSET(ORD(FTSupport.FBuff[i])));
  870. ***** ^ undeclared identifier
  871. ***** ^ not supported yet
  872. ***** ^ undeclared identifier
  873. ***** ^ undeclared identifier
  874. ***** ^ not supported yet
  875. ***** ^ not supported yet
  876. ***** ^ not supported yet
  877. 449 CRC := CARDINAL(BITSET(FTSupport.CRCTable[CRCIndex])/BITSET(CRC<<8))
  878. ***** ^ undeclared identifier
  879. ***** ^ not supported yet
  880. ***** ^ not supported yet
  881. ***** ^ not supported yet
  882. ***** ^ undeclared identifier
  883. ***** ^ not supported yet
  884. 450 END;
  885. 451 FTSupport.FBuff[Lnth] := CHR(CRC DIV 100H);
  886. ***** ^ not supported yet
  887. ***** ^ not supported yet
  888. ***** ^ not supported yet
  889. ***** ^ undeclared identifier
  890. ***** ^ not supported yet
  891. 452 FTSupport.FBuff[Lnth+1] := CHR(CRC MOD 100H);
  892. ***** ^ not supported yet
  893. ***** ^ not supported yet
  894. ***** ^ not supported yet
  895. ***** ^ undeclared identifier
  896. ***** ^ not supported yet
  897. 453 RS232.SerialWrite(FTSupport.FBuff[Lnth],2);
  898. ***** ^ not supported yet
  899. ***** ^ not supported yet
  900. ***** ^ not supported yet
  901. ***** ^ not supported yet
  902. ***** ^ not supported yet
  903. ***** ^ not supported yet
  904. 454 INC(Lnth,2);
  905. ***** ^ undeclared identifier
  906. ***** ^ not supported yet
  907. 455 ELSE
  908. 456 FOR i:=0 TO Lnth-1 DO
  909. 457 RS232.SerialWrite(FTSupport.FBuff[i],1);
  910. ***** ^ not supported yet
  911. ***** ^ not supported yet
  912. ***** ^ not supported yet
  913. ***** ^ not supported yet
  914. ***** ^ not supported yet
  915. ***** ^ not supported yet
  916. 458 CheckSum := (CheckSum + ORD(FTSupport.FBuff[i])) MOD 100H;
  917. ***** ^ undeclared identifier
  918. ***** ^ not supported yet
  919. ***** ^ not supported yet
  920. ***** ^ not supported yet
  921. 459 END;
  922. 460 FTSupport.FBuff[Lnth] := CHR(CheckSum);
  923. ***** ^ not supported yet
  924. ***** ^ not supported yet
  925. ***** ^ not supported yet
  926. ***** ^ undeclared identifier
  927. ***** ^ not supported yet
  928. 461 RS232.SerialWrite(CHR(CheckSum),1);
  929. ***** ^ not supported yet
  930. ***** ^ not supported yet
  931. ***** ^ undeclared identifier
  932. ***** ^ not supported yet
  933. ***** ^ not supported yet
  934. 462 INC(Lnth);
  935. ***** ^ undeclared identifier
  936. ***** ^ not supported yet
  937. 463 END;
  938. 464 REPEAT
  939. 465 IF NOT NoACKS THEN
  940. 466 Result := GetResponse(c);
  941. ***** ^ not supported yet
  942. ***** ^ not supported yet
  943. 467 IF Result # 0 THEN
  944. 468 RETURN(Result);
  945. 469 END;
  946. 470 IF c # ACK THEN
  947. ***** ^ not supported yet
  948. 471 FTSupport.LastMessage := 'Received NAK';
  949. ***** ^ not supported yet
  950. ***** ^ not supported yet
  951. ***** ^ not supported yet
  952. 472 INC(FTSupport.Errors);
  953. ***** ^ undeclared identifier
  954. ***** ^ not supported yet
  955. ***** ^ not supported yet
  956. 473 FTSupport.UpdateStatus;
  957. ***** ^ not supported yet
  958. ***** ^ not supported yet
  959. 474 IF FTSupport.Errors=5 THEN
  960. ***** ^ not supported yet
  961. ***** ^ not supported yet
  962. 475 RETURN(14);
  963. 476 END;
  964. 477 RS232.SerialWrite(Header,3);
  965. ***** ^ not supported yet
  966. ***** ^ not supported yet
  967. ***** ^ not supported yet
  968. ***** ^ not supported yet
  969. 478 RS232.SerialWrite(FTSupport.FBuff,Lnth);
  970. ***** ^ not supported yet
  971. ***** ^ not supported yet
  972. ***** ^ not supported yet
  973. ***** ^ not supported yet
  974. ***** ^ not supported yet
  975. 479 END;
  976. 480 ELSE
  977. 481 c:=ACK;
  978. ***** ^ not supported yet
  979. 482 IF FTSupport.AbortRequested() THEN
  980. ***** ^ not supported yet
  981. ***** ^ not supported yet
  982. ***** ^ not supported yet
  983. 483 RETURN(6);
  984. 484 END;
  985. 485 END;
  986. 486 UNTIL c = ACK;
  987. ***** ^ not supported yet
  988. 487 RETURN 0;
  989. 488 END SendBlock;
  990. ***** ^ not supported yet
  991. 489
  992. 490 (*..................................................*)
  993. 491
  994. 492 PROCEDURE GetStartChar(VAR c:CHAR):CARDINAL;
  995. 493 VAR
  996. 494 Result : CARDINAL;
  997. 495 BEGIN
  998. 496 REPEAT
  999. 497 Result := GetResponse(c);
  1000. ***** ^ not supported yet
  1001. ***** ^ not supported yet
  1002. 498 IF Result<>0 THEN
  1003. 499 RETURN(Result);
  1004. 500 END;
  1005. 501 UNTIL (c=NAK) OR (c=CRCREQ) OR (c='G');
  1006. ***** ^ not supported yet
  1007. ***** ^ not supported yet
  1008. 502 IF c=NAK THEN
  1009. ***** ^ not supported yet
  1010. 503 CRCCheck:=FALSE;
  1011. 504 FTSupport.XferMode:='CHK'
  1012. ***** ^ not supported yet
  1013. ***** ^ not supported yet
  1014. ***** ^ not supported yet
  1015. 505 END;
  1016. 506 RS232.FlushInBuf;
  1017. ***** ^ not supported yet
  1018. ***** ^ not supported yet
  1019. 507 RETURN 0;
  1020. 508 END GetStartChar;
  1021. ***** ^ not supported yet
  1022. 509
  1023. 510 (*..................................................*)
  1024. 511
  1025. 512 PROCEDURE YMSend():CARDINAL;
  1026. 513 VAR
  1027. 514 c : CHAR;
  1028. 515 Result,BytesRead,
  1029. 516 CANCount : CARDINAL;
  1030. 517 BEGIN
  1031. 518 Result := GetStartChar(c);
  1032. ***** ^ not supported yet
  1033. ***** ^ not supported yet
  1034. 519 IF Result<>0 THEN
  1035. 520 RETURN(Result);
  1036. 521 END;
  1037. 522 FTSupport.UpdateStatus;
  1038. ***** ^ not supported yet
  1039. ***** ^ not supported yet
  1040. 523 WHILE NOT FIO.EOF DO
  1041. ***** ^ not supported yet
  1042. ***** ^ not supported yet
  1043. 524 BytesRead := FIO.RdBin(f,FTSupport.FBuff,BlockSize);
  1044. ***** ^ not supported yet
  1045. ***** ^ not supported yet
  1046. ***** ^ not supported yet
  1047. ***** ^ not supported yet
  1048. ***** ^ not supported yet
  1049. ***** ^ not supported yet
  1050. 525 IF FIO.IOresult()<>0 THEN
  1051. ***** ^ not supported yet
  1052. ***** ^ not supported yet
  1053. ***** ^ not supported yet
  1054. 526 RETURN(5);
  1055. 527 END;
  1056. 528 IF BytesRead<BlockSize THEN
  1057. 529 Lib.Fill(ADR(FTSupport.FBuff[BytesRead]),BlockSize-BytesRead,CHR(26));
  1058. ***** ^ not supported yet
  1059. ***** ^ not supported yet
  1060. ***** ^ undeclared identifier
  1061. ***** ^ not supported yet
  1062. ***** ^ not supported yet
  1063. ***** ^ not supported yet
  1064. ***** ^ undeclared identifier
  1065. ***** ^ not supported yet
  1066. 530 END;
  1067. 531 FTSupport.Errors := 0;
  1068. ***** ^ not supported yet
  1069. ***** ^ not supported yet
  1070. 532 Result := SendBlock(c);
  1071. ***** ^ not supported yet
  1072. ***** ^ not supported yet
  1073. 533 IF Result<>0 THEN
  1074. 534 RETURN(Result);
  1075. 535 END;
  1076. 536 FTSupport.LastMessage := '';
  1077. ***** ^ not supported yet
  1078. ***** ^ not supported yet
  1079. 537 FTSupport.Transferred := FTSupport.Transferred+LONGCARD(BlockSize);
  1080. ***** ^ not supported yet
  1081. ***** ^ not supported yet
  1082. ***** ^ not supported yet
  1083. ***** ^ not supported yet
  1084. ***** ^ undeclared identifier
  1085. ***** ^ not supported yet
  1086. 538 BlockNo := (BlockNo+1) MOD 100H;
  1087. 539 FTSupport.Errors := 0;
  1088. ***** ^ not supported yet
  1089. ***** ^ not supported yet
  1090. 540 FTSupport.UpdateStatus;
  1091. ***** ^ not supported yet
  1092. ***** ^ not supported yet
  1093. 541 END;
  1094. 542 FTSupport.LastMessage := 'End of File';
  1095. ***** ^ not supported yet
  1096. ***** ^ not supported yet
  1097. ***** ^ not supported yet
  1098. 543 FTSupport.UpdateStatus;
  1099. ***** ^ not supported yet
  1100. ***** ^ not supported yet
  1101. 544 REPEAT
  1102. 545 REPEAT
  1103. 546 RS232.SerialWrite(EOT,1);
  1104. ***** ^ not supported yet
  1105. ***** ^ not supported yet
  1106. ***** ^ not supported yet
  1107. ***** ^ not supported yet
  1108. 547 Result := GetResponse(c);
  1109. ***** ^ not supported yet
  1110. ***** ^ not supported yet
  1111. 548 IF Result<>0 THEN
  1112. 549 RETURN(Result);
  1113. 550 END;
  1114. 551 UNTIL (c=NAK) OR (c=ACK);
  1115. ***** ^ not supported yet
  1116. ***** ^ not supported yet
  1117. 552 UNTIL c=ACK;
  1118. ***** ^ not supported yet
  1119. 553 RETURN 0;
  1120. 554 END YMSend;
  1121. ***** ^ not supported yet
  1122. 555
  1123. 556 (*..................................................*)
  1124. 557
  1125. 558 PROCEDURE YModemSend(VAR Filename:ARRAY OF CHAR):CARDINAL;
  1126. ***** ^ not supported yet
  1127. 559 VAR
  1128. 560 Result : CARDINAL;
  1129. 561 HookSave : BOOLEAN;
  1130. 562 BEGIN
  1131. 563 IF FIO.Exists(Filename) THEN
  1132. ***** ^ not supported yet
  1133. ***** ^ not supported yet
  1134. ***** ^ not supported yet
  1135. 564 HookSave := RS232.Hooked;
  1136. ***** ^ not supported yet
  1137. ***** ^ not supported yet
  1138. 565 RS232.Hooked := FTSupport.HookOnFT;
  1139. ***** ^ not supported yet
  1140. ***** ^ not supported yet
  1141. ***** ^ not supported yet
  1142. ***** ^ not supported yet
  1143. 566 InitVars(Filename);
  1144. ***** ^ not supported yet
  1145. ***** ^ not supported yet
  1146. 567 BlockSize := 1024;
  1147. 568 f := FIO.Open(Filename);
  1148. ***** ^ not supported yet
  1149. ***** ^ not supported yet
  1150. ***** ^ not supported yet
  1151. ***** ^ not supported yet
  1152. 569 FIO.EOF := FALSE;
  1153. ***** ^ not supported yet
  1154. ***** ^ not supported yet
  1155. 570 FTSupport.SizeInBytes := FIO.Size(f);
  1156. ***** ^ not supported yet
  1157. ***** ^ not supported yet
  1158. ***** ^ not supported yet
  1159. ***** ^ not supported yet
  1160. ***** ^ not supported yet
  1161. 571 FTSupport.OpenStatusWindow('YModem Upload');
  1162. ***** ^ not supported yet
  1163. ***** ^ not supported yet
  1164. ***** ^ not supported yet
  1165. 572 FTSupport.NewFilename;
  1166. ***** ^ not supported yet
  1167. ***** ^ not supported yet
  1168. 573 Result := YMSend();
  1169. ***** ^ not supported yet
  1170. ***** ^ not supported yet
  1171. 574 FTSupport.CloseStatusWindow;
  1172. ***** ^ not supported yet
  1173. ***** ^ not supported yet
  1174. 575 RS232.Hooked := HookSave;
  1175. ***** ^ not supported yet
  1176. ***** ^ not supported yet
  1177. 576 FIO.Close(f);
  1178. ***** ^ not supported yet
  1179. ***** ^ not supported yet
  1180. ***** ^ not supported yet
  1181. 577 RETURN Result;
  1182. 578 ELSE
  1183. 579 CommUtil.ErrorMessage('Could not open file!');
  1184. ***** ^ not supported yet
  1185. ***** ^ not supported yet
  1186. ***** ^ not supported yet
  1187. 580 RETURN 7;
  1188. 581 END;
  1189. 582 END YModemSend;
  1190. ***** ^ not supported yet
  1191. 583
  1192. 584 (*..................................................*)
  1193. 585
  1194. 586 PROCEDURE GetPath(Wild:ARRAY OF CHAR; VAR Path:ARRAY OF CHAR):BOOLEAN;
  1195. ***** ^ not supported yet
  1196. ***** ^ not supported yet
  1197. 587 VAR
  1198. 588 Drive,Ext : ARRAY[0..4] OF CHAR;
  1199. ***** ^ not supported yet
  1200. ***** ^ not supported yet
  1201. 589 Name : ARRAY[0..12] OF CHAR;
  1202. ***** ^ not supported yet
  1203. ***** ^ not supported yet
  1204. 590 BEGIN
  1205. 591 IF NOT Filenames.ParseFilename(Wild,Drive,Path,Name,Ext) THEN
  1206. ***** ^ not supported yet
  1207. ***** ^ not supported yet
  1208. ***** ^ not supported yet
  1209. ***** ^ not supported yet
  1210. ***** ^ not supported yet
  1211. ***** ^ not supported yet
  1212. ***** ^ not supported yet
  1213. 592 RETURN(FALSE);
  1214. 593 END;
  1215. 594 Name := '';
  1216. ***** ^ not supported yet
  1217. ***** ^ incompatible assignment
  1218. 595 Ext:='';
  1219. ***** ^ not supported yet
  1220. ***** ^ incompatible assignment
  1221. 596 Filenames.MakeFilename(Drive,Path,Name,Ext,Path);
  1222. ***** ^ not supported yet
  1223. ***** ^ not supported yet
  1224. ***** ^ not supported yet
  1225. ***** ^ not supported yet
  1226. ***** ^ not supported yet
  1227. ***** ^ not supported yet
  1228. ***** ^ not supported yet
  1229. 597 RETURN TRUE;
  1230. 598 END GetPath;
  1231. ***** ^ not supported yet
  1232. 599
  1233. 600 (*...............................................*)
  1234. 601
  1235. 602 PROCEDURE YModemBatchSend(VAR Wild:ARRAY OF CHAR):CARDINAL;
  1236. ***** ^ not supported yet
  1237. 603 VAR
  1238. 604 c : CHAR;
  1239. 605 GotFile : BOOLEAN;
  1240. 606 Result : CARDINAL;
  1241. 607 Path : ARRAY[0..70] OF CHAR;
  1242. ***** ^ not supported yet
  1243. ***** ^ not supported yet
  1244. 608 entry : FIO.DirEntry;
  1245. ***** ^ not supported yet
  1246. 609 HookSave : BOOLEAN;
  1247. 610 BEGIN
  1248. 611 IF GetPath(Wild,Path) THEN
  1249. ***** ^ not supported yet
  1250. ***** ^ not supported yet
  1251. ***** ^ not supported yet
  1252. 612 HookSave := RS232.Hooked;
  1253. ***** ^ not supported yet
  1254. ***** ^ not supported yet
  1255. 613 RS232.Hooked := FTSupport.HookOnFT;
  1256. ***** ^ not supported yet
  1257. ***** ^ not supported yet
  1258. ***** ^ not supported yet
  1259. ***** ^ not supported yet
  1260. 614 FTSupport.OpenStatusWindow('YModem Batch Upload');
  1261. ***** ^ not supported yet
  1262. ***** ^ not supported yet
  1263. ***** ^ not supported yet
  1264. 615 GotFile := FIO.ReadFirstEntry(Wild,FIO.FileAttr{},entry);
  1265. ***** ^ not supported yet
  1266. ***** ^ not supported yet
  1267. ***** ^ not supported yet
  1268. ***** ^ not supported yet
  1269. ***** ^ not supported yet
  1270. 616 WHILE GotFile DO
  1271. 617 FTSupport.FileSpec:='';
  1272. 618 InitVars(FTSupport.FileSpec);
  1273. 619 Str.Concat(FTSupport.FileSpec,Path,entry.Name);
  1274. 620 FTSupport.NewFilename;
  1275. 621 f := FIO.Open(FTSupport.FileSpec);
  1276. 622 FIO.EOF := FALSE;
  1277. 623 FTSupport.SizeInBytes := FIO.Size(f);
  1278. 624 Lib.Fill(ADR(FTSupport.FBuff),128,0C);
  1279. 625 SPRINTF.SPrintF2('%s\000%u',entry.Name,FTSupport.SizeInBytes,FTSupport.FBuff);
  1280. 626 BlockNo := 0;
  1281. 627 Result := GetStartChar(c);
  1282. 628 IF Result<>0 THEN
  1283. 629 FIO.Close(f);
  1284. 630 FTSupport.CloseStatusWindow;
  1285. 631 RETURN(Result);
  1286. 632 END;
  1287. 633 IF c='G' THEN
  1288. 634 NoACKS:=TRUE;
  1289. 635 END;
  1290. 636 REPEAT
  1291. 637 Result := SendBlock(c);
  1292. 638 IF Result<>0 THEN
  1293. 639 FIO.Close(f);
  1294. 640 NoACKS:=FALSE;
  1295. 641 FTSupport.CloseStatusWindow;
  1296. 642 RETURN Result;
  1297. 643 END;
  1298. 644 UNTIL c<>NAK;
  1299. 645 Response := c;
  1300. 646 ResponseWaiting := TRUE;
  1301. 647 BlockNo:=1;
  1302. 648 BlockSize:=1024;
  1303. 649 Result := YMSend();
  1304. 650 FIO.Close(f);
  1305. 651 IF Result<>0 THEN
  1306. 652 FTSupport.CloseStatusWindow;
  1307. 653 NoACKS:=FALSE;
  1308. 654 RETURN(Result);
  1309. 655 END;
  1310. 656 GotFile := FIO.ReadNextEntry(entry);
  1311. 657 END;
  1312. 658 BlockNo:=0;
  1313. 659 BlockSize:=128;
  1314. 660 Lib.Fill(ADR(FTSupport.FBuff),128,0C);
  1315. 661 Result := GetStartChar(c);
  1316. 662 IF Result=0 THEN
  1317. 663 Result := SendBlock(c);
  1318. 664 END;
  1319. 665 FTSupport.CloseStatusWindow;
  1320. 666 RS232.Hooked := HookSave;
  1321. 667 ELSE
  1322. 668 CommUtil.ErrorMessage('Bad filename');
  1323. 669 RETURN 7;
  1324. 670 END;
  1325. 671 RETURN 0;
  1326. 672 END YModemBatchSend;
  1327. 673
  1328. 674 (*..................................................*)
  1329. 675
  1330. 676 BEGIN
  1331. 677 ResponseWaiting := FALSE;
  1332. 678 NoACKS := FALSE;
  1333. 679 END YModem.
  1334. 680
  1335. 653 errors