PressToIPTool.mesa
Last edited by:
Shore, November 16, 1982 1:18 pm
Doug Wyatt, April 14, 1983 5:34 pm
DIRECTORY
Commander USING [CommandProc, Register],
IO USING [PutRope, STREAM],
MessageWindow USING [Append, Blink],
PressToIP USING [ConvertPressToInterpress, Error, IPMaster, OpenOutputIPMaster, OpenPressFile, PressFile, ProgressProc],
Rope USING [ROPE, Concat, Find, SkipOver, SkipTo, Substr];
PressToIPTool: PROGRAM
IMPORTS Commander, IO, MessageWindow, PressToIP, Rope
= BEGIN
FirstToken: PROC[line: Rope.ROPE] RETURNS[Rope.ROPE] = {
start: INT = line.SkipOver[skip: " \t"];
end: INT = line.SkipTo[pos: start, skip: " \t\n"];
RETURN[line.Substr[start, end-start]];
};
PressToInterpress: Commander.CommandProc = TRUSTED {
fileName: Rope.ROPE = FirstToken[cmd.commandLine];
Convert[fileName, cmd.out, FALSE];
};
PressToFullInterpress: Commander.CommandProc = TRUSTED {
fileName: Rope.ROPE = FirstToken[cmd.commandLine];
Convert[fileName, cmd.out, TRUE];
};
Convert: PROC[fileName: Rope.ROPE, feedback: IO.STREAM, full: BOOLEAN] = {
pressFile: PressToIP.PressFile ← NIL;
ipMaster: PressToIP.IPMaster;
fileNameNoExtension: Rope.ROPE;
dotPosition: INT;
ProgressProc: PressToIP.ProgressProc = {
feedback: IO.STREAMNARROW[progressData];
IF finishedWhat # document THEN feedback.PutRope[" ."]
ELSE feedback.PutRope[" done\n"];
}; -- ProgressProc
dotPosition ← fileName.Find["."];
fileNameNoExtension ←
IF dotPosition # -1 THEN fileName.Substr[start: 0, len: dotPosition]
ELSE fileName;
pressFile ← PressToIP.OpenPressFile[fileName !
PressToIP.Error => CONTINUE];
IF pressFile = NIL THEN {
fileName ← Rope.Concat[fileName, ".press"];
pressFile ← PressToIP.OpenPressFile[fileName !
PressToIP.Error => {
MessageWindow.Append[message: "Can't Find Press File", clearFirst: TRUE];
MessageWindow.Blink[];
GOTO Quit; }
];
};
ipMaster ← PressToIP.OpenOutputIPMaster[Rope.Concat[fileNameNoExtension, ".Interpress"]];
feedback.PutRope[Rope.Concat["Translating: ", fileNameNoExtension]];
PressToIP.ConvertPressToInterpress[
pressFile: pressFile,
ipMaster: ipMaster,
usePriority: FALSE,
fullInterpress: full,
progressProc: ProgressProc,
progressData: feedback];
EXITS
Quit => RETURN;
}; -- Convert
Commander.Register["PressToInterpress", PressToInterpress,
"Convert Press file to Xerox encoded Interpress 2.0 Master." ];
Commander.Register["PressToFullInterpress", PressToFullInterpress,
"Convert Press file to Xerox encoded Full Interpress Master." ];
END. -- PressToIPTool
Change Log
Created by Shore; September 16, 1982 3:39 pm
Changed by Shore; September 22, 1982 10:44 am
Added ProgressProc
Changed by Shore; November 16, 1982 1:16 pm
converted to Cedar.Style and added node formats
Changed by Wyatt; March 1, 1983 4:16 pm
to accommodate new UserExec interface for Cedar 4.0
Changed by Wyatt; March 2, 1983 11:18 am
added PressToFullInterpress command
Changed by Wyatt; March 3, 1983 1:33 pm
changed extension of output file name from IP to Interpress