<<>> <> <> <> <> DIRECTORY IntCodeDefs, IO, C2CSourcePositions, C2CBasics, Rope; C2CSourcePositionsImpl: CEDAR PROGRAM IMPORTS C2CBasics, IO, Rope EXPORTS C2CSourcePositions = BEGIN currentSourceNode: PUBLIC IntCodeDefs.SourceNode ¬ NIL; CompileNewModule: PROC [] = { currentSourceNode ¬ NIL; }; CurrentPosAsRope: PUBLIC PROC [] RETURNS [Rope.ROPE] = { <<--returns flat rope so it can be read with simple debuggers>> IF currentSourceNode=NIL THEN RETURN ["positioned outside client code range"] ELSE RETURN [Rope.Flatten[IO.PutFR["source position %g [%g chars]", [integer[currentSourceNode.source.start]], [integer[currentSourceNode.source.chars]]]]] }; C2CBasics.CallbackWhenC2CIsCalled[CompileNewModule]; END.