CLIENT.LST 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. Listing:
  2. 1 IMPLEMENTATION MODULE Client;
  3. 2 (*
  4. 3 Copyright (C) 1988,1989 Jensen & Partners International
  5. 4 *)
  6. 5
  7. 6 IMPORT Globals, Window, IO, Str, Misc, Btree;
  8. 7 FROM Globals IMPORT GetMenu, ItemIndex, ItemData, ClientIndex, ClientData;
  9. ***** ^ duplicate identifier
  10. 8
  11. 9 VAR
  12. 10 ClientWin, lastWin : Window.WinType;
  13. ***** ^ not supported yet
  14. 11 OnScreen : BOOLEAN;
  15. 12 EmptyClient, BlankClient : ClientRec;
  16. ***** ^ undeclared identifier
  17. 13 keyPressed : CHAR;
  18. 14
  19. 15 PROCEDURE PressAKey( txt : ARRAY OF CHAR);
  20. ***** ^ not supported yet
  21. 16 VAR
  22. 17 ch : CHAR;
  23. 18 BEGIN
  24. 19 Window.TextColor(Globals.PromptFore);
  25. ***** ^ not supported yet
  26. ***** ^ not supported yet
  27. ***** ^ not supported yet
  28. ***** ^ not supported yet
  29. 20 Window.TextBackground(Globals.DisplayBack);
  30. ***** ^ not supported yet
  31. ***** ^ not supported yet
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. 21 Globals.WriteAt(9,1,txt);
  35. ***** ^ not supported yet
  36. ***** ^ not supported yet
  37. ***** ^ not supported yet
  38. 22 Window.GotoXY(30,9);
  39. ***** ^ not supported yet
  40. ***** ^ not supported yet
  41. ***** ^ not supported yet
  42. 23 ch := IO.RdKey();
  43. ***** ^ not supported yet
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. 24 Window.GotoXY(1,9);
  47. ***** ^ not supported yet
  48. ***** ^ not supported yet
  49. ***** ^ not supported yet
  50. 25 Window.ClrEol();
  51. ***** ^ not supported yet
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. 26 keyPressed := CAP(ch);
  55. ***** ^ undeclared identifier
  56. ***** ^ not supported yet
  57. 27 END PressAKey;
  58. ***** ^ not supported yet
  59. 28
  60. 29
  61. 30 PROCEDURE MakeKey( keyA, myClientA : ADDRESS );
  62. ***** ^ undeclared identifier
  63. 31 VAR
  64. 32 key : POINTER TO Globals.FileKey;
  65. ***** ^ not supported yet
  66. 33 myClient : POINTER TO ClientRec;
  67. ***** ^ undeclared identifier
  68. 34 BEGIN
  69. 35 key := keyA;
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. 36 myClient := myClientA;
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. 37 Str.Copy(key^,myClient^.CNum);
  76. ***** ^ not supported yet
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. 38 END MakeKey;
  82. ***** ^ not supported yet
  83. 39
  84. 40
  85. 41 PROCEDURE Display( aClient : ClientRec );
  86. ***** ^ undeclared identifier
  87. 42 (*
  88. 43 This procedure displays the client record on the screen.
  89. 44 *)
  90. 45 VAR
  91. 46 S : ARRAY[0..10] OF CHAR;
  92. ***** ^ not supported yet
  93. ***** ^ not supported yet
  94. 47 ok : BOOLEAN;
  95. 48 BEGIN
  96. 49 Window.TextColor(Globals.DataFore);
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. ***** ^ not supported yet
  101. 50 Window.TextBackground(Globals.DataBack);
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. 51 WITH aClient DO
  107. ***** ^ not supported yet
  108. 52 Globals.WriteAt(1,15,CNum);
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. ***** ^ undeclared identifier
  112. 53 Globals.WriteAt(2,15,LName);
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. ***** ^ undeclared identifier
  116. 54 Globals.WriteAt(2,48,FName);
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. ***** ^ undeclared identifier
  120. 55 Globals.WriteAt(3,15,Street);
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. ***** ^ undeclared identifier
  124. 56 Globals.WriteAt(4,15,City);
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ undeclared identifier
  128. 57 Globals.WriteAt(4,48,State);
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. ***** ^ undeclared identifier
  132. 58 Globals.WriteAt(4,62,Zip);
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. ***** ^ undeclared identifier
  136. 59 Globals.WriteAt(6,15,Phone);
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ undeclared identifier
  140. 60 Globals.WriteAt(6,55," ");
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. ***** ^ not supported yet
  144. 61 Str.FixRealToStr(Balance,2,S,ok);
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ undeclared identifier
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. 62 IF ok = FALSE THEN
  151. 63 Globals.WriteAt(6,55,"???");
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. 64 ELSE
  156. 65 Globals.WriteAt(6,55,S);
  157. ***** ^ not supported yet
  158. ***** ^ not supported yet
  159. ***** ^ not supported yet
  160. 66 END;
  161. 67 END;
  162. ***** ^ not supported yet
  163. 68 END Display;
  164. ***** ^ not supported yet
  165. 69
  166. 70 PROCEDURE Clear( );
  167. 71 (*
  168. 72 This procedure clears the previous client information.
  169. 73 *)
  170. 74 BEGIN
  171. 75 Display(BlankClient);
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. 76 END Clear;
  175. ***** ^ not supported yet
  176. 77
  177. 78 PROCEDURE Template( );
  178. 79 (*
  179. 80 This procedure un-hides the client display window and displays
  180. 81 the field names.
  181. 82 *)
  182. 83 BEGIN
  183. 84 lastWin := Window.Used();
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. ***** ^ not supported yet
  187. ***** ^ not supported yet
  188. 85 Window.Use(ClientWin);
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. 86 Window.PutOnTop(ClientWin);
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. 87 Clear();
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 88 OnScreen := TRUE;
  200. 89 END Template;
  201. ***** ^ not supported yet
  202. 90
  203. 91 PROCEDURE Input( VAR aClient : ClientRec; Clear : BOOLEAN );
  204. ***** ^ undeclared identifier
  205. 92 (*
  206. 93 This procedure inputs the client information from the user.
  207. 94 If Clear is TRUE, then the information is cleared before the
  208. 95 user enters new information. If Clear is FALSE, Display() is
  209. 96 called first to show the current information, and it is then
  210. 97 edited.
  211. 98 *)
  212. 99 VAR
  213. 100 ok,
  214. 101 Continue : BOOLEAN;
  215. 102 Field : CARDINAL;
  216. 103 ch : CHAR;
  217. 104 S : ARRAY[0..10] OF CHAR;
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. 105 BEGIN
  221. 106 IF Clear THEN
  222. 107 aClient := EmptyClient;
  223. ***** ^ not supported yet
  224. ***** ^ not supported yet
  225. 108 Display(BlankClient);
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 109 END;
  229. 110 Display(aClient);
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. 111 Continue := TRUE;
  233. 112 Field := 1;
  234. 113 WITH aClient DO
  235. ***** ^ not supported yet
  236. 114 WHILE (Continue) DO
  237. 115 CASE Field OF
  238. 116 1: Window.GotoXY(15,1); Misc.InputStr(CNum,10);
  239. ***** ^ not supported yet
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. ***** ^ not supported yet
  244. ***** ^ undeclared identifier
  245. ***** ^ not supported yet
  246. 117 | 2: Window.GotoXY(15,2); Misc.InputStr(LName,15);
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. ***** ^ undeclared identifier
  253. ***** ^ not supported yet
  254. 118 | 3: Window.GotoXY(48,2); Misc.InputStr(FName,10);
  255. ***** ^ not supported yet
  256. ***** ^ not supported yet
  257. ***** ^ not supported yet
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ undeclared identifier
  261. ***** ^ not supported yet
  262. 119 | 4: Window.GotoXY(15,3); Misc.InputStr(Street,25);
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. ***** ^ not supported yet
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. ***** ^ undeclared identifier
  269. ***** ^ not supported yet
  270. 120 | 5: Window.GotoXY(15,4); Misc.InputStr(City,15);
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. ***** ^ not supported yet
  276. ***** ^ undeclared identifier
  277. ***** ^ not supported yet
  278. 121 | 6: Window.GotoXY(48,4); Misc.InputStr(State,2);
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. ***** ^ not supported yet
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. ***** ^ undeclared identifier
  285. ***** ^ not supported yet
  286. 122 | 7: Window.GotoXY(62,4); Misc.InputStr(Zip,5);
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. ***** ^ not supported yet
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. ***** ^ undeclared identifier
  293. ***** ^ not supported yet
  294. 123 | 8: Window.GotoXY(15,6); Misc.InputStr(Phone,13);
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. ***** ^ not supported yet
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. ***** ^ undeclared identifier
  301. ***** ^ not supported yet
  302. 124 | 9: Window.GotoXY(55,6);
  303. ***** ^ not supported yet
  304. ***** ^ not supported yet
  305. ***** ^ not supported yet
  306. 125 Str.FixRealToStr(Balance,2,S,ok);
  307. ***** ^ not supported yet
  308. ***** ^ not supported yet
  309. ***** ^ undeclared identifier
  310. ***** ^ not supported yet
  311. ***** ^ not supported yet
  312. 126 Misc.InputStr(S,10);
  313. ***** ^ not supported yet
  314. ***** ^ not supported yet
  315. ***** ^ not supported yet
  316. ***** ^ not supported yet
  317. 127 Balance := Str.StrToReal(S,ok);
  318. ***** ^ undeclared identifier
  319. ***** ^ not supported yet
  320. ***** ^ not supported yet
  321. ***** ^ not supported yet
  322. ***** ^ not supported yet
  323. 128 END;
  324. 129 INC(Field);
  325. ***** ^ undeclared identifier
  326. ***** ^ not supported yet
  327. 130 IF Field >= 10 THEN
  328. 131 Window.TextColor(Globals.PromptFore);
  329. ***** ^ not supported yet
  330. ***** ^ not supported yet
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. 132 Window.TextBackground(Globals.DisplayBack);
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. ***** ^ not supported yet
  338. 133 Globals.WriteAt(8,1,"Are these ok? ");
  339. ***** ^ not supported yet
  340. ***** ^ not supported yet
  341. ***** ^ not supported yet
  342. 134 Window.GotoXY(15,8);
  343. ***** ^ not supported yet
  344. ***** ^ not supported yet
  345. ***** ^ not supported yet
  346. 135 ch := IO.RdKey();
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. ***** ^ not supported yet
  350. 136 Globals.WriteAt(8,1," ");
  351. ***** ^ not supported yet
  352. ***** ^ not supported yet
  353. ***** ^ not supported yet
  354. 137 IF CAP(ch) = 'Y' THEN
  355. ***** ^ undeclared identifier
  356. ***** ^ not supported yet
  357. 138 Continue := FALSE;
  358. 139 ELSE
  359. 140 Field := 1;
  360. 141 Window.TextColor(Globals.DataFore);
  361. ***** ^ not supported yet
  362. ***** ^ not supported yet
  363. ***** ^ not supported yet
  364. ***** ^ not supported yet
  365. 142 Window.TextBackground(Globals.DataBack);
  366. ***** ^ not supported yet
  367. ***** ^ not supported yet
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. 143 END;
  371. 144 END;
  372. 145 END;
  373. 146 END;
  374. ***** ^ not supported yet
  375. 147 END Input;
  376. ***** ^ not supported yet
  377. 148
  378. 149 PROCEDURE Search( VAR aClient : ClientRec ) : BOOLEAN ;
  379. ***** ^ undeclared identifier
  380. 150 (*
  381. 151 This procedure asks the user for search information, and then
  382. 152 searches for the given record. If it is found, it is copied to
  383. 153 aClient, and TRUE is returned. If it is not found, FALSE is
  384. 154 returned.
  385. 155 *)
  386. 156 VAR
  387. 157 searchStr : Globals.FileKey;
  388. ***** ^ not supported yet
  389. 158 ch : CHAR;
  390. 159 BEGIN
  391. 160 Clear();
  392. ***** ^ not supported yet
  393. ***** ^ not supported yet
  394. 161 IF aClient.CNum[0] > ' ' THEN
  395. ***** ^ not supported yet
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. 162 Str.Copy(searchStr,aClient.CNum);
  399. ***** ^ not supported yet
  400. ***** ^ not supported yet
  401. ***** ^ not supported yet
  402. ***** ^ not supported yet
  403. ***** ^ not supported yet
  404. 163 ELSE
  405. 164 Window.GotoXY(15,1);
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. ***** ^ not supported yet
  409. 165 searchStr := "";
  410. ***** ^ not supported yet
  411. 166 Misc.InputStr(searchStr,10);
  412. ***** ^ not supported yet
  413. ***** ^ not supported yet
  414. ***** ^ not supported yet
  415. ***** ^ not supported yet
  416. 167 END;
  417. 168 IF searchStr[0] <= ' ' THEN
  418. ***** ^ not supported yet
  419. ***** ^ not supported yet
  420. 169 Clear();
  421. ***** ^ not supported yet
  422. ***** ^ not supported yet
  423. 170 RETURN FALSE;
  424. 171 END;
  425. 172 Str.Caps(searchStr);
  426. ***** ^ not supported yet
  427. ***** ^ not supported yet
  428. ***** ^ not supported yet
  429. 173 IF Btree.Find(ClientIndex,searchStr,aClient) THEN
  430. ***** ^ not supported yet
  431. ***** ^ not supported yet
  432. ***** ^ not supported yet
  433. ***** ^ not supported yet
  434. ***** ^ not supported yet
  435. 174 Display(aClient);
  436. ***** ^ not supported yet
  437. ***** ^ not supported yet
  438. 175 ELSE
  439. 176 IF Btree.Search(ClientIndex,searchStr,aClient) THEN
  440. ***** ^ not supported yet
  441. ***** ^ not supported yet
  442. ***** ^ not supported yet
  443. ***** ^ not supported yet
  444. ***** ^ not supported yet
  445. 177 Display(aClient);
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. 178 REPEAT
  449. 179 GetMenu("N)ext P)revious or T)his One? ",
  450. ***** ^ not supported yet
  451. ***** ^ not supported yet
  452. 180 Globals.CharSet{'N','P','T'}, ch);
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. ***** ^ not supported yet
  456. ***** ^ not supported yet
  457. ***** ^ not supported yet
  458. 181 CASE ch OF
  459. 182 'N' : IF Btree.Next(ClientIndex,aClient) THEN
  460. 183 Clear();
  461. 184 Display(aClient);
  462. 185 ELSE
  463. 186 Globals.Beep();
  464. 187 END;
  465. 188 | 'P' : IF Btree.Prev(ClientIndex,aClient) THEN
  466. 189 Clear();
  467. 190 Display(aClient);
  468. 191 ELSE
  469. 192 Globals.Beep();
  470. 193 END;
  471. 194 | 'T' : ;
  472. 195 ELSE
  473. 196 Globals.Beep();
  474. 197 END;
  475. 198 UNTIL ch = 'T';
  476. 199 ELSE
  477. 200 Globals.WriteAt(8,1,"Failed Search!");
  478. 201 PressAKey("Press Any Key to Continue... ");
  479. 202 Window.TextColor(Globals.PromptFore);
  480. 203 Window.TextBackground(Globals.DisplayBack);
  481. 204 Globals.WriteAt(8,1," ");
  482. 205 RETURN FALSE;
  483. 206 END;
  484. 207 END;
  485. 208 PressAKey("E)dit, D)elete, or Q)uit? ");
  486. 209 IF keyPressed = 33C THEN
  487. 210 RETURN FALSE;
  488. 211 ELSIF keyPressed = 'E' THEN
  489. 212 Btree.Delete(ClientData);
  490. 213 Input(aClient,FALSE);
  491. 214 Btree.Add(ClientData,aClient,SIZE(aClient));
  492. 215 RETURN TRUE;
  493. 216 ELSIF keyPressed = 'D' THEN
  494. 217 Btree.Delete(ClientData);
  495. 218 RETURN FALSE;
  496. 219 ELSE
  497. 220 RETURN TRUE;
  498. 221 END;
  499. 222 END Search;
  500. 223
  501. 224 PROCEDURE Close( );
  502. 225 (*
  503. 226 This procedure removes the client display window from the screen.
  504. 227 *)
  505. 228 BEGIN
  506. 229 Window.Hide(ClientWin);
  507. 230 Window.Use(lastWin);
  508. 231 Window.PutOnTop(lastWin);
  509. 232 OnScreen := FALSE;
  510. 233 END Close;
  511. 234
  512. 235 BEGIN
  513. 236 ClientWin := Window.Open( Window.WinDef( 0, 4, 79, 14,
  514. 237 Window.White,Window.Black,TRUE,FALSE,TRUE,TRUE,
  515. 238 Window.SingleFrame,Window.White,Window.Black) );
  516. 239 Window.SetFrame(ClientWin,Window.SingleFrame,Globals.DisplayBorder,
  517. 240 Globals.DisplayBack);
  518. 241 Window.Use(ClientWin);
  519. 242 Window.TextColor(Globals.DisplayFore);
  520. 243 Window.TextBackground(Globals.DisplayBack);
  521. 244 Window.Clear();
  522. 245 Globals.WriteAt(1,1,"Cust Number:");
  523. 246 Globals.WriteAt(2,1,"Last Name:");
  524. 247 Globals.WriteAt(2,40,"First:");
  525. 248 Globals.WriteAt(3,1,"Street:");
  526. 249 Globals.WriteAt(4,1,"City:");
  527. 250 Globals.WriteAt(4,40,"State:");
  528. 251 Globals.WriteAt(4,55,"Zip:");
  529. 252 Globals.WriteAt(6,1,"Phone:");
  530. 253 Globals.WriteAt(6,40,"Balance:");
  531. 254
  532. 255 WITH BlankClient DO
  533. 256 CNum := " ";
  534. 257 LName := " ";
  535. 258 FName := " ";
  536. 259 Street := " ";
  537. 260 City := " ";
  538. 261 State := " ";
  539. 262 Zip := " ";
  540. 263 Phone := " ";
  541. 264 Balance := 0.0;
  542. 265 END;
  543. 266
  544. 267 WITH EmptyClient DO
  545. 268 CNum := "";
  546. 269 LName := "";
  547. 270 FName := "";
  548. 271 Street := "";
  549. 272 City := "";
  550. 273 State := "";
  551. 274 Zip := "";
  552. 275 Phone := "";
  553. 276 Balance := 0.0;
  554. 277 END;
  555. 278
  556. 279 OnScreen := FALSE;
  557. 280 END Client.
  558. 281
  559. 276 errors