Listing: 1 IMPLEMENTATION MODULE AltKeys; 2 (* 3 * REPERTOIRE 4 * Release 1.6 5 * By Charles Bradford and Cole Brecheen 6 * (c) Copyright 1985-1992 PMI 7 * Green Bay, Wisconsin 8 * All rights reserved 9 * (414) 468-6040 10 * 11 * $Header: D:/logfiles/mods/altkeys.mov 1.5 10 Mar 1991 15:24:44 coleb $ 12 * 13 *) 14 15 16 IMPORT ErrorNames; 17 IMPORT GenLists; 18 IMPORT ListUtils; 19 IMPORT LowLevel; 20 IMPORT M2Strings; 21 IMPORT NdxBones; 22 IMPORT NdxFiles; 23 IMPORT NdxTypes; 24 IMPORT PosUtils; 25 IMPORT StrEdit; 26 IMPORT StrLogic; 27 IMPORT SYSTEM; 28 29 VAR 30 Initialized : BOOLEAN; 31 32 PROCEDURE Init(); 33 BEGIN 34 IF Initialized THEN 35 RETURN; 36 ELSE 37 Initialized := TRUE; 38 END; 39 ErrorNames.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 40 GenLists.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 41 ListUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 42 LowLevel.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 43 M2Strings.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 44 NdxBones.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 45 NdxFiles.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 46 NdxTypes.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 47 PosUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 48 StrEdit.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 49 StrLogic.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 50 END Init; ***** ^ not supported yet 51 52 53 PROCEDURE FieldLoaded( NdxFile: NdxTypes.NdxFileType; FieldName: ***** ^ not supported yet 54 ARRAY OF CHAR; VAR spot: CARDINAL): BOOLEAN; ***** ^ not supported yet 55 (*FieldLoaded returns true if FieldName is found, false if not. 56 If it returns a true, spot will represent the actual position 57 of FieldName in the NameList. If false, spot will represent 58 the length of the NameList.*) 59 60 VAR 61 NameList: GenLists.GenList; ***** ^ not supported yet 62 TypeCode, NameListLen, TmpSpot: CARDINAL; 63 TmpName: ARRAY [0..127] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 64 BEGIN 65 spot := 1; 66 WITH NdxFile^ DO ***** ^ not supported yet 67 IF (NOT GenLists.Initialized(AltKeys)) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 68 OR (GenLists.ListLength(AltKeys) = 0) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 69 spot := 0; 70 RETURN FALSE; 71 END; 72 GenLists.GetChildList( NdxFile^.AltKeys, 1, NameList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 73 END; ***** ^ not supported yet 74 TmpSpot := 1; ***** ^ undeclared identifier 75 NameListLen := GenLists.ListLength( NameList ); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 76 IF NameListLen > 0 THEN ***** ^ undeclared identifier 77 REPEAT 78 GenLists.GetElmt( NameList, TmpSpot, TmpName, TypeCode ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ undeclared identifier 79 IF PosUtils.Equal( FieldName, TmpName ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 80 spot := TmpSpot; ***** ^ undeclared identifier ***** ^ undeclared identifier 81 RETURN TRUE; 82 END; 83 INC(TmpSpot); ***** ^ undeclared identifier ***** ^ undeclared identifier 84 UNTIL TmpSpot > NameListLen; ***** ^ undeclared identifier ***** ^ undeclared identifier 85 END; 86 spot := NameListLen; ***** ^ undeclared identifier ***** ^ undeclared identifier 87 RETURN FALSE; 88 END FieldLoaded; ***** ^ not supported yet 89 90 91 PROCEDURE CreateAltList( VAR NdxFile: NdxTypes.NdxFileType; FieldName: ***** ^ not supported yet 92 ARRAY OF CHAR; VAR SpotUsed: CARDINAL); ***** ^ not supported yet 93 (*Each element of the AltKey list is, in turn, a list. The 94 first one contains a list of the field names associated with 95 the others. The others are lists of selected field values, 96 each of which contains in its first two bytes a CARDINAL 97 indicating the position of the corresponding record in the 98 file's main Ndx list. CreateAltList returns in its SpotUsed 99 parameter the position in NdxFile^.AltKeys where it put the 100 AltList.*) 101 VAR 102 FieldList, NameList: GenLists.GenList; ***** ^ not supported yet 103 spot, AltKeysLen: CARDINAL; 104 BEGIN 105 IF NOT GenLists.Initialized( NdxFile^.AltKeys ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 106 GenLists.NewList( NdxFile^.AltKeys ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 107 END; 108 AltKeysLen := GenLists.ListLength( NdxFile^.AltKeys ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 109 IF AltKeysLen = 0 THEN 110 (*Create the first list.*) 111 GenLists.NewList( NameList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 112 GenLists.ListInsert( NameList, GenLists.ListCode, NdxFile^.AltKeys, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 113 INC(AltKeysLen); ***** ^ undeclared identifier ***** ^ not supported yet 114 ELSE 115 GenLists.GetChildList( NdxFile^.AltKeys, 1, NameList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 116 IF GenLists.ListLength(NameList) # (AltKeysLen - 1) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 117 (*You could take this check out if you're not worried about 118 corruption.*) 119 ErrorNames.WarningName( 'BadAlt' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 120 RETURN; 121 END; 122 END; 123 GenLists.NewList( FieldList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 124 IF FieldLoaded( NdxFile, FieldName, spot ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 125 SpotUsed := spot; 126 GenLists.ListReplace(FieldList, GenLists.ListCode, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 127 NdxFile^.AltKeys, SpotUsed + 1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 128 (*ListReplace will dispose of the old list.*) 129 ELSE 130 GenLists.ListInsert( FieldName, GenLists.StrCode, NameList, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 131 spot + 1); ***** ^ not supported yet 132 SpotUsed := spot + 1; 133 GenLists.ListInsert( FieldList, GenLists.ListCode, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 134 NdxFile^.AltKeys, SpotUsed + 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 135 END; 136 END CreateAltList; ***** ^ not supported yet 137 138 139 PROCEDURE CriteriaMet( NdxFile: NdxTypes.NdxFileType; Criteria: ***** ^ not supported yet 140 GenLists.GenList; VAR CriteriaValid: BOOLEAN ): BOOLEAN; ***** ^ not supported yet 141 VAR 142 FieldSize, FieldSpot, lngth, ListSpot, TypeCode: CARDINAL; 143 TmpCriterion: Criterion; ***** ^ undeclared identifier 144 RunningResult, TmpResult: BOOLEAN; 145 FieldList: GenLists.GenList; ***** ^ not supported yet 146 FieldAdr: SYSTEM.ADDRESS; ***** ^ not supported yet 147 BEGIN 148 CriteriaValid := TRUE; 149 IF (NOT GenLists.Initialized(Criteria)) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 150 OR (GenLists.ListLength(Criteria) = 0) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 151 RETURN TRUE; 152 (*Means that if you don't pass a criteria list, everything 153 will match.*) 154 END; 155 ListSpot := 1; 156 lngth := GenLists.ListLength(Criteria); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 157 RunningResult := FALSE; 158 REPEAT 159 GenLists.GetElmt( Criteria, ListSpot, TmpCriterion, TypeCode ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 160 FieldList := NdxFile^.ListBuf; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 161 FieldSpot := 0; 162 IF (GenLists.ErrorFlag # GenLists.NoListError) OR ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 163 (TypeCode # CriterionCode) THEN ***** ^ undeclared identifier 164 ErrorNames.WarningName( 'Crit' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 165 TmpResult := FALSE; 166 ELSIF NdxFiles.FindField(NdxFile^.StructLst, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 167 TmpCriterion.field, FieldList, FieldSpot) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 168 GenLists.GetElmtAdr( FieldList, FieldSpot, FieldAdr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 169 FieldSize, TypeCode ); ***** ^ not supported yet 170 TmpResult := TmpCriterion.determiner( FieldAdr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 171 FieldSize, TypeCode, TmpCriterion.rule, CriteriaValid ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 172 ELSE 173 TmpResult := FALSE; 174 END; 175 CASE TmpCriterion.operator OF ***** ^ not supported yet ***** ^ not supported yet 176 and: RunningResult := RunningResult AND TmpResult; ***** ^ undeclared identifier 177 | or: RunningResult := RunningResult OR TmpResult; ***** ^ undeclared identifier 178 | AndNot: RunningResult := RunningResult AND (NOT TmpResult); ***** ^ undeclared identifier 179 ELSE 180 (*I'm assuming we can get here if range-checking is off.*) 181 ErrorNames.WarningName( 'Crit' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 182 END; 183 INC( ListSpot ); ***** ^ undeclared identifier ***** ^ not supported yet 184 UNTIL ListSpot > lngth; 185 RETURN RunningResult; 186 END CriteriaMet; ***** ^ not supported yet 187 188 189 PROCEDURE AddFieldContents( NdxFile: NdxTypes.NdxFileType; RecName, ***** ^ not supported yet 190 FieldName: ARRAY OF CHAR; ElmtAdr: SYSTEM.ADDRESS; ElmtSize: CARDINAL ); ***** ^ not supported yet ***** ^ not supported yet 191 VAR 192 FieldList: GenLists.GenList; ***** ^ not supported yet 193 duml: LONGINT; 194 TypeCode, spot, dumc: CARDINAL; 195 BEGIN 196 IF NOT FieldLoaded( NdxFile, FieldName, spot ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 197 ErrorNames.WarningName( 'AFC' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 198 RETURN; 199 END; 200 IF NOT NdxBones.FindRecord(NdxFile, RecName, duml, dumc, dumc) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 201 ErrorNames.WarningName( 'RecNam' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 202 RETURN; 203 END; 204 GenLists.GetChildList( NdxFile^.AltKeys, spot + 1, FieldList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 205 dumc := GenLists.ElmtNow( NdxFile^.Ndx ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 206 GenLists.ListInsertAdr( ElmtAdr, ElmtSize + 2, TypeCode, FieldList, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 207 GenLists.ListLength(FieldList) + 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 208 GenLists.GetElmtAdr( FieldList, GenLists.ListLength(FieldList), ElmtAdr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 209 ElmtSize, TypeCode ); ***** ^ not supported yet 210 (*Get the element's new data area.*) 211 LowLevel.ShiftArrayRight( ElmtAdr, ElmtSize, 2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 212 (*Make room for the record identifier at the start of the 213 element's data area.*) 214 LowLevel.PokeWord( dumc, LowLevel.seg(ElmtAdr), LowLevel.ofs(ElmtAdr) ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 215 (*Put the record identifier in the first two bytes of the 216 data area.*) 217 END AddFieldContents; ***** ^ not supported yet 218 219 220 PROCEDURE LoadAltList( VAR NdxFile: NdxTypes.NdxFileType; ***** ^ not supported yet 221 InList: GenLists.GenList; FieldName: ARRAY OF CHAR; Criteria: ***** ^ not supported yet ***** ^ not supported yet 222 GenLists.GenList): BOOLEAN; ***** ^ not supported yet 223 VAR 224 ListType, ListSpot, NameListLength, InListLength, TypeCode, 225 ElmtSize, AltFieldSpot, AltKeyListSpot: CARDINAL; 226 ElmtAdr: SYSTEM.ADDRESS; ***** ^ not supported yet 227 AltFieldList, AltKeyList: GenLists.GenList; ***** ^ not supported yet 228 TmpNdxRec: NdxTypes.NdxElement; ***** ^ not supported yet 229 CriteriaValid: BOOLEAN; 230 RecName: ARRAY [0..(NdxTypes.RecNameLength - 1)] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 231 BEGIN 232 (*LoadAltList*) 233 CriteriaValid := TRUE; 234 AltKeyListSpot := 1; 235 InListLength := GenLists.ListLength(InList); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 236 IF InListLength = 0 THEN 237 NameListLength := GenLists.ListLength(NdxFile^.Ndx); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 238 ListType := NdxTypes.NdxTypeCode; ***** ^ not supported yet ***** ^ not supported yet 239 (*We set ListType to NdxTypeCode if there's no InList 240 because we're going to use the file's entire Ndx in this 241 situation.*) 242 ELSE 243 NameListLength := GenLists.ListLength(InList); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 244 ListType := ListUtils.TypeCheck( InList, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 245 END; 246 ListSpot := 1; 247 REPEAT 248 CASE ListType OF 249 NdxTypes.NdxTypeCode: ***** ^ not supported yet ***** ^ not supported yet 250 IF GenLists.ListLength( NdxFile^.Ndx ) > 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 251 GenLists.GetElmt( NdxFile^.Ndx, ListSpot, TmpNdxRec, TypeCode ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 252 StrEdit.AssignStr( TmpNdxRec.RecName, RecName ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 253 ELSE 254 RETURN FALSE; 255 END; 256 | AltKeyCode: ***** ^ undeclared identifier 257 GetMatchingKey( NdxFile, InList, ListSpot, RecName ); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 258 ELSE 259 (*We assume we have a list of valid record names.*) 260 GenLists.GetElmt( InList, ListSpot, RecName, TypeCode ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 261 END; 262 IF (M2Strings.Length( RecName ) > 0) AND ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 263 NdxBones.InitBuffer( NdxFile, RecName) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 264 (*If Length(RecName) = 0, it's a garbage record.*) 265 (*InitBuffer does the actual record read, and returns 266 FALSE if the record does not exist *) 267 IF NOT FieldLoaded( NdxFile, FieldName, AltKeyListSpot ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 268 (*AltKeyListSpot now represents the length of the 269 NameList, but CreateAltList will INC it.*) 270 CreateAltList( NdxFile, FieldName, AltKeyListSpot ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 271 END; 272 IF PosUtils.Equal('KEY', FieldName) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 273 (*They just want the matching record names.*) 274 GenLists.GetChildList( NdxFile^.AltKeys, AltKeyListSpot + 1, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 275 AltKeyList ); ***** ^ not supported yet 276 IF CriteriaMet(NdxFile, Criteria, CriteriaValid) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 277 GenLists.ListInsert( RecName, GenLists.StrCode, AltKeyList, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 278 GenLists.ListLength(AltKeyList) + 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 279 END; 280 ELSE 281 AltFieldList := NdxFile^.ListBuf; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 282 AltFieldSpot := 0; 283 IF NdxFiles.FindField(NdxFile^.StructLst, FieldName, AltFieldList, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 284 AltFieldSpot) THEN ***** ^ not supported yet 285 IF CriteriaMet( NdxFile, Criteria, CriteriaValid ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 286 GenLists.GetElmtAdr( AltFieldList, AltFieldSpot, ElmtAdr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 287 ElmtSize, TypeCode ); ***** ^ not supported yet 288 IF (NOT (TypeCode = GenLists.ListCode)) THEN ***** ^ not supported yet ***** ^ not supported yet 289 AddFieldContents( NdxFile, RecName, FieldName, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 290 ElmtAdr, ElmtSize ); ***** ^ not supported yet ***** ^ not supported yet 291 ELSE 292 ErrorNames.WarningName( 'LstAlt' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 293 END; 294 END; 295 END; 296 END; 297 END; 298 INC(ListSpot); ***** ^ undeclared identifier ***** ^ not supported yet 299 UNTIL (ListSpot > NameListLength) OR (NOT CriteriaValid); 300 (*We're at the end of the InList.*) 301 RETURN TRUE; 302 END LoadAltList; ***** ^ not supported yet 303 304 305 PROCEDURE DisposeAltList( VAR NdxFile: NdxTypes.NdxFileType; FieldName: ***** ^ not supported yet 306 ARRAY OF CHAR); ***** ^ not supported yet 307 VAR 308 NameList: GenLists.GenList; ***** ^ not supported yet 309 spot: CARDINAL; 310 BEGIN 311 IF NOT GenLists.Initialized( NdxFile^.AltKeys ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 312 ErrorNames.WarningName('BadLst'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 313 RETURN; 314 END; 315 IF GenLists.ListLength( NdxFile^.AltKeys ) > 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 316 IF FieldLoaded( NdxFile, FieldName, spot ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 317 GenLists.GetChildList( NdxFile^.AltKeys, 1, NameList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 318 GenLists.ListDelete( NameList, spot, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 319 (*Delete the FieldName.*) 320 GenLists.ListDelete( NdxFile^.AltKeys, spot + 1, 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 321 (*Delete the list itself.*) 322 RETURN; 323 END; 324 END; 325 ErrorNames.WarningName( 'AltNam' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 326 END DisposeAltList; ***** ^ not supported yet 327 328 329 PROCEDURE TallyAltLists(NdxFile: NdxTypes.NdxFileType; VAR ***** ^ not supported yet 330 TheList: GenLists.GenList); ***** ^ not supported yet 331 (*Returns a list of the field names that have AltLists 332 presently loaded.*) 333 VAR 334 NameList: GenLists.GenList; ***** ^ not supported yet 335 BEGIN 336 IF (GenLists.Initialized( NdxFile^.AltKeys )) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 337 AND (GenLists.ListLength( NdxFile^.AltKeys ) > 0) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 338 GenLists.GetChildList( NdxFile^.AltKeys, 1, NameList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 339 GenLists.CopyList( NameList, TheList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 340 ELSE 341 ErrorNames.WarningName( 'AltNam' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 342 END; 343 END TallyAltLists; ***** ^ not supported yet 344 345 346 PROCEDURE GetAltList( NdxFile: NdxTypes.NdxFileType; FieldName: ARRAY OF ***** ^ not supported yet 347 CHAR; VAR AltList: GenLists.GenList): BOOLEAN; ***** ^ not supported yet ***** ^ not supported yet 348 (*Note that this returns the real AltList, so the first two 349 bytes of each data area will be the record identifier. You 350 have to get rid of those things with ShiftArrayLeft.*) 351 VAR 352 spot: CARDINAL; 353 BEGIN 354 IF FieldLoaded( NdxFile, FieldName, spot ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 355 GenLists.GetChildList( NdxFile^.AltKeys, spot + 1, AltList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 356 IF GenLists.ErrorFlag = GenLists.NoListError THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 357 RETURN TRUE; 358 ELSE 359 RETURN FALSE; 360 END; 361 ELSE 362 RETURN FALSE; 363 END; 364 END GetAltList; ***** ^ not supported yet 365 366 367 PROCEDURE GetMatchingKey( NdxFile: NdxTypes.NdxFileType; AltList: ***** ^ not supported yet 368 GenLists.GenList; spot: CARDINAL; VAR RecName: ARRAY OF CHAR ); ***** ^ not supported yet ***** ^ not supported yet 369 370 (*Pass this procedure an AltKeyList (i.e., the kind of list 371 that has a record number and a field value in every 372 element) and the position of an element in that list, and 373 it returns in RecName the name of the record from which the 374 field value was read.*) 375 VAR 376 RecordNumber, AltKeySize, TypeCode: CARDINAL; 377 AltKeyAdr: SYSTEM.ADDRESS; ***** ^ not supported yet 378 TmpNdxRec: NdxTypes.NdxElement; ***** ^ not supported yet 379 BEGIN 380 GenLists.GetElmtAdr( AltList, spot, AltKeyAdr, AltKeySize, TypeCode ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 381 IF (TypeCode # AltKeyCode) THEN ***** ^ undeclared identifier 382 LowLevel.Move( AltKeyAdr, SYSTEM.ADR(RecName), AltKeySize ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 383 (* 28 Nov 88: added this so that GetMatchingKey can be 384 used with AltKeyLists that contain only record names. *) 385 ELSE 386 LowLevel.Move( AltKeyAdr, SYSTEM.ADR(RecordNumber), 2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 387 GenLists.GetElmt( NdxFile^.Ndx, RecordNumber, TmpNdxRec, TypeCode ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 388 StrEdit.AssignStr( TmpNdxRec.RecName, RecName ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 389 END; 390 END GetMatchingKey; ***** ^ not supported yet 391 392 393 PROCEDURE GetMatchingKeys( NdxFile: NdxTypes.NdxFileType; AltList: ***** ^ not supported yet 394 GenLists.GenList; VAR KeyList: GenLists.GenList): BOOLEAN; ***** ^ not supported yet ***** ^ not supported yet 395 (*Returns a RecNameList that contains only records presently in 396 the AltList.*) 397 VAR 398 spot, lngth: CARDINAL; 399 RecName: ARRAY [0..(NdxTypes.RecNameLength - 1)] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 400 BEGIN 401 IF NOT GenLists.Initialized(AltList) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 402 ErrorNames.WarningName('BadLst'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 403 RETURN FALSE; 404 END; 405 lngth := GenLists.ListLength( AltList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 406 FOR spot := 1 TO lngth DO 407 GetMatchingKey( NdxFile, AltList, spot, RecName ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 408 IF GenLists.ErrorFlag = GenLists.NoListError THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 409 GenLists.ListInsert( RecName, RecNameCode, KeyList, spot ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 410 END; 411 END; 412 RETURN TRUE; 413 END GetMatchingKeys; ***** ^ not supported yet 414 415 416 PROCEDURE StrSelector( TheAdr: SYSTEM.ADDRESS; TheSize, TypeCode: ***** ^ not supported yet 417 CARDINAL; TheRule: ARRAY OF CHAR; VAR CriteriaValid: ***** ^ not supported yet 418 BOOLEAN): BOOLEAN; 419 (*This will be assigned to a SelectProc variable.*) 420 VAR 421 TmpStr: ARRAY [0..255] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 422 TmpResult, SubSize, SubType, leng, cnt: CARDINAL; 423 SubAddr: SYSTEM.ADDRESS; ***** ^ not supported yet 424 SubList: GenLists.GenList; ***** ^ not supported yet 425 found: BOOLEAN; 426 BEGIN 427 IF (TypeCode = GenLists.StrCode) THEN ***** ^ not supported yet ***** ^ not supported yet 428 IF M2Strings.Length( TheRule ) = 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 429 RETURN TRUE; 430 END; 431 IF TheSize > (HIGH(TmpStr)+1) THEN ***** ^ undeclared identifier ***** ^ not supported yet 432 TheSize := (HIGH(TmpStr)+1); ***** ^ undeclared identifier ***** ^ not supported yet 433 END; 434 LowLevel.Move( TheAdr, SYSTEM.ADR(TmpStr), TheSize ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 435 TmpResult := StrLogic.ExpressionTest( TmpStr, TheRule ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 436 CriteriaValid := StrLogic.StrLogicErrorLevel = 0; ***** ^ not supported yet ***** ^ not supported yet 437 RETURN ( TmpResult > 0); 438 ELSIF (TypeCode = GenLists.ListCode) THEN ***** ^ not supported yet ***** ^ not supported yet 439 IF NOT GenLists.AdrToList( TheAdr, TheSize, SubList ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 440 RETURN FALSE; 441 END; 442 leng := GenLists.ListLength(SubList); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 443 found := FALSE; 444 cnt := 1; 445 WHILE (cnt <= leng) AND (NOT found) DO 446 GenLists.GetElmtAdr( SubList, cnt, SubAddr, SubSize, SubType ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 447 (*We ought to be able to do a recursive call here, but for 448 some reason it causes a stack overflow.*) 449 IF (SubType = GenLists.StrCode) THEN ***** ^ not supported yet ***** ^ not supported yet 450 IF M2Strings.Length( TheRule ) = 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 451 RETURN TRUE; 452 END; 453 IF SubSize > (HIGH(TmpStr)+1) THEN ***** ^ undeclared identifier ***** ^ not supported yet 454 SubSize := (HIGH(TmpStr)+1); ***** ^ undeclared identifier ***** ^ not supported yet 455 END; 456 LowLevel.Move( SubAddr, SYSTEM.ADR(TmpStr), SubSize ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 457 TmpResult := StrLogic.ExpressionTest( TmpStr, TheRule ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 458 CriteriaValid := StrLogic.StrLogicErrorLevel = 0; ***** ^ not supported yet ***** ^ not supported yet 459 found := TmpResult > 0; 460 END; 461 INC(cnt); ***** ^ undeclared identifier ***** ^ not supported yet 462 END; 463 RETURN found; 464 END; 465 RETURN FALSE; 466 END StrSelector; ***** ^ not supported yet 467 468 469 PROCEDURE AddCriteria( CriteriaList: GenLists.GenList; op: LogicOperator; ***** ^ not supported yet ***** ^ undeclared identifier 470 TheSelectProc: SelectProc; TheRule, FieldName: ARRAY OF CHAR ); ***** ^ undeclared identifier ***** ^ not supported yet 471 VAR 472 TmpCriterion: Criterion; ***** ^ undeclared identifier 473 BEGIN 474 IF NOT GenLists.Initialized( CriteriaList ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 475 ErrorNames.WarningName('BadLst'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 476 RETURN; 477 END; 478 StrEdit.AssignStr( FieldName, TmpCriterion.field ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 479 StrEdit.AssignStr( TheRule, TmpCriterion.rule ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 480 TmpCriterion.operator := op; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 481 TmpCriterion.determiner := TheSelectProc; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 482 GenLists.ListInsert( TmpCriterion, CriterionCode, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 483 CriteriaList, GenLists.ListLength(CriteriaList) + 1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 484 END AddCriteria; ***** ^ not supported yet 485 486 BEGIN 487 Initialized := FALSE; 488 Init(); ***** ^ not supported yet ***** ^ not supported yet 489 END AltKeys. ***** ^ not supported yet 641 errors