DIRECTORY BcdDefs USING [Base, BcdBase, CTHandle, CTIndex, CTNull, CTRecord, EVHandle, EVIndex, EVNull, EVRecord, EXPHandle, EXPIndex, EXPNull, EXPRecord, FPHandle, FPIndex, FPRecord, FPNull, FTHandle, FTIndex, FTNull, FTRecord, IMPHandle, IMPIndex, IMPNull, IMPRecord, Link, MTHandle, MTIndex, MTNull, MTRecord, Namee, NameRecord, NTHandle, NTIndex, NTNull, NTRecord, NullName, SGHandle, SGIndex, SGNull, SGRecord, SpaceID, SPHandle, SPIndex, SPNull, SPRecord, VersionStamp], BcdOps USING []; BcdOpsImpl: PROGRAM EXPORTS BcdOps = PUBLIC { OPEN BcdDefs; ProcessConfigs: PROC [bcd: BcdBase, proc: PROC [CTHandle, CTIndex] RETURNS [BOOL]] RETURNS [cth: CTHandle, cti: CTIndex] = { ctb: Base = LOOPHOLE[bcd + bcd.ctOffset]; i: CARDINAL; cti _ FIRST[CTIndex]; FOR i IN [0..bcd.nConfigs) DO cth _ @ctb[cti]; IF proc[cth, cti] THEN RETURN; cti _ cti + SIZE[CTRecord] + cth.nControls; ENDLOOP; RETURN[NIL, CTNull]; }; ProcessExternals: PROC [bcd: BcdBase, proc: PROC [EVHandle, EVIndex] RETURNS [BOOL]] RETURNS [evh: EVHandle, evi: EVIndex] = { evb: Base = LOOPHOLE[bcd + bcd.evOffset]; FOR evi _ FIRST[EVIndex], evi + SIZE[EVRecord] + evh.length UNTIL evi = bcd.evLimit DO evh _ @evb[evi]; IF proc[evh, evi] THEN RETURN; ENDLOOP; RETURN[NIL, EVNull]; }; ProcessExports: PROC [bcd: BcdBase, proc: PROC [EXPHandle, EXPIndex] RETURNS [BOOL]] RETURNS [eth: EXPHandle, eti: EXPIndex] = { etb: Base = LOOPHOLE[bcd + bcd.expOffset]; i: CARDINAL; eti _ FIRST[EXPIndex]; FOR i IN [0..bcd.nExports) DO eth _ @etb[eti]; IF proc[eth, eti] THEN RETURN; eti _ eti + SIZE[EXPRecord] + eth.size; ENDLOOP; RETURN[NIL, EXPNull]; }; ProcessFiles: PROC [bcd: BcdBase, proc: PROC [FTHandle, FTIndex] RETURNS [BOOL]] RETURNS [fth: FTHandle, fti: FTIndex] = { ftb: Base = LOOPHOLE[bcd + bcd.ftOffset]; FOR fti _ FIRST[FTIndex], fti + SIZE[FTRecord] UNTIL fti = bcd.ftLimit DO fth _ @ftb[fti]; IF proc[fth, fti] THEN RETURN; ENDLOOP; RETURN[NIL, FTNull]; }; ProcessImports: PROC [bcd: BcdBase, proc: PROC [IMPHandle, IMPIndex] RETURNS [BOOL]] RETURNS [ith: IMPHandle, iti: IMPIndex] = { itb: Base = LOOPHOLE[bcd + bcd.impOffset]; i: CARDINAL; iti _ FIRST[IMPIndex]; FOR i IN [0..bcd.nImports) DO ith _ @itb[iti]; IF proc[ith, iti] THEN RETURN; iti _ iti + SIZE[IMPRecord]; ENDLOOP; RETURN[NIL, IMPNull]; }; ProcessModules: PROC [bcd: BcdBase, proc: PROC [MTHandle, MTIndex] RETURNS [BOOL]] RETURNS [mth: MTHandle, mti: MTIndex] = { mtb: Base = LOOPHOLE[bcd + bcd.mtOffset]; i: CARDINAL; mti _ FIRST[MTIndex]; FOR i IN [0..bcd.nModules) DO mth _ @mtb[mti]; IF proc[mth, mti] THEN RETURN; mti _ mti + (WITH m: mtb[mti] SELECT FROM direct => SIZE[MTRecord[direct]] + m.length*SIZE[Link], indirect => SIZE[MTRecord[indirect]], multiple => SIZE[MTRecord[multiple]], ENDCASE => ERROR) ENDLOOP; RETURN[NIL, MTNull]; }; ProcessNames: PROC [bcd: BcdBase, proc: PROC [NTHandle, NTIndex] RETURNS [BOOL]] RETURNS [nth: NTHandle, nti: NTIndex] = { ntb: Base = LOOPHOLE[bcd + bcd.ntOffset]; FOR nti _ FIRST[NTIndex], nti + SIZE[NTRecord] UNTIL nti = bcd.ntLimit DO nth _ @ntb[nti]; IF proc[nth, nti] THEN RETURN; ENDLOOP; RETURN[NIL, NTNull]; }; ProcessSegs: PROC [bcd: BcdBase, proc: PROC [SGHandle, SGIndex] RETURNS [BOOL]] RETURNS [sgh: SGHandle, sgi: SGIndex] = { sgb: Base = LOOPHOLE[bcd + bcd.sgOffset]; FOR sgi _ FIRST[SGIndex], sgi + SIZE[SGRecord] UNTIL sgi = bcd.sgLimit DO sgh _ @sgb[sgi]; IF proc[sgh, sgi] THEN RETURN; ENDLOOP; RETURN[NIL, SGNull]; }; ProcessSpaces: PROC [bcd: BcdBase, proc: PROC [SPHandle, SPIndex] RETURNS [BOOL]] RETURNS [sph: SPHandle, spi: SPIndex] = { spb: Base = LOOPHOLE[bcd + bcd.spOffset]; FOR spi _ FIRST[SPIndex], spi + SIZE[SPRecord] + sph.length*SIZE[SpaceID] UNTIL spi = bcd.spLimit DO sph _ @spb[spi]; IF proc[sph, spi] THEN RETURN; ENDLOOP; RETURN[NIL, SPNull]; }; FindName: PROC [bcd: BcdBase, owner: Namee] RETURNS [name: NameRecord] = { FindOwner: PROC [nth: NTHandle, nti: NTIndex] RETURNS [BOOL] = { RETURN[owner = nth.item]; }; n: NTHandle _ ProcessNames[bcd, FindOwner].nth; RETURN[IF n = NIL THEN NullName ELSE n.name] }; ModuleVersion: PROC [bcd: BcdBase, mti: MTIndex] RETURNS [version: VersionStamp] = { mtb: Base = LOOPHOLE[bcd + bcd.mtOffset]; ftb: Base = LOOPHOLE[bcd + bcd.ftOffset]; RETURN[ftb[mtb[mti].file].version]; }; ProcessFramePacks: PUBLIC PROC [ bcd: BcdBase, proc: PROC [fph: FPHandle, fpi: FPIndex] RETURNS [BOOL]] RETURNS [fph: FPHandle, fpi: FPIndex] = { fpb: Base = LOOPHOLE[bcd + bcd.fpOffset]; FOR fpi: FPIndex _ FIRST[FPIndex], fpi + SIZE[FPRecord] + fph.length*SIZE[MTIndex] UNTIL fpi = bcd.fpLimit DO fph _ @fpb[fpi]; IF proc[fph, fpi] THEN RETURN[fph, fpi]; ENDLOOP; RETURN[NIL, FPNull]; }; }. âBcdOpsImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Sandman, July 17, 1980 11:55 AM Rovner, 4-Feb-82 11:28:51 Levin, May 13, 1983 5:22 pm Russ Atkinson (RRA) January 31, 1985 11:27:50 am PST Ê‹˜codešœ™Kšœ Ïmœ1™