aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-06-05 22:04:42 +0200
committerTristan Gingold <tgingold@free.fr>2015-06-05 22:04:42 +0200
commit463e00e93d8b2507519310789ea9e4fc668cc4ac (patch)
tree3292cbb3bd7ef34156c1768b7719e828078eeeab /src/grt
parentb250273b27b71e2096f05fe4669dae42d83f4e26 (diff)
downloadghdl-463e00e93d8b2507519310789ea9e4fc668cc4ac.tar.gz
ghdl-463e00e93d8b2507519310789ea9e4fc668cc4ac.tar.bz2
ghdl-463e00e93d8b2507519310789ea9e4fc668cc4ac.zip
Rework procedure calls, now use a record to pass parameters.
Diffstat (limited to 'src/grt')
-rw-r--r--src/grt/grt-files.adb12
-rw-r--r--src/grt/grt-files.ads12
-rw-r--r--src/grt/grt-lib.adb12
-rw-r--r--src/grt/grt-lib.ads12
4 files changed, 28 insertions, 20 deletions
diff --git a/src/grt/grt-files.adb b/src/grt/grt-files.adb
index 14dde9702..46d3cedac 100644
--- a/src/grt/grt-files.adb
+++ b/src/grt/grt-files.adb
@@ -384,16 +384,15 @@ package body Grt.Files is
end Ghdl_Text_Read_Length;
procedure Ghdl_Untruncated_Text_Read
- (Res : Ghdl_Untruncated_Text_Read_Result_Acc;
- File : Ghdl_File_Index;
- Str : Std_String_Ptr)
+ (Params : Ghdl_Untruncated_Text_Read_Params_Acc)
is
+ Str : constant Std_String_Ptr := Params.Str;
Stream : C_Files;
Len : int;
Idx : Ghdl_Index_Type;
begin
- Stream := Get_File (File);
- Check_File_Mode (File, True);
+ 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
Internal_Error ("ghdl_untruncated_text_read: end of file");
@@ -405,7 +404,7 @@ package body Grt.Files is
exit;
end if;
end loop;
- Res.Len := Std_Integer (Idx);
+ Params.Len := Std_Integer (Idx);
end Ghdl_Untruncated_Text_Read;
procedure File_Close (File : Ghdl_File_Index; Is_Text : Boolean)
@@ -447,4 +446,3 @@ package body Grt.Files is
fflush (Stream);
end Ghdl_File_Flush;
end Grt.Files;
-
diff --git a/src/grt/grt-files.ads b/src/grt/grt-files.ads
index 14f998468..3fadc981e 100644
--- a/src/grt/grt-files.ads
+++ b/src/grt/grt-files.ads
@@ -75,17 +75,17 @@ 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_Result is record
+ 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_Result_Acc is
- access Ghdl_Untruncated_Text_Read_Result;
+ type Ghdl_Untruncated_Text_Read_Params_Acc is
+ access Ghdl_Untruncated_Text_Read_Params;
procedure Ghdl_Untruncated_Text_Read
- (Res : Ghdl_Untruncated_Text_Read_Result_Acc;
- File : Ghdl_File_Index;
- Str : Std_String_Ptr);
+ (Params : Ghdl_Untruncated_Text_Read_Params_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 d2b095c67..b4505adb6 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
- (Stop : Ghdl_B1; Has_Status : Ghdl_B1; Status : Std_Integer) is
+ (Params : Ghdl_Control_Simulation_Params_Ptr) is
begin
Report_H;
-- Report_C (Grt.Options.Progname);
Report_C ("simulation ");
- if Stop then
+ if Params.Stop then
Report_C ("stopped");
else
Report_C ("finished");
end if;
Report_C (" @");
Report_Now_C;
- if Has_Status then
+ if Params.Has_Status then
Report_C (" with status ");
- Report_C (Integer (Status));
+ Report_C (Integer (Params.Status));
end if;
Report_E ("");
- if Has_Status then
- Exit_Status := Integer (Status);
+ if Params.Has_Status then
+ Exit_Status := Integer (Params.Status);
end if;
Exit_Simulation;
end Ghdl_Control_Simulation;
diff --git a/src/grt/grt-lib.ads b/src/grt/grt-lib.ads
index 50be6a7a6..dcd2c55b7 100644
--- a/src/grt/grt-lib.ads
+++ b/src/grt/grt-lib.ads
@@ -94,8 +94,18 @@ 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
- (Stop : Ghdl_B1; Has_Status : Ghdl_B1; Status : Std_Integer);
+ (Params : Ghdl_Control_Simulation_Params_Ptr);
private
pragma Export (C, Ghdl_Memcpy, "__ghdl_memcpy");