MakeDoCmdsAliases.mesa
Copyright Ó 1989 by Xerox Corporation. All rights reserved.
Eduardo Pelegri-Llopart March 22, 1989 6:13:55 am PST
Last tweaked by Mike Spreitzer on October 26, 1989 3:34:34 pm PDT
Knowledge about slices.
DIRECTORY
Commander USING [CommandObject, Handle, Register],
CommandTool USING [DoCommand],
IO USING [CharClass, EndOf, GetTokenRope, PutFR, RIS, SkipWhitespace, STREAM],
List USING [AList, PutAssoc],
Process USING [CheckForAbort],
ProcessProps USING [AddPropList, GetProp],
Rope USING [ROPE];
MakeDoCmdsAliases: CEDAR PROGRAM
IMPORTS Commander, CommandTool, IO, --List, ProcessProps,-- Process
~ BEGIN
wDir: ROPE;
ROPE: TYPE ~ Rope.ROPE;
ExecuteACommand: PROC [commandRope: ROPE] RETURNS [ok: BOOL] ~ {
Execute a bridgeload file for the command cmdName. Ok indicates if the file could be found and executed properly.
result: REF;
handleList: List.AList ~ NIL;
handle: Commander.Handle;
processList: List.AList ~ List.PutAssoc[$WorkingDirectoryStack, wDir, List.PutAssoc[$WorkingDirectory, wDir, NIL]];
InnerExecute: PROC ~ {
result ← CommandTool.DoCommand[commandRope, handle];
};
handle ← NIL;
ProcessProps.AddPropList[processList, InnerExecute];
RETURN [ok: result = NIL];
};
Break: PROC [char: CHAR] RETURNS [cc: IO.CharClass] = {
cc ← SELECT char FROM
IN [0C .. ' ] => sepr,
ENDCASE => other;
};
MakeSlices: PROC [cmd: Commander.Handle] RETURNS [result: REF ANYNIL, msg: ROPENIL] ~ {
Commander.CommandProc
clientData: REF ANY ~ cmd.procData.clientData;
in: IO.STREAMIO.RIS[cmd.commandLine];
FOR i: INT ← in.SkipWhitespace[], in.SkipWhitespace[] WHILE NOT in.EndOf[] DO
MakeCommandRope: PROC [clientData: REF ANY, package: ROPE] RETURNS [cmd: ROPE] ~ {
SELECT clientData FROM
Slice 4
$MakeDo4 => cmd ← IO.PutFR["MakeDo -df %g-Source.df -df %g-PCR.df -df %g-Sun4.df", [rope[package]], [rope[package]], [rope[package]]];
$MakePrediction4 => cmd ← IO.PutFR["MakePrediction -df %g-Source.df -df %g-PCR.df -df %g-Sun4.df", [rope[package]], [rope[package]], [rope[package]]];
$MakeVerify4 => cmd ← IO.PutFR["MakeVerify %g-Source.df %g-PCR.df %g-Sun4.df", [rope[package]], [rope[package]], [rope[package]]];
Slice 4O3
$MakeDo4O3 => cmd ← IO.PutFR["MakeDo -df %g-Source.df -df %g-PCR.df -df %g-sun4O3.df", [rope[package]], [rope[package]], [rope[package]]];
$MakePrediction4O3 => cmd ← IO.PutFR["MakePrediction -df %g-Source.df -df %g-PCR.df -df %g-sun4O3.df", [rope[package]], [rope[package]], [rope[package]]];
$MakeVerify4O3 => cmd ← IO.PutFR["MakeVerify %g-Source.df %g-PCR.df %g-sun4O3.df", [rope[package]], [rope[package]], [rope[package]]];
Slice 0
$MakeDo0 => cmd ← IO.PutFR["MakeDo -df %g-Source.df -df %g-PrincOps.df", [rope[package]], [rope[package]]];
$MakePrediction0 => cmd ← IO.PutFR["MakePrediction -df %g-Source.df -df %g-PrincOps.df", [rope[package]], [rope[package]]];
$MakeVerify0 => cmd ← IO.PutFR["MakeVerify %g-Source.df %g-PrincOps.df", [rope[package]], [rope[package]]];
ENDCASE => ERROR;
};
package: ROPE ~ in.GetTokenRope[Break].token;
commandRope: ROPE ~ MakeCommandRope[clientData, package];
[] ← CommandTool.DoCommand[commandRope, cmd];
Process.CheckForAbort[];
ENDLOOP;
};
Init: PROC ~ {
ok: BOOL;
wDir ← NARROW [ProcessProps.GetProp[$WorkingDirectory]];
ok ← ExecuteACommand["alias MakeDo4(package) MakeDo -rgom package-Source.df -rgom package-PCR.df -rgom package-Sun4.df"];
ok ← ExecuteACommand["alias MakePrediction4(package) MakePrediction -rgom package-Source.df -rgom package-PCR.df -rgom package-Sun4.df"];
ok ← ExecuteACommand["alias MakeVerify4(package) MakeVerify package-Source.df package-PCR.df package-Sun4.df"];
};
Init: PROC [] ~ {
Commander.Register[key: "MakeDo4", proc: MakeSlices, doc: "Slice for Sun4", clientData: $MakeDo4];
Commander.Register[key: "MakePrediction4", proc: MakeSlices, doc: "Slice for Sun4", clientData: $MakePrediction4];
Commander.Register[key: "MakeVerify4", proc: MakeSlices, doc: "Slice for Sun4", clientData: $MakeVerify4];
Commander.Register[key: "MakeDo4O3", proc: MakeSlices, doc: "Slice for Sun4O3", clientData: $MakeDo4O3];
Commander.Register[key: "MakePrediction4O3", proc: MakeSlices, doc: "Slice for Sun4O3", clientData: $MakePrediction4O3];
Commander.Register[key: "MakeVerify4O3", proc: MakeSlices, doc: "Slice for Sun4O3", clientData: $MakeVerify4O3];
Commander.Register[key: "MakeDo0", proc: MakeSlices, doc: "Slice for PrincOps", clientData: $MakeDo0];
Commander.Register[key: "MakePrediction0", proc: MakeSlices, doc: "Slice for PrincOps", clientData: $MakePrediction0];
Commander.Register[key: "MakeVerify0", proc: MakeSlices, doc: "Slice for PrincOps", clientData: $MakeVerify0];
};
Init[];
END.