--CDDraw.mesa (a Chipndale module)
--by Christian Jacobi May 3, 1983 10:40 am
--last edited by Christian Jacobi November 21, 1983 3:08 pm
DIRECTORY
CD USING [DesignRect, Design];
CDDraw: CEDAR DEFINITIONS =
BEGIN
CommandTable:
TYPE =
REF CTableRep;
--one commandtable is executed (emptied) by max one process
--but arbitrary (typically only one) processes may fill the commandtable
CTableRep: TYPE;
CommType:
TYPE = {none, rect, all, ref, sel, alldone, disapearforever};
--Do not "InsertCommand" alldone and disapearforever; they are generated implicitely
--alldone: hint that temporary marks should be redrawn now
--disapearforever: hint that no further commands will arrive
Comm:
TYPE =
RECORD [
cmd: CommType,
erase: BOOLEAN,
rect: CD.DesignRect,
ref: REF];
CreateCommandTable:
PROC [design:
CD.Design, clip:
CD.DesignRect, cleanStopFlag:
REF
BOOLEAN]
RETURNS [CommandTable];
--cleanStopFlag^ tells any drawing process to stop volunterly and to fetch the next
--command.
--cleanStopFlag^ must not be modified any more outside this monitor!!
--until DeleteCommandTable is called
--Users may request a stop by calling FlushCommands.
ModifyCommandTable:
PROC [design:
CD.Design, ct: CommandTable, clip:
CD.DesignRect];
--changes the clipping aera
DestroyCommandTable:
PROC [ct: CommandTable];
--no more calls of InsertCommand on ct allowed!!
--draw process must disapear from itself,
--when draw process dispears and contains nomore
--reference of ct, it is subject for garbage collection
--The cleanStopFlag is immediately set to TRUE and later
--reset to FALSE when the draw
--process stopped the current command, if it then fetches another
--command it gets the disapearforever command.
InsertCommand: PROC [ct: CommandTable, c: Comm];
InsertCommandAll: PROC [design: CD.Design, c: Comm];
FetchCommand:
PROC [ct: CommandTable]
RETURNS [c: Comm];
--waits till command is available or CommandTable deleted
FlushCommands:
PROC [ct: CommandTable];
--the drawing may stop after some time only,
--and NOT immediately with procedure return
--The stop-mechanism must still be improved: It should allow introduction
--of an in-between process which "zusammenlegt" some rects to cause
--less real drawing.
END.