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

     $RCSfile: MathResource.mod $
  Description: Interface to MathIEEE.resource

   Created by: fjc (Frank Copeland)
    $Revision: 3.2 $
      $Author: fjc $
        $Date: 1994/08/08 00:45:36 $

  $VER: mathresource.h 1.2 (13.7.90)
  Includes Release 40.15

  (C) Copyright 1985-1993 Commodore-Amiga, Inc.
      All Rights Reserved

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

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

MODULE MathResource;

(*
** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
** $V- OvflChk       $Z- ZeroVars
*)

IMPORT E := Exec;


(*
**
**      Data structure returned by OpenResource of:
**      "MathIEEE.resource"
**
*)


(*
*       The 'Init' entries are only used if the corresponding
*       bit is set in the Flags field.
*
*       So if you are just a 68881, you do not need the Init stuff
*       just make sure you have cleared the Flags field.
*
*       This should allow us to add Extended Precision later.
*
*       For Init users, if you need to be called whenever a task
*       opens this library for use, you need to change the appropriate
*       entries in MathIEEELibrary.
*)

TYPE

  MathIEEEResourcePtr * = CPOINTER TO MathIEEEResource;
  MathIEEEResource * = RECORD (E.Node)
    flags *        : E.WSET;
    baseAddr *     : E.APTR; (* ptr to 881 if exists *)
    dblBasInit *   : E.PROC;
    dblTransInit * : E.PROC;
    sglBasInit *   : E.PROC;
    sglTransInit * : E.PROC;
    extBasInit *   : E.PROC;
    extTransInit * : E.PROC;
  END; (* MathIEEEResource *)

CONST

(* definations for MathIEEEResourceFLAGS *)
  dblBas        * = 0;
  dblTrans      * = 1;
  sglBas        * = 2;
  sglTrans      * = 3;
  extBas        * = 4;
  extTrans      * = 5;


(*-- Resource Base variable --------------------------------------------*)

CONST

  name * = "MathIEEE.resource";

VAR

  base * : MathIEEEResourcePtr;


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


(*-----------------------------------*)
PROCEDURE OpenResource * (mustOpen : BOOLEAN);

BEGIN (* OpenResource *)
  IF base = NIL THEN
    base := E.base.OpenResource (name);
    IF mustOpen & (base = NIL) THEN HALT (100) END;
  END
END OpenResource;


END MathResource.
