(**************************************************************************

     $RCSfile: MathFfp.mod $
  Description: Interface to mathffp.library

   Created by: fjc (Frank Copeland)
    $Revision: 1.2 $
      $Author: fjc $
        $Date: 1994/05/12 19:11:02 $

  Copyright © 1994, Frank Copeland.
  This file is part of the Oberon-A Library.
  See Oberon-A.doc for conditions of use and distribution.

  Log entries are at the end of the file.

***************************************************************************)

MODULE MathFFP;

(* $P- allow non-portable code *)

IMPORT Exec, SYSTEM;

CONST

  Pi *       = 3.141592653589793;
  TwoPi *    = 6.283185307179586;
  Pi2 *      = 1.570796326794696;
  Pi4 *      = 0.785398163397448;
  E *        = 2.718281828459045;
  Log10 *    = 2.302585092994046;

  fpTen *    = 10.0;
  fpOne *    = 1.0;
  fpHalf *   = 0.5;
  fpZero *   = 0.0;

(*-- Library Base variable --------------------------------------------*)

TYPE

  MathFFPBasePtr * = CPOINTER TO MathFFPBase;
  MathFFPBase * = RECORD (Exec.Library) END;

CONST

  Name * = "mathffp.library";

VAR

  Base * : MathFFPBasePtr;
  cleanup : PROCEDURE (rc : LONGINT);

(*-- Library Functions ------------------------------------------------*)

(*
 *  There is no need to call any of these functions directly.  They are
 *  implicitly called by the compiler when translating expressions
 *  involving REAL values.  They are defined here for completeness.
 *)

LIBCALL (base : MathFFPBasePtr) SPFix *
  ( parm {0} : REAL )
  : LONGINT;
  -30;
LIBCALL (base : MathFFPBasePtr) SPFlt *
  ( integer {0} : LONGINT )
  : REAL;
  -36;
LIBCALL (base : MathFFPBasePtr) SPCmp *
  ( leftParm  {1} : REAL;
    rightParm {0} : REAL )
  : SHORTINT;
  -42;
LIBCALL (base : MathFFPBasePtr) SPTst *
  ( parm {1} : REAL )
  : SHORTINT;
  -48;
LIBCALL (base : MathFFPBasePtr) SPAbs *
  ( parm {0} : REAL )
  : REAL;
  -54;
LIBCALL (base : MathFFPBasePtr) SPNeg *
  ( parm {0} : REAL )
  : REAL;
  -60;
LIBCALL (base : MathFFPBasePtr) SPAdd *
  ( leftParm  {1} : REAL;
    rightParm {0} : REAL )
  : REAL;
  -66;
LIBCALL (base : MathFFPBasePtr) SPSub *
  ( leftParm  {1} : REAL;
    rightParm {0} : REAL )
  : REAL;
  -72;
LIBCALL (base : MathFFPBasePtr) SPMul *
  ( leftParm  {1} : REAL;
    rightParm {0} : REAL )
  : REAL;
  -78;
LIBCALL (base : MathFFPBasePtr) SPDiv *
  ( leftParm  {1} : REAL;
    rightParm {0} : REAL )
  : REAL;
  -84;

LIBCALL (base : MathFFPBasePtr) SPFloor *
  ( parm {0} : REAL )
  : LONGINT;
  -90;
LIBCALL (base : MathFFPBasePtr) SPCeil *
  ( parm {0} : REAL )
  : LONGINT;
  -96;

(*-- Library Base variable --------------------------------------------*)
(* $L- Address globals through A4 *)

(*-----------------------------------*)
PROCEDURE* CloseLib (rc : LONGINT);

BEGIN
  IF Base # NIL THEN Exec.Base.CloseLibrary (Base) END;
  IF cleanup # NIL THEN cleanup (rc) END
END CloseLib;

(*-----------------------------------*)
PROCEDURE OpenLib * ();

BEGIN
  IF Base = NIL THEN
    Base := Exec.Base.OpenLibrary (Name, Exec.libraryMinimum);
    IF Base = NIL THEN HALT (100) END;
    SYSTEM.SETCLEANUP (CloseLib, cleanup)
  END;
END OpenLib;

BEGIN
  Base := NIL; cleanup := NIL
END MathFFP.

(**************************************************************************

  $Log: MathFfp.mod $
  Revision 1.2  1994/05/12  19:11:02  fjc
  - Prepared for release

  Revision 1.1  1994/01/15  21:04:12  fjc
  - Start of revision control

***************************************************************************)

 

(* Comments stripped by StripComments 1.0 *)
