aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-readline.ads
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-11-05 05:11:00 +0100
committerTristan Gingold <tgingold@free.fr>2014-11-05 05:11:00 +0100
commit3fddf1c59fd7a8fcd260bb9e05c611bef3dd141b (patch)
treecbfe6d75f8e09db8b98f335406fb6ecb2fce3e0c /src/grt/grt-readline.ads
parent0a088b311ed2fcebc542f8a2e42d09e2e3c9311c (diff)
downloadghdl-3fddf1c59fd7a8fcd260bb9e05c611bef3dd141b.tar.gz
ghdl-3fddf1c59fd7a8fcd260bb9e05c611bef3dd141b.tar.bz2
ghdl-3fddf1c59fd7a8fcd260bb9e05c611bef3dd141b.zip
Move files and dirs from translate/
Diffstat (limited to 'src/grt/grt-readline.ads')
-rw-r--r--src/grt/grt-readline.ads30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/grt/grt-readline.ads b/src/grt/grt-readline.ads
new file mode 100644
index 000000000..1a3083981
--- /dev/null
+++ b/src/grt/grt-readline.ads
@@ -0,0 +1,30 @@
+-- Although being part of GRT, the readline binding should be independent of
+-- it (for easier reuse).
+
+with System; use System;
+
+package Grt.Readline is
+ subtype Fat_String is String (Positive);
+ type Char_Ptr is access Fat_String;
+ pragma Convention (C, Char_Ptr);
+ -- A C string (which is NUL terminated) is represented as a (thin) access
+ -- to a fat string (a string whose range is 1 .. integer'Last).
+ -- The use of an access to a constrained array allows a representation
+ -- compatible with C. Indexing of object of that type is safe only for
+ -- indexes until the NUL character.
+
+ function Readline (Prompt : Char_Ptr) return Char_Ptr;
+ function Readline (Prompt : Address) return Char_Ptr;
+ pragma Import (C, Readline);
+
+ procedure Free (Buf : Char_Ptr);
+ pragma Import (C, Free);
+
+ procedure Add_History (Line : Char_Ptr);
+ pragma Import (C, Add_History);
+
+ function Strlen (Str : Char_Ptr) return Natural;
+ pragma Import (C, Strlen);
+
+ pragma Linker_Options ("-lreadline");
+end Grt.Readline;