strings.def 733 B

123456789101112131415161718192021
  1. DEFINITION MODULE Strings;
  2. (* Bounded string operations over descriptor strings (classic
  3. Modula-2 form). Sources are [0..] indexed; destinations are
  4. truncated to fit (never overrun). *)
  5. PROCEDURE Length(VAR s : ARRAY OF CHAR) : INTEGER;
  6. (* Number of characters in s. *)
  7. PROCEDURE Assign(VAR src, dst : ARRAY OF CHAR);
  8. (* Copies src into dst (truncated to dst's capacity). *)
  9. PROCEDURE Concat(VAR s1, s2 : ARRAY OF CHAR; VAR dst : ARRAY OF CHAR);
  10. (* dst := s1 followed by s2 (truncated to fit). *)
  11. PROCEDURE Compare(VAR s1, s2 : ARRAY OF CHAR) : INTEGER;
  12. (* <0, 0 or >0 as s1 is less than, equal to, or greater than s2. *)
  13. PROCEDURE Copy(VAR src, dst : ARRAY OF CHAR);
  14. (* Alias for Assign, ISO-style name. *)
  15. END Strings.