------------------------------------------------------------------------------ -- -- -- G N U . M U L T I P L E _ P R E C I S I O N . R -- -- -- -- S p e c -- -- -- -- $Revision: 1.1 $ -- -- -- -- Copyright (C) 1999 Michael Roe -- -- -- -- This is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- ------------------------------------------------------------------------------ with System; with Interfaces.C; package GNU_Multiple_Precision.R is pragma Remote_Types (GNU_Multiple_Precision.R); pragma Linker_Options ("-lgmp"); type Big_Float is limited private; ------------------------------------------------------------------------------ -- Initialization and assignment -- ------------------------------------------------------------------------------ procedure Init (Rop : out Big_Float); pragma Import (C, Init, "mpf_init"); procedure Init2 (Rop : out Big_Float; Precision : in Interfaces.C.unsigned); pragma Import (C, Init2, "mpf_init2"); procedure Clear (Rop : in out Big_Float); pragma Import (C, Clear, "mpf_clear"); -- The procedures for changing precision not yet done procedure Set (Rop : in out Big_Float; Op : in Big_Float); pragma Import (C, Set, "mpf_set"); procedure Set_Unsigned (Rop : in out Big_Float; Op : in Interfaces.C.unsigned); pragma Import (C, Set_Unsigned, "mpf_set_ui"); procedure Set_Integer (Rop : in out Big_Float; Op : in Interfaces.C.int); pragma Import (C, Set_Integer, "mpf_set_si"); procedure Set_Double (Rop : in out Big_Float; Op : in Interfaces.C.double); pragma Import (C, Set_Double, "mpf_set_d"); procedure Set_C_String (Rop : in out Big_Float; Str : in Interfaces.C.char_array; Base : Interfaces.C.int); pragma Import (C, Set_C_String, "mpf_set_str"); ------------------------------------------------------------------------------ -- Conversion -- ------------------------------------------------------------------------------ procedure Get_C_String (Out_Ptr : out System.Address; In_Ptr : in System.Address; Exponent : out Interfaces.C.int; -- HACK Base : in Interfaces.C.int; N_Digits : in Interfaces.C.size_t; Op : in Big_Float); pragma Import (C, Get_C_String, "mpf_get_str"); pragma Import_Valued_Procedure (Get_C_String); ------------------------------------------------------------------------------ -- Comparison -- ------------------------------------------------------------------------------ function Compare (Op1, Op2 : Big_Float) return Interfaces.C.int; pragma Import (C, Compare, "mpf_cmp"); function Compare_Unsigned (Op1 : Big_Float; Op2 : Interfaces.C.unsigned) return Interfaces.C.int; pragma Import (C, Compare_Unsigned, "mpf_cmp_ui"); function Compare_Integer (Op1 : Big_Float; Op2 : Interfaces.C.int) return Interfaces.C.int; pragma Import (C, Compare_Integer, "mpf_cmp_si"); function Compare (Op1 : Big_Float; Op2 : Interfaces.C.int) return Interfaces.C.int renames Compare_Integer; private type Big_Float is limited record Precision : Interfaces.C.int; Size : Interfaces.C.int; Exponent : Interfaces.C.int; Buffer : System.Address; end record; end GNU_Multiple_Precision.R;