M3ID.Trepresents a Modula-3 identifier. Equal identifiers are represented by the same M3ID.T. Any non-NULL character may be included in an
IMPORT M3Buf; TYPE T = [-16_7fffffff-1 .. 16_7fffffff]; (* a 32-bit integer *) CONST NoID = 0; (* an illegal ID, never returned by Add or FromStr *) PROCEDURE Add (x: TEXT; class: [0..255] := 0): T;
Returns the ID representing
xand sets the class of the ID to
PROCEDURE FromStr (READONLY buf: ARRAY OF CHAR; length: INTEGER := 99999): T;
Returns the ID representing buf[0 .. MIN(HIGH(buf), length-1)].
PROCEDURE ToText (t: T): TEXT;
Returns a text equal to the one
PROCEDURE GetClass (t: T): INTEGER;
Returns the class assigned to
PROCEDURE Hash (t: T): INTEGER;
Returns the hash value of
PROCEDURE Put (wr: M3Buf.T; t: T);
== M3Buf.PutText (ToText(t)), without the implied TEXT allocation
PROCEDURE AdvanceMarks ();
start using a
newset of marks. They're recycled after 256 advances.
PROCEDURE SetMark (t: T): BOOLEAN;
SetMark(t)hash been called since the last call to
AdvanceMarks. There's a chance for false positives, so clients must be prepared to check that
twas indeed marked twice.
PROCEDURE IsLT (a, b: T): BOOLEAN;
TRUEif the text represented by
ais lexicographically less than the one represented by