-- RTSymbolAccessImpl.mesa -- Last Modified By Paul Rovner On February 16, 1983 10:14 am DIRECTORY RTBasic USING[TypeIndex], RTOS USING[PrivateHeapZone, PermanentPageZone], RTSD USING[SD, sMapStiStd], RTSymbolDefs USING[nullHandle], RTTypesBasicPrivate USING[TMapStiStd, RMapStiStd, STDesc, SymbolTableIndex]; RTSymbolAccessImpl: MONITOR -- protects MapStiStd IMPORTS RTOS EXPORTS RTTypesBasicPrivate = BEGIN OPEN RTBasic, RTTypesBasicPrivate; InitialSTIRangeSize: CARDINAL = 1000B; lastSTIndex: TypeIndex _ 0; MapStiStd: PUBLIC TMapStiStd; TooManyTypes: ERROR = CODE; FindSTI: PUBLIC ENTRY PROC[std: STDesc] RETURNS[i: SymbolTableIndex] = {ENABLE UNWIND => NULL; RETURN[DoFindSTI[std]]}; DoFindSTI: INTERNAL PROC[std: STDesc] RETURNS[i: SymbolTableIndex] = INLINE { FOR i IN [1..lastSTIndex] DO IF MapStiStd[i].symbolsStamp = std.symbolsStamp THEN {IF std.bcd = NIL OR std.sgi = MapStiStd[i].sgi THEN {IF MapStiStd[i].sth = RTSymbolDefs.nullHandle THEN MapStiStd[i].sth _ std.sth; RETURN[i]} }; ENDLOOP; IF lastSTIndex = InitialSTIRangeSize - 1 THEN ERROR TooManyTypes; i _ lastSTIndex _ lastSTIndex + 1; MapStiStd[i] _ RTOS.PrivateHeapZone.NEW[STDesc _ std]; }; -- START HERE MapStiStd _ LOOPHOLE[RTOS.PermanentPageZone.NEW[RMapStiStd[InitialSTIRangeSize]]]; FOR i: CARDINAL IN [0..InitialSTIRangeSize) DO MapStiStd[i] _ NIL ENDLOOP; LOOPHOLE[LONG[RTSD.SD + RTSD.sMapStiStd], LONG POINTER TO LONG POINTER]^ _ MapStiStd; END.