C2CSourcePositionsImpl.mesa
Copyright Ó 1990, 1991 by Xerox Corporation. All rights reserved.
Christian Jacobi, October 5, 1990 11:29:25 am PDT
Christian Jacobi, October 5, 1990 11:29:31 am PDT
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.