INTERFACE Mis; (* This interface contain "miscelaneus" procedures reused without extensive modifications, created by J. Stolfi and R. Marcone. See the copyright and authorship futher down. *) IMPORT Wr, Rd, LR4, R3, LR3, Random, Lex; TYPE Point = LR4.T; CONST Boole = ARRAY BOOLEAN OF CHAR {'F', 'T'}; AlphaChars = SET OF CHAR{'\t', '\n', '\r', '\f', ' ', 'A'..'Z', 'a'..'z'}; PROCEDURE InitLongReal(coins: Random.T; radius: REAL): LONGREAL; (* Return one real value between [-radius, +radius]. *) PROCEDURE WriteLong(wr: Wr.T; x: LONGREAL); (* Write one longreal value with "fixed" format. *) PROCEDURE WriteInt(wr: Wr.T; x: INTEGER); (* Write one integer value . *) PROCEDURE WriteCoord(wr: Wr.T; x: LONGREAL); (* Write one longreal value with "scientific" format. *) PROCEDURE WritePoint(wr: Wr.T; READONLY c: LR4.T); (* Write 4D point with "scientific" format. *) PROCEDURE WritePoint3D(wr: Wr.T; READONLY c: LR3.T); (* Write 3D point with "scientific" format. *) PROCEDURE WriteIntensity(wr: Wr.T; r: REAL); (* Write one component color (real value) between 0-1. *) PROCEDURE WriteColor(wr: Wr.T; READONLY c: R3.T); (* Write colors in RGB mode. *) PROCEDURE WriteRadius(wr: Wr.T; r: REAL); (* Write one value Real. *) PROCEDURE WriteCommentsJS(wr: Wr.T; comments: TEXT; prefix: CHAR); (* Writes the given "comments" text to "wr", with a "prefix" character and a blank in front of every line. Supplies a final '\n' if the text is non-empty but does not end with newline. *) PROCEDURE ReadBool(rd: Rd.T): BOOLEAN RAISES {Lex.Error}; (* Read one boolean value. *) PROCEDURE ReadCommentsJS(rd: Rd.T; prefix: CHAR): TEXT; (* Read the comments writes by the WriteCommentsJS procedure. *) PROCEDURE NumDigits(n: CARDINAL): CARDINAL; (* Compute the number of digits of one cardinal value. *) PROCEDURE InsertionSort(n: CARDINAL; VAR a: REF ARRAY OF INTEGER ); (* sort n+1 integer values by InsertionSort *) PROCEDURE Sort(n: CARDINAL; VAR a: REF ARRAY OF CARDINAL); (* sort n+1 integer values by InsertionSort *) PROCEDURE Today(): TEXT; (* Print the date and time *) END Mis. (* ***************** START OF COPYRIGHT AND AUTHORSHIP NOTICE ********** All files in this directory tree are Copyright 1996 by Jorge Stolfi, Rober Marcone Rosi, and Universidade Estadual de Campinas, Brazil--- unless stated otherwise in the files themselves. THESE FILES ARE DISTRIBUTED WITH NO GUARANTEE OF ANY KIND. Neither the authors nor their employers may be held responsible for any losses or damages attributed to their use. These files may be freely copied, distributed, modified, and used for any purpose; provided that any subtantial excerpt of these files that is redistributed or incorporated in other software packages is accompanied by this copyright and authorship notice, and is made freely available under these same terms. ***************** END OF COPYRIGHT AND AUTHORSHIP NOTICE ************ *)