]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/readline/readline.factor
Add vocab completion for readline when line begins with USING:
[factor.git] / extra / readline / readline.factor
index dd10bdac915343ee9dcfd52c502b161e0d6823da..688934cba439eb0c21f83856bbe53af4c2f75a91 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.strings destructors io.encodings.utf8 kernel libc
 sequences macros quotations words compiler.units fry
-alien.data ;
+alien.data alien.libraries ;
 QUALIFIED: readline.ffi
 IN: readline
 
@@ -15,6 +15,12 @@ IN: readline
         ] [ f ] if*
     ] with-destructors ;
 
+: current-line ( -- str )
+    readline.ffi:rl_line_buffer ;
+
+: has-readline ( -- ? )
+    "readline" dup load-library dlsym-raw >boolean ;
+
 MACRO: set-completion ( quot -- )
     [
        '[ @ [ utf8 malloc-string ] [ f ] if* ]