aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-04-18 06:05:30 +0200
committerTristan Gingold <tgingold@free.fr>2017-04-19 20:48:24 +0200
commit1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0 (patch)
treefa9a687793b418f6be7c8483c2576d12419fd45b /src/grt
parent464259ae4be27dcf43f3273e2217cb226bebdc71 (diff)
downloadghdl-1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0.tar.gz
ghdl-1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0.tar.bz2
ghdl-1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0.zip
textio: use grt.fcvt to read real numbers.
Diffstat (limited to 'src/grt')
-rw-r--r--src/grt/grt-lib.adb9
-rw-r--r--src/grt/grt-lib.ads5
2 files changed, 14 insertions, 0 deletions
diff --git a/src/grt/grt-lib.adb b/src/grt/grt-lib.adb
index 95a4a0948..3c16392be 100644
--- a/src/grt/grt-lib.adb
+++ b/src/grt/grt-lib.adb
@@ -24,6 +24,7 @@
-- covered by the GNU Public License.
with Grt.Errors; use Grt.Errors;
with Grt.Options;
+with Grt.Fcvt;
package body Grt.Lib is
--procedure Memcpy (Dst : Address; Src : Address; Size : Size_T);
@@ -271,6 +272,14 @@ package body Grt.Lib is
end if;
end Ghdl_Real_Exp;
+ function Textio_Read_Real (Str : Std_String_Ptr) return Ghdl_F64
+ is
+ subtype Str1 is String (1 .. Natural (Str.Bounds.Dim_1.Length));
+ begin
+ return Ghdl_F64 (Grt.Fcvt.From_String
+ (Str1 (Str.Base (0 .. Str.Bounds.Dim_1.Length))));
+ end Textio_Read_Real;
+
function Ghdl_Get_Resolution_Limit return Std_Time is
begin
return 1;
diff --git a/src/grt/grt-lib.ads b/src/grt/grt-lib.ads
index 2ee918ba2..97ee669a8 100644
--- a/src/grt/grt-lib.ads
+++ b/src/grt/grt-lib.ads
@@ -92,6 +92,8 @@ package Grt.Lib is
False -- -
);
+ function Textio_Read_Real (Str : Std_String_Ptr) return Ghdl_F64;
+
function Ghdl_Get_Resolution_Limit return Std_Time;
procedure Ghdl_Control_Simulation
@@ -120,6 +122,9 @@ private
pragma Export (C, Ghdl_Std_Ulogic_To_Boolean_Array,
"__ghdl_std_ulogic_to_boolean_array");
+ pragma Export (C, Textio_Read_Real,
+ "std__textio__textio_read_real");
+
pragma Export (C, Ghdl_Get_Resolution_Limit,
"std__env__get_resolution_limit");
pragma Export (Ada, Ghdl_Control_Simulation,