| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631 |
- Listing:
- 1 IMPLEMENTATION MODULE NdxBones;
- 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/ndxbones.mov 1.7 10 Mar 1991 15:30:02 coleb $
- 12 *
- 13 *)
- 14
- 15
- 16 (*EntryDiag:
- 17 IMPORT Diagnostics;
- 18 :EntryDiag*)
- 19
- 20 IMPORT ErrorNames;
- 21 IMPORT HandleIO;
- 22 IMPORT GenLists;
- 23 IMPORT ListUtils;
- 24 IMPORT LowLevel;
- 25 IMPORT M2Strings;
- 26 IMPORT NdxTypes;
- 27 IMPORT Numbers;
- 28 IMPORT NumTypes;
- 29 IMPORT PosUtils;
- 30 IMPORT StrEdit;
- 31 IMPORT StringIO;
- 32 IMPORT SYSTEM;
- 33 IMPORT VStorage;
- 34
- 35 VAR
- 36 Initialized : BOOLEAN;
- 37
- 38
- 39 CONST
- 40 StartChar = 'B';
- 41 EndChar = 'E';
- 42 EncodedChar = 'R';
- 43 NdxMarkChar = 'X';
- 44 (*This character marks the start of the ndx list. We use it
- 45 to make sure we've got the right file offset when we back
- 46 up and read the list.*)
- 47 blank = ' ';
- 48 null = '';
- 49 AfterLastElmt = 65535;
- 50
- 51
- 52 PROCEDURE BiggestRecord( NdxFile: NdxTypes.NdxFileType ): CARDINAL;
- ***** ^ not supported yet
- 53 VAR
- 54 TmpElmt: NdxTypes.NdxElement;
- ***** ^ not supported yet
- 55 TypeCode, LstLngth, TmpResult: CARDINAL;
- 56 BEGIN
- 57 IF GenLists.ListLength( NdxFile^.Ndx ) = 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 58 RETURN 0;
- 59 END;
- 60 GenLists.GetElmt( NdxFile^.Ndx, 1, TmpElmt, TypeCode );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 61 TmpResult := TmpElmt.UsedChars;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 62 LstLngth := GenLists.ListLength( NdxFile^.Ndx );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 63 WHILE GenLists.ElmtNow( NdxFile^.Ndx ) < LstLngth DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 64 GenLists.NextElmt( NdxFile^.Ndx, 1, TmpElmt, TypeCode );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 65 IF TmpElmt.UsedChars > TmpResult THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 TmpResult := TmpElmt.UsedChars;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 67 END;
- 68 END;
- 69 RETURN TmpResult;
- 70 END BiggestRecord;
- ***** ^ not supported yet
- 71
- 72
- 73 PROCEDURE FindRecord( NdxFile: NdxTypes.NdxFileType; VAR
- ***** ^ not supported yet
- 74 RecordName : ARRAY OF CHAR; VAR offset : LONGINT; VAR
- ***** ^ not supported yet
- 75 UsedRecSize, AllocSize: CARDINAL) : BOOLEAN;
- 76 (* Move in the record list to this record. If can't find
- 77 record, AllocSize is set to the collating position where
- 78 record requested would be inserted. All other VAR results
- 79 are meaningless *)
- 80
- 81 VAR
- 82 found, StillLooking: BOOLEAN;
- 83 HiBound, LoBound, distance, ListPos, TypeCode: CARDINAL;
- 84 CompResult: INTEGER;
- 85 TmpElmt : NdxTypes.NdxElement;
- ***** ^ not supported yet
- 86
- 87
- 88 PROCEDURE AtCurrentPtr( VAR InsertionPoint: CARDINAL ): BOOLEAN;
- 89 (*Because lots of routines call FindRecord, sometimes
- 90 in sequence when they're all looking for the same record,
- 91 it's usually a good bet that the record you want is
- 92 either at the current pointer for the ndx list or at
- 93 least needs to be inserted there. This routine
- 94 determines whether that is true, and if it is, allows us
- 95 to skip the binary search through the whole list.*)
- 96
- 97 VAR
- 98 CompResult: INTEGER;
- 99 now: CARDINAL;
- 100 BEGIN
- 101 InsertionPoint := 0;
- 102 (*If AtCurrentPtr comes back FALSE but with a non-zero
- 103 value in its parameter, it means we didn't find the
- 104 record but we know its insertion point.*)
- 105 now := GenLists.ElmtNow(NdxFile^.Ndx);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 106 IF (now = 0) OR (now > GenLists.ListLength(NdxFile^.Ndx)) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 107 (* list has not been used at all yet (or is empty) *)
- 108 RETURN FALSE;
- 109 END;
- 110 GenLists.GetElmt( NdxFile^.Ndx, now, TmpElmt, TypeCode );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 111 CompResult := CompareProc(RecordName, TmpElmt.RecName);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 112 CASE CompResult OF
- 113 0 :
- 114 M2Strings.Assign( TmpElmt.RecName, RecordName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 115 RETURN TRUE;
- 116 | 1 :
- 117 IF GenLists.ElmtNow( NdxFile^.Ndx ) = 1 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 118 (*We were at the first of the list and RecordName was
- 119 less than TmpElmt.RecName, so we know the
- 120 insertion point.*)
- 121 InsertionPoint := 1;
- 122 RETURN FALSE;
- 123 END;
- 124 GenLists.NextElmt( NdxFile^.Ndx, -1, TmpElmt, TypeCode );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 125 CompResult := CompareProc( RecordName, TmpElmt.RecName );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 126 IF CompResult = 0 THEN
- 127 M2Strings.Assign( TmpElmt.RecName, RecordName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 128 RETURN TRUE;
- 129 ELSIF CompResult = -1 THEN
- 130 (*We know the insertion point is between this
- 131 element and the last one we tried.*)
- 132 InsertionPoint := GenLists.ElmtNow(NdxFile^.Ndx) + 1;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 133 END;
- 134 RETURN FALSE;
- 135 |-1 :
- 136 IF now = GenLists.ListLength(NdxFile^.Ndx) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 137 (*We were at the end of the list and RecordName was
- 138 greater than TmpElmt.RecName, so we know the insertion
- 139 point.*)
- 140 InsertionPoint := now + 1;
- 141 RETURN FALSE;
- 142 END;
- 143 GenLists.NextElmt( NdxFile^.Ndx, 1, TmpElmt, TypeCode );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 144 CompResult := CompareProc( RecordName, TmpElmt.RecName );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 145 IF CompResult = 0 THEN
- 146 M2Strings.Assign( TmpElmt.RecName, RecordName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 147 RETURN TRUE;
- 148 ELSIF CompResult = 1 THEN
- 149 (*We know the insertion point is between this
- 150 element and the last one we tried.*)
- 151 InsertionPoint := GenLists.ElmtNow(NdxFile^.Ndx);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 152 END;
- 153 RETURN FALSE;
- 154 END;
- 155 RETURN FALSE;
- 156 END AtCurrentPtr;
- ***** ^ not supported yet
- 157
- 158 BEGIN
- 159 IF AtCurrentPtr( AllocSize ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 160 found := TRUE;
- 161 ELSE
- 162 IF AllocSize # 0 THEN
- 163 RETURN FALSE;
- 164 END;
- 165 found := FALSE;
- 166 offset := Numbers.Lc( 0);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 167 UsedRecSize := 0;
- 168 ListPos := 1;
- 169 HiBound := GenLists.ListLength(NdxFile^.Ndx) + 1;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 170 IF HiBound = 1 THEN
- 171 AllocSize := 1;
- 172 RETURN FALSE;
- 173 END;
- 174 LoBound := 0;
- 175 StillLooking := TRUE;
- 176 GenLists.GetElmt( NdxFile^.Ndx, 1, TmpElmt, TypeCode );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 177 END;
- 178 WHILE (NOT found) AND StillLooking DO
- 179 CompResult := CompareProc(RecordName,
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 180 TmpElmt.RecName);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 181 IF CompResult = 0 THEN
- 182 M2Strings.Assign( TmpElmt.RecName, RecordName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 183 found := TRUE;
- 184 ELSIF CompResult < 0 THEN
- 185 (* new name is higher than current spot in list;
- 186 so try to move higher in list *)
- 187 distance := (HiBound - ListPos) DIV 2;
- 188 LoBound := ListPos;
- 189 INC( ListPos, distance );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 190 IF distance = 0 THEN
- 191 StillLooking := FALSE;
- 192 AllocSize := ListPos + 1;
- 193 ELSE
- 194 GenLists.NextElmt(NdxFile^.Ndx, distance, TmpElmt, TypeCode);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 195 END;
- 196 ELSE
- 197 distance := (ListPos - LoBound) DIV 2;
- 198 HiBound := ListPos;
- 199 DEC( ListPos, distance );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 200 IF distance = 0 THEN
- 201 StillLooking := FALSE;
- 202 AllocSize := ListPos;
- 203 ELSE
- 204 GenLists.NextElmt(NdxFile^.Ndx, -INTEGER(distance),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 205 TmpElmt, TypeCode);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 206 END;
- 207 END;
- 208 END;
- 209 IF NOT found THEN
- 210 (*If we can't find RecordName in the list ... *)
- 211 RETURN FALSE;
- 212 ELSE
- 213 (*Return file location of record.*)
- 214 offset := TmpElmt.FilePos;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 215 UsedRecSize := TmpElmt.UsedChars;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 216 AllocSize := TmpElmt.Allocated;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 217 RETURN TRUE;
- 218 END;
- 219 END FindRecord;
- ***** ^ not supported yet
- 220
- 221
- 222 PROCEDURE RemoveCodes( Source: SYSTEM.ADDRESS; VAR TheSize: CARDINAL);
- ***** ^ not supported yet
- 223 (* Removes all chars that follow CodeChars, and changes
- 224 TheSize to reflect number of chars removed. *)
- 225 VAR
- 226 tmpsize, toskip : CARDINAL;
- 227 badspot : SYSTEM.ADDRESS;
- ***** ^ not supported yet
- 228 tmpchar : CHAR;
- 229 BEGIN
- 230 tmpsize := TheSize;
- 231 tmpchar := CodeChar;
- ***** ^ undeclared identifier
- 232 LOOP
- 233 toskip := PosUtils.PatternScan( SYSTEM.ADR(tmpchar),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 234 1, Source, tmpsize );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 235 IF toskip >= tmpsize THEN
- 236 RETURN
- 237 END;
- 238 badspot := LowLevel.AddAddr( Source, toskip + 1 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 239 DEC( tmpsize, toskip + 1);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 240 LowLevel.ShiftArrayLeft( badspot, tmpsize, 1 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 241 Source := badspot;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 242 DEC( TheSize);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 243 END;
- 244 END RemoveCodes;
- ***** ^ not supported yet
- 245
- 246
- 247 PROCEDURE StripList( VAR TheList: GenLists.GenList);
- ***** ^ not supported yet
- 248 (* Converts CodedStrs to CodeChars in TheList *)
- 249
- 250 VAR
- 251 OldSize, NewSize, ElmntType, cnt, leng: CARDINAL;
- 252 SubList: GenLists.GenList;
- ***** ^ not supported yet
- 253 GenAddr: SYSTEM.ADDRESS;
- ***** ^ not supported yet
- 254 BEGIN
- 255 leng := GenLists.ListLength( TheList );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 256 FOR cnt := 1 TO leng DO
- 257 GenLists.GetElmtAdr( TheList, cnt, GenAddr, OldSize, ElmntType);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 258 NewSize := OldSize;
- 259 IF ElmntType # GenLists.ListCode THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 260 RemoveCodes( GenAddr, NewSize );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 261 IF OldSize # NewSize THEN
- 262 (* do not replace unless code chars found *)
- 263 GenLists.ListReplaceAdr( GenAddr, NewSize, ElmntType,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 264 TheList, cnt);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 265 END;
- 266 ELSE
- 267 (* this element is a list *)
- 268 GenLists.GetChildList( TheList, cnt, SubList);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 269 StripList( SubList );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 270 (* strip this sub list *)
- 271 END;
- 272 END;
- 273 END StripList;
- ***** ^ not supported yet
- 274
- 275 PROCEDURE ReadStructure( NdxFile: NdxTypes.NdxFileType;
- ***** ^ not supported yet
- 276 VAR HadToRebuild: BOOLEAN): BOOLEAN;
- 277 (*Note that this is the first procedure that will have an
- 278 opportunity to determine whether the user is trying to open
- 279 a file that is not a valid NdxFile. It has to be very
- 280 careful about relying on values it gets from the file.*)
- 281 VAR
- 282 tmpstr: ARRAY [0..80] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 283 checkchar: CHAR;
- 284 bufsize, dumcard: CARDINAL;
- 285 ReadBuf : SYSTEM.ADDRESS;
- ***** ^ not supported yet
- 286 TmpHandle: VStorage.MemHandle;
- ***** ^ not supported yet
- 287 BEGIN
- 288 (*ReadStructure*)
- 289 HadToRebuild := FALSE;
- 290 bufsize := 0;
- 291 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart, NumTypes.L0 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 292 CASE HandleIO.BlockRead( NdxFile^.handle, SYSTEM.ADR(bufsize), 2) OF
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 293 (*Read the file's first two bytes into bufsize.*)
- 294 StringIO.NoError: (*fall through*);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 295 ELSE
- 296 RETURN FALSE;
- 297 END;
- 298 HandleIO.SetFilePtr( NdxFile^.handle, HandleIO.FromStart, Numbers.Lc( 2));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 299 (*Put the pointer on the third byte in the file.*)
- 300 IF NOT VStorage.IsAvailable( bufsize ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 301 ErrorNames.WarningName('Mem');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 302 RETURN FALSE;
- 303 END;
- 304 IF NOT VStorage.AllocMem( TmpHandle, bufsize ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 305 ErrorNames.WarningName('Mem');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 306 RETURN FALSE;
- 307 END;
- 308
- 309
- 310 ReadBuf := VStorage.LockMem( TmpHandle );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 311 CASE HandleIO.BlockRead( NdxFile^.handle, ReadBuf, bufsize) OF
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 312 (*Read the structure record into the ReadBuf.*)
- 313 StringIO.NoError, StringIO.EndOfFile: (*fall through*);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 314 ELSE
- 315 VStorage.DeallocMem( TmpHandle, bufsize);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 316 RETURN FALSE;
- 317 END;
- 318 (*
- 319 Diagnostics.diagBlock( NdxFile^.name, ReadBuf, bufsize );
- 320 *)
- 321 LowLevel.Fill( ReadBuf, 4, 0C );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 322 LowLevel.Fill( LowLevel.AddAddr(ReadBuf, bufsize - 2), 2, 0C );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 323 (*Wipe out the startsep and endsep that brackets the whole
- 324 structure.*)
- 325 VStorage.UnLockMem( TmpHandle );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 326
- 327 GenLists.NewList( NdxFile^.StructLst );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 328 ListUtils.HandleToList( TmpHandle, bufsize, StartSep, EndSep, 0, 0,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- 329 NdxFile^.StructLst);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 330 IF GenLists.ListLength( NdxFile^.StructLst ) = 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 331 GenLists.DisposeList( NdxFile^.StructLst);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 332 RETURN FALSE;
- 333 END;
- 334 GenLists.GetElmt( NdxFile^.StructLst, 1, tmpstr, dumcard);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 335 checkchar := tmpstr[0];
- ***** ^ not supported yet
- ***** ^ not supported yet
- 336 M2Strings.Delete(tmpstr, 0, 1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 337 IF NOT PosUtils.Equal( tmpstr, StructName) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 338 GenLists.DisposeList( NdxFile^.StructLst);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 339 RETURN FALSE;
- 340 ELSIF checkchar = IsGarbageByte THEN
- ***** ^ undeclared identifier
- 341 (*
- 342 Diagnostics.diagS( 'STRUCTURE record is marked garbage', checkchar );
- 343 *)
- 344 RebuildProc( NdxFile );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 345 (*Structure record gets marked as garbage when you write a
- 346 record but don't update the ndx. Gets marked okay when
- 347 the ndx gets written.*)
- 348 HadToRebuild := TRUE;
- 349 END;
- 350 GenLists.ListDelete( NdxFile^.StructLst, 1, 1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 351 (* deletes the StructName from the Structure *)
- 352 StripList( NdxFile^.StructLst );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 353 (*Removes CodedStrs from StructLst.*)
- 354 RETURN TRUE;
- 355 END ReadStructure;
- ***** ^ not supported yet
- 356
- 357 PROCEDURE MakeEmptyBuf( VAR StruList, BufList: GenLists.GenList);
- ***** ^ not supported yet
- 358 VAR
- 359 LastCode, TheType, cnt, StructLstLength : CARDINAL;
- 360 SubStruList, EmptyList: GenLists.GenList;
- ***** ^ not supported yet
- 361 BEGIN
- 362 StructLstLength := GenLists.ListLength( StruList);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 363 LastCode := GenLists.ListCode;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 364 FOR cnt := 1 TO StructLstLength DO
- 365 (* write a ListBuf element for each structure element *)
- 366 TheType := ListUtils.TypeCheck( StruList, cnt );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 367 (* get next element from structure list *)
- 368 IF TheType = GenLists.ListCode THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 369 IF LastCode = GenLists.ListCode THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 370 ErrorNames.WarningName( 'BadStruc' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 371 END;
- 372 GenLists.NewList( EmptyList);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 373 GenLists.ListInsert( EmptyList, GenLists.ListCode,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 374 BufList, AfterLastElmt);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 375 GenLists.GetChildList( StruList, cnt, SubStruList);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 376 MakeEmptyBuf( SubStruList, EmptyList);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 377 ELSE
- 378 IF LastCode # GenLists.ListCode THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 379 GenLists.ListInsert( 0C, GenLists.StrCode, BufList,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 380 AfterLastElmt);
- ***** ^ not supported yet
- 381 END;
- 382 END;
- 383 LastCode := TheType;
- 384 END;
- 385 IF LastCode # GenLists.ListCode THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 386 GenLists.ListInsert( 0C, GenLists.StrCode, BufList,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 387 AfterLastElmt);
- ***** ^ not supported yet
- 388 END;
- 389 END MakeEmptyBuf;
- ***** ^ not supported yet
- 390
- 391 PROCEDURE OpenNdxFile( VAR NdxFile: NdxTypes.NdxFileType;
- ***** ^ not supported yet
- 392 FileName: ARRAY OF CHAR): BOOLEAN;
- ***** ^ not supported yet
- 393 (*Uses HandleIO FindFile routine to open NdxFile. Returns
- 394 FALSE if not found. Otherwise initializes NdxFile and
- 395 creates linked list of record names, record sizes, and file
- 396 offsets from the ndx stored at the end of NdxFile.*)
- 397
- 398 PROCEDURE ReadNdx( NdxFile: NdxTypes.NdxFileType );
- ***** ^ not supported yet
- 399 VAR
- 400 TmpAvail, len1, len2, FilePos, BytesToRead : LONGINT;
- 401 CheckStr: ARRAY [0..1] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 402 NdxAddr : SYSTEM.ADDRESS;
- ***** ^ not supported yet
- 403 TmpHandle : VStorage.MemHandle;
- ***** ^ not supported yet
- 404 TmpNdx: GenLists.GenList;
- ***** ^ not supported yet
- 405 ThisChunk: CARDINAL;
- 406 BEGIN
- 407 (*ReadNdx*)
- 408 HandleIO.SetFilePtr(NdxFile^.handle, HandleIO.FromEnd,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 409 Numbers.Li( -4) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 410 (*Goto end of file and read Ndx offset*)
- 411 IF StringIO.NoError <> HandleIO.BlockRead(NdxFile^.handle,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 412 SYSTEM.ADR(FilePos), 4) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 413 ErrorNames.WarningName( 'FRead' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 414 RETURN;
- 415 END;
- 416 IF (FilePos < NumTypes.L0) OR
- ***** ^ not supported yet
- ***** ^ not supported yet
- 417 ( FilePos > HandleIO.FileLength(NdxFile^.handle)) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 418 (*
- 419 Diagnostics.diagL( 'FilePos', FilePos );
- 420 *)
- 421 RebuildProc( NdxFile );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 422 RETURN;
- 423 END;
- 424 HandleIO.SetFilePtr(NdxFile^.handle, HandleIO.FromStart, FilePos);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 425 (*Now we should be sitting on the NdxMarker.*)
- 426 NdxFile^.NdxFilePtr := FilePos;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 427 (*Set file pointer to start of the index.*)
- 428 len1 := HandleIO.FileLength(NdxFile^.handle) - FilePos;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 429 (* len1 is the file size minus the data *)
- 430 BytesToRead := len1 - Numbers.Lc( 6);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 431 (* the index size *)
- 432 IF BytesToRead = NumTypes.L0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 433 (* return empty index if index area of file is empty *)
- 434 GenLists.NewList( NdxFile^.Ndx );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 435 RETURN;
- 436 END;
- 437 (*Now we check to make sure our offset numbers are valid by
- 438 looking for the NdxMarker.*)
- 439 IF HandleIO.BlockRead(NdxFile^.handle, SYSTEM.ADR(CheckStr),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 440 2) # StringIO.NoError THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 441 (*
- 442 Diagnostics.diagL( 'BlockRead failure at', FilePos );
- 443 *)
- 444 RebuildProc( NdxFile );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 445 RETURN;
- 446 END;
- 447 IF NOT PosUtils.Equal( CheckStr, NdxMarker) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 448 (*
- 449 Diagnostics.diagS( 'Invalid CheckStr:', CheckStr );
- 450 *)
- 451 RebuildProc( NdxFile );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 452 RETURN;
- 453 END;
- 454 IF (BytesToRead MOD Numbers.Lc( SYSTEM.TSIZE(NdxTypes.NdxElement)))
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 455 # NumTypes.L0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 456 (*If the size of the index does not divide evenly by the
- 457 size of an NdxElement, then the size of an NdxElement
- 458 has been changed since the file was last used, and we
- 459 have to rebuild.*)
- 460 (*
- 461 Diagnostics.diagL( 'BytesToRead', BytesToRead );
- 462 *)
- 463 RebuildProc( NdxFile );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 464 RETURN;
- 465 END;
- 466 (* Next, read in the index *)
- 467 GenLists.NewList( NdxFile^.Ndx );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 468 WHILE BytesToRead > NumTypes.L0 DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- 469 TmpAvail := VStorage.AvailMem();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 470 (*If EMS is installed, more than 64K may be available,
- 471 so we do this in two steps.*)
- 472 IF TmpAvail > NumTypes.L65535 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 473 ThisChunk := 65535;
- 474 ELSE
- 475 ThisChunk := Numbers.C( TmpAvail );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 476 END;
- 477 DEC( ThisChunk, ThisChunk MOD SYSTEM.TSIZE(NdxTypes.NdxElement) );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 478 IF ThisChunk < SYSTEM.TSIZE(NdxTypes.NdxElement) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 479 ErrorNames.WarningName('Mem');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 480 RETURN;
- 481 END;
- 482 IF BytesToRead > Numbers.Lc( ThisChunk) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 483 BytesToRead := BytesToRead - Numbers.Lc( ThisChunk );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 484 ELSE
- 485 ThisChunk := Numbers.C( BytesToRead);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 486 BytesToRead := NumTypes.L0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 487 END;
- 488 IF NOT VStorage.AllocMem( TmpHandle, ThisChunk ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 489 ErrorNames.WarningName('Mem');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 490 RETURN;
- 491 END;
- 492 NdxAddr := VStorage.LockMem( TmpHandle );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 493 IF HandleIO.BlockRead(NdxFile^.handle, NdxAddr, ThisChunk)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 494 # StringIO.NoError THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 495 VStorage.UnLockMem( TmpHandle );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 496 VStorage.DeallocMem( TmpHandle, ThisChunk );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 497 (*
- 498 Diagnostics.diagC( 'Unable to read ThisChunk # of bytes:', ThisChunk );
- 499 *)
- 500 RebuildProc( NdxFile );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 501 RETURN;
- 502 END;
- 503 VStorage.UnLockMem( TmpHandle );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 504 GenLists.NewList( TmpNdx );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 505 ListUtils.HandleToList( TmpHandle, ThisChunk, '', '',
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 506 SYSTEM.TSIZE(NdxTypes.NdxElement), NdxTypes.NdxTypeCode,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 507 TmpNdx );
- ***** ^ not supported yet
- 508 (*The nulls mean "there are no delimiters in the
- 509 block."*)
- 510 len1 := Numbers.Lc( GenLists.ListLength(TmpNdx));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 511 len2 := Numbers.Lc( GenLists.ListLength(NdxFile^.Ndx));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 512 IF (len1 + len2) > NumTypes.L65535 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 513 ErrorNames.WarningName('RecLim');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 514 END;
- 515 GenLists.JoinLists( TmpNdx, NdxFile^.Ndx,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 516 GenLists.ListLength(NdxFile^.Ndx) + 1 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 517 END;
- 518 END ReadNdx;
- ***** ^ not supported yet
- 519
- 520 VAR
- 521 NdxRebuilt : BOOLEAN;
- 522
- 523 BEGIN
- 524 (*OpenNdxFile*)
- 525 NdxTypes.InitNdxFile( NdxFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 526 M2Strings.Assign( FileName, NdxFile^.name );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 527 IF HandleIO.FindFile( NdxFile^.handle, NdxFile^.name, "path" )
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 528 # StringIO.NoError THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 529 (*Find and open the ndx file if it exists.*)
- 530 NdxFile^.name := "";
- ***** ^ not supported yet
- ***** ^ not supported yet
- 531 VStorage.DosDealloc( NdxFile, SYSTEM.TSIZE(NdxTypes.NdxRecord) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 532 NdxFile := NIL;
- ***** ^ not supported yet
- 533 (*Some Storage modules don't nil out the pointer after
- 534 deallocating it, so we do it ourselves.*)
- 535 RETURN FALSE;
- 536 END;
- 537 IF NOT ReadStructure( NdxFile, NdxRebuilt) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 538 (*Reads the zero record and fills the StructLst in
- 539 NdxFile^.*)
- 540 VStorage.DosDealloc( NdxFile, SYSTEM.TSIZE(NdxTypes.NdxRecord) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 541 NdxFile := NIL;
- ***** ^ not supported yet
- 542 RETURN FALSE;
- 543 END;
- 544 IF NOT NdxRebuilt THEN
- 545 ReadNdx( NdxFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 546 (*Load a linked list with the record index for this file.*)
- 547 END;
- 548 NdxFile^.FileBufPtr := NIL;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 549 GenLists.NewList( NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 550 MakeEmptyBuf( NdxFile^.StructLst, NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 551 RETURN TRUE;
- 552 END OpenNdxFile;
- ***** ^ not supported yet
- 553
- 554
- 555 PROCEDURE InitBuffer( VAR NdxFile: NdxTypes.NdxFileType; RecName: ARRAY
- ***** ^ not supported yet
- 556 OF CHAR): BOOLEAN;
- ***** ^ not supported yet
- 557 (* called by PutField and GetField to load the record data
- 558 into the list buffer. If RecordName is already in BufRecName
- 559 RETURNs TRUE. If not, checks to see if RecName exists in
- 560 index. If no, returns FALSE. If OK, retrieves record,
- 561 then moves read buffer into GenList in ListBuf. IF all OK,
- 562 returns TRUE.*)
- 563 VAR
- 564 NameFound: ARRAY [0..NdxTypes.RecNameLength] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 565 NameAdr : SYSTEM.ADDRESS;
- ***** ^ not supported yet
- 566 NameSize : CARDINAL;
- 567 checkchar: CHAR;
- 568 OffSet: LONGINT;
- 569 UsedSize, AllocatedSize, dumcard: CARDINAL;
- 570
- 571 BEGIN
- 572 NdxTypes.CheckInit( NdxFile);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 573 StrEdit.CrunchBlanks( RecName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 574 IF PosUtils.Equal(RecName, NdxFile^.BufRecName) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 575 RETURN TRUE;
- 576 ELSIF M2Strings.Length(RecName) = 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 577 RETURN FALSE;
- 578 END;
- 579 IF GenLists.Initialized( NdxFile^.ListBuf ) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 580 GenLists.DisposeList( NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 581 END;
- 582 IF NOT FindRecord( NdxFile, RecName, OffSet, UsedSize,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 583 AllocatedSize ) THEN
- ***** ^ not supported yet
- 584 GenLists.NewList( NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 585 MakeEmptyBuf( NdxFile^.StructLst, NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 586 M2Strings.Assign( RecName, NdxFile^.BufRecName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 587 RETURN FALSE;
- 588 END;
- 589 VStorage.DosAlloc( NdxFile^.FileBufPtr, UsedSize );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 590 NdxFile^.BufSizeNow := UsedSize;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 591 HandleIO.SetFilePtr(NdxFile^.handle, HandleIO.FromStart, OffSet );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 592 IF NOT (StringIO.NoError = HandleIO.BlockRead( NdxFile^.handle,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 593 NdxFile^.FileBufPtr, UsedSize)) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 594 VStorage.DosDealloc( NdxFile^.FileBufPtr, UsedSize );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 595 NdxFile^.BufSizeNow := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 596 RETURN FALSE;
- 597 END;
- 598 LowLevel.Fill( NdxFile^.FileBufPtr, 4 (*SIZE(StartSep) +
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 599 SIZE(TypeCode)*), 0C );
- ***** ^ not supported yet
- 600 LowLevel.Fill( LowLevel.AddAddr( NdxFile^.FileBufPtr,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 601 UsedSize - 2 ), 2, 0C );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 602 (*These two fills wipe out the startsep and endsep that begin
- 603 and end each record.*)
- 604 M2Strings.Assign( RecName, NdxFile^.BufRecName );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 605 (* put current record name in BufRecName *)
- 606 GenLists.NewList( NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 607 GenLists.BlockToList( NdxFile^.FileBufPtr, NdxFile^.BufSizeNow,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 608 StartSep, EndSep, 0, 0, NdxFile^.ListBuf);
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 609 IF GenLists.ErrorFlag # GenLists.NoListError THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 610 RETURN FALSE;
- 611 END;
- 612
- 613 IF GenLists.ListLength( NdxFile^.ListBuf ) > 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 614 StripList( NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 615 GenLists.GetElmtAdr( NdxFile^.ListBuf, 1, NameAdr,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 616 NameSize, dumcard );
- ***** ^ not supported yet
- 617 (* We want to store the record name in NameFound, but first we
- 618 have to check it so that we can warn intelligently
- 619 in case of file damage. *)
- 620 NameSize := LowLevel.ScanEQ( NameSize, 0C, NameAdr );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 621 (* Reduce NameSize to length of string before the null. *)
- 622 IF NameSize <= NdxTypes.RecNameLength THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 623 LowLevel.Move( NameAdr, SYSTEM.ADR(NameFound), NameSize + 1 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 624 (* It's NameSize + 1 because we have to make sure the trailing
- 625 null gets included in the move. *)
- 626 ELSE
- 627 ErrorNames.WarningName( 'RecDam' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 628 END;
- 629 GenLists.ListDelete( NdxFile^.ListBuf, 1, 1 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 630 (*Delete the record name from the ListBuf.*)
- 631 ELSE
- 632 MakeEmptyBuf( NdxFile^.StructLst, NdxFile^.ListBuf );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 633 RETURN TRUE;
- 634 (*Actually something has probably gone wrong here--a
- 635 record has apparently been written to the file that
- 636 doesn't even have the record-bracketing StartSep and
- 637 EndSep. But maybe we're about to correct it, so we
- 638 return TRUE.*)
- 639 END;
- 640 checkchar := NameFound[0];
- ***** ^ not supported yet
- ***** ^ not supported yet
- 641 M2Strings.Delete(NameFound, 0, 1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 642 RETURN PosUtils.Equal( NameFound, RecName )
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 643 (* RecName stored in record read *)
- 644 AND (checkchar # IsGarbageByte);
- ***** ^ undeclared identifier
- 645 (* Successful closing of file last time it was used *)
- 646 END InitBuffer;
- ***** ^ not supported yet
- 647
- 648
- 649 PROCEDURE Retrieve( NdxFile: NdxTypes.NdxFileType; RecordName: ARRAY OF
- ***** ^ not supported yet
- 650 CHAR; BufAddr: SYSTEM.ADDRESS; VAR RecSize: CARDINAL): BOOLEAN;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 651 (* Reads record named into file buffer. Returns TRUE if found,
- 652 FALSE if not. *)
- 653 VAR
- 654 offset: LONGINT;
- 655 ListSpot: CARDINAL;
- 656 BEGIN
- 657 NdxTypes.CheckInit( NdxFile );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 658 IF NOT FindRecord( NdxFile, RecordName, offset, RecSize,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 659 ListSpot ) THEN
- ***** ^ not supported yet
- 660 (* if RecordName not in index list, return FALSE *)
- 661 RETURN FALSE;
- 662 END;
- 663 HandleIO.SetFilePtr(NdxFile^.handle, HandleIO.FromStart, offset );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 664 RETURN StringIO.NoError = HandleIO.BlockRead( NdxFile^.handle,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 665 BufAddr, RecSize);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 666 END Retrieve;
- ***** ^ not supported yet
- 667
- 668
- 669 PROCEDURE NoRebuild( VAR NdxFile: NdxTypes.NdxFileType );
- ***** ^ not supported yet
- 670 BEGIN
- 671 ErrorNames.WarningName( 'NdxDam' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 672 END NoRebuild;
- ***** ^ not supported yet
- 673
- 674
- 675 PROCEDURE Init();
- 676 BEGIN
- 677 IF Initialized THEN
- 678 RETURN;
- 679 ELSE
- 680 Initialized := TRUE;
- 681 END;
- 682 (*EntryDiag:
- 683 Diagnostics.Init();
- 684 :EntryDiag*)
- 685
- 686 ErrorNames.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 687 HandleIO.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 688 GenLists.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 689 ListUtils.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 690 LowLevel.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 691 M2Strings.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 692 NdxTypes.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 693 Numbers.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 694 NumTypes.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 695 PosUtils.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 696 StrEdit.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 697 StringIO.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 698 VStorage.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 699
- 700 (*EntryDiag:
- 701 Diagnostics.diagS( 'Entering NdxBones', '' );
- 702 :EntryDiag*)
- 703
- 704 RebuildProc := NoRebuild;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 705 CompareProc := M2Strings.CompareStr;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 706 StartSep[0] := CodeChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 707 StartSep[1] := StartChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 708 EndSep[0] := CodeChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 709 EndSep[1] := EndChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 710 CodedStr[0] := CodeChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 711 CodedStr[1] := EncodedChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 712 NdxMarker[0] := CodeChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 713 NdxMarker[1] := NdxMarkChar;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 714 StrEdit.AssignStr( "STRUCTURE", StructName);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 715
- 716 (*EntryDiag:
- 717 Diagnostics.diagS( 'Exiting NdxBones', '' );
- 718 :EntryDiag*)
- 719 END Init;
- ***** ^ not supported yet
- 720
- 721 BEGIN
- 722 Initialized := FALSE;
- 723 Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 724 END NdxBones.
- ***** ^ not supported yet
- 901 errors
|