-- String.mesa (last edited by: Forrest on: May 19, 1980 4:27 PM) --
DIRECTORY
Environment: FROM "Environment";
String: DEFINITIONS =
BEGIN
StringHeaderSize: CARDINAL = 2;
CharsPerWord: CARDINAL = Environment.charsPerWord;
charlength: CARDINAL = Environment.bitsPerCharacter;
CharsPerPage: CARDINAL = Environment.charsPerPage;
LogCharsPerPage: CARDINAL = Environment.logCharsPerPage;
SubStringDescriptor: TYPE = RECORD [
base: STRING, offset, length: CARDINAL];
SubString: TYPE = POINTER TO SubStringDescriptor;
Overflow: SIGNAL;
InvalidNumber: SIGNAL;
StringBoundsFault: SIGNAL [s: STRING] RETURNS [ns: STRING];
WordsForString: PROCEDURE [nchars: CARDINAL] RETURNS [CARDINAL];
AppendChar: PROCEDURE [s: STRING, c: CHARACTER];
AppendString: PROCEDURE [to: STRING, from: STRING];
EqualString, EquivalentString: PROCEDURE [s1, s2: STRING] RETURNS [BOOLEAN];
EqualStrings, EquivalentStrings: PROCEDURE [s1, s2: STRING] RETURNS [BOOLEAN];
CompareStrings: PROCEDURE [s1, s2: STRING, ignoreCase: BOOLEAN ← TRUE] RETURNS [INTEGER];
-- -1 => less, 0 => equal, 1 => greater
AppendSubString: PROCEDURE[to: STRING, from: SubString];
EqualSubStrings, EquivalentSubStrings: PROCEDURE [s1, s2: SubString] RETURNS [BOOLEAN];
EqualSubString, EquivalentSubString: PROCEDURE [s1, s2: SubString] RETURNS [BOOLEAN];
DeleteSubString: PROCEDURE [s: SubString];
UpperCase, LowerCase: PROCEDURE [CHARACTER] RETURNS [CHARACTER];
-- routines for converting between strings and numbers
StringToDecimal: PROCEDURE [STRING] RETURNS [INTEGER];
StringToOctal: PROCEDURE [STRING] RETURNS [UNSPECIFIED];
StringToNumber: PROCEDURE [s: STRING, radix: CARDINAL] RETURNS [UNSPECIFIED];
StringToLongNumber: PROCEDURE [s: STRING, radix: CARDINAL] RETURNS [LONG UNSPECIFIED];
AppendNumber: PROCEDURE [s: STRING, n: CARDINAL, radix: CARDINAL];
AppendDecimal: PROCEDURE [s: STRING, n: INTEGER];
AppendOctal: PROCEDURE [s: STRING, n: UNSPECIFIED];
AppendLongNumber: PROCEDURE [s: STRING, n: LONG UNSPECIFIED, radix: CARDINAL];
AppendLongDecimal: PROCEDURE [s: STRING, n: LONG INTEGER];
END.
LOG
Time: May 23, 1979 11:57 AMBy: LauerAction: Created file by copying and editing Mesa>System>StringDefs.mesa
Time: January 25, 1980 8:33 PMBy: ForrestAction: Deleted BCPL Routines
-- routines for bcpl strings
bcplStringHeaderSize: CARDINAL = 1;
bcplMaxLength: CARDINAL = 255;
bcplSTRING: TYPE = MACHINE DEPENDENT RECORD[
SELECT OVERLAID * FROM
length => [length: [0..bcplMaxLength], body: CHARACTER],
characters => [char: PACKED ARRAY [-1..bcplMaxLength) OF CHARACTER],
ENDCASE];
bcplStringOverflow, mesaStringOverflow: SIGNAL;
WordsForBcplString: PROCEDURE [nchars: CARDINAL] RETURNS [CARDINAL];
MesaToBcplString: PROCEDURE [s: STRING, t: POINTER TO bcplSTRING];
BcplToMesaString: PROCEDURE [t: POINTER TO bcplSTRING, s: STRING];
Time: May 19, 1980 4:27 PMBy: ForrestAction: Added CompareString
Time: timeStampBy: yourNameAction: shortDescription