DIRECTORY MorePfsNames, PFS, PFSNames, Rope, RopeParts, RuntimeError; MorePfsNamesImpl: CEDAR PROGRAM IMPORTS PFS, PFSNames, Rope, RopeParts EXPORTS MorePfsNames = BEGIN OPEN RP:RopeParts, MorePfsNames; ConsComponent: PUBLIC PROC [name: RopePart, version: Version _ [none]] RETURNS [Component] ~ { RETURN [[name: [name.base, name.start, name.len], version: version]]}; ConstructComponent: PUBLIC PROC [name: NamePart, version: Version _ [none]] RETURNS [Component] ~ {RETURN ConsComponent[RP.InlineMake[name.base, name.start, name.len], version]}; ComponentName: PUBLIC PROC [c: Component] RETURNS [RopePart] ~ {RETURN RP.InlineMake[c.name.base, c.name.start, c.name.len]}; ComponentToRope: PUBLIC PROC [c: Component] RETURNS [ROPE] ~ {RETURN PFS.RopeFromPath[PFSNames.ConstructName[LIST[c], FALSE, FALSE]]}; VersionToRope: PUBLIC PROC [v: Version] RETURNS [ROPE] ~ {RETURN ComponentToRope[ConsComponent[RP.nil, v]]}; Replace: PUBLIC PROC [base: PATH, start: INT _ 0, len: INT _ INT.LAST, with: PATH] RETURNS [PATH] ~ { bl: INT ~ base.ComponentCount[]; wl: INT ~ with.ComponentCount[]; len _ MIN[len, bl-start]; IF start=0 AND len=bl THEN RETURN [with]; IF len=0 AND wl=0 THEN RETURN [base]; {cl: LIST OF Component _ NIL; FOR i: INT IN [0..start) DO cl _ CONS[base.Fetch[i], cl] ENDLOOP; FOR i: INT IN [0..wl) DO cl _ CONS[with.Fetch[i], cl] ENDLOOP; FOR i: INT IN [start+len..bl) DO cl _ CONS[base.Fetch[i], cl] ENDLOOP; RETURN PFSNames.ConstructName[components: cl, absolute: base.IsAbsolute[], directory: base.IsADirectory, reverse: TRUE]}}; Cons1: PUBLIC PROC [component: Component, absolute, directory: BOOL _ FALSE, unparsed: REF _ NIL] RETURNS [name: PATH] ~ { RETURN PFSNames.ConstructName[LIST[component], absolute, directory, FALSE, unparsed]}; END. œ MorePfsNamesImpl.mesa Copyright Σ 1990 by Xerox Corporation. All rights reserved. Last tweaked by Mike Spreitzer on October 5, 1990 8:43:11 am PDT ΚΉ•NewlineDelimiter – "cedar" style™codešœ™K™Kš œœœœœœ˜FKšœlœ˜z—K˜šžœœœ-œœ œœœœ˜zKšœœ"œ ˜V—K˜Kšœ˜—…—μ A