PrintFileConvertImpl.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Michael Plass, October 29, 1985 9:04:51 am PST
Tim Diebert: September 18, 1985 4:06:16 pm PDT
Doug Wyatt, November 27, 1985 2:33:31 pm PST
DIRECTORY Commander, Convert, FS, Imager, ImagerColorOperator, ImagerFont, ImagerFontFilter, ImagerInterpress, ImagerPD, ImagerPixelArray, ImagerTransformation, Interpress, IO, Process, Real, Rope, ShowPress;
PrintFileConvertImpl: CEDAR PROGRAM
IMPORTS Commander, Convert, FS, Imager, ImagerColorOperator, ImagerFont, ImagerFontFilter, ImagerInterpress, ImagerPD, ImagerPixelArray, ImagerTransformation, Interpress, IO, Process, Real, Rope, ShowPress
~ BEGIN
ActionProc:
TYPE ~
PROC [inputName:
ROPE, outputName:
ROPE, cmd: Commander.Handle, cmds:
IO.
STREAM];
Log: Interpress.LogProc ~ {
cmd: Commander.Handle ~ NARROW[master.logData];
msg: IO.STREAM ~ cmd.out;
msg.PutRope[
SELECT class
FROM
0 => "Master Error: ",
10 => "Master Warning: ",
50 => "Appearance Error: ",
60 => "Appearance Warning: ",
100 => "Comment: ",
ENDCASE => NIL
];
msg.PutRope[explanation];
msg.PutRope[" . . . "];
};
PressToInterpressAction: ActionProc ~ {
version: ROPE ~ GetCmdToken[cmds];
verbose: ROPE ~ GetCmdToken[cmds];
header: ROPE ~ IF Rope.Size[version] = 3 AND Rope.Fetch[version, 1] = '. THEN Rope.Cat["Interpress/Xerox/", version, " "] ELSE NIL;
showPress: ShowPress.Handle ~ ShowPress.Open[inputName];
interpress: ImagerInterpress.Ref ← ImagerInterpress.Create[outputName, header];
xc: BOOL ← Rope.Size[version] = 3 AND Rope.Fetch[version, 0] < '3;
FOR i:
NAT
IN[0..256)
DO
font: ImagerFont.Font ~ showPress.fontTable[i].imagerFont;
IF font#NIL THEN ImagerInterpress.DeclareFont[interpress, font];
ENDLOOP;
FOR i:
INT
IN [1..showPress.lastPart)
DO
Paint:
PROC [context: Imager.Context] ~ {
cmd.out.PutF["[%g", IO.int[i]];
IF xc THEN context ← FontTranslator[context, version, cmd, verbose.Equal["verbose", FALSE]];
Imager.SetPriorityImportant[context, TRUE];
ShowPress.DrawPressPage[context: context, show: showPress, pageNumber: i];
cmd.out.PutRope["] "];
};
Process.CheckForAbort[];
ImagerInterpress.DoPage[self: interpress, action: Paint, scale: 1.0E-5];
ENDLOOP;
ImagerInterpress.Close[interpress];
};
inch: REAL ~ 0.0254;
headerSampled: ROPE ← "Interpress/Xerox/3.0 ";
aisMargin: REAL ← 0.25*inch;
pageWidth: REAL ← 8.5*inch;
pageHeight: REAL ← 11*inch;
captionFont: ROPE ← "xerox/pressfonts/helvetica-mir";
captionLoc: Imager.
VEC ~ [72, 9];
FileChoice:
PROC [r: Rope.
ROPE, a:
ARRAY [0..3)
OF Rope.
ROPE]
RETURNS [result: Rope.ROPE ← NIL] ~ {
FOR i:
NAT
IN [0..3)
DO
IF a[i] #
NIL
THEN {
name: ROPE ~ Rope.Cat[r, "-", a[i], ".ais"];
result ← FS.FileInfo[name ! FS.Error => {IF error.code = $unknownFile THEN CONTINUE}].fullFName;
IF result# NIL THEN RETURN;
};
ENDLOOP;
};
GetColorNames:
PROC [name: Rope.
ROPE]
RETURNS [ok:
BOOL, red, grn, blu: Rope.
ROPE] ~ {
red ← FileChoice[name, ["red", "r", NIL]];
IF red = NIL THEN { ok ← FALSE; RETURN};
grn ← FileChoice[name, ["grn", "green", "g"]];
IF grn = NIL THEN { ok ← FALSE; RETURN};
blu ← FileChoice[name, ["blu", "blue", "b"]];
ok ← blu # NIL;
};
ColorAISToInterpressCommand: Commander.CommandProc ~ {
red, grn, blu: ROPE;
interpress: ImagerInterpress.Ref;
pa: Imager.PixelArray;
maxSample: CARDINAL;
rect: Imager.Rectangle;
scale: REAL;
Paint:
PROC [context: Imager.Context] ~ {
Caption:
PROC ~ {
Imager.ScaleT[context, inch/72];
Imager.SetFont[context, ImagerFont.Scale[ImagerFont.Find[captionFont], 9]];
Imager.SetXY[context, [72, 9]];
Imager.ShowRope[context, cmd.commandLine];
};
Imager.SetPriorityImportant[context, TRUE];
Imager.DoSave[context, Caption];
Imager.TranslateT[context, [pageWidth*0.5, pageHeight*0.5]];
Imager.ScaleT[context, scale];
Imager.TranslateT[context, [-(rect.x+rect.w*0.5), -(rect.y+rect.h*0.5)]];
Imager.SetSampledColor[context: context, pa: pa, m: NIL, colorOperator: ImagerColorOperator.RGBLinearColorModel[maxSample]];
Imager.MaskRectangle[context, rect];
};
stream: IO.STREAM ← IO.RIS[cmd.commandLine];
outputName: ROPE ← GetCmdToken[stream];
secondTokenIndex: INT ← IO.GetIndex[stream];
gets: ROPE ← GetCmdToken[stream];
ok: BOOL ← FALSE;
inputName: ROPE ← NIL;
IF
NOT gets.Equal["←"]
THEN {
inputName ← outputName;
outputName ← NIL;
stream.SetIndex[secondTokenIndex];
}
ELSE {inputName ← GetCmdToken[stream]};
IF inputName = NIL THEN RETURN[result: $Failure, msg: cmd.procData.doc];
[ok, red, grn, blu] ← GetColorNames[inputName !
FS.Error => {
IF error.group = user THEN {result ← $Failure; msg ← error.explanation; GOTO Quit}
}];
IF NOT ok THEN RETURN[result: $Failure, msg: "Could not find one or more of the input files\n"];
IF outputName =
NIL
THEN {
outputName ← MakeOutputName[inputName, cmd.procData.doc];
};
cmd.out.PutF["Reading\n %g\n %g\n %g . . . ", IO.rope[red], IO.rope[grn], IO.rope[blu]];
pa ← ImagerPixelArray.Join3AIS[red, grn, blu];
maxSample ← ImagerPixelArray.MaxSampleValue[pa, 0];
rect ← ImagerTransformation.TransformRectangle[pa.m, [0, 0, pa.sSize, pa.fSize]];
scale ← MIN[(pageWidth-2*aisMargin)/rect.w, (pageHeight-2*aisMargin)/rect.h];
interpress ← ImagerInterpress.Create[outputName, headerSampled];
ImagerInterpress.DeclarePixelArray[interpress, pa];
ImagerInterpress.DoPage[self: interpress, action: Paint, scale: 1.0];
ImagerInterpress.Close[interpress];
outputName ← FindFullName[outputName];
cmd.out.PutRope["\n "];
cmd.out.PutRope[outputName];
cmd.out.PutRope[" written.\n"];
EXITS Quit => NULL
};
AISToInterpressAction: ActionProc ~ {
interpress: ImagerInterpress.Ref ← ImagerInterpress.Create[outputName, headerSampled];
pa: Imager.PixelArray ← ImagerPixelArray.FromAIS[inputName];
maxSample: CARDINAL ~ ImagerPixelArray.MaxSampleValue[pa, 0];
rect: Imager.Rectangle ← ImagerTransformation.TransformRectangle[pa.m, [0, 0, pa.sSize, pa.fSize]];
scale: REAL ← MIN[(pageWidth-2*aisMargin)/rect.w, (pageHeight-2*aisMargin)/rect.h];
Paint:
PROC [context: Imager.Context] ~ {
Caption:
PROC ~ {
Imager.ScaleT[context, inch/72];
Imager.SetFont[context, ImagerFont.Scale[ImagerFont.Find[captionFont], 9]];
Imager.SetXY[context, [72, 9]];
Imager.ShowRope[context, cmd.commandLine];
};
Imager.SetPriorityImportant[context, TRUE];
Imager.DoSave[context, Caption];
Imager.TranslateT[context, [pageWidth*0.5, pageHeight*0.5]];
Imager.ScaleT[context, scale];
Imager.TranslateT[context, [-(rect.x+rect.w*0.5), -(rect.y+rect.h*0.5)]];
Imager.SetSampledColor[context: context, pa: pa, m: NIL, colorOperator: ImagerColorOperator.GrayLinearColorModel[maxSample, 0, maxSample]];
Imager.MaskRectangle[context, rect];
};
cmd.out.PutF["[%g", IO.int[1]];
ImagerInterpress.DeclarePixelArray[interpress, pa];
ImagerInterpress.DoPage[self: interpress, action: Paint, scale: 1.0];
cmd.out.PutRope["] "];
ImagerInterpress.Close[interpress];
};
InterpressToPressAction: ActionProc ~ {
interpress: Interpress.OpenMaster ~ Interpress.Open[inputName, Log, cmd];
context: Imager.Context ~ ImagerPress.SimpleCreate[fileName: outputName, printerType: press];
FOR i: INT IN [1..interpress.pages] DO
Process.CheckForAbort[];
cmd.out.PutF["[%g", IO.int[i]];
Interpress.DoPage[master: interpress, context: context, page: i];
cmd.out.PutRope["] "];
IF i # interpress.pages THEN ImagerPress.NewPage[context];
ENDLOOP;
ImagerPress.Close[context];
};
InterpressToJaMAction: ActionProc ~ {
interpress: Interpress.OpenMaster ~ Interpress.Open[inputName, Log, cmd];
stream: IO.STREAM ~ FS.StreamOpen[outputName, $create];
context: Imager.Context ~ ImagerToJaM.Create[stream];
stream.PutRope["% Produced from "];
stream.PutRope[inputName];
stream.PutRope["\n"];
FOR i: INT IN [1..interpress.pages] DO
Process.CheckForAbort[];
stream.PutF["%% Page %g\n", IO.int[i]];
Interpress.DoPage[master: interpress, context: context, page: i];
ENDLOOP;
ImagerToJaM.Close[context];
};
printerTypeNames:
ARRAY ImagerPD.PrinterType
OF
ROPE ← [
nil: NIL,
raven300: "raven300",
raven384: "raven384",
o3: NIL,
plateMaker: "plateMaker",
o5: NIL,
puffin: "puffin",
colorVersatec: "colorVersatec",
versatec: "versatec",
color400: "color400",
c150: "c150",
o11: NIL,
o12: NIL,
o13: NIL,
o14: NIL,
o15: NIL
];
printerTypePPD:
ARRAY ImagerPD.PrinterType
OF
REAL ← [
nil: 5,
raven300: 6,
raven384: 6,
o3: 5,
plateMaker: 9,
o5: 5,
puffin: 6,
colorVersatec: 5,
versatec: 5,
color400: 7,
c150: 4,
o11: 5,
o12: 5,
o13: 5,
o14: 5,
o15: 5
];
PrinterTypeFromRope:
PROC [rope:
ROPE]
RETURNS [ImagerPD.PrinterType] ~ {
FOR p: ImagerPD.PrinterType
IN ImagerPD.PrinterType
DO
IF Rope.Equal[rope, printerTypeNames[p], FALSE] THEN RETURN [p];
ENDLOOP;
RETURN [nil];
};
Rev:
PROC [list: ImagerPD.Toners]
RETURNS [ImagerPD.Toners] ~ {
l1, l2, l3: ImagerPD.Toners ←
NIL;
IF list = NIL THEN RETURN[NIL];
l3 ← list;
UNTIL (l1 ← l3) =
NIL
DO
l3 ← l3.rest;
l1.rest ← l2;
l2 ← l1;
ENDLOOP;
RETURN[l2];
};
InterpressToPDAction: ActionProc ~ {
deviceCodeRope: ROPE ~ GetCmdToken[cmds];
printerType: ImagerPD.PrinterType ~ PrinterTypeFromRope[deviceCodeRope];
r: REAL ← 0.0;
tok: ROPE ← NIL;
Err:
PROC ~ {
IF tok#NIL THEN Complain[Rope.Concat["Unknown keyword: ", tok]]
ELSE Complain["Malformed command"];
};
tx, ty: REAL ← 0.0;
scale: REAL ← 1.0;
toners: ImagerPD.Toners ← NIL;
tonerUniverse: ImagerPD.Toners ← NIL;
ppd: REAL ← -1.0;
skipPages: INT ← 0;
nPages: INT ← INT.LAST;
tok ← GetCmdToken[cmds];
DO
SELECT
TRUE
FROM
Rope.Equal[tok, "black",
FALSE] => {
toners ← CONS[black, toners];
};
Rope.Equal[tok, "cyan",
FALSE] => {
toners ← CONS[cyan, toners];
};
Rope.Equal[tok, "magenta",
FALSE] => {
toners ← CONS[magenta, toners];
};
Rope.Equal[tok, "yellow",
FALSE] => {
toners ← CONS[yellow, toners];
};
ENDCASE => EXIT;
tok ← GetCmdToken[cmds];
ENDLOOP;
toners ← Rev[toners];
IF Rope.Equal[tok, "of",
FALSE]
THEN {
tok ← GetCmdToken[cmds];
SELECT
TRUE
FROM
Rope.Equal[tok, "3",
FALSE] => {
tonerUniverse ← LIST[cyan, magenta, yellow];
};
Rope.Equal[tok, "4",
FALSE] => {
tonerUniverse ← LIST[black, cyan, magenta, yellow];
};
ENDCASE => Err[];
tok ← GetCmdToken[cmds];
};
IF tok #
NIL
THEN {
r ← RealFromRope[tok];
tok ← GetCmdToken[cmds];
SELECT
TRUE
FROM
Rope.Equal[tok, "ppd", FALSE] => {ppd ← r; r ← GetReal[cmds]; tok ← GetCmdToken[cmds]};
ENDCASE => NULL;
SELECT
TRUE
FROM
Rope.Equal[tok, "in",
FALSE] => {
tx ← r;
ty ← GetReal[cmds];
tok ← GetCmdToken[cmds];
IF Rope.Equal[tok, "in", FALSE] AND Rope.Equal[tok ← GetCmdToken[cmds], "translate", FALSE] THEN {r ← GetReal[cmds]; tok ← GetCmdToken[cmds]}
ELSE Err[];
};
ENDCASE => NULL;
SELECT
TRUE
FROM
Rope.Equal[tok, "scale", FALSE] => {scale ← r; r ← GetReal[cmds]; tok ← GetCmdToken[cmds]};
ENDCASE => NULL;
SELECT
TRUE
FROM
Rope.Equal[tok, "skipPages", FALSE] => {skipPages ← Real.Round[r]; r ← GetReal[cmds]; tok ← GetCmdToken[cmds]};
ENDCASE => NULL;
SELECT
TRUE
FROM
Rope.Equal[tok, "nPages", FALSE] => {nPages ← Real.Round[r]; r ← GetReal[cmds]; tok ← GetCmdToken[cmds]};
tok = NIL => NULL;
ENDCASE => Err[];
};
IF printerType = nil
THEN {
cmd.out.PutRope["Unknown printer type: "];
cmd.out.PutRope[deviceCodeRope];
cmd.out.PutChar['\n];
cmd.out.PutRope["Valid types are: "];
FOR p: ImagerPD.PrinterType
IN ImagerPD.PrinterType
DO
cmd.out.PutRope[printerTypeNames[p]];
cmd.out.PutChar[' ];
ENDLOOP;
cmd.out.PutChar['\n];
ERROR ABORTED;
}
ELSE {
realPPD: REAL ~ IF ppd > 0 THEN ppd ELSE printerTypePPD[printerType];
interpress: Interpress.OpenMaster ~ Interpress.Open[inputName, Log, cmd];
pd: ImagerPD.PD ~ ImagerPD.CreateFromPrinterType[outputName, printerType, toners, tonerUniverse, realPPD];
nPages ← MIN[nPages, interpress.pages-skipPages];
FOR i:
INT
IN [skipPages..skipPages+nPages)
DO
action:
PROC [context: Imager.Context] ~ {
IF tx#0.0
OR ty#0.0
THEN {
Imager.TranslateT[context, [tx*0.0254, ty*0.0254]];
};
IF scale#1.0
THEN {
Imager.ScaleT[context, scale];
};
Interpress.DoPage[master: interpress, context: context, page: i+1];
};
cmd.out.PutF[" [%g", IO.int[i+1]];
ImagerPD.DoPage[pd: pd, action: action, pixelUnits: FALSE];
cmd.out.PutChar[']];
ENDLOOP;
cmd.out.PutChar[' ];
ImagerPD.Close[pd];
};
};
FontTranslator:
PROC [c: Imager.Context, version:
ROPE, cmd: Commander.Handle, verbose:
BOOL]
RETURNS [context: Imager.Context] ~ {
fontMap: ImagerFontFilter.FontMap ← xc1map;
RETURN [ImagerFontFilter.FilterFonts[c, fontMap, cmd, verbose]];
};
CH: PROC [char: CHAR] RETURNS [WORD] ~ INLINE {RETURN [ORD[char]]};
XC: PROC [set: [0..256), code: [0..256)] RETURNS [WORD] ~ {RETURN [set*256+code]};
C1:
PROC [char:
CHAR, set: [0..256), code: [0..256)]
RETURNS [ImagerFontFilter.CharRangeMap] ~ {
RETURN [[bc: CH[char], ec: CH[char], newbc: XC[set, code]]]
};
classicModernEtAl: LIST OF ROPE ← LIST["Classic", "Modern"];
timesRomanEtAl: LIST OF LIST OF ROPE ← LIST[LIST["TimesRoman", "Classic"], LIST["Helvetica", "Modern"], LIST["Gacha", "XeroxBook"], LIST["Tioga", "Classic"], LIST["Laurel", "Classic"]];
mrrEtAl: LIST OF ROPE ← LIST["-mrr", "-mir-italic", "-bir-bold-italic", "-brr-bold"];
alphaMap: ImagerFontFilter.CharacterCodeMap ~
LIST [
[bc: CH[' ], ec: CH['~], newbc: CH[' ]]
];
mathMap: ImagerFontFilter.CharacterCodeMap ←
LIST [
C1['©, 0, 323B],
C1['®, 0, 322B]
];
oisMap: ImagerFontFilter.CharacterCodeMap ←
LIST [
[bc: CH['a], ec: CH['~], newbc: CH['a]],
[bc: CH['.], ec: CH[']], newbc: CH['.]],
[bc: CH['%], ec: CH[',], newbc: CH['%]],
[bc: CH['-], ec: CH['-], newbc: XC[357B, 42B]],
[bc: CH[' ], ec: CH['!], newbc: CH[' ]],
[bc: CH['\"], ec: CH['\"], newbc: XC[0, 271B]],
[bc: CH['#], ec: CH['#], newbc: CH['#]],
[bc: CH['$], ec: CH['$], newbc: XC[0, 244B]],
[bc: CH['^], ec: CH['^], newbc: XC[0, 255B]],
[bc: CH['←], ec: CH['←], newbc: XC[0, 254B]],
C1['\030, 357B, 45B],
C1['\267, 357B, 146B],
C1['\265, 41B, 172B],
C1['\140, 0, 140B],
C1[', 357B, 064B],
C1[', 357B, 065B],
];
xc1map: ImagerFontFilter.FontMap ← MakeXC1map[];
MakeXC1map:
PROC
RETURNS [f: ImagerFontFilter.FontMap] ~ {
Enter: PROC [e: ImagerFontFilter.FontMapEntry] ~ {f ← CONS[e, f]};
FOR family:
LIST
OF
ROPE ← classicModernEtAl, family.rest
UNTIL family =
NIL
DO
FOR face:
LIST
OF
ROPE ← mrrEtAl, face.rest
UNTIL face =
NIL
DO
Enter[[
inputName: Rope.Cat["Xerox/Pressfonts/", family.first, face.first.Substr[0, 4]],
output: LIST[[newName: Rope.Cat["Xerox/xc1-1-1/", family.first, face.first.Substr[4]], charMap: oisMap]]
]];
ENDLOOP;
ENDLOOP;
FOR family:
LIST
OF
LIST OF ROPE ← timesRomanEtAl, family.rest
UNTIL family =
NIL
DO
FOR face:
LIST
OF
ROPE ← mrrEtAl, face.rest
UNTIL face =
NIL
DO
Enter[[
inputName: Rope.Cat["Xerox/Pressfonts/", family.first.first, face.first.Substr[0, 4]],
output: LIST[[newName: Rope.Cat["Xerox/xc1-1-1/", family.first.rest.first, face.first.Substr[4]], charMap: oisMap]],
warn: TRUE
]];
ENDLOOP;
ENDLOOP;
Enter[[
inputName: "Xerox/Pressfonts/Logo-mrr",
output: LIST[[newName: "Xerox/xc1-1-1/Logotypes-Xerox", charMap: alphaMap]]
]];
Enter[[
inputName: "Xerox/Pressfonts/Math-mrr",
output: LIST[[newName: "Xerox/xc1-1-1/Modern", charMap: mathMap]]
]];
Enter[[
inputName: "Xerox/Pressfonts/Math-mir",
output: LIST[[newName: "Xerox/xc1-1-1/Modern-italic", charMap: mathMap]]
]];
};
FindFullName:
PROC [inputName:
ROPE]
RETURNS [
ROPE] ~ {
fullFName: ROPE ← NIL;
fullFName ← FS.FileInfo[inputName].fullFName;
RETURN [fullFName]
};
CmdTokenBreak:
PROC [char:
CHAR]
RETURNS [
IO.CharClass] = {
IF char = '← THEN RETURN [break];
IF char = ' OR char = '\t OR char = ', OR char = '; OR char = '\n THEN RETURN [sepr];
RETURN [other];
};
GetCmdToken:
PROC [stream:
IO.
STREAM]
RETURNS [rope:
ROPE] = {
rope ← NIL;
rope ← stream.GetTokenRope[CmdTokenBreak ! IO.EndOfStream => CONTINUE].token;
};
RealFromRope:
PROC [rope:
ROPE]
RETURNS [real:
REAL] = {
oops: BOOL ← FALSE;
real ← Convert.RealFromRope[rope ! Convert.Error => {oops ← TRUE; CONTINUE}];
IF oops THEN {oops ← FALSE; real ← Convert.IntFromRope[rope ! Convert.Error => {oops ← TRUE; CONTINUE}]};
IF oops THEN Complain[Rope.Concat["Number expected: ", rope]];
};
GetReal:
PROC [stream:
IO.
STREAM]
RETURNS [real:
REAL ← 0.0] = {
tokenKind: IO.TokenKind ← tokenEOF;
rope: ROPE ← NIL;
[tokenKind: tokenKind, token: rope] ← stream.GetCedarTokenRope[ !
IO.EndOfStream => CONTINUE;
IO.Error => Complain["Number expected"];
];
SELECT tokenKind
FROM
tokenDECIMAL => real ← Convert.IntFromRope[rope];
tokenREAL => real ← Convert.RealFromRope[rope];
tokenEOF => real ← -0.0;
ENDCASE => Complain[Rope.Concat["Number expected: ", rope]];
};
Complain:
ERROR [complaint:
ROPE] ~
CODE;
MakeOutputName:
PROC [inputName:
ROPE, doc:
ROPE]
RETURNS [
ROPE] ~ {
start: INT ← Rope.Index[s1: doc, s2: " to "]+4;
end: INT ← Rope.Index[s1: doc, pos1: start, s2: " "];
cp: FS.ComponentPositions;
[inputName, cp] ← FS.ExpandName[inputName];
RETURN [Rope.Cat[
Rope.Substr[inputName, cp.base.start, cp.base.length],
".",
Rope.Substr[doc, start, end-start]
]]
};
Command: Commander.CommandProc ~ {
refAction: REF ActionProc ~ NARROW[cmd.procData.clientData];
stream: IO.STREAM ← IO.RIS[cmd.commandLine];
outputName: ROPE ← GetCmdToken[stream];
secondTokenIndex: INT ← IO.GetIndex[stream];
gets: ROPE ← GetCmdToken[stream];
inputName: ROPE ← NIL;
IF
NOT gets.Equal["←"]
THEN {
inputName ← outputName;
outputName ← NIL;
stream.SetIndex[secondTokenIndex];
}
ELSE {inputName ← GetCmdToken[stream]};
IF inputName = NIL THEN RETURN[result: $Failure, msg: cmd.procData.doc];
inputName ← FindFullName[inputName !
FS.Error => {
IF error.group = user THEN {result ← $Failure; msg ← error.explanation; GOTO Quit}
}];
IF outputName =
NIL
THEN {
outputName ← MakeOutputName[inputName, cmd.procData.doc];
};
cmd.out.PutRope["Reading "];
cmd.out.PutRope[inputName];
cmd.out.PutRope[" . . . "];
refAction^[inputName, outputName, cmd, stream ! Complain => {result ← $Failure; msg ← complaint; GOTO Quit}];
outputName ← FindFullName[outputName];
cmd.out.PutRope[outputName];
cmd.out.PutRope[" written.\n"];
EXITS Quit => NULL
};
Commander.Register["PressToInterpress", Command, "Convert Press file to Interpress (output ← input [version])\n", NEW[ActionProc ← PressToInterpressAction]];
Commander.Register["AISToInterpress", Command, "Convert AIS file to Interpress (output ← input)\n", NEW[ActionProc ← AISToInterpressAction]];
Commander.Register["ColorAISToInterpress", Command, "Convert Color AIS file to Interpress (output ← input)\n", NEW[ActionProc ← AISToInterpressAction]];
Commander.Register["InterpressToPress", Command, "Convert Interpress file to Press (output ← input)\n", NEW[ActionProc ← InterpressToPressAction]];
Commander.Register["InterpressToJaM", Command, "Convert Interpress file to JaM (output ← input)\n", NEW[ActionProc ← InterpressToJaMAction]];
Commander.Register["InterpressToPD", Command, "Convert Interpress file to PD (output ← input printerType {black | cyan | magenta | yellow} [of (3 | 4)] [<pixelsPerHalftoneDot> ppd] [<tx> in <ty> in translate] [<scale> scale] [<skip> skipPages] [<n> nPages])\n", NEW[ActionProc ← InterpressToPDAction]];
Commander.Register["ColorAISToInterpress", ColorAISToInterpressCommand, "Convert Color AIS files to Interpress (output ← inputRoot)\n"];
END.