CDSatellites.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Created by: Christian Jacobi August 29, 1986 6:14:13 pm PDT
based on ideas from Louis Monier and Christian Jacobi
a previous version by Pradeep Sindhu, December 20, 1985 1:22:54 pm PST
Last edited by: Pradeep Sindhu, February 20, 1986 1:37:22 pm PST
Last edited by: Bertrand Serlet, August 19, 1986 11:44:28 am PDT
Last edited by: Jean-Marc Frailong, July 28, 1986 6:46:31 pm PDT
Last edited by: Christian Jacobi, September 1, 1986 12:34:37 pm PDT
DIRECTORY
CD USING [Instance, InstanceList],
Rope USING [ROPE];
CDSatellites: CEDAR DEFINITIONS =
BEGIN
A satellite is a text CD.Instance associated with another CD.Instance called the
satellite's master. A master along with its satellites forms a satellite group. It
is useful to think of satellites simply as visible properties attatched to the
master. However, three things distinguish satellites from ordinary properties:
1) satellites are always visible,
2) the user can control their looks and placement to suit his taste, and
3) satellites are untyped—as far as clients are concerned satellites are simply
pieces of text.
The containing cell or design can also be designated as master.
Restriction: Text objects of certain fonts may be ignored if used as satellites; this
allows the implementation to speed up computation of the invariants.
All procedures assume the caller has ChipNDale's lock on the design (CDSequencer).
There are two internal invariants of objects maintained by this package,
called the strong and the weak invariant. The strong invariant implies
the weak invariant. The invariants will stay valid until any change
of the objects are made.
"Design" in context of this package always means the real top of design,
not the pushed in cell.
GetSatellites: PROC [from: REF] RETURNS [sats: CD.InstanceList];
Returns the satellites of from, where from is a design, an object (in directory),
or an instance. The returned instance list is readonly; (the instances may be
the ones used by a cell or design).
If from is an object
Enforces the strong invariant in object, one level deep
Caches the result
If from is a design
Enforces the strong invariant in the designs top level
If from is instance
Caller must have enforced the strong invariant of containing cell or design.
Enforceing the invariants and caching is not considered a change by ChipNDale.
GetMaster: PROC [cell: REF, text: CD.Instance] RETURNS [master: REF];
Returns the master of a satellite text; you must treat it readonly
Enforces the strong invariant in cell, one level deep
master: the master; NIL, instance, object, or design.
cell: design or cell
text: text instance; must be an instance used in cell
Relatively slow (not cached)
Associate: PROC [master: REF, text: CD.Instance←NIL];
Associates or changes association of a text to a master as satellite.
Important:
This procedure changes the environment! It can not notify the change
directly. The caller must also call CDDirectory.PropagateChange if
the environment is a cell, respectively CDSequencer.MarkChanged
if it is a design.
master:
Non-text CD.Instance: text gets instance satellite of master
master and text must be instance of of same cell or design
CD.Object, CD.Design: text gets object satellite of master
text must be instance of master
NIL: previous association of text is removed
text: text instance; a NIL instance removes all satellites of master
Invariants:
If for the environment of the text either the strong or the weak invariant
invariant is true at the beginning, only the weak invariant will be true at
the end. If neither of the invariants are true at the beginning, none will
be true at the end, and there is a small probability that (even previous!!)
changes of the environment might confuse the association.
Rational: allows multiple edits before reinstallation of invariants; doesn't
incrementally keep invariants because this is typically combined with
editing operations for which the invariants have to be completelely
reinstalled anyway.
IsAssociated: PROC [any: REF, inst: CD.Instance] RETURNS [BOOL];
Returns whether inst is satellite of any, (any is satellite of inst), or both
any and inst are satellites of the same master.
Does not change invariants.
If the strong or the weak invariance is true for the environmet of inst,
the returned result is guaranteed; otherwise there is a small probability
that (even previous!!) changes of the environment might cause confusion.
GetSatelliteRopes: PROC [from: REF, filter: FilterProc ← StandardFilter] RETURNS [ropes: LIST OF Rope.ROPE];
Convenience proc that returns the list of satellite ropes
from and invariants: exactly as in GetSatellites.
filter: if returns false, this satellite is not seen;
a NIL filter means use all instances
FilterProc: TYPE = PROC [inst: CD.Instance] RETURNS [useIt: BOOLTRUE];
StandardFilter: PROC [inst: CD.Instance] RETURNS [useIt: BOOL];
Returns "instance is to be considered a satellite"
[By looking at font and layer: italic fonts are filtered out,
but they still can be used in the Instance level procedures]
END.