-- VersionMap.mesa -- Russ Atkinson, August 27, 1982 1:26 pm -- Support for version stamp to long file name mapping. DIRECTORY Rope USING [ROPE], TimeStamp USING [Stamp]; VersionMap: CEDAR DEFINITIONS = BEGIN OPEN Rope; Map: TYPE = REF MapRep; MapList: TYPE = LIST OF Map; MapRep: TYPE = PRIVATE RECORD [names: ROPE _ NIL, prefix: NameMapIndex _ 0, -- place to find factored prefix entries: SEQUENCE len: CARDINAL OF MapEntry]; -- the full names follow the entries, sans prefix, follow the index -- each full name ends in a CR (15C) MapEntry: TYPE = RECORD [stamp: MyStamp, index: NameMapIndex]; NameMapIndex: TYPE = INT; -- byte index of name in map MyStamp: TYPE = MACHINE DEPENDENT RECORD [lo,num,hi: CARDINAL]; -- must be as long as TimeStamp.Stamp -- we extract num to use as uniformly distributed bits -- num should be the low bits of the time MapAndName: TYPE = RECORD [map: Map, name: ROPE]; MapAndNameList: TYPE = LIST OF MapAndName; VersionToName: PROC [list: MapList, stamp: TimeStamp.Stamp] RETURNS [MapAndName]; -- returns a full path name (IFS format) for the given version stamp -- the list of maps is searched in order -- the containing map is also returned -- [NIL, NIL] is returned if the stamp is not found VersionToAllNames: PROC [list: MapList, stamp: TimeStamp.Stamp] RETURNS [MapAndNameList]; -- returns a full path name (IFS format) for the given version stamp -- the list of maps is searched in order -- the containing map is also returned -- NIL is returned if the stamp is not found GetPrefix: PROC [map: Map] RETURNS [ROPE]; -- returns the prefix for file names in the map -- uses IFS format ("[host]") StampToHex: PROC [stamp: TimeStamp.Stamp] RETURNS [ROPE]; -- returns the hex string for the version stamp -- uses standard hex format (0123456789ABCDEF) -- same format is used for VersionMapBuilder.WriteMapToFile SaveMapToFile: PROC [map: Map, name: ROPE]; -- saves a map in quickly machine-readable form RestoreMapFromFile: PROC [name: ROPE, assumeImmutable: BOOL _ FALSE] RETURNS [map: Map]; -- restores a map from a file written by SaveMapToFile -- if assumeImmutable, then the named file is assumed to not change -- (this avoids copying the file names from the save file) Length: PROC [map: Map] RETURNS [INT]; -- returns the # of entries in the map Fetch: PROC [map: Map, index: INT] RETURNS [stamp: TimeStamp.Stamp, name: ROPE]; -- returns the stamp and name at the given index -- index must be in [0..Length[map]) FetchStamp: PROC [map: Map, index: INT] RETURNS [stamp: TimeStamp.Stamp]; -- returns the stamp at the given index -- index must be in [0..Length[map]) FetchName: PROC [map: Map, index: INT] RETURNS [name: ROPE]; -- returns the name at the given index -- index must be in [0..Length[map]) END. Κσ– "Mesa" style˜IprocšήΟc=œ8œΟk œžœžœžœžœž œžœžœžœžœžœžœžœžœžœžœ žœžœ"!œžœžœžœDœ%œ žœžœ<žœžœœ žœžœž œžœ žœ&œ7œ*œžœžœžœžœžœžœΟn œžœ/žœEœ)œ'œ4œŸœžœ/žœEœ)œ'œ-œŸ œžœ žœžœ0œ)œŸ œžœžœžœ0œ/œ<œŸ œžœžœ 2œŸœžœžœžœžœžœ7œDœ<œŸœžœ žœžœ (œŸœžœžœžœ žœ 1œ%œŸ œžœžœžœ!(œ%œŸ œžœžœžœžœ 'œ%œžœ˜Σ—…— Φ Ο