-- VersatectoPress.mesa - April 1980
-- Replacement versatec module to generate press files
-- Updated: February 10, 1981 3:23 PM

DIRECTORY
InlineDefs: FROM "InlineDefs" USING [LongCOPY],
PressDefs: FROM "PressDefs" USING[
InitPressFileDescriptor,
ClosePressFile, PressFileDescriptor, PutDots],
SystemDefs: FROM "SystemDefs" USING [AllocateHeapNode, FreeHeapNode],
VersatecDefs: FROM "VersatecDefs";

Versatec: PROGRAM
IMPORTS InlineDefs, PressDefs, SystemDefs
EXPORTS VersatecDefs =
BEGIN OPEN InlineDefs, PressDefs, SystemDefs;

StartVersatecPlot: PUBLIC PROCEDURE[fileName: STRING, width,height: CARDINAL] =
BEGIN
ScanLineBits ← width;
ScanLineLength ← (width+1)/16;
ScanLine ← AllocateHeapNode[ScanLineLength];
LineNumber ← 0;
InitPressFileDescriptor[@pressFileDescriptor,fileName];
END;

EndVersatecPlot: PUBLIC PROCEDURE =
BEGIN
FreeHeapNode[ScanLine];
ClosePressFile[@pressFileDescriptor];
END;

WriteVersatecLine: PUBLIC PROCEDURE [line: LONG POINTER, nBytes: CARDINAL] =
BEGIN
LongCOPY[line, ScanLineLength, ScanLine];
PutDots[@pressFileDescriptor,
0,LineNumber,ScanLineBits,1,0,ScanLineBits,1,ScanLine];
LineNumber ← LineNumber + 1;
END;

pressFileDescriptor: PressFileDescriptor;
ScanLine: POINTER ← NIL;
ScanLineLength: CARDINAL;
ScanLineBits: CARDINAL;
LineNumber: CARDINAL;

-- *** START CODE ***

END.