-- VersatectoPress.mesa - April 1980 -- Replacement versatec module to generate press files -- Updated: February 6, 1981 3:26 PM DIRECTORY InlineDefs: FROM "InlineDefs" USING [LongCOPY], PressDefs: FROM "PressDefs" USING[InitPressFileDescriptor, ClosePressFile, PressFileDescriptor, PutComputedDots], ProcessDefs: FROM "ProcessDefs" USING [Detach, Yield], SystemDefs: FROM "SystemDefs" USING [AllocateHeapNode, FreeHeapNode], VersatecDefs: FROM "VersatecDefs"; Versatec: PROGRAM IMPORTS InlineDefs, PressDefs, ProcessDefs, SystemDefs EXPORTS VersatecDefs = BEGIN OPEN InlineDefs, PressDefs, ProcessDefs, SystemDefs; StartVersatecPlot: PUBLIC PROCEDURE[fileName: STRING, width,height: CARDINAL] = BEGIN ScanLineLength _ (width+1)/16; ScanLine _ AllocateHeapNode[ScanLineLength]; ScanLineReady _ TRUE; Done _ FALSE; Detach[FORK GeneratePressFile[fileName, width,height]]; WHILE ScanLineReady DO Yield[]; ENDLOOP; --make sure GetLine is waiting END; EndVersatecPlot: PUBLIC PROCEDURE = BEGIN FreeHeapNode[ScanLine]; ClosePressFile[@pressFileDescriptor]; END; WriteVersatecLine: PUBLIC PROCEDURE [line: LONG POINTER, nBytes: CARDINAL] = BEGIN IF Done THEN RETURN; WHILE ScanLineReady DO Yield[]; ENDLOOP; LongCOPY[line, ScanLineLength, ScanLine]; ScanLineReady _ TRUE; END; --the following runs as a separate process, since PutComputedDots insists on having control GeneratePressFile: PROCEDURE[fileName: STRING, width,height: CARDINAL] = BEGIN InitPressFileDescriptor[@pressFileDescriptor,fileName]; PutComputedDots[@pressFileDescriptor, 0,0,width,height,1,width,height,GetLine]; Done _ TRUE; END; GetLine: PROCEDURE RETURNS[POINTER] = BEGIN ScanLineReady _ FALSE; UNTIL ScanLineReady DO Yield[]; ENDLOOP; RETURN[ScanLine]; END; pressFileDescriptor: PressFileDescriptor; ScanLine: POINTER _ NIL; ScanLineLength: CARDINAL; ScanLineReady: BOOLEAN; Done: BOOLEAN; -- *** START CODE *** END.(635)\223f1 23f0 1f1 18f0 21f1 15f0 164b8B149b17B323b15B99b17B254f1 15f0 27b17B121f1 16f0 87b7B