IPConvert.mesa
Last edited by:
Doug Wyatt, March 23, 1983 2:57 pm
DIRECTORY
IPBasic USING [Any, Identifier, Integer, maxInteger, Number, Operator, Vector];
IPConvert:
CEDAR
DEFINITIONS
= BEGIN OPEN IPBasic;
RealToInteger: PROC[REAL] RETURNS[Integer];
IntegerToReal: PROC[i: Integer] RETURNS[REAL] = INLINE { RETURN[i] };
NumberToInteger:
PROC[x: Number]
RETURNS[Integer] =
INLINE {
RETURN[
WITH x: x SELECT FROM int => x.i, real => RealToInteger[x.r], ENDCASE => ERROR] };
NumberToReal:
PROC[x: Number]
RETURNS[
REAL] =
INLINE {
RETURN[
WITH x: x SELECT FROM int => IntegerToReal[x.i], real => x.r, ENDCASE => ERROR] };
IntegerToNumber: PROC[i: Integer] RETURNS[Number] = INLINE { RETURN[[int[i]]] };
RealToNumber: PROC[r: REAL] RETURNS[Number] = INLINE { RETURN[[real[r]]] };
IntToNumber:
PROC[i:
INT]
RETURNS[Number] =
INLINE {
RETURN[
IF i IN[0..maxInteger] THEN [int[i]] ELSE [real[i]]] };
AnyToNumber: PROC[Any] RETURNS[Number];
AnyToReal: PROC[Any] RETURNS[REAL];
AnyToInteger: PROC[Any] RETURNS[Integer];
AnyToIdentifier: PROC[Any] RETURNS[Identifier];
AnyToVector: PROC[Any] RETURNS[Vector];
AnyToOperator: PROC[Any] RETURNS[Operator];
NumberToAny: PROC[Number] RETURNS[Any];
RealToAny: PROC[REAL] RETURNS[Any];
IntegerToAny: PROC[Integer] RETURNS[Any];
IdentifierToAny: PROC[Identifier] RETURNS[Any];
VectorToAny: PROC[Vector] RETURNS[Any];
OperatorToAny: PROC[Operator] RETURNS[Any];
END.