aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-files_operations.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-11-15 06:36:34 +0100
committerTristan Gingold <tgingold@free.fr>2019-11-15 06:36:34 +0100
commitac54fb8f7f7130c9bb18124694ea9de07266f214 (patch)
treecd36bfdbc55c98bed4f030ef68f8bf571b410ee1 /src/grt/grt-files_operations.adb
parent9518660d894ff1695ba84f7fe060f50bc643d701 (diff)
downloadghdl-ac54fb8f7f7130c9bb18124694ea9de07266f214.tar.gz
ghdl-ac54fb8f7f7130c9bb18124694ea9de07266f214.tar.bz2
ghdl-ac54fb8f7f7130c9bb18124694ea9de07266f214.zip
grt-files_operations: reduce dependencies.
Diffstat (limited to 'src/grt/grt-files_operations.adb')
-rw-r--r--src/grt/grt-files_operations.adb33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/grt/grt-files_operations.adb b/src/grt/grt-files_operations.adb
index a9af35ade..ed15f7fa0 100644
--- a/src/grt/grt-files_operations.adb
+++ b/src/grt/grt-files_operations.adb
@@ -22,11 +22,9 @@
-- covered by the GNU General Public License. This exception does not
-- however invalidate any other reasons why the executable file might be
-- covered by the GNU Public License.
-with Grt.Errors; use Grt.Errors;
with Grt.Stdio; use Grt.Stdio;
with Grt.C; use Grt.C;
with Grt.Table;
-with Grt.Options;
with System; use System;
pragma Elaborate_All (Grt.Table);
@@ -177,13 +175,6 @@ package body Grt.Files_Operations is
end if;
end Destroy_File;
- procedure File_Error (File : Ghdl_File_Index)
- is
- pragma Unreferenced (File);
- begin
- Internal_Error ("file: IO error");
- end File_Error;
-
function Ghdl_Text_File_Elaborate return Ghdl_File_Index is
begin
return Create_File (True, ' ', null);
@@ -319,9 +310,9 @@ package body Grt.Files_Operations is
Status := Op_Name_Error;
return;
end if;
- if Grt.Options.Unbuffered_Writes and Mode /= Read_Mode then
- setbuf (F, NULL_voids);
- end if;
+ -- if Grt.Options.Unbuffered_Writes and Mode /= Read_Mode then
+ -- setbuf (F, NULL_voids);
+ -- end if;
end if;
Sig := Files_Table.Table (File).Signature;
@@ -332,12 +323,14 @@ package body Grt.Files_Operations is
if fwrite (Sig_Header'Address, 1, Sig_Header'Length, F)
/= Sig_Header'Length
then
- File_Error (File);
+ Status := Op_Write_Error;
+ return;
end if;
if fwrite (Sig (1)'Address, 1, size_t (Sig_Len), F)
/= size_t (Sig_Len)
then
- File_Error (File);
+ Status := Op_Write_Error;
+ return;
end if;
when Read_Mode =>
declare
@@ -345,18 +338,22 @@ package body Grt.Files_Operations is
Sig_Buf : String (1 .. Sig_Len);
begin
if fread (Hdr'Address, 1, Hdr'Length, F) /= Hdr'Length then
- File_Error (File);
+ Status := Op_Read_Error;
+ return;
end if;
if Hdr /= Sig_Header then
- File_Error (File);
+ Status := Op_Signature_Error;
+ return;
end if;
if fread (Sig_Buf'Address, 1, Sig_Buf'Length, F)
/= Sig_Buf'Length
then
- File_Error (File);
+ Status := Op_Read_Error;
+ return;
end if;
if Sig_Buf /= Sig (1 .. Sig_Len) then
- File_Error (File);
+ Status := Op_Signature_Error;
+ return;
end if;
end;
when Append_Mode =>