-- TestTree.Text
-- written by Bill Paxton, May 1981
-- last edit by Bill Paxton, 20-May-81 10:26:13
CheckTrees: PROC [t1,t2: editI.Ref] = { -- ERROR if trees not equal
x1, x2: editI.Ref;
WITH n1:t1 SELECT FROM
text => WITH n2:t2 SELECT FROM
text => { -- must have same text&looks
size: Card ← editI.Size[@n1];
IF editI.Size[@n2] # size THEN ERROR;
CheckRopes[n1.rope,0,n2.rope,0,size];
CheckRuns[n1.runs,0,n2.runs,0,size] };
ENDCASE => ERROR;
other => WITH n2:t2 SELECT FROM
other => NULL;
ENDCASE => ERROR;
ENDCASE => ERROR;
IF t1.typename # t2.typename THEN ERROR;
IF (t1.hasstyle OR t2.hasstyle) AND propsI.GetStyleName[t1]#propsI.GetStyleName[t2]
THEN ERROR;
x1 ← t1.child; x2 ← t2.child;
DO -- check children
IF x1=NIL THEN IF x2=NIL THEN RETURN ELSE ERROR;
IF x2=NIL THEN ERROR;
CheckTrees[x1,x2];
x1 ← nodeI.Next[x1]; x2 ← nodeI.Next[x2];
ENDLOOP };
END.