This interface defines operations on strings of 8-bit CHARs.
They are represented by address of the first character of
the string and the string's length in characters.
INTERFACEString8 ; PROCEDURE Equal (a, b: ADDRESS; len: CARDINAL): BOOLEAN;
ReturnTRUEif the strings oflencharacters starting ataandbhave the same (case-sensitive) contents.
PROCEDURE Compare (a: ADDRESS; len_a: CARDINAL;
b: ADDRESS; len_b: CARDINAL): [-1..1];
Return-1if stringaoccurs before stringb,0if the strings are equal, and+1ifaoccurs afterbin lexicographic order.
PROCEDURE Hash (a: ADDRESS; len: CARDINAL; initial: INTEGER): INTEGER;
Return a hash function of the contents of stringastarting with the valueinitial.
PROCEDURE FindChar (a: ADDRESS; len: CARDINAL; c: CHAR): INTEGER;
Ifc = a[i]for someiin[0~..~len-1], return the smallest suchi; otherwise, return-1.
PROCEDURE FindCharR (a: ADDRESS; len: CARDINAL; c: CHAR): INTEGER;
Ifc = a[i]for someiin[0~..~len-1], return the largest suchi; otherwise, return-1.
PROCEDURE ArrayStart (READONLY a: ARRAY OF CHAR): ADDRESS;
Returns the address of the first character ofaif it is non-empty, otherwise returnsNIL. WARNING: the returned address is only valid as long asadoes not move. To prevent heap allocated arrays from moving, keep the returned address on the stack.
END String8.