File: OutputExtras.mesa
Last Edited by: McCreight, March 12, 1985 1:39:43 pm PST
DIRECTORY
Atom, IODefs, OutputDefs, OutputInternalDefs, MPCDefs, PartitionDefs, ParserErrorDefs, Rope;
OutputExtras: CEDAR PROGRAM IMPORTS Atom, IODefs, OutputInternalDefs, ParserErrorDefs, PartitionDefs EXPORTS OutputDefs =
BEGIN
FinishOutput: PUBLIC PROC RETURNS [BOOL] =
BEGIN
fileLength: INT = PartitionDefs.DestroyPartitions[];
IODefs.WriteDecimal[fileLength];
IODefs.WriteString[" bytes in PFILE$"];
RETURN[TRUE];
END;
Map: PUBLIC PROC [layerName: Rope.ROPE]
RETURNS [n: CARDINAL] =
BEGIN
r: REF ANY;
cifMap: REF OutputInternalDefs.CIFMap ← OutputInternalDefs.cifMap;
cm: REF OutputInternalDefs.CIFMap;
cifLayerAtom: ATOM = Atom.MakeAtom[layerName];
FOR n IN [1..cifMap.size) DO
IF cifMap[n].cifName = cifLayerAtom THEN RETURN;
ENDLOOP;
cm ← NEW[OutputInternalDefs.CIFMap[cifMap.size+1]]; -- make space for a new layer
FOR i: NAT IN [0..OutputInternalDefs.cifMap.size) DO
cm[i] ← cifMap[i];
ENDLOOP;
OutputInternalDefs.cifMap ← cifMap ← cm;
cifMap[cifMap.size-1] ← NEW[MPCDefs.LayerGroupRec ← [
cifName: cifLayerAtom,
cifIndex: cifMap.size-1,
maskLayers: (IF (r ← OutputInternalDefs.w.layerFileList.GetPropFromList[$waste]) = NIL THEN NIL
ELSE Atom.PutPropOnList[propList: NIL, prop: $waste, val: NEW[MPCDefs.LayerAssocRec ← [
fromLayer: cifLayerAtom,
toLayer: NARROW[r, MPCDefs.LayerFileItem],
include: TRUE]]])
]];
ParserErrorDefs.Report[(IF r # NIL THEN "Undefined CIF layer name, objects mapped to waste mask" ELSE "Undefined CIF layer name, objects thrown away"), Advisory];
END;
END.