home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1988-02-13 | 3.7 KB | 97 lines |
- DEFINITION MODULE Text;
-
-
- (* This package defines the String80 abstract data type and lists *)
- (* the operations possible on Text.String objects. Note that the *)
- (* Text.String data type is defined as ARRAY [0..n] OF CHAR, where *)
- (* n is the largest possible length of the string. Since the *)
- (* length of a string may vary dynamically, strings are terminated *)
- (* by the Null character. *)
- (* *)
- (* Note: Since all strings have the same representation regardless *)
- (* of length, the operations provided by this module may be used *)
- (* on strings of any length. *)
-
-
- TYPE String80 = ARRAY [0..80] OF CHAR;
- TYPE StringPtr = POINTER TO String80;
-
- (* These types define a varying length string with a maximum *)
- (* length of 80 characters. *)
-
-
- PROCEDURE Length ( VAR Source : (* IN *) ARRAY OF CHAR ) : CARDINAL;
-
- (* Return the current length of the string. *)
-
-
- PROCEDURE Assign (
- VAR Source : (* IN *) ARRAY OF CHAR;
- VAR Destination : (* OUT *) ARRAY OF CHAR );
-
- (* Assign the source string to the destination. If the *)
- (* length of source exceeds the length of Destination, *)
- (* the source string is truncated. *)
-
-
- TYPE CompareResult = ( LessThan, Equal, GreaterThan );
-
- PROCEDURE Compare (
- VAR LeftString : (* IN *) ARRAY OF CHAR;
- VAR RightString : (* IN *) ARRAY OF CHAR ) : CompareResult;
-
- (* Compare the contents of LeftString with that of RightString *)
- (* using the ASCII collating sequence. *)
-
-
- PROCEDURE SliceChar (
- VAR Source : (* IN *) ARRAY OF CHAR;
- Position : (* IN *) CARDINAL;
- VAR Result : (* OUT *) CHAR ) : BOOLEAN;
-
- (* Slice the character indicated by Position out of the string *)
- (* contained in Source. This routine returns FALSE if the *)
- (* position exceeds the current length of the String, or TRUE *)
- (* otherwise. *)
-
-
- PROCEDURE SliceString (
- VAR Source : (* IN *) ARRAY OF CHAR;
- Start : (* IN *) CARDINAL;
- Stop : (* IN *) CARDINAL;
- VAR Result : (* OUT *) ARRAY OF CHAR ) : BOOLEAN;
-
- (* Slice the string indicated by the range Start..Stop from *)
- (* the source string. This routine returns FALSE if Start is *)
- (* greater than Stop, if Stop exceeds the current length of *)
- (* the string, or if the slice length exceeds the length of *)
- (* Result. Otherwise, TRUE is returned. *)
-
-
- PROCEDURE ConcatChar (
- VAR Source : (* IN *) ARRAY OF CHAR;
- Character : (* IN *) CHAR;
- VAR Result : (* OUT *) ARRAY OF CHAR ) : BOOLEAN;
-
- (* Concatenate Character onto the end of Source. This routine *)
- (* returns FALSE if the resulting string exceeds the length of *)
- (* Result, or TRUE otherwise. *)
-
-
- PROCEDURE ConcatString (
- VAR LeftString : (* IN *) ARRAY OF CHAR;
- VAR RightString : (* IN *) ARRAY OF CHAR;
- VAR Result : (* OUT *) ARRAY OF CHAR ) : BOOLEAN;
-
- (* Concatenate RightString onto the end of LeftString. This *)
- (* routine returns FALSE is the resulting string exceeds the *)
- (* length of Result, or TRUE otherwise. *)
-
-
- PROCEDURE UpperCase ( VAR String : (* IN *) ARRAY OF CHAR );
-
- (* Convert a string into all uppercase *)
-
-
- END Text.
-