DIRECTORY CCTypes USING[CCError, CCErrorCase, CreateCedarCompilerContext], CirioNubAccess USING[Handle], CirioTypes USING[CompilerContext, Node], FS USING[ComponentPositions, ExpandName], LoadStateAccess USING [LoadStateHandle], ObjectFiles USING[BracketNest, Module, GetBracketNestForPC], RCTW USING [CC, FrameNodeInfo, MakeSimpleFrame, Node, ProcedureFrameInfo, RCTWData, RCTWDataBody], RefTab USING[Create, Ref], Rope USING[Concat, Equal, Fetch, Find, FindBackward, Length, ROPE, Substr], RuntimeError USING[BoundsFault], SymTab USING[Create]; RCTWModules: CEDAR PROGRAM IMPORTS CCTypes, ObjectFiles, FS, RCTW, RefTab, Rope, RuntimeError, SymTab EXPORTS RCTW = BEGIN OPEN ObjF:ObjectFiles, LSA:LoadStateAccess, RCTW; CCError: ERROR[case: CCTypes.CCErrorCase, msg: Rope.ROPE ¬ NIL] ¬ CCTypes.CCError; GetFrameNodeInfo: PUBLIC PROC [serverName: Rope.ROPE, frameInfo: RCTW.ProcedureFrameInfo, handle: CirioNubAccess.Handle, lsh: LSA.LoadStateHandle, module: ObjectFiles.Module] RETURNS [rfni: REF RCTW.FrameNodeInfo] ~ { node: Node; cc: CC; [cc, node] ¬ GetCCAndFrameFromDotO[serverName, frameInfo, handle, lsh, module]; rfni ¬ NEW [RCTW.FrameNodeInfo ¬ [node, cc, GetCFrameDiagnosticInfo, frameInfo]]; RETURN}; GetCFrameDiagnosticInfo: PROC [frame: REF RCTW.FrameNodeInfo] RETURNS[LIST OF Rope.ROPE] ~ { RETURN[LIST["a C frame"]]}; GetCCAndFrameFromDotO: PUBLIC PROC [serverName: Rope.ROPE, frameInfo: RCTW.ProcedureFrameInfo, handle: CirioNubAccess.Handle, lsh: LSA.LoadStateHandle, module: ObjF.Module] RETURNS [CC, Node] ~ { cc: CC ¬ CCTypes.CreateCedarCompilerContext[]; bracketNest:ObjF.BracketNest ¬ ObjF.GetBracketNestForPC[module, [[0, ""], frameInfo.relativePC]]; rctw: RCTW.RCTWData ¬ CreateRCTW[cc, serverName, handle, lsh, module, bracketNest]; frame:Node ¬ RCTW.MakeSimpleFrame[frameInfo, rctw]; cc.nameScope ¬ frame; RETURN[cc, frame]}; CreateRCTW: PUBLIC PROC[cc: CC, serverName: Rope.ROPE, cirioNub: CirioNubAccess.Handle, lsh: LSA.LoadStateHandle, module: ObjF.Module, bracketNest: ObjF.BracketNest] RETURNS[RCTW.RCTWData] = BEGIN rctw: RCTW.RCTWData ¬ NEW[RCTW.RCTWDataBody¬[ module: module, bracketNest: bracketNest, bracketHashTable: RefTab.Create[], typeRefHashTable: SymTab.Create[], serverName: serverName, lsh: lsh, nub: cirioNub, cc: cc]]; RETURN[rctw]; END; FactoredDotOName: TYPE = RECORD[ name1: Rope.ROPE, remainingPath: Rope.ROPE, stem: Rope.ROPE, cToC: Rope.ROPE, -- either empty or ".ctoc" extension: Rope.ROPE, -- ".o" or empty version: Rope.ROPE -- either empty or ".~" versionNumber "~" or "!" versionNumber ]; FactorDotOName: PROC[dotOLongName: Rope.ROPE] RETURNS[FactoredDotOName] = BEGIN ENABLE RuntimeError.BoundsFault => GOTO fails; FindStartOfVersion: PROC RETURNS[INT] = BEGIN IF length = 0 THEN RETURN[length-1]; IF Rope.Fetch[dotOLongName, length-1] = '~ THEN RETURN[Rope.FindBackward[dotOLongName, ".~", length-2]] ELSE BEGIN lastBang: INT ¬ Rope.FindBackward[dotOLongName, "!", length-1]; IF lastBang > 0 THEN RETURN[lastBang] ELSE RETURN[length]; END; END; length: INT ¬ Rope.Length[dotOLongName]; firstSlash: INT ¬ Rope.Find[dotOLongName, "/"]; secondSlash: INT ¬ Rope.Find[dotOLongName, "/", firstSlash+1]; lastSlash: INT ¬ Rope.FindBackward[dotOLongName, "/", length]; startOfVersion: INT ¬ FindStartOfVersion[]; lastDot: INT ¬ Rope.FindBackward[dotOLongName, ".", startOfVersion-1]; startOfExtension: INT ¬ IF Rope.Equal[Rope.Substr[dotOLongName, lastDot+1, startOfVersion-lastDot-1], "o", FALSE] THEN lastDot ELSE startOfVersion; secondLastDot: INT ¬ Rope.FindBackward[dotOLongName, ".", startOfExtension-1]; startOfcToC: INT ¬ IF Rope.Equal[Rope.Substr[dotOLongName, secondLastDot+1, startOfExtension-secondLastDot-1], "ctoc", FALSE] THEN secondLastDot ELSE startOfExtension; IF NOT ( firstSlash = 0) AND (firstSlash < secondSlash) AND (secondSlash <= lastSlash) AND (lastSlash < startOfcToC) AND (startOfcToC <= startOfExtension) AND (startOfExtension <= startOfVersion) AND startOfVersion < length THEN BadDotONameSyntax[]; RETURN[[ Rope.Substr[dotOLongName, firstSlash+1, secondSlash-firstSlash-1], Rope.Substr[dotOLongName, secondSlash+1, lastSlash-secondSlash-1], Rope.Substr[dotOLongName, lastSlash+1, startOfcToC-lastSlash-1], Rope.Substr[dotOLongName, startOfcToC, startOfExtension-startOfcToC], Rope.Substr[dotOLongName, startOfExtension, startOfVersion-startOfExtension], Rope.Substr[dotOLongName, startOfVersion, length-startOfVersion]]]; EXITS fails => BadDotONameSyntax[]; END; BadDotONameSyntax: ERROR = CODE; FilePair: TYPE = RECORD[dotO, mob: Rope.ROPE]; FindFiles: PROC[dotOName: Rope.ROPE] RETURNS[FilePair] = BEGIN components: FS.ComponentPositions; fullFName: Rope.ROPE; dirOmitted: BOOL; shortRoot: Rope.ROPE; firstExt: Rope.ROPE; fullFName2: Rope.ROPE; components2: FS.ComponentPositions; dirOmitted2: BOOL; [fullFName, components, dirOmitted] ¬ FS.ExpandName[dotOName]; shortRoot ¬ Rope.Substr[fullFName, components.base.start, components.base.length]; firstExt ¬ Rope.Substr[fullFName, components.ext.start, components.ext.length]; IF Rope.Length[firstExt] # 0 AND Rope.Fetch[firstExt, 0] = '~ THEN BEGIN [fullFName2, components2, dirOmitted2] ¬ FS.ExpandName[shortRoot]; shortRoot ¬ Rope.Substr[fullFName2, components2.base.start, components2.base.length]; END; RETURN[[Rope.Concat[shortRoot, ".o"], Rope.Concat[shortRoot, ".mob"]]]; END; END. ΐ RCTWModules.mesa Copyright Σ 1989, 1990, 1991, 1992 by Xerox Corporation. All rights reserved. Hopcroft August 18, 1989 11:45:29 am PDT Sturgis, August 18, 1989 12:16:12 pm PDT Last changed by Theimer on October 9, 1989 2:06:43 pm PDT Last tweaked by Mike Spreitzer on August 13, 1991 12:36 pm PDT Philip James, August 27, 1991 3:32 pm PDT Laurie Horton, May 29, 1992 10:18 am PDT Willie-s, June 11, 1992 3:43 pm PDT Remarks: This is a file obtained from Hopcrofts save stuff, modified following notes that I (Sturgis) made on August 25, 1989 9:54:25 am PDT. Here is a copy of the notes. commenting out GetCCAndFrame together with attendent changes to the directory clauses. modifying GetCCAndFrameFromDotO to take an module, rather than a dotO. Note: the fields module and bracketNest are temporary. Eventually, these will be hashed. unfortunately, the original name may have had an encoded version number, it got stripped off as the extension Κ•NewlineDelimiter –(cedarcode) style™code™Kšœ ΟeœC™NK™(K™(K™9K™>K™)K™(K™#K™—K˜šΟk ˜ Kšœžœ3˜@Kšœžœ ˜Kšœ žœ˜(Kšžœžœ!˜)Kšœžœ˜(Kšœ žœ+˜˜QK˜—K˜š œžœžœžœ˜IKšž˜Kšžœžœ˜.K˜š œžœžœžœ˜'Kšž˜Kšžœ žœžœ ˜$Kšžœ)žœžœ1˜gšœž˜Kšž˜Kšœ žœ2˜?Kš žœžœžœ žœžœ ˜:Kšžœ˜—Kšžœ˜K˜—Kšœžœ˜(Kšœ žœ ˜/Kšœ žœ.˜>Kšœ žœ0˜>Kšœžœ˜+Kšœ žœ:˜FKš œžœžœQžœžœ žœ˜“Kšœžœ<˜NKš œ žœžœbžœžœžœ˜§K˜Kšžœžœžœžœžœžœ#žœ&žœžœ˜ωK˜šžœ˜K˜BK˜BK˜@K˜EK˜MK˜C—K˜šž˜K˜—Kšžœ˜—K˜Kš œžœžœ˜ K˜K˜Kšœ žœžœžœ˜.K˜š  œžœžœžœ ˜8Kšž˜Kšœ žœ˜"Kšœžœ˜Kšœ žœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœ žœ˜#Kšœ žœ˜K™Kšœ&žœ˜>K˜RK™K™mK™K˜Ošžœžœž˜BKšž˜Kšœ)žœ˜BK˜UKšžœ˜—K˜K™KšžœA˜GKšžœ˜—K˜Kšžœ˜—…—δ·