DIRECTORY AMBridge, AMTypes USING [Error], BBContext, Space, Rope, RopeFile, RTBasic USING [TV], Runtime USING [IsBound], UserProfile, VersionMap, VersionMapDefaults; InitHacks: CEDAR PROGRAM IMPORTS AMBridge, AMTypes, BBContext, Space, Rope, RopeFile, Runtime, UserProfile, VersionMap, VersionMapDefaults = BEGIN OPEN RTBasic; ROPE: TYPE = Rope.ROPE; Greedy: PROC [] = TRUSTED { transImplTV: TV = BBContext.GlobalFrameSearch[NIL, "TransactionImpl"].tv; pageCountTV: TV = BBContext.RecordSearch[transImplTV, "logSpaceSize"].tv; pageCountPtr: LONG POINTER TO CARDINAL = LOOPHOLE[AMBridge.PointerFromTV[pageCountTV]]; oldPageCount: INT = pageCountPtr^; newSize: INT = UserProfile.Number["TransactionImpl.logSpaceSize", oldPageCount]; IF newSize IN [1..oldPageCount) THEN { logSpaceTV: TV = BBContext.RecordSearch[transImplTV, "logSpace"].tv; logSpacePtr: LONG POINTER TO Space.Handle = LOOPHOLE[AMBridge.PointerFromTV[logSpaceTV]]; clientSpaceTV: TV = BBContext.RecordSearch[transImplTV, "clientSpace"].tv; clientSpacePtr: LONG POINTER TO Space.Handle = LOOPHOLE[AMBridge.PointerFromTV[clientSpaceTV]]; Space.Delete[logSpacePtr^]; Space.Delete[clientSpacePtr^]; pageCountPtr^ _ newSize; logSpacePtr^ _ Space.Create[pageCountPtr^, Space.virtualMemory, Space.defaultBase]; clientSpacePtr^ _ Space.Create[pageCountPtr^, Space.virtualMemory, Space.defaultBase]; }; }; InstallRopeFile: PROC = TRUSTED { IF Runtime.IsBound[RopeFile.SubstrCreate] AND UserProfile.Boolean["VersionMap.UseRopeFile", FALSE] THEN { vmapImplTV: TV = BBContext.GlobalFrameSearch[NIL, "VersionMapImpl"].tv; vmapDefImplTV: TV = BBContext.GlobalFrameSearch[NIL, "VersionMapDefaultsImpl"].tv; substrCreatorTV: TV = BBContext.RecordSearch[vmapImplTV, "substrCreator"].tv; substrCreatorPtr: LONG POINTER TO PROC ANY RETURNS ANY = LOOPHOLE[AMBridge.PointerFromTV[substrCreatorTV]]; amvImplTV: TV = BBContext.GlobalFrameSearch[NIL, "AMViewerOpsImpl"].tv; ropeCreatorTV: TV = BBContext.RecordSearch[amvImplTV, "ropeCreator"].tv; ropeCreatorPtr: LONG POINTER TO PROC ANY RETURNS ANY = LOOPHOLE[AMBridge.PointerFromTV[ropeCreatorTV]]; rootTV: TV = BBContext.RecordSearch[vmapDefImplTV, "root"].tv; rootPtr: LONG POINTER TO REF = LOOPHOLE[AMBridge.PointerFromTV[rootTV]]; substrCreatorPtr^ _ RopeFile.SubstrCreate; ropeCreatorPtr^ _ RopeFile.SimpleCreate; rootPtr^ _ NIL; }; }; AppendVersionMaps: PROC = { AddListToMapList[$Symbols, "VersionMap.Symbols"]; AddListToMapList[$Source, "VersionMap.Source"]; }; ReverseAndUnique: PROC [list: LIST OF ROPE] RETURNS [new: LIST OF ROPE _ NIL] = { FOR subList: LIST OF ROPE _ list, subList.rest WHILE subList # NIL DO outer: ROPE _ subList.first; found: BOOL _ FALSE; FOR rest: LIST OF ROPE _ list.rest, rest.rest WHILE rest # NIL DO inner: ROPE _ rest.first; IF Rope.Equal[outer, inner, FALSE] THEN { found _ TRUE; EXIT; }; ENDLOOP; IF found THEN LOOP; new _ CONS[outer, new]; ENDLOOP; }; AddListToMapList: PROC [which: ATOM, key: ROPE] = { nameList: LIST OF ROPE _ ReverseAndUnique[UserProfile.ListOfTokens[key]]; mapList: VersionMap.MapList _ VersionMapDefaults.GetMapList[which]; FOR each: LIST OF ROPE _ nameList, each.rest WHILE each # NIL DO name: ROPE _ Rope.Flatten[each.first]; map: VersionMap.Map _ NIL; WHILE Rope.Match["*.", name] DO name _ name.Flatten[0, name.Size[]-1]; ENDLOOP; map _ VersionMap.RestoreMapFromFile[ name, TRUE ! ANY => CONTINUE]; IF map = NIL AND NOT Rope.Match["*.VersionMap", name, FALSE] THEN { name _ name.Concat[".VersionMap"].Flatten[]; map _ VersionMap.RestoreMapFromFile[ name, TRUE ! ANY => CONTINUE]; }; IF map # NIL THEN VersionMapDefaults.AddToMapList[which, map]; ENDLOOP; }; InstallRopeFile[! AMTypes.Error => CONTINUE]; Greedy[! AMTypes.Error => CONTINUE]; AppendVersionMaps[]; END. TInitHacks.mesa Russ Atkinson, August 4, 1983 5:18 pm ... "steals" pages from the spaces used for Pilot Transactions. The size of the new spaces depends on the User Profile option TransactionImpl.logSpaceSize, which is the name of the global variable we set. ... installs RopeFile routines as the file access routines for version maps. This saves significant VM at a small cost in safety and/or search time. The UserProfile option that gioverns this feature is VersionMap.UseRopeFile. ... adds the version maps stored in the files specified in the UserProfile options VersionMap.Symbols and VersionMap.Source to the version maps to be searched. ... reverses a list and removes duplicates. ... is a utility to add version maps specified by the UserProfile option named by key to the list specified by which. The resulting search order is as given in the option, which means that we have to add the maps in the reverse order. The file name extension defaults to "VersionMap". Missing version map files are ignored. the above line forces the map list to be made current if it is NIL. Initialization ʘšœ™Jšœ%™%—J˜šÏk ˜ Jšœ ˜ Jšœœ ˜Jšœ ˜ Jšœ˜J˜Jšœ ˜ Jšœœœ˜Jšœœ ˜Jšœ ˜ Jšœ ˜ Jšœ˜J˜—šÏb œœ˜š˜Jšœi˜i—Jšœœœ ˜J˜Jšœœœ˜J˜—šÏnœœœ˜Jšœžœ2™ÍJšœ œœ˜IJšœ œ:˜Iš œœœœœ˜(Jšœ&˜.—Jšœœ˜"Jšœ œD˜Pšœ œœ˜&Jšœ œ6˜Dšœ œœœ˜+Jšœ%˜-—Jšœœ9˜Jšœœœœ˜.Jšœ(˜0—Jšœ˜Jšœ˜Jšœ˜JšœS˜SJšœV˜VJ˜—J˜J˜—šŸœœœ˜!JšœÌžœ™ãšœ'˜)Jšœ/œœ˜?Jšœ œœ˜GJšœœœ˜RJšœœ:˜Mšœœœœœœœœ˜8Jšœ*˜2—Jšœ œœ˜GJšœœ7˜Hšœœœœœœœœ˜6Jšœ(˜0—Jšœœ4˜>Jš œ œœœœœ!˜HJšœ*˜*Jšœ(˜(Jšœ œ˜J˜—J˜J˜—šŸœœ˜JšœSžœžœ$™ŸJšœ1˜1Jšœ/˜/Jšœ˜J˜—šŸœœœœœœœœœœ˜QJšœ+™+š œ œœœœ œ˜EJšœœ˜Jšœœœ˜š œœœœœœ˜AJšœœ˜šœœœ˜)Jšœœ˜ Jšœ˜J˜—Jšœ˜—Jšœœœ˜Jšœœ ˜Jšœ˜—Jšœ˜J˜—šŸœ˜Jšœœœ˜JšœRÏfœ œÒ™ÆJšœ œœœ3˜IšœC˜CJšœC™C—š œœœœœœ˜@Jšœœ˜&Jšœœ˜šœ˜Jšœ&˜&Jšœ˜—šœ$˜$Jšœ˜ Jšœœœ˜—š œœœœ"œœ˜CJ˜,šœ$˜$Jšœ˜ Jšœœœ˜—J˜—Jšœœœ-˜>Jšœ˜—Jšœ˜J˜—šœ™Jšœ#œ˜-Jšœœ˜$Jšœ˜—J˜Jšœ˜J˜—…—œq