diff options
author | gingold | 2006-08-06 06:45:40 +0000 |
---|---|---|
committer | gingold | 2006-08-06 06:45:40 +0000 |
commit | 63925c8de8d3171e6b258796e4d167524691490a (patch) | |
tree | a8e7971f5889da0b7bba2cd7f9624c704d0145df /translate/ghdldrv/foreigns.adb | |
parent | 3841c37a946481815c89928ccd15b71b608aa526 (diff) | |
download | ghdl-63925c8de8d3171e6b258796e4d167524691490a.tar.gz ghdl-63925c8de8d3171e6b258796e4d167524691490a.tar.bz2 ghdl-63925c8de8d3171e6b258796e4d167524691490a.zip |
bugs fixed
Diffstat (limited to 'translate/ghdldrv/foreigns.adb')
-rw-r--r-- | translate/ghdldrv/foreigns.adb | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/translate/ghdldrv/foreigns.adb b/translate/ghdldrv/foreigns.adb new file mode 100644 index 0000000..15e3dd0 --- /dev/null +++ b/translate/ghdldrv/foreigns.adb @@ -0,0 +1,64 @@ +with Interfaces.C; use Interfaces.C; + +package body Foreigns is + function Sin (Arg : double) return double; + pragma Import (C, Sin); + + function Log (Arg : double) return double; + pragma Import (C, Log); + + function Exp (Arg : double) return double; + pragma Import (C, Exp); + + function Sqrt (Arg : double) return double; + pragma Import (C, Sqrt); + + function Asin (Arg : double) return double; + pragma Import (C, Asin); + + function Acos (Arg : double) return double; + pragma Import (C, Acos); + + function Asinh (Arg : double) return double; + pragma Import (C, Asinh); + + function Acosh (Arg : double) return double; + pragma Import (C, Acosh); + + function Atanh (X : double) return double; + pragma Import (C, Atanh); + + function Atan2 (X, Y : double) return double; + pragma Import (C, Atan2); + + type String_Cacc is access constant String; + type Foreign_Record is record + Name : String_Cacc; + Addr : Address; + end record; + + + Foreign_Arr : constant array (Natural range <>) of Foreign_Record := + ( + (new String'("sin"), Sin'Address), + (new String'("log"), Log'Address), + (new String'("exp"), Exp'Address), + (new String'("sqrt"), Sqrt'Address), + (new String'("asin"), Asin'Address), + (new String'("acos"), Acos'Address), + (new String'("asinh"), Asinh'Address), + (new String'("acosh"), Acosh'Address), + (new String'("atanh"), Atanh'Address), + (new String'("atan2"), Atan2'Address) + ); + + function Find_Foreign (Name : String) return Address is + begin + for I in Foreign_Arr'Range loop + if Foreign_Arr(I).Name.all = Name then + return Foreign_Arr(I).Addr; + end if; + end loop; + return Null_Address; + end Find_Foreign; +end Foreigns; |