-- File DJExtMergeDefs.mesa
-- Written by Martin Newell, June 1980
-- Last updated: July 24, 1981 3:15 PM

DIRECTORY
DJExtTypes: FROM "DJExtTypes" USING [NodeNumber];

DJExtMergeDefs: DEFINITIONS =
BEGIN
OPEN DJExtTypes;

InitMerge: PUBLIC PROCEDURE [];
-- Initialize merge table

FinishMerge: PUBLIC PROCEDURE;
-- Close files and release structures

GenNodeNumber: PUBLIC PROCEDURE RETURNS[n: NodeNumber];
-- Generate new node number

ReserveNodeNumbers: PUBLIC PROCEDURE [n: NodeNumber];
-- Reserves node numbers 1 through n

Merge: PUBLIC PROCEDURE [n1,n2: NodeNumber] RETURNS[r: NodeNumber];
--Merge numbers n1 and n2 towards smaller of the two
--Returns resulting value of Lookup[n1] (=Lookup[n2])

Lookup: PUBLIC PROCEDURE[n1: NodeNumber] RETURNS[n2: NodeNumber];
--Return smallest number to which n1 has been merged, transitively closed
--Can be called before FinishMerge
--Cannot be called after LookSmall

LookSmall: PUBLIC PROCEDURE[n: NodeNumber] RETURNS[r: NodeNumber];
--Return smallest number it can assign to n

GetSmall
: PUBLIC PROCEDURE RETURNS[NodeNumber];
--Return smallest number assigned

IsSmall
: PUBLIC PROCEDURE[n: NodeNumber] RETURNS[BOOLEAN];
--Return true if it has been assigned a small number

PutProp
: PUBLIC PROCEDURE[n: NodeNumber, prop:LONG UNSPECIFIED];
--attach prop to node number n

GetProp
: PUBLIC PROCEDURE[n: NodeNumber] RETURNS[LONG UNSPECIFIED];
--get the prop that has been attached to n.

MergeError: PUBLIC ERROR[reason: STRING];


END.