<> <> <> <> DIRECTORY CD; CDSequencer: CEDAR DEFINITIONS = BEGIN Command: TYPE = REF CommandRec; CommandRec: TYPE = RECORD [ a: ATOM _ NIL, design: CD.Design _ NIL, l: CD.Layer _ CD.combined, n: CD.Number _ 0, pos: CD.DesignPosition _ [0, 0], -- final position of command sPos: CD.DesignPosition _ [0, 0], -- special position, start position, (exceptional: size) orient: CD.Orientation _ CD.original, b: BOOLEAN _ FALSE, ref: REF _ NIL, --typically describes who issued the command (viewers data field) data: REF _ NIL, --reserved for command implementor fetched: --PRIVATE-- REF READONLY CommDescriptor _ NIL --private for CDSequencerImpl ]; CommandProc: TYPE = PROC[Command]; QueueMethod: TYPE = {doQueueAndMark, doQueue, dontQueue, useDefault}; <<--doQueueAndMark: mark the design as changed>> <<--the queued executions are also forked>> CommDescriptor: TYPE = RECORD [p: CommandProc, qm: QueueMethod]; ExecuteProc: PROC [comm: CDSequencer.Command _ NIL, design: CD.Design _ NIL, proc: CommandProc, queue: QueueMethod _ doQueue]; <<--if design#NIL replaces comm.design>> ExecuteCommand: PROC [comm: CDSequencer.Command _ NIL, design: CD.Design _ NIL, command: ATOM _ NIL, queue: QueueMethod _ useDefault]; <<--if command#NIL replaces comm.a>> <<--if design#NIL replaces comm.design>> ImplementCommand: PROC [a: ATOM, p: CommandProc, technology: CD.Technology_NIL, queue: QueueMethod _ doQueueAndMark]; <<--If technology is NIL implement for all technologies.>> <<--Reimplementing the same atom in a technology overwrites the command; >> <<--If the same atom is specified for a particular technology and all technologies,>> <<--the more specific implementation wins independent of order. >> <<--There is a (finite, short) list of atoms you can NOT use.>> FetchCommand: PROC [a: ATOM, technology: CD.Technology] RETURNS [REF READONLY CommDescriptor]; <<--NIL if not defined>> MarkChanged: PROC [design: CD.Design]; AbortTheCommand: PROC [design: CD.Design]; Aborted: PROC [design: CD.Design] RETURNS [BOOL]; CheckAborted: PROC [design: CD.Design]; <<--IF Aborted[design] THEN SIGNAL TerminalIO.UserAbort>> END.