| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171 |
- Listing:
- 1 MODULE AddrBook;
- 2 (*
- 3 * ModBase
- 4 * Release 3.0
- 5 * (c) Copyright 1986 - 1990 Donald G. Fletcher
- 6 * (c) Copyright 1986 - 1990 PMI
- 7 * P.O. Box 8402
- 8 * Green Bay Wi 53308
- 9 * All Rights Reserved
- 10 *)
- 11 (* IMPORT PMD;*)
- 12 IMPORT DBIndxes;
- 13 IMPORT DspFiles;
- 14 IMPORT ErrorManager;
- 15 IMPORT HandleIO;
- 16 IMPORT KbdInput;
- 17 IMPORT LowLevel;
- 18 IMPORT M2Strings;
- 19 IMPORT ModBase3;
- 20 IMPORT MsColors;
- 21 IMPORT PosUtils;
- 22 IMPORT ScreenDisplay;
- 23 IMPORT ScreenInput;
- 24 IMPORT Scrn2DBF;
- 25 IMPORT ScrnTypes;
- 26 IMPORT SmartScreen;
- 27 IMPORT StrConv;
- 28 IMPORT StrEdit;
- 29 IMPORT StringIO;
- 30 IMPORT SYSTEM;
- 31 IMPORT UserOps;
- 32 IMPORT VWindows;
- 33 IMPORT WindowPrims;
- 34
- 35 IMPORT InitCompilerMods;
- 36
- 37 VAR
- 38 DataFile: ModBase3.DBFile;
- ***** ^ not supported yet
- 39 IndexByName: DBIndxes.DBIndex;
- ***** ^ not supported yet
- 40 ScreenFile : ScrnTypes.DisplayFile;
- ***** ^ not supported yet
- 41 SavedCursorHeight : CARDINAL;
- 42
- 43 PROCEDURE Confirm(query: ARRAY OF CHAR): BOOLEAN;
- ***** ^ not supported yet
- 44 VAR
- 45 KeyHit: CARDINAL;
- 46 BEGIN
- 47 WindowPrims.MsgBox( VWindows.SE, query,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 48 KbdInput.YorN, KeyHit );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 49 RETURN KbdInput.CAPkey( KeyHit ) = ORD('Y');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 50 END Confirm;
- ***** ^ not supported yet
- 51
- 52 PROCEDURE ChangeExtension(VAR name: ARRAY OF CHAR; ext: ARRAY OF CHAR);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 53 VAR
- 54 i, j: CARDINAL;
- 55 BEGIN
- 56 i := 0;
- 57 StrEdit.CrunchBlanks(name);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 58 LOOP
- 59 IF (i > HIGH(name)) OR (name[i] = 0C) OR (name[i] = '.') THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 60 EXIT
- 61 END;
- 62 INC(i);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 63 END; (* LOOP *)
- 64 IF i <= (HIGH(name)) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 65 name[i] := '.';
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 INC(i);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 67 FOR j := 0 TO 2 DO
- 68 IF i <= HIGH(name) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 69 name[i] := ext[j];
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 70 INC(i);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 71 END;
- 72 END;
- 73 END;
- 74 END ChangeExtension;
- ***** ^ not supported yet
- 75
- 76 PROCEDURE GetNewDbFile( VAR TheDbFile: ModBase3.DBFile; VAR TheDbIndex:
- ***** ^ not supported yet
- 77 DBIndxes.DBIndex; TheName: ARRAY OF CHAR ): BOOLEAN;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 78 VAR
- 79 temp: ARRAY [1..8] OF ModBase3.DBFieldDescriptor;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 80 TmpStr: ARRAY [0..255] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 81 IndexOpened : BOOLEAN;
- 82 BEGIN
- 83 IF ModBase3.Initialized(TheDbFile) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 84 ModBase3.CloseDBF( TheDbFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 85 ModBase3.DisposeDBF(TheDbFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 86 DBIndxes.CloseIndex( TheDbIndex );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 87 DBIndxes.DisposeIndex(TheDbIndex );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 88 END;
- 89 ChangeExtension( TheName, 'dbf');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 90 IndexOpened := FALSE;
- 91 ModBase3.InitDBF( TheName, TheDbFile, 0, TRUE ,FALSE,TRUE,ModBase3.DefaultFixUp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 92 IF NOT ModBase3.OpenDBF( TheDbFile ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 93 StrEdit.AssignStr(
- ***** ^ not supported yet
- ***** ^ not supported yet
- 94 'File not found. Create a new file named ', TmpStr );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 95 StrEdit.Append( TmpStr, TheName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 96 StrEdit.CutTrailingChars( ' ', TmpStr );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 97 StrEdit.Append( TmpStr, '? (Y/N)' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 98 IF Confirm( TmpStr ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 99 temp[1].name := 'NAME';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 100 temp[1].size := 30;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 101 temp[1].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 102
- 103 temp[2].name := 'COMPANY';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 104 temp[2].size := 30;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 105 temp[2].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 106
- 107 temp[3].name := 'ADDRESS1';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 108 temp[3].size := 30;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 109 temp[3].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 110
- 111 temp[4].name := 'ADDRESS2';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 112 temp[4].size := 30;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 113 temp[4].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 114
- 115 temp[5].name := 'CITY';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 116 temp[5].size := 20;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 117 temp[5].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 118
- 119 temp[6].name := 'STATE';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 120 temp[6].size := 2;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 121 temp[6].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 122
- 123 temp[7].name := 'ZIPCODE';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 124 temp[7].size := 10;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 125 temp[7].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 126
- 127 temp[8].name := 'ASKDATE';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 128 temp[8].size := 8;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 129 temp[8].fldtype := 'C';
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 130
- 131 StringIO.PrintMessage(ModBase3.BuildDBF( temp, 8, TheDbFile ));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 132
- 133 END;
- 134 END;
- 135 ChangeExtension(TheName, 'NUM');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 136 IF ModBase3.OpenDBF(TheDbFile) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 137 IF HandleIO.FileExists( TheName ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 138 DBIndxes.InitIndex(TheName, TheDbIndex,TheDbFile, 5, TRUE,TRUE,FALSE);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 139 IndexOpened := DBIndxes.OpenIndex(TheDbIndex);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 140 ELSE
- 141 DBIndxes.InitIndex(TheName, TheDbIndex, TheDbFile, 5, TRUE,TRUE,FALSE);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 142 StringIO.PrintMessage(DBIndxes.BuildIndex(TheDbIndex, 'NAME'));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 143 IndexOpened := DBIndxes.OpenIndex(TheDbIndex);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 144 END;
- 145 END;
- 146 RETURN (*TheDbFile.open AND*) IndexOpened;
- 147 END GetNewDbFile;
- ***** ^ not supported yet
- 148
- 149 PROCEDURE ProcessNumberedRecord( RecordNumber: LONGINT;
- 150 NewRecord: BOOLEAN; NameIfNew: ARRAY OF CHAR ): ScrnTypes.FrameKey;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 151 VAR
- 152 NxtFrame: ScrnTypes.FrameKey;
- ***** ^ not supported yet
- 153 TheCount: CARDINAL;
- 154 BEGIN
- 155 IF (RecordNumber >ModBase3.NumberRecords(DataFile)) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 156 IF NOT NewRecord THEN
- 157 RETURN 2;
- ***** ^ bad RETURN
- 158 END;
- 159 END;
- 160 ScreenDisplay.ReadDisplayFrame( ScreenFile,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 161 DspFiles.MainFrame, 4 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 162 (* The data input frame. *)
- 163 IF NOT NewRecord THEN
- 164 ModBase3.ReadDBRec( DataFile, RecordNumber );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 165 IF ModBase3.Deleted( DataFile ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 166 RETURN 2;
- ***** ^ bad RETURN
- 167 END;
- 168 Scrn2DBF.DBFToFrame( DataFile, DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 169 ELSE
- 170 ScreenInput.ChangeField( DspFiles.MainFrame,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 171 NameIfNew, 'NAME', TRUE );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 172 END;
- 173 REPEAT
- 174 (* MainFrame should always have frame 4, the input frame,
- 175 in it at this point. *)
- 176 ScreenDisplay.ShowDisplayFrame( DspFiles.MainFrame,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 177 0, 0, 0, 0 );
- ***** ^ not supported yet
- 178 ScreenDisplay.PushFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 179 (* This saves the contents of the input frame until we
- 180 are ready to Edit it or write it to the DataFile. *)
- 181 NxtFrame := 3; (* The Edit/Save/Delete/Return menu. *)
- ***** ^ not supported yet
- 182 ScreenInput.Input( NxtFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 183 CASE NxtFrame OF
- ***** ^ not supported yet
- 184 4: (* User wants to Edit record. *)
- 185 ScreenDisplay.PopFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 186 (* Pop frame 3 off MainFrame's frame stack,
- 187 bringing frame 4 back to the top. *)
- 188 NxtFrame := ScreenInput.ControlFrame(
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 189 DspFiles.MainFrame, 0, '', FALSE );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 190 | 9: (*Save*)
- 191 ScreenDisplay.PopFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 192 (* Brings the input frame back to the top of
- 193 MainFrame's frame stack. *)
- 194 IF NewRecord THEN
- 195 ModBase3.AppendBlank( DataFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 196 END;
- 197 IF NOT Scrn2DBF.FrameToDBF( DataFile,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 198 DspFiles.MainFrame) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 199 IF NOT Confirm( 'Error writing record. Continue?' ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 200 HALT;
- ***** ^ undeclared identifier
- 201 END;
- 202 END;
- 203 ModBase3.WriteDBRec( DataFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 204 IF NOT NewRecord THEN
- 205 DBIndxes.DeleteCurrentEntry( IndexByName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 206 ELSE
- 207 NewRecord := FALSE;
- 208 END;
- 209 DBIndxes.AddRecord( DataFile, IndexByName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 210 ScreenDisplay.PushFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 211 (* We're going to be pushing MainFrame at the top
- 212 of the next loop, so we save and restore it
- 213 here. *)
- 214 ScreenInput.Input( NxtFrame ); (* success message *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 215 ScreenDisplay.PopFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 216 | 10: (*Delete*)
- 217 ScreenDisplay.PopFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 218 IF NOT NewRecord THEN
- 219 ModBase3.DeleteRecord( DataFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 220 DBIndxes.DeleteCurrentEntry( IndexByName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 221 END;
- 222 NewRecord := TRUE;
- 223 ScreenDisplay.PushFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 224 ScreenInput.Input( NxtFrame ); (* success message *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 225 ScreenDisplay.PopFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 226 | 2: (*Return*)
- 227 ScreenDisplay.PopFrame( DspFiles.MainFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 228 END;
- 229 UNTIL (NxtFrame = 2);
- ***** ^ not supported yet
- 230 RETURN NxtFrame;
- ***** ^ not supported yet
- 231 END ProcessNumberedRecord;
- ***** ^ not supported yet
- 232
- 233 PROCEDURE ProcessNamedRecord( RecordName: ARRAY OF CHAR; VAR
- ***** ^ not supported yet
- 234 RecordNumber: LONGINT ): ScrnTypes.FrameKey;
- ***** ^ not supported yet
- 235 VAR
- 236 found: BOOLEAN;
- 237 BEGIN
- 238 IF PosUtils.IsBlank( RecordName ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 239 RETURN 2;
- ***** ^ bad RETURN
- 240 END;
- 241 DBIndxes.FindPositionCh( IndexByName, RecordName, found );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 242 IF (NOT found) AND
- 243 (NOT Confirm( 'Record not found. Create it? (Y/N)' )) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 244 RETURN 2;
- ***** ^ bad RETURN
- 245 END;
- 246 RecordNumber := DBIndxes.CurrentRec( IndexByName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 247 ScreenDisplay.ReadDisplayFrame( ScreenFile,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 248 DspFiles.MainFrame, 4 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 249 (* Reads the data input frame from disk into MainFrame. *)
- 250 RETURN ProcessNumberedRecord( RecordNumber, NOT found, RecordName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 251 END ProcessNamedRecord;
- ***** ^ not supported yet
- 252
- 253 PROCEDURE ImportFromAscii( VAR TheDbFile: ModBase3.DBFile; VAR
- ***** ^ not supported yet
- 254 TheIndexFile: DBIndxes.DBIndex; AsciiFileName: ARRAY OF CHAR ):
- ***** ^ not supported yet
- ***** ^ not supported yet
- 255 BOOLEAN;
- 256 (*Assumes the ascii file contains fixed-length records, each
- 257 on a single CR/LF-terminated line. *)
- 258 VAR
- 259 FieldCnt, FileHandle: CARDINAL;
- 260 CheckStr: ARRAY [0..1] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 261 fpt:ModBase3.DBFieldPtr;
- ***** ^ not supported yet
- 262 BEGIN
- 263 IF NOT (HandleIO.OpenFile( FileHandle, AsciiFileName) =
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 264 StringIO.NoError) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 265 RETURN FALSE;
- 266 END;
- 267 fpt:= ModBase3.FieldList(TheDbFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 268 LOOP
- 269 ModBase3.AppendBlank( TheDbFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 270 FieldCnt := 1;
- 271 REPEAT
- 272 IF NOT (HandleIO.BlockRead( FileHandle,
- ***** ^ not supported yet
- ***** ^ not supported yet
- 273 LowLevel.AddAddr(ModBase3.RecordPtr(TheDbFile),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 274 fpt^[FieldCnt].offset - 1),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 275 fpt^[FieldCnt].size ) =
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 276 StringIO.NoError) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 277 EXIT;
- 278 END;
- 279 INC( FieldCnt );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 280 UNTIL FieldCnt > ModBase3.NumberOfFields(TheDbFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 281 IF NOT (HandleIO.BlockRead( FileHandle,
- ***** ^ not supported yet
- ***** ^ not supported yet
- 282 SYSTEM.ADR(CheckStr), 2 ) = StringIO.NoError) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 283 (*Read what should be the CR/LF.*)
- 284 EXIT;
- 285 END;
- 286 IF M2Strings.CompareStr( CheckStr, StringIO.CrLf ) # 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 287 EXIT;
- 288 (* We exit here instead of returning false to make sure
- 289 the FileHandle is closed. *)
- 290 END;
- 291 ModBase3.WriteDBRec( TheDbFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 292 DBIndxes.AddRecord( TheDbFile, TheIndexFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 293 IF HandleIO.EndReached( FileHandle ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 294 EXIT;
- 295 END;
- 296 END;
- 297 IF (HandleIO.CloseHandle( FileHandle ) = StringIO.NoError) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 298 RETURN TRUE;
- 299 ELSE
- 300 RETURN FALSE;
- 301 END;
- 302 END ImportFromAscii;
- ***** ^ not supported yet
- 303
- 304 PROCEDURE ExportToAscii( VAR TheDbFile: ModBase3.DBFile; AsciiFileName:
- ***** ^ not supported yet
- 305 ARRAY OF CHAR );
- ***** ^ not supported yet
- 306 VAR
- 307 FieldCnt, FileHandle: CARDINAL;
- 308 RecordNumber: LONGINT;
- 309 fpt:ModBase3.DBFieldPtr;
- ***** ^ not supported yet
- 310 BEGIN
- 311 IF NOT (HandleIO.CreateFile( FileHandle, AsciiFileName ) =
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 312 StringIO.NoError) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 313 RETURN;
- 314 END;
- 315 fpt:= ModBase3.FieldList(TheDbFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 316 RecordNumber := VAL(LONGINT, 0);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 317 LOOP
- 318 INC( RecordNumber );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 319 IF (RecordNumber > ModBase3.NumberRecords(TheDbFile)) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 320 EXIT;
- 321 END;
- 322 ModBase3.ReadDBRec( TheDbFile, RecordNumber );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 323 IF NOT ModBase3.Deleted( TheDbFile ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 324 (* skip records that have been marked for deletion *)
- 325 FieldCnt := 1;
- 326 REPEAT
- 327 IF NOT (HandleIO.BlockWrite( FileHandle,
- ***** ^ not supported yet
- ***** ^ not supported yet
- 328 LowLevel.AddAddr(ModBase3.RecordPtr(TheDbFile),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 329 fpt^[FieldCnt].offset - 1),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 330 fpt^[FieldCnt].size ) =
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 331 StringIO.NoError) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 332 EXIT;
- 333 END;
- 334 INC( FieldCnt );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 335 UNTIL FieldCnt > ModBase3.NumberOfFields(TheDbFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 336 StringIO.WriteEol( FileHandle, '' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 337 END;
- 338 END;
- 339 StringIO.PrintMessage( HandleIO.CloseHandle( FileHandle ) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 340 END ExportToAscii;
- ***** ^ not supported yet
- 341
- 342 PROCEDURE RestoreDisplay();
- 343 BEGIN
- 344 VWindows.SetForeColor( VWindows.CurrentWindow, MsColors.lightgrey );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 345 VWindows.SetBackColor( VWindows.CurrentWindow, MsColors.black );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 346 VWindows.SetMonoAttr( VWindows.CurrentWindow, MsColors.plain );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 347 VWindows.ClearPart( VWindows.CurrentWindow, 1, 1,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 348 VWindows.EndCol(VWindows.CurrentWindow),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 349 VWindows.EndRow(VWindows.CurrentWindow) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 350 VWindows.SetCursorHeight( VWindows.CurrentWindow, SavedCursorHeight );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 351 END RestoreDisplay;
- ***** ^ not supported yet
- 352
- 353 PROCEDURE CloseFiles();
- 354 BEGIN
- 355 DspFiles.CloseDisplayFile( ScreenFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 356 IF ModBase3.Initialized(DataFile) AND ModBase3.OpenDBF(DataFile) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 357 ModBase3.CloseDBF( DataFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 358 DBIndxes.CloseIndex( IndexByName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 359 END;
- 360 END CloseFiles;
- ***** ^ not supported yet
- 361
- 362
- 363 VAR
- 364 NextFrame : ScrnTypes.FrameKey;
- ***** ^ not supported yet
- 365 CurrentRecName: ARRAY [0..29] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 366 CurrentRecNum: LONGINT;
- 367 AsciiFileName, DbFileName: ARRAY [0..63] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 368 dumbool: BOOLEAN;
- 369
- 370 BEGIN (* MAIN *)
- 371 ModBase3.NilDBF(DataFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 372 SavedCursorHeight := WindowPrims.GetCursorHeight();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 373 (*VWindows.GetCursorHeight( VWindows.CurrentWindow );*)
- 374 SmartScreen.SetCursorHeight(0);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 375 (* VWindows.SetCursorHeight( VWindows.CurrentWindow, 0 );*)
- 376 ErrorManager.AddTermProc( RestoreDisplay );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 377 ErrorManager.AddTermProc( CloseFiles );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 378 CurrentRecName := '';
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 379 CurrentRecNum := VAL( LONGINT, 1 );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 380 ScreenDisplay.OpenDisplayFile( ScreenFile, 'AddrBook.DSP' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 381 ScreenDisplay.Display( 1 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 382 (* the box and the banner *)
- 383 NextFrame := 8;
- ***** ^ not supported yet
- 384 ScreenInput.Input( NextFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 385 (* Prompts for the name of the database file; you could get
- 386 it from the command line if you wanted to. *)
- 387 ScreenInput.ReadInput( DspFiles.MainFrame, DbFileName,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 388 dumbool, 'filename' );
- ***** ^ not supported yet
- 389 StrEdit.CrunchBlanks( DbFileName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 390 IF GetNewDbFile( DataFile, IndexByName, DbFileName ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 391 LOOP
- 392 (*NextFrame should always be 2 at this point.*)
- 393 ScreenInput.Input( NextFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 394 CASE NextFrame OF
- ***** ^ not supported yet
- 395 11: (*User has selected Record option.*)
- 396 ScreenInput.Input( NextFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 397 (* This is the drop-down menu. *)
- 398 IF NextFrame # StrConv.ReturnedInt(DspFiles.MainFrame^.parent) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 399 CASE NextFrame OF
- ***** ^ not supported yet
- 400 5: (* user wants a Specific record *)
- 401 ScreenInput.Input( NextFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 402 (* Prompts for the name of the record. *)
- 403 IF NextFrame = UserOps.EndCode THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 404 (*User wants to exit program.*)
- 405 EXIT;
- 406 ELSE
- 407 ScreenInput.ReadInput( DspFiles.MainFrame,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 408 CurrentRecName, dumbool, 'name' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 409 NextFrame := ProcessNamedRecord( CurrentRecName,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 410 CurrentRecNum );
- ***** ^ not supported yet
- 411 (*NextFrame should always be 2 at this point.*)
- 412 END;
- 413 | 1000: (* user wants Next record *)
- 414 IF (CurrentRecNum <= ModBase3.NumberRecords(DataFile)) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 415 INC( CurrentRecNum );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 416 NextFrame := ProcessNumberedRecord(
- ***** ^ not supported yet
- ***** ^ not supported yet
- 417 CurrentRecNum, FALSE, '' );
- ***** ^ not supported yet
- 418 ELSE
- 419 NextFrame := 2;
- ***** ^ not supported yet
- 420 END;
- 421 | 1001: (* user wants Prev record *)
- 422 IF (CurrentRecNum > VAL(LONGINT, 1)) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 423 DEC( CurrentRecNum );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 424 NextFrame := ProcessNumberedRecord(
- ***** ^ not supported yet
- ***** ^ not supported yet
- 425 CurrentRecNum, FALSE, '' );
- ***** ^ not supported yet
- 426 ELSE
- 427 NextFrame := 2;
- ***** ^ not supported yet
- 428 END;
- 429 END;
- 430 END;
- 431
- 432 | 8: (*User has selected File option.*)
- 433 CurrentRecName := '';
- ***** ^ not supported yet
- ***** ^ incompatible assignment
- 434 CurrentRecNum := VAL( LONGINT, 1 );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 435 REPEAT
- 436 ScreenInput.Input( NextFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 437 (* Prompts for the name of the database file. *)
- 438 ScreenInput.ReadInput( DspFiles.MainFrame,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 439 DbFileName, dumbool, 'filename' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 440 StrEdit.CrunchBlanks( DbFileName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 441 IF NOT GetNewDbFile( DataFile, IndexByName, DbFileName ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 442 EXIT;
- 443 END;
- 444 UNTIL ModBase3.OpenDBF(DataFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 445
- 446 | 6: (*User has selected Import option.*)
- 447 ScreenInput.Input( NextFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 448 ScreenInput.ReadInput( DspFiles.MainFrame,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 449 AsciiFileName, dumbool, 'filename' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 450 IF NOT ImportFromAscii( DataFile, IndexByName,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 451 AsciiFileName ) THEN
- ***** ^ not supported yet
- 452 IF NOT Confirm( 'Error importing file. Continue?' ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 453 EXIT;
- 454 END;
- 455 END;
- 456 NextFrame := 2;
- ***** ^ not supported yet
- 457
- 458 | 7: (*User has selected Export option.*)
- 459 ScreenInput.Input( NextFrame );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 460 ScreenInput.ReadInput( DspFiles.MainFrame,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 461 AsciiFileName, dumbool, 'filename' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 462 ExportToAscii( DataFile, AsciiFileName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 463 NextFrame := 2;
- ***** ^ not supported yet
- 464
- 465 | UserOps.EndCode: EXIT;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 466 ELSE
- 467 IF NOT Confirm(
- ***** ^ not supported yet
- 468 'Unanticipated value returned from frame 2. Continue?') THEN
- ***** ^ not supported yet
- 469 EXIT;
- 470 END;
- 471 END;
- 472 END;
- 473 END;
- 474 END AddrBook.
- 691 errors
|