java.lang.Object
samer.silk.SilkCompleter
- All Implemented Interfaces:
- org.gnu.readline.ReadlineCompleter
- public class SilkCompleter
- extends java.lang.Object
- implements org.gnu.readline.ReadlineCompleter
This completer works with the JScheme scheme
interpreter by looking up symbols in the global
namespace. You can register it with the Java
Readline library either in Java or in scheme. Something
like the following should do it:
;;; Switches JScheme's input port to a new one that uses
;;; a ReadlineReader with a ">" prompt.
;;; (Note that on some systems, you might get a double
;;; prompt "> >" because JScheme's main loop also prints
;;; a prompt. If this bugs you a lot, you can just write your
;;; own main loop to replace jsint.Scheme.readEvalWriteLoop().)
(set! jsint.Scheme.input$ (jsint.InputPort.
(org.gnu.readline.ReadlineReader. "> "
org.gnu.readline.ReadlineLibrary.GnuReadline$)))
;;; not sure that this helps a lot, but I suppose it's good practice...
(.addShutdownHook (Runtime.getRuntime)
(Thread. (lambda ()
(display "cleaning up readline.\n")
(org.gnu.readline.Readline.cleanup))))
;;; set Readline's completer to a new Scheme-aware one
(org.gnu.readline.Readline.setCompleter (samer.silk.SilkCompleter.))
Author: Samer Abdallah (samer.abdallah@elec.qmul.ac.uk)
November 2002
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
it
java.util.Iterator it
SilkCompleter
public SilkCompleter()
completer
public java.lang.String completer(java.lang.String text,
int state)
- Implementation of abstract function. Finds
possible completions of the given text.
- Specified by:
completer
in interface org.gnu.readline.ReadlineCompleter