CDCommandOps.mesa (part of ChipNDale)
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, July 12, 1984 3:46:45 pm PDT
Last edited by: Christian Jacobi, January 28, 1987 3:22:30 pm PST
DIRECTORY
CD,
CDSequencer,
Rope USING [ROPE];
CDCommandOps: CEDAR DEFINITIONS =
BEGIN
Various procedures to ease implementing commands.
CommandProc: TYPE = CDSequencer.CommandProc;
Command: TYPE = CDSequencer.Command;
DoWithResource:
PROC [proc: CDSequencer.CommandProc, comm: CDSequencer.Command, resource:
REF ←
NIL, waitIfBusy:
BOOL ←
FALSE, messageIfSkipped:
BOOL ←
TRUE]
RETURNS [skipped:
BOOL];
--Monitoring commands using global resources
--proc will be called with comm as parameter
--resource: typically atom; every resource is called only once at a time
--waitIfBusy
-- TRUE: proc waits if resource is occupied
-- FALSE: proc is skipped if resource is occupied
--messageIfSkipped: The procedure message on Terminal if it skipped the call
RegisterWithMenu:
PROC [menu:
REF←NIL, entry: Rope.
ROPE←NIL, doc: Rope.
ROPE←NIL, key:
ATOM←
NIL, proc: CDSequencer.CommandProc←
NIL, queue: CDSequencer.QueueMethod𡤍oQueue, tech:
CD.Technology←
NIL];
--Pure conveniance
--Fetches a menu, installs an entry and implements a command with CDSequencer
--menu: pop-up menu, or NIL
--entry: entry line for pop up menu
--doc: documentation
--key: command key (as in tip table, pop-up menu)
--proc #NIL: registers proc with CDSequencer
--proc NIL: registration of menu entry only
--queue: method how proc is called
--tech: (NIL for all technologies); used for command registration but not for menu
--There are two classes of tools
-- Standard tools register commands with CDSequencer,
-- they do not make PopUp menus themself
-- Fancy tools might not be included in the PopUp menu table file
-- they might consider registering a menu themself, after they are loaded
RegisterCurrentLayerCommand:
PROC [key:
ATOM, layer:
CD.Layer, tech:
CD.Technology←
NIL, w:
CD.Number←-1];
--Registers a command to set layer current layer
IncludeOb:
PROC [comm: CDSequencer.Command, ob:
CD.Object, failMessage: Rope.
ROPE←
NIL];
--Includes object into design and makes (always!) a message
--failMessage: output if ob is NIL
--Trivial procedure, but used often enough
RegisterCommanderNewDesign:
PROC [technology:
CD.Technology];
--Registers a commander command to create a new design
END.