ComplexJaM.mesa
Written by Michael Plass, 29-Sep-81
Last edit by Michael Plass, December 2, 1982 11:03 am
Makes complex functions visible to JaM
DIRECTORY
Complex,
JaMFnsDefs USING [PushReal, GetReal, Register];
ComplexJaM: PROGRAM IMPORTS Complex, JaMFnsDefs =
BEGIN OPEN JaMFnsDefs;
PushVec:
PROCEDURE [v:Complex.Vec] =
BEGIN
PushReal[v.x];
PushReal[v.y];
END;
PopVec:
PROCEDURE
RETURNS [Complex.Vec] =
BEGIN
y:REAL ← GetReal[];
x:REAL ← GetReal[];
RETURN[[x,y]];
END;
CAdd: PROCEDURE = {b:Complex.Vec ← PopVec[]; PushVec[Complex.Add[PopVec[],b]]};
CSub: PROCEDURE = {b:Complex.Vec ← PopVec[]; PushVec[Complex.Sub[PopVec[],b]]};
CMul: PROCEDURE = {b:Complex.Vec ← PopVec[]; PushVec[Complex.Mul[PopVec[],b]]};
CDiv: PROCEDURE = {b:Complex.Vec ← PopVec[]; PushVec[Complex.Div[PopVec[],b]]};
CFromPolar:
PROCEDURE = {b:REAL ← GetReal[]; PushVec[Complex.FromPolar[GetReal[],b]]};
CAbs: PROCEDURE = {PushReal[Complex.Abs[PopVec[]]]};
CSqrAbs: PROCEDURE = {PushReal[Complex.SqrAbs[PopVec[]]]};
CArg: PROCEDURE = {PushReal[Complex.Arg[PopVec[]]]};
CExp: PROCEDURE = {PushVec[Complex.Exp[PopVec[]]]};
CLn: PROCEDURE = {PushVec[Complex.Ln[PopVec[]]]};
CSqr: PROCEDURE = {PushVec[Complex.Sqr[PopVec[]]]};
CSqRt: PROCEDURE = {PushVec[Complex.SqRt[PopVec[]]]};
Register["Complex.Add"L,CAdd];
Register["Complex.Sub"L,CSub];
Register["Complex.Mul"L,CMul];
Register["Complex.Div"L,CDiv];
Register["Complex.FromPolar"L,CFromPolar];
Register["Complex.Abs"L,CAbs];
Register["Complex.SqrAbs"L,CSqrAbs];
Register["Complex.Arg"L,CArg];
Register["Complex.Exp"L,CExp];
Register["Complex.Ln"L,CLn];
Register["Complex.Sqr"L,CSqr];
Register["Complex.Sqrt"L,CSqRt];
END.