EqualCheckImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
EdMcCreight (EMM) March 28, 1986 10:30:16 am PST
DIRECTORY
AMBridge, AMTypes, EqualCheck, Rope;
EqualCheckImpl: CEDAR PROGRAM IMPORTS AMBridge, AMTypes EXPORTS EqualCheck = BEGIN
FindDif: PUBLIC PROC [ a, b: REF ANY ] RETURNS [ fieldNames: LIST OF Rope.ROPE ] =
NIL means no difference
BEGIN
tva, tvb: AMTypes.TV;
typea: AMTypes.Type;
TRUSTED {
tva ← AMBridge.TVForReferent[a, readOnly];
tvb ← AMBridge.TVForReferent[b, readOnly];
};
typea ← AMTypes.TVType[tva];
IF AMTypes.TVType[tvb] # typea THEN ERROR;
fieldNames ← NIL;
FOR i: AMTypes.Index DECREASING IN [1..AMTypes.NComponents[typea]] DO
tvac: AMTypes.TV = AMTypes.IndexToTV[tva, i];
tvbc: AMTypes.TV = AMTypes.IndexToTV[tvb, i];
IF NOT AMTypes.TVEqual[tvac, tvbc] THEN fieldNames ← CONS[AMTypes.IndexToName[typea, i], fieldNames];
ENDLOOP;
END;
END.