SaffronDriver.Mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Sturgis, July 23, 1987 6:13:00 pm PDT
Bill Jackson (bj) August 11, 1987 1:25:18 pm PDT
Lucy Hederman July 30, 1987 2:12:24 pm PDT
DIRECTORY
Commander USING [ CommandProc, Register ],
IO USING [ GetTokenRope, IDProc, PutF, RIS, STREAM ],
OneCasabaParser USING [ GetReportStream ],
Rope USING [ ROPE ],
SaffronATDef USING [ ModulePNode, ModulePVal ],
SaffronBaseDef USING [ CreateEmptyEnvironment, EnvironmentNode, InterfaceValNode, ReadDefFile ],
SaffronContext USING [ ErrorSignal, ShowEnvironment ],
ThreeC4Support USING [ GetReportStream ];
SaffronDriver: CEDAR MONITOR
IMPORTS SaffronATDef, SaffronBaseDef, Commander, IO, OneCasabaParser, SaffronContext, ThreeC4Support ~ {
debugFlags: CARDINAL ← 0;
SaffronCompiler: Commander.CommandProc ~ {
ENABLE {
ThreeC4Support.GetReportStream => RESUME[cmd.out];
OneCasabaParser.GetReportStream => { result ← $Failure; RESUME[cmd.out] };
};
assumes command line contains a file name with no extension
args: IO.STREAMIO.RIS[cmd.commandLine];
fname: Rope.ROPEIO.GetTokenRope[args, IO.IDProc].token;
root: SaffronATDef.ModulePNode ← SaffronATDef.ModulePVal[SaffronBaseDef.ReadDefFile[fname]];
env: SaffronBaseDef.EnvironmentNode ← NIL;
if: SaffronBaseDef.InterfaceValNode ← NIL;
result ← $Success; -- bad assumption?
IF ( result = $Failure )
THEN { IO.PutF[cmd.out, "Syntax Errors Detected.\n"]; RETURN; }
ELSE { IO.PutF[cmd.out, "No Syntax Errors Detected.\n"]; };
[env, if] ← root.procs.MakeEnvironment[root, "ShouldBeAFileName", SaffronBaseDef.CreateEmptyEnvironment[]
! SaffronContext.ErrorSignal => { ERROR };
];
SaffronContext.ShowEnvironment[cmd.out, 0, env];
};
Commander.Register["Saffron", SaffronCompiler];
}.