| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563 |
- Listing:
- 1 IMPLEMENTATION MODULE Client;
- 2 (*
- 3 Copyright (C) 1988,1989 Jensen & Partners International
- 4 *)
- 5
- 6 IMPORT Globals, Window, IO, Str, Misc, Btree;
- 7 FROM Globals IMPORT GetMenu, ItemIndex, ItemData, ClientIndex, ClientData;
- ***** ^ duplicate identifier
- 8
- 9 VAR
- 10 ClientWin, lastWin : Window.WinType;
- ***** ^ not supported yet
- 11 OnScreen : BOOLEAN;
- 12 EmptyClient, BlankClient : ClientRec;
- ***** ^ undeclared identifier
- 13 keyPressed : CHAR;
- 14
- 15 PROCEDURE PressAKey( txt : ARRAY OF CHAR);
- ***** ^ not supported yet
- 16 VAR
- 17 ch : CHAR;
- 18 BEGIN
- 19 Window.TextColor(Globals.PromptFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 20 Window.TextBackground(Globals.DisplayBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 21 Globals.WriteAt(9,1,txt);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 22 Window.GotoXY(30,9);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 23 ch := IO.RdKey();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 24 Window.GotoXY(1,9);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 25 Window.ClrEol();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 26 keyPressed := CAP(ch);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 27 END PressAKey;
- ***** ^ not supported yet
- 28
- 29
- 30 PROCEDURE MakeKey( keyA, myClientA : ADDRESS );
- ***** ^ undeclared identifier
- 31 VAR
- 32 key : POINTER TO Globals.FileKey;
- ***** ^ not supported yet
- 33 myClient : POINTER TO ClientRec;
- ***** ^ undeclared identifier
- 34 BEGIN
- 35 key := keyA;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 36 myClient := myClientA;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 37 Str.Copy(key^,myClient^.CNum);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 38 END MakeKey;
- ***** ^ not supported yet
- 39
- 40
- 41 PROCEDURE Display( aClient : ClientRec );
- ***** ^ undeclared identifier
- 42 (*
- 43 This procedure displays the client record on the screen.
- 44 *)
- 45 VAR
- 46 S : ARRAY[0..10] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 47 ok : BOOLEAN;
- 48 BEGIN
- 49 Window.TextColor(Globals.DataFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 50 Window.TextBackground(Globals.DataBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 51 WITH aClient DO
- ***** ^ not supported yet
- 52 Globals.WriteAt(1,15,CNum);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 53 Globals.WriteAt(2,15,LName);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 54 Globals.WriteAt(2,48,FName);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 55 Globals.WriteAt(3,15,Street);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 56 Globals.WriteAt(4,15,City);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 57 Globals.WriteAt(4,48,State);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 58 Globals.WriteAt(4,62,Zip);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 59 Globals.WriteAt(6,15,Phone);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 60 Globals.WriteAt(6,55," ");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 61 Str.FixRealToStr(Balance,2,S,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 62 IF ok = FALSE THEN
- 63 Globals.WriteAt(6,55,"???");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 64 ELSE
- 65 Globals.WriteAt(6,55,S);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 END;
- 67 END;
- ***** ^ not supported yet
- 68 END Display;
- ***** ^ not supported yet
- 69
- 70 PROCEDURE Clear( );
- 71 (*
- 72 This procedure clears the previous client information.
- 73 *)
- 74 BEGIN
- 75 Display(BlankClient);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 76 END Clear;
- ***** ^ not supported yet
- 77
- 78 PROCEDURE Template( );
- 79 (*
- 80 This procedure un-hides the client display window and displays
- 81 the field names.
- 82 *)
- 83 BEGIN
- 84 lastWin := Window.Used();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 85 Window.Use(ClientWin);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 86 Window.PutOnTop(ClientWin);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 87 Clear();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 88 OnScreen := TRUE;
- 89 END Template;
- ***** ^ not supported yet
- 90
- 91 PROCEDURE Input( VAR aClient : ClientRec; Clear : BOOLEAN );
- ***** ^ undeclared identifier
- 92 (*
- 93 This procedure inputs the client information from the user.
- 94 If Clear is TRUE, then the information is cleared before the
- 95 user enters new information. If Clear is FALSE, Display() is
- 96 called first to show the current information, and it is then
- 97 edited.
- 98 *)
- 99 VAR
- 100 ok,
- 101 Continue : BOOLEAN;
- 102 Field : CARDINAL;
- 103 ch : CHAR;
- 104 S : ARRAY[0..10] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 105 BEGIN
- 106 IF Clear THEN
- 107 aClient := EmptyClient;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 108 Display(BlankClient);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 109 END;
- 110 Display(aClient);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 111 Continue := TRUE;
- 112 Field := 1;
- 113 WITH aClient DO
- ***** ^ not supported yet
- 114 WHILE (Continue) DO
- 115 CASE Field OF
- 116 1: Window.GotoXY(15,1); Misc.InputStr(CNum,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 117 | 2: Window.GotoXY(15,2); Misc.InputStr(LName,15);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 118 | 3: Window.GotoXY(48,2); Misc.InputStr(FName,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 119 | 4: Window.GotoXY(15,3); Misc.InputStr(Street,25);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 120 | 5: Window.GotoXY(15,4); Misc.InputStr(City,15);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 121 | 6: Window.GotoXY(48,4); Misc.InputStr(State,2);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 122 | 7: Window.GotoXY(62,4); Misc.InputStr(Zip,5);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 123 | 8: Window.GotoXY(15,6); Misc.InputStr(Phone,13);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 124 | 9: Window.GotoXY(55,6);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 125 Str.FixRealToStr(Balance,2,S,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 126 Misc.InputStr(S,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 127 Balance := Str.StrToReal(S,ok);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 128 END;
- 129 INC(Field);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 130 IF Field >= 10 THEN
- 131 Window.TextColor(Globals.PromptFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 132 Window.TextBackground(Globals.DisplayBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 133 Globals.WriteAt(8,1,"Are these ok? ");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 134 Window.GotoXY(15,8);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 135 ch := IO.RdKey();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 136 Globals.WriteAt(8,1," ");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 137 IF CAP(ch) = 'Y' THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 138 Continue := FALSE;
- 139 ELSE
- 140 Field := 1;
- 141 Window.TextColor(Globals.DataFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 142 Window.TextBackground(Globals.DataBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 143 END;
- 144 END;
- 145 END;
- 146 END;
- ***** ^ not supported yet
- 147 END Input;
- ***** ^ not supported yet
- 148
- 149 PROCEDURE Search( VAR aClient : ClientRec ) : BOOLEAN ;
- ***** ^ undeclared identifier
- 150 (*
- 151 This procedure asks the user for search information, and then
- 152 searches for the given record. If it is found, it is copied to
- 153 aClient, and TRUE is returned. If it is not found, FALSE is
- 154 returned.
- 155 *)
- 156 VAR
- 157 searchStr : Globals.FileKey;
- ***** ^ not supported yet
- 158 ch : CHAR;
- 159 BEGIN
- 160 Clear();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 161 IF aClient.CNum[0] > ' ' THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 162 Str.Copy(searchStr,aClient.CNum);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 163 ELSE
- 164 Window.GotoXY(15,1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 165 searchStr := "";
- ***** ^ not supported yet
- 166 Misc.InputStr(searchStr,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 167 END;
- 168 IF searchStr[0] <= ' ' THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 169 Clear();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 170 RETURN FALSE;
- 171 END;
- 172 Str.Caps(searchStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 173 IF Btree.Find(ClientIndex,searchStr,aClient) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 174 Display(aClient);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 175 ELSE
- 176 IF Btree.Search(ClientIndex,searchStr,aClient) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 177 Display(aClient);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 178 REPEAT
- 179 GetMenu("N)ext P)revious or T)his One? ",
- ***** ^ not supported yet
- ***** ^ not supported yet
- 180 Globals.CharSet{'N','P','T'}, ch);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 181 CASE ch OF
- 182 'N' : IF Btree.Next(ClientIndex,aClient) THEN
- 183 Clear();
- 184 Display(aClient);
- 185 ELSE
- 186 Globals.Beep();
- 187 END;
- 188 | 'P' : IF Btree.Prev(ClientIndex,aClient) THEN
- 189 Clear();
- 190 Display(aClient);
- 191 ELSE
- 192 Globals.Beep();
- 193 END;
- 194 | 'T' : ;
- 195 ELSE
- 196 Globals.Beep();
- 197 END;
- 198 UNTIL ch = 'T';
- 199 ELSE
- 200 Globals.WriteAt(8,1,"Failed Search!");
- 201 PressAKey("Press Any Key to Continue... ");
- 202 Window.TextColor(Globals.PromptFore);
- 203 Window.TextBackground(Globals.DisplayBack);
- 204 Globals.WriteAt(8,1," ");
- 205 RETURN FALSE;
- 206 END;
- 207 END;
- 208 PressAKey("E)dit, D)elete, or Q)uit? ");
- 209 IF keyPressed = 33C THEN
- 210 RETURN FALSE;
- 211 ELSIF keyPressed = 'E' THEN
- 212 Btree.Delete(ClientData);
- 213 Input(aClient,FALSE);
- 214 Btree.Add(ClientData,aClient,SIZE(aClient));
- 215 RETURN TRUE;
- 216 ELSIF keyPressed = 'D' THEN
- 217 Btree.Delete(ClientData);
- 218 RETURN FALSE;
- 219 ELSE
- 220 RETURN TRUE;
- 221 END;
- 222 END Search;
- 223
- 224 PROCEDURE Close( );
- 225 (*
- 226 This procedure removes the client display window from the screen.
- 227 *)
- 228 BEGIN
- 229 Window.Hide(ClientWin);
- 230 Window.Use(lastWin);
- 231 Window.PutOnTop(lastWin);
- 232 OnScreen := FALSE;
- 233 END Close;
- 234
- 235 BEGIN
- 236 ClientWin := Window.Open( Window.WinDef( 0, 4, 79, 14,
- 237 Window.White,Window.Black,TRUE,FALSE,TRUE,TRUE,
- 238 Window.SingleFrame,Window.White,Window.Black) );
- 239 Window.SetFrame(ClientWin,Window.SingleFrame,Globals.DisplayBorder,
- 240 Globals.DisplayBack);
- 241 Window.Use(ClientWin);
- 242 Window.TextColor(Globals.DisplayFore);
- 243 Window.TextBackground(Globals.DisplayBack);
- 244 Window.Clear();
- 245 Globals.WriteAt(1,1,"Cust Number:");
- 246 Globals.WriteAt(2,1,"Last Name:");
- 247 Globals.WriteAt(2,40,"First:");
- 248 Globals.WriteAt(3,1,"Street:");
- 249 Globals.WriteAt(4,1,"City:");
- 250 Globals.WriteAt(4,40,"State:");
- 251 Globals.WriteAt(4,55,"Zip:");
- 252 Globals.WriteAt(6,1,"Phone:");
- 253 Globals.WriteAt(6,40,"Balance:");
- 254
- 255 WITH BlankClient DO
- 256 CNum := " ";
- 257 LName := " ";
- 258 FName := " ";
- 259 Street := " ";
- 260 City := " ";
- 261 State := " ";
- 262 Zip := " ";
- 263 Phone := " ";
- 264 Balance := 0.0;
- 265 END;
- 266
- 267 WITH EmptyClient DO
- 268 CNum := "";
- 269 LName := "";
- 270 FName := "";
- 271 Street := "";
- 272 City := "";
- 273 State := "";
- 274 Zip := "";
- 275 Phone := "";
- 276 Balance := 0.0;
- 277 END;
- 278
- 279 OnScreen := FALSE;
- 280 END Client.
- 281
- 276 errors
|