summaryrefslogtreecommitdiff
path: root/translate/grt
diff options
context:
space:
mode:
authorTristan Gingold2014-06-16 03:53:55 +0200
committerTristan Gingold2014-06-16 03:53:55 +0200
commitf8429fbe0d7e8f172fba2e3f3d157fbb6508da17 (patch)
tree628142db2731bb276abd21e5bce34a88a7d1a4bb /translate/grt
parentcf8955bb1f272f6e3a935ae70cb19d3f339ec0af (diff)
downloadghdl-f8429fbe0d7e8f172fba2e3f3d157fbb6508da17.tar.gz
ghdl-f8429fbe0d7e8f172fba2e3f3d157fbb6508da17.tar.bz2
ghdl-f8429fbe0d7e8f172fba2e3f3d157fbb6508da17.zip
Add missing grt-readline.ads file.
Diffstat (limited to 'translate/grt')
-rw-r--r--translate/grt/grt-readline.ads30
1 files changed, 30 insertions, 0 deletions
diff --git a/translate/grt/grt-readline.ads b/translate/grt/grt-readline.ads
new file mode 100644
index 0000000..1a30839
--- /dev/null
+++ b/translate/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;