home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / oberon-a-1.4ß.lha / Oberon-A / source / amiga / MathFFP.mod < prev    next >
Text File  |  1994-08-08  |  4KB  |  170 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: MathFFP.mod $
  4.   Description: Interface to mathffp.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 00:49:28 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. MODULE MathFFP;
  23.  
  24. (*
  25. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  26. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  27. ** $V- OvflChk       $Z- ZeroVars
  28. *)
  29.  
  30. IMPORT Exec, SYSTEM;
  31.  
  32.  
  33. (*
  34. **      $VER: mathffp.h 36.2 (1.5.90)
  35. **
  36. **      general floating point declarations
  37. *)
  38.  
  39. CONST
  40.  
  41.   pi *       = 3.141592653589793;
  42.   twoPi *    = 6.283185307179586; (* Pi * 2.0 *)
  43.   pi2 *      = 1.570796326794696; (* Pi / 2.0 *)
  44.   pi4 *      = 0.785398163397448; (* Pi / 4.0 *)
  45.   e *        = 2.718281828459045;
  46.   log10 *    = 2.302585092994046;
  47.  
  48.   fpTen *    = 10.0;
  49.   fpOne *    = 1.0;
  50.   fpHalf *   = 0.5;
  51.   fpZero *   = 0.0;
  52.  
  53.  
  54. (*-- Library Base variable --------------------------------------------*)
  55.  
  56. TYPE
  57.  
  58.   MathFFPBasePtr * = CPOINTER TO MathFFPBase;
  59.   MathFFPBase * = RECORD (Exec.Library) END;
  60.  
  61. CONST
  62.  
  63.   name * = "mathffp.library";
  64.  
  65. VAR
  66.  
  67.   base * : MathFFPBasePtr;
  68.  
  69.  
  70. (*-- Library Functions ------------------------------------------------*)
  71.  
  72. (*
  73. **      $VER: mathffp_protos.h 1.4 (3.5.90)
  74. *)
  75.  
  76. (*
  77.  *  There is no need to call any of these functions directly.  They are
  78.  *  called inline by the compiler when translating expressions
  79.  *  involving REAL values.  They are defined here for completeness.
  80.  *)
  81.  
  82. LIBCALL (base : MathFFPBasePtr) Fix *
  83.   ( parm [0] : REAL )
  84.   : LONGINT;
  85.   -30;
  86. LIBCALL (base : MathFFPBasePtr) Flt *
  87.   ( integer [0] : LONGINT )
  88.   : REAL;
  89.   -36;
  90. LIBCALL (base : MathFFPBasePtr) Cmp *
  91.   ( leftParm  [1] : REAL;
  92.     rightParm [0] : REAL )
  93.   : LONGINT;
  94.   -42;
  95. LIBCALL (base : MathFFPBasePtr) Tst *
  96.   ( parm [1] : REAL )
  97.   : LONGINT;
  98.   -48;
  99. LIBCALL (base : MathFFPBasePtr) Abs *
  100.   ( parm [0] : REAL )
  101.   : REAL;
  102.   -54;
  103. LIBCALL (base : MathFFPBasePtr) Neg *
  104.   ( parm [0] : REAL )
  105.   : REAL;
  106.   -60;
  107. LIBCALL (base : MathFFPBasePtr) Add *
  108.   ( leftParm  [1] : REAL;
  109.     rightParm [0] : REAL )
  110.   : REAL;
  111.   -66;
  112. LIBCALL (base : MathFFPBasePtr) Sub *
  113.   ( leftParm  [1] : REAL;
  114.     rightParm [0] : REAL )
  115.   : REAL;
  116.   -72;
  117. LIBCALL (base : MathFFPBasePtr) Mul *
  118.   ( leftParm  [1] : REAL;
  119.     rightParm [0] : REAL )
  120.   : REAL;
  121.   -78;
  122. LIBCALL (base : MathFFPBasePtr) Div *
  123.   ( leftParm  [1] : REAL;
  124.     rightParm [0] : REAL )
  125.   : REAL;
  126.   -84;
  127.  
  128. (* --- functions in V33 or higher (distributed as Release 1.2) ---*)
  129.  
  130. LIBCALL (base : MathFFPBasePtr) Floor *
  131.   ( parm [0] : REAL )
  132.   : REAL;
  133.   -90;
  134. LIBCALL (base : MathFFPBasePtr) Ceil *
  135.   ( parm [0] : REAL )
  136.   : REAL;
  137.   -96;
  138.  
  139.  
  140. (*-- Library Base variable --------------------------------------------*)
  141. (* $L- Address globals through A4 *)
  142.  
  143.  
  144. (*-----------------------------------*)
  145. PROCEDURE* CloseLib ();
  146.  
  147. BEGIN (* CloseLib *)
  148.   IF base # NIL THEN Exec.base.CloseLibrary (base) END
  149. END CloseLib;
  150.  
  151. (*-----------------------------------*)
  152. PROCEDURE OpenLib * (mustOpen : BOOLEAN);
  153.  
  154. BEGIN (* OpenLib *)
  155.   IF base = NIL THEN
  156.     base :=
  157.       SYSTEM.VAL
  158.         ( MathFFPBasePtr,
  159.           Exec.base.OpenLibrary (name, Exec.libraryMinimum));
  160.     IF base # NIL THEN SYSTEM.SETCLEANUP (CloseLib)
  161.     ELSIF mustOpen THEN HALT (100)
  162.     END;
  163.   END;
  164. END OpenLib;
  165.  
  166.  
  167. BEGIN
  168.   base := NIL
  169. END MathFFP.
  170.