1 with Interfaces
.C
.Strings
;
3 package body Readline
is
5 function Input
(Prompt
: in String) return String is
8 use Interfaces
.C
.Strings
;
10 function C_Readline
(Prompt
: in char_array
) return chars_ptr
11 with Import
, Convention
=> C
, External_Name
=> "readline";
13 procedure Add_History
(Line
: in chars_ptr
)
14 with Import
, Convention
=> C
, External_Name
=> "add_history";
16 procedure Free
(Line
: in chars_ptr
)
17 with Import
, Convention
=> C
, External_Name
=> "free";
19 C_Line
: constant chars_ptr
:= C_Readline
(To_C
(Prompt
));
21 if C_Line
= Null_Ptr
then
24 return Ada_Line
: constant String := Value
(C_Line
) do
25 if Ada_Line
/= "" then