| 1234567891011121314151617181920212223242526272829 |
- DEFINITION MODULE Strings;
- (* Bounded string operations over descriptor strings (classic
- Modula-2 form). Sources are [0..] indexed; destinations are
- truncated to fit (never overrun). *)
- PROCEDURE Length(VAR s : ARRAY OF CHAR) : INTEGER;
- (* Number of characters in s. *)
- PROCEDURE Assign(VAR src, dst : ARRAY OF CHAR);
- (* Copies src into dst (truncated to dst's capacity). *)
- PROCEDURE Concat(VAR s1, s2 : ARRAY OF CHAR; VAR dst : ARRAY OF CHAR);
- (* dst := s1 followed by s2 (truncated to fit). *)
- PROCEDURE Compare(VAR s1, s2 : ARRAY OF CHAR) : INTEGER;
- (* <0, 0 or >0 as s1 is less than, equal to, or greater than s2. *)
- PROCEDURE Delete(VAR s : ARRAY OF CHAR; start, count : INTEGER);
- (* Removes count characters from s, beginning at position start. *)
- PROCEDURE Append(VAR src, dst : ARRAY OF CHAR);
- (* Appends src to dst. NOTE: dst is an open array whose descriptor
- count is the logical length, so appending past it traps until the
- string model separates length from capacity. *)
- PROCEDURE Copy(VAR src, dst : ARRAY OF CHAR);
- (* Alias for Assign, ISO-style name. *)
- END Strings.
|