CoreWireImpl.mesa
Created by Don Curry, February 1, 1986 2:43:22 pm PST
Edited by Don Curry, March 26, 1986 7:37:24 am PST
CoreWireImpl:
CEDAR
PROGRAM
IMPORTS CoreOps, CoreName, CoreWire, CoreXform
EXPORTS CoreWire =
BEGIN OPEN CoreWire;
Signal: SIGNAL = CODE;
f:
PUBLIC
PROC[wire: CWire, name:
ROPE]
RETURNS[subWire: CWire] = {
index: INT ← CoreOps.GetWireIndex[wire.w, name];
RETURN[IF index=-1 OR wire.w.size<(index+1) THEN [NIL] ELSE [wire.w[index]]]};
i:
PUBLIC
PROC[wire: CWire, index:
INT]
RETURNS[subWire: CWire] = {
RETURN[
IF index=-1
OR wire=
NIL
OR wire.w.size<(index+1)
THEN [NIL]
ELSE [wire.w[index]]]};
x:
PUBLIC
PROC[wire: CWire, index:
INT]
RETURNS[subWire: CWire] = {
wireXform: CoreXform.Xform ← CoreXform.GetXform[wire.w];
addr: CoreXform.Addr;
IF wireXform=
NIL
THEN
RETURN[IF wire=NIL THEN [NIL] ELSE IF wire.size=0 THEN wire ELSE wire.i[index] ];
addr ← CoreXform.XformIndex[wireXform, rl, index].a;
FOR addr ← addr, addr.rest
WHILE addr#
NIL
DO
IF wire.size=0 THEN EXIT;
wire ← wire.i[ addr.first ] ENDLOOP;
RETURN[wire]};
n:
PUBLIC
PROC[wire: CWire]
RETURNS[name:
ROPE] =
{RETURN[ CoreName.WireNm[ wire.w ].n ]};
END.