-- TSTypesImpl.mesa -- Michael Plass DIRECTORY TSTypes, Real USING [RoundI]; TSTypesImpl: PROGRAM IMPORTS Real EXPORTS TSTypes = BEGIN OPEN TSTypes; DimnInt: PUBLIC PROCEDURE [num,denom: Dimn] RETURNS [INTEGER] = BEGIN t:REAL←num.texPts/denom.texPts; s:INTEGER ← 1; IF t<0 THEN {t ← -t; s ← -s}; IF t<=LAST[NAT] THEN RETURN[s*Real.RoundI[t]] ELSE RETURN[s*LAST[NAT]] END; END.