summaryrefslogtreecommitdiff
path: root/src/grt
diff options
context:
space:
mode:
authorTristan Gingold2015-08-29 07:57:12 +0200
committerTristan Gingold2015-08-29 07:57:12 +0200
commitb75d703676ab830ea3e5731e1965d1d89879a456 (patch)
tree1a0a21ba1cce6385715bd2823853ee4ad47905ee /src/grt
parent64fa65e1395bef4f05c51bc19d9a46d6003339ee (diff)
downloadghdl-b75d703676ab830ea3e5731e1965d1d89879a456.tar.gz
ghdl-b75d703676ab830ea3e5731e1965d1d89879a456.tar.bz2
ghdl-b75d703676ab830ea3e5731e1965d1d89879a456.zip
Replace fat accesses by bounds accesses
translate: separate info for signals from object. Improve some error messages.
Diffstat (limited to 'src/grt')
-rw-r--r--src/grt/grt-files.adb18
-rw-r--r--src/grt/grt-files.ads12
-rw-r--r--src/grt/grt-lib.adb12
-rw-r--r--src/grt/grt-lib.ads11
-rw-r--r--src/grt/grt-values.adb2
5 files changed, 19 insertions, 36 deletions
diff --git a/src/grt/grt-files.adb b/src/grt/grt-files.adb
index 46d3ced..1f037a7 100644
--- a/src/grt/grt-files.adb
+++ b/src/grt/grt-files.adb
@@ -384,27 +384,25 @@ package body Grt.Files is
end Ghdl_Text_Read_Length;
procedure Ghdl_Untruncated_Text_Read
- (Params : Ghdl_Untruncated_Text_Read_Params_Acc)
+ (File : Ghdl_File_Index; Str : Std_String_Ptr; Len : Std_Integer_Acc)
is
- Str : constant Std_String_Ptr := Params.Str;
Stream : C_Files;
- Len : int;
- Idx : Ghdl_Index_Type;
+ Max_Len : int;
begin
- Stream := Get_File (Params.File);
- Check_File_Mode (Params.File, True);
- Len := int (Str.Bounds.Dim_1.Length);
- if fgets (Str.Base (0)'Address, Len, Stream) = Null_Address then
+ Stream := Get_File (File);
+ Check_File_Mode (File, True);
+ Max_Len := int (Str.Bounds.Dim_1.Length);
+ if fgets (Str.Base (0)'Address, Max_Len, Stream) = Null_Address then
Internal_Error ("ghdl_untruncated_text_read: end of file");
end if;
+
-- Compute the length.
for I in Ghdl_Index_Type loop
if Str.Base (I) = NUL then
- Idx := I;
+ Len.all := Std_Integer (I);
exit;
end if;
end loop;
- Params.Len := Std_Integer (Idx);
end Ghdl_Untruncated_Text_Read;
procedure File_Close (File : Ghdl_File_Index; Is_Text : Boolean)
diff --git a/src/grt/grt-files.ads b/src/grt/grt-files.ads
index 3fadc98..3c6191f 100644
--- a/src/grt/grt-files.ads
+++ b/src/grt/grt-files.ads
@@ -75,17 +75,11 @@ package Grt.Files is
function Ghdl_Text_Read_Length
(File : Ghdl_File_Index; Str : Std_String_Ptr) return Std_Integer;
- type Ghdl_Untruncated_Text_Read_Params is record
- File : Ghdl_File_Index;
- Str : Std_String_Ptr;
- Len : Std_Integer;
- end record;
-
- type Ghdl_Untruncated_Text_Read_Params_Acc is
- access Ghdl_Untruncated_Text_Read_Params;
+ type Std_Integer_Acc is access Std_Integer;
+ pragma Convention (C, Std_Integer_Acc);
procedure Ghdl_Untruncated_Text_Read
- (Params : Ghdl_Untruncated_Text_Read_Params_Acc);
+ (File : Ghdl_File_Index; Str : Std_String_Ptr; Len : Std_Integer_Acc);
procedure Ghdl_Text_File_Close (File : Ghdl_File_Index);
procedure Ghdl_File_Close (File : Ghdl_File_Index);
diff --git a/src/grt/grt-lib.adb b/src/grt/grt-lib.adb
index b4505ad..d2b095c 100644
--- a/src/grt/grt-lib.adb
+++ b/src/grt/grt-lib.adb
@@ -272,25 +272,25 @@ package body Grt.Lib is
end Ghdl_Get_Resolution_Limit;
procedure Ghdl_Control_Simulation
- (Params : Ghdl_Control_Simulation_Params_Ptr) is
+ (Stop : Ghdl_B1; Has_Status : Ghdl_B1; Status : Std_Integer) is
begin
Report_H;
-- Report_C (Grt.Options.Progname);
Report_C ("simulation ");
- if Params.Stop then
+ if Stop then
Report_C ("stopped");
else
Report_C ("finished");
end if;
Report_C (" @");
Report_Now_C;
- if Params.Has_Status then
+ if Has_Status then
Report_C (" with status ");
- Report_C (Integer (Params.Status));
+ Report_C (Integer (Status));
end if;
Report_E ("");
- if Params.Has_Status then
- Exit_Status := Integer (Params.Status);
+ if Has_Status then
+ Exit_Status := Integer (Status);
end if;
Exit_Simulation;
end Ghdl_Control_Simulation;
diff --git a/src/grt/grt-lib.ads b/src/grt/grt-lib.ads
index dcd2c55..82fee91 100644
--- a/src/grt/grt-lib.ads
+++ b/src/grt/grt-lib.ads
@@ -95,17 +95,8 @@ package Grt.Lib is
function Ghdl_Get_Resolution_Limit return Std_Time;
- type Ghdl_Control_Simulation_Params is record
- Stop : Ghdl_B1;
- Has_Status : Ghdl_B1;
- Status : Std_Integer;
- end record;
-
- type Ghdl_Control_Simulation_Params_Ptr is access
- Ghdl_Control_Simulation_Params;
-
procedure Ghdl_Control_Simulation
- (Params : Ghdl_Control_Simulation_Params_Ptr);
+ (Stop : Ghdl_B1; Has_Status : Ghdl_B1; Status : Std_Integer);
private
pragma Export (C, Ghdl_Memcpy, "__ghdl_memcpy");
diff --git a/src/grt/grt-values.adb b/src/grt/grt-values.adb
index 18a917b..e871827 100644
--- a/src/grt/grt-values.adb
+++ b/src/grt/grt-values.adb
@@ -119,7 +119,7 @@ package body Grt.Values is
end if;
end loop;
Error_C ("'value: '");
- Error_C_Std (S (Pos .. L));
+ Error_C_Std (S (Pos .. L - 1));
Error_C ("' not in enumeration '");
Error_C (Enum_Rti.Name);
Error_E ("'");