CDDefaultsImpl.mesa (part of ChipNDale)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 11, 1983 11:32 am
last edited by Christian Jacobi, March 30, 1985 3:52:03 pm PST
DIRECTORY
CD,
CDDefaults,
CDDefaultsExtras,
CDPrivate,
CDProperties,
CDValue;
CDDefaultsImpl:
CEDAR
PROGRAM
IMPORTS CDPrivate, CDProperties, CDValue
EXPORTS CDDefaults, CDDefaultsExtras =
BEGIN
CurrentLayer:
PUBLIC
PROC [design:
CD.Design]
RETURNS [
CD.Layer] =
BEGIN
RETURN [CDValue.FetchInt[boundTo: design, key: $CurrentLayer, propagation: technology]]
END;
SetCurrentLayer:
PUBLIC
PROC [design:
REF, layer:
CD.Layer] =
BEGIN
CDValue.StoreInt[boundTo: design, key: $CurrentLayer, value: layer]
END;
--design can exceptionally be a technology to set default values
--reserve call for CDPanelImpl; otherwise CDPanel gets fooled
LayerWidth:
PUBLIC
PROC [design:
CD.Design, layer:
CD.Layer]
RETURNS [
CD.Number] =
BEGIN
RETURN [CDValue.FetchInt[boundTo: design, key: CDPrivate.layers[layer].globalUniqueKey, propagation: technology]]
END;
SetLayerWidth:
PUBLIC
PROC [design:
REF, layer:
CD.Layer, width:
CD.Number] =
BEGIN
CDValue.StoreInt[boundTo: design, key: CDPrivate.layers[layer].globalUniqueKey, value: width]
END;
-- design can exceptionally be a technology to set default values
-- reserve call for CDPanelImpl; otherwise CDPanel gets fooled
Substitute:
PUBLIC
PROC [abstract:
CD.Layer, pure:
CD.Layer] =
--only technology implementor should call this procedure
BEGIN
CDProperties.PutPropOnLayer[onto: abstract, prop: privateProp, val: CDPrivate.layers[pure]]
END;
PureLayer:
PUBLIC
PROC [layer:
CD.Layer]
RETURNS [
CD.Layer] =
--returns corresponding real layer
--usage: given layer as control panel value, this returns mask layer to be used
--for cases which do not accept abstract layers
BEGIN
WITH CDProperties.GetPropFromLayer[from: layer, prop: privateProp]
SELECT
FROM
lp: CDPrivate.LayerRef => RETURN [lp.number];
ENDCASE => RETURN [layer];
END;
privateProp: REF INT ← NEW[INT];
CDValue.EnregisterKey[key: $CurrentLayer, boundTo: NIL];
FOR l:
CD.Layer
IN
CD.Layer
DO
[] ← CDValue.EnregisterKey[CDPrivate.layers[l].globalUniqueKey];
ENDLOOP;
END.