-- LongString.Mesa Last edited by Johnsson on 5-Dec-80 14:57:46 DIRECTORY Environment USING [bitsPerCharacter, charsPerPage, charsPerWord, logCharsPerPage]; LongString: DEFINITIONS = BEGIN bitsPerCharacter: CARDINAL = Environment.bitsPerCharacter; charsPerPage: CARDINAL = Environment.charsPerPage; charsPerWord: CARDINAL = Environment.charsPerWord; logCharsPerPage: CARDINAL = Environment.logCharsPerPage; SubStringDescriptor: TYPE = RECORD [base: LONG STRING, offset, length: CARDINAL]; SubString: TYPE = POINTER TO SubStringDescriptor; Overflow: SIGNAL; InvalidNumber: SIGNAL; StringBoundsFault: SIGNAL [s: LONG STRING] RETURNS [ns: LONG STRING]; WordsForString: PROCEDURE [nchars: CARDINAL] RETURNS [CARDINAL]; AppendChar: PROCEDURE [s: LONG STRING, c: CHARACTER]; AppendString: PROCEDURE [to: LONG STRING, from: LONG STRING]; EqualStrings, EquivalentStrings: PROCEDURE [s1, s2: LONG STRING] RETURNS [BOOLEAN]; EqualString: PROCEDURE [s1, s2: LONG STRING] RETURNS [BOOLEAN] = INLINE { RETURN[EqualStrings[s1, s2]]}; EquivalentString: PROCEDURE [s1, s2: LONG STRING] RETURNS [BOOLEAN] = INLINE { RETURN[EquivalentStrings[s1, s2]]}; CompareStrings: PROCEDURE [s1, s2: LONG STRING, ignoreCase: BOOLEAN ← TRUE] RETURNS [INTEGER]; -- -1 => less, 0 => equal, 1 => greater AppendSubString: PROCEDURE [to: LONG STRING, from: SubString]; EqualSubStrings, EquivalentSubStrings: PROCEDURE [s1, s2: SubString] RETURNS [BOOLEAN]; EqualSubString: PROCEDURE [s1, s2: SubString] RETURNS [BOOLEAN] = INLINE { RETURN[EqualSubStrings[s1, s2]]}; EquivalentSubString: PROCEDURE [s1, s2: SubString] RETURNS [BOOLEAN] = INLINE { RETURN[EquivalentSubStrings[s1, s2]]}; DeleteSubString: PROCEDURE [s: SubString]; UpperCase, LowerCase: PROCEDURE [c: CHARACTER] RETURNS [CHARACTER]; -- routines for converting between strings and numbers StringToNumber: PROCEDURE [s: LONG STRING, radix: CARDINAL ← 10] RETURNS [UNSPECIFIED]; StringToDecimal: PROCEDURE [s: LONG STRING] RETURNS [INTEGER] = INLINE BEGIN RETURN[StringToNumber[s, 10]] END; StringToOctal: PROCEDURE [s: LONG STRING] RETURNS [UNSPECIFIED] = INLINE BEGIN RETURN[StringToNumber[s, 8]]; END; StringToLongNumber: PROCEDURE [s: LONG STRING, radix: CARDINAL ← 10] RETURNS [LONG UNSPECIFIED]; AppendNumber: PROCEDURE [s: LONG STRING, n: UNSPECIFIED, radix: CARDINAL ← 10]; AppendDecimal: PROCEDURE [s: LONG STRING, n: INTEGER]; AppendOctal: PROCEDURE [s: LONG STRING, n: UNSPECIFIED]; AppendLongNumber: PROCEDURE [s: LONG STRING, n: LONG UNSPECIFIED, radix: CARDINAL ← 10]; AppendLongDecimal: PROCEDURE [s: LONG STRING, n: LONG INTEGER]; END.