(* Copyright (C) 1989, Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* File: String.i3 *) (* Last modified on Sat Feb 24 01:03:39 1990 by muller *) (* modified on Wed Jan 10 09:32:59 1990 by kalsow *) INTERFACE String; IMPORT Wr, Text; TYPE T <: ADDRESS; TYPE QID = RECORD module, item: T END; TYPE Stack = RECORD top: INTEGER; stk: ARRAY [0..99] OF T; END; PROCEDURE Add (x: Text.T; length: INTEGER := 999999): T; (* Returns the a string equal to 'x' *) PROCEDURE AddInt (i: INTEGER): T; (* Returns the a string equal to decimal representation of i *) PROCEDURE FromStr (READONLY buf: ARRAY OF CHAR; length: INTEGER := 99999): T; (* Returns a string equal to buf[0 .. MIN(HIGH(buf), length-1)]. *) PROCEDURE Concat (a, b: T): T; (* Returns the concatenation of two strings *) PROCEDURE Unique (root: T): T; (* Returns root appended with a unique integer *) PROCEDURE ToText (t: T): Text.T; (* Returns a text equal to t *) PROCEDURE Put (wr: Wr.T; t: T); (* writes the string on the writer *) PROCEDURE PutChars (wr: Wr.T; t: T); (* writes the string as a list of characters on the writer *) PROCEDURE PutStack (wr: Wr.T; s: Stack); (* writes the strings of stack on the writer *) PROCEDURE SetClass (t: T; class: CARDINAL); (* puts the string into its own syntactic class *) PROCEDURE GetClass (t: T): INTEGER; (* returns the assigned class *) PROCEDURE Length (t: T): INTEGER; (* returns the length of the string *) PROCEDURE GetUID (t: T): INTEGER; (* returns the string's UID *) PROCEDURE SetUID (t: T; uid: INTEGER); (* sets the string's UID *) PROCEDURE Initialize (); END String.