1-- GHDL Run Time (GRT) - VHDL files subprograms. 2-- Copyright (C) 2002 - 2014 Tristan Gingold 3-- 4-- This program is free software: you can redistribute it and/or modify 5-- it under the terms of the GNU General Public License as published by 6-- the Free Software Foundation, either version 2 of the License, or 7-- (at your option) any later version. 8-- 9-- This program is distributed in the hope that it will be useful, 10-- but WITHOUT ANY WARRANTY; without even the implied warranty of 11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12-- GNU General Public License for more details. 13-- 14-- You should have received a copy of the GNU General Public License 15-- along with this program. If not, see <gnu.org/licenses>. 16-- 17-- As a special exception, if other files instantiate generics from this 18-- unit, or you link this unit with other files to produce an executable, 19-- this unit does not by itself cause the resulting executable to be 20-- covered by the GNU General Public License. This exception does not 21-- however invalidate any other reasons why the executable file might be 22-- covered by the GNU Public License. 23with Grt.Types; use Grt.Types; 24with Interfaces; 25 26package Grt.Files is 27 type Ghdl_File_Index is new Interfaces.Integer_32; 28 29 -- File open mode. 30 Read_Mode : constant Ghdl_I32 := 0; 31 Write_Mode : constant Ghdl_I32 := 1; 32 Append_Mode : constant Ghdl_I32 := 2; 33 34 -- file_open_status. 35 Open_Ok : constant Ghdl_I32 := 0; 36 Status_Error : constant Ghdl_I32 := 1; 37 Name_Error : constant Ghdl_I32 := 2; 38 Mode_Error : constant Ghdl_I32 := 3; 39 40 -- General files. 41 function Ghdl_File_Endfile (File : Ghdl_File_Index) return Boolean; 42 43 -- Elaboration. 44 function Ghdl_Text_File_Elaborate return Ghdl_File_Index; 45 function Ghdl_File_Elaborate (Sig : Ghdl_C_String) return Ghdl_File_Index; 46 47 -- Finalization. 48 procedure Ghdl_Text_File_Finalize (File : Ghdl_File_Index); 49 procedure Ghdl_File_Finalize (File : Ghdl_File_Index); 50 51 -- Subprograms. 52 procedure Ghdl_Text_File_Open 53 (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr); 54 function Ghdl_Text_File_Open_Status 55 (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr) 56 return Ghdl_I32; 57 58 procedure Ghdl_File_Open 59 (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr); 60 function Ghdl_File_Open_Status 61 (File : Ghdl_File_Index; Mode : Ghdl_I32; Str : Std_String_Ptr) 62 return Ghdl_I32; 63 64 procedure Ghdl_Text_Write (File : Ghdl_File_Index; Str : Std_String_Ptr); 65 procedure Ghdl_Write_Scalar (File : Ghdl_File_Index; 66 Ptr : Ghdl_Ptr; 67 Length : Ghdl_Index_Type); 68 69 procedure Ghdl_Read_Scalar (File : Ghdl_File_Index; 70 Ptr : Ghdl_Ptr; 71 Length : Ghdl_Index_Type); 72 73 function Ghdl_Text_Read_Length 74 (File : Ghdl_File_Index; Str : Std_String_Ptr) return Std_Integer; 75 76 procedure Ghdl_Untruncated_Text_Read 77 (File : Ghdl_File_Index; Str : Std_String_Ptr; Len : Std_Integer_Acc); 78 79 procedure Ghdl_Text_File_Close (File : Ghdl_File_Index); 80 procedure Ghdl_File_Close (File : Ghdl_File_Index); 81 82 procedure Ghdl_File_Flush (File : Ghdl_File_Index); 83private 84 pragma Export (Ada, Ghdl_File_Endfile, "__ghdl_file_endfile"); 85 86 pragma Export (C, Ghdl_Text_File_Elaborate, "__ghdl_text_file_elaborate"); 87 pragma Export (C, Ghdl_File_Elaborate, "__ghdl_file_elaborate"); 88 89 pragma Export (C, Ghdl_Text_File_Finalize, "__ghdl_text_file_finalize"); 90 pragma Export (C, Ghdl_File_Finalize, "__ghdl_file_finalize"); 91 92 pragma Export (C, Ghdl_Text_File_Open, "__ghdl_text_file_open"); 93 pragma Export (C, Ghdl_Text_File_Open_Status, 94 "__ghdl_text_file_open_status"); 95 96 pragma Export (C, Ghdl_File_Open, "__ghdl_file_open"); 97 pragma Export (C, Ghdl_File_Open_Status, "__ghdl_file_open_status"); 98 99 pragma Export (C, Ghdl_Text_Write, "__ghdl_text_write"); 100 pragma Export (C, Ghdl_Write_Scalar, "__ghdl_write_scalar"); 101 102 pragma Export (C, Ghdl_Read_Scalar, "__ghdl_read_scalar"); 103 104 pragma Export (C, Ghdl_Text_Read_Length, "__ghdl_text_read_length"); 105 pragma Export (C, Ghdl_Untruncated_Text_Read, 106 "std__textio__untruncated_text_read"); 107 108 pragma Export (C, Ghdl_Text_File_Close, "__ghdl_text_file_close"); 109 pragma Export (C, Ghdl_File_Close, "__ghdl_file_close"); 110 111 pragma Export (C, Ghdl_File_Flush, "__ghdl_file_flush"); 112end Grt.Files; 113