From 06c4e6e0ba10149b272b0c49869152a50c732ae5 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 20 May 2015 21:55:21 +0200 Subject: Handle to_string for i64 numbers. Fix ticket 76 --- src/grt/grt-images.adb | 12 ++++++++++++ src/grt/grt-images.ads | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'src/grt') diff --git a/src/grt/grt-images.adb b/src/grt/grt-images.adb index 272c423..e56c835 100644 --- a/src/grt/grt-images.adb +++ b/src/grt/grt-images.adb @@ -100,6 +100,16 @@ package body Grt.Images is Return_String (Res, Str (First .. Str'Last)); end Ghdl_Image_I32; + procedure Ghdl_Image_I64 (Res : Std_String_Ptr; Val : Ghdl_I64) + is + -- biggest number is: 18446744073709551615 (20 digits) + Str : String (1 .. 21); + First : Natural; + begin + To_String (Str, First, Val); + Return_String (Res, Str (First .. Str'Last)); + end Ghdl_Image_I64; + procedure Ghdl_Image_P64 (Res : Std_String_Ptr; Val : Ghdl_I64; Rti : Ghdl_Rti_Access) is @@ -159,6 +169,8 @@ package body Grt.Images is procedure Ghdl_To_String_I32 (Res : Std_String_Ptr; Val : Ghdl_I32) renames Ghdl_Image_I32; + procedure Ghdl_To_String_I64 (Res : Std_String_Ptr; Val : Ghdl_I64) + renames Ghdl_Image_I64; procedure Ghdl_To_String_F64 (Res : Std_String_Ptr; Val : Ghdl_F64) renames Ghdl_Image_F64; diff --git a/src/grt/grt-images.ads b/src/grt/grt-images.ads index cd89110..afbaaad 100644 --- a/src/grt/grt-images.ads +++ b/src/grt/grt-images.ads @@ -36,6 +36,7 @@ package Grt.Images is procedure Ghdl_Image_E32 (Res : Std_String_Ptr; Val : Ghdl_E32; Rti : Ghdl_Rti_Access); procedure Ghdl_Image_I32 (Res : Std_String_Ptr; Val : Ghdl_I32); + procedure Ghdl_Image_I64 (Res : Std_String_Ptr; Val : Ghdl_I64); procedure Ghdl_Image_F64 (Res : Std_String_Ptr; Val : Ghdl_F64); procedure Ghdl_Image_P64 (Res : Std_String_Ptr; Val : Ghdl_I64; Rti : Ghdl_Rti_Access); @@ -43,6 +44,7 @@ package Grt.Images is (Res : Std_String_Ptr; Val : Ghdl_I32; Rti : Ghdl_Rti_Access); procedure Ghdl_To_String_I32 (Res : Std_String_Ptr; Val : Ghdl_I32); + procedure Ghdl_To_String_I64 (Res : Std_String_Ptr; Val : Ghdl_I64); procedure Ghdl_To_String_F64 (Res : Std_String_Ptr; Val : Ghdl_F64); procedure Ghdl_To_String_F64_Digits (Res : Std_String_Ptr; Val : Ghdl_F64; Nbr_Digits : Ghdl_I32); @@ -84,11 +86,13 @@ private pragma Export (C, Ghdl_Image_E8, "__ghdl_image_e8"); pragma Export (C, Ghdl_Image_E32, "__ghdl_image_e32"); pragma Export (C, Ghdl_Image_I32, "__ghdl_image_i32"); + pragma Export (C, Ghdl_Image_I64, "__ghdl_image_i64"); pragma Export (C, Ghdl_Image_F64, "__ghdl_image_f64"); pragma Export (C, Ghdl_Image_P64, "__ghdl_image_p64"); pragma Export (C, Ghdl_Image_P32, "__ghdl_image_p32"); pragma Export (C, Ghdl_To_String_I32, "__ghdl_to_string_i32"); + pragma Export (C, Ghdl_To_String_I64, "__ghdl_to_string_i64"); pragma Export (C, Ghdl_To_String_F64, "__ghdl_to_string_f64"); pragma Export (C, Ghdl_To_String_F64_Digits, "__ghdl_to_string_f64_digits"); pragma Export (C, Ghdl_To_String_F64_Format, "__ghdl_to_string_f64_format"); -- cgit