Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Tomas Zellerin <zellerin <at> gmail.com>
Subject: Re: readline interface
Newsgroups: gmane.lisp.clisp.general
Date: Saturday 1st October 2005 06:59:24 UTC (over 12 years ago)
2005/9/30, Sam Steingold :
> > * Tomas Zellerin  [2005-09-30 13:53:13 +0200]:
> >
> > Correcting myself - it is name parameter that must be allocated
elsewhere.
>
> does my module work for you?

Mostly, but not here. Try add-defun something, and then either list
all known functions, or try to get the function using named-function.
The former case is probably more instructive, as you can see that
there is new function with name containing strange characters - new
content of given place on stack, I guess.

Also, setf-ing readline-name causes crash for me. No idea why and how
to prevent it - I had same problem. As read-only variable, it is
pretty useless. "It would be nice" if it was set to clisp somewhere by
default.

> > As for the set of function, I am missing these (binding from
string/file)
> >
> > (def-call-out parse-and-bind
> >   (:name "rl_parse_and_bind")
> >   (:arguments (line c-string))
> >   (:return-type int))
> > (def-call-out read-init-file
> >   (:name "rl_read_init_file")
> >   (:arguments (name c-string))
> >   (:return-type int))
>
> please send a patch placing all the functions you want in the right
> order in the right section.
See attached below. Hope it would work, I have access to internet only
through Windows atm.

I included functions and variables I actually used, so it should work.
It is still by no means complete set. I tried to make work key
bindings and doing some work on background while waiting in repl, the
choice of functions reflects this.

Change to add-defun is not included. Also, according to info readline
(which I used as the base), redisplay has return-type void.

>
> > Actually, my definitions are slightly different, as I use a wrapper
> > macro so that not to type function name twice:
>
> and how do you convert from "history_is_stifled" to "history-stifled-p"?
:-)
>
Good point. I did not define the function :)

> >             (:library ,+readline-library+)
>
> not needed in the module.
I tried to make it work on Windows, this is probably leftover of it.

>
> PS. please fix your mailer to respect "Mail-Copies-To" and "Reply-to".
Ill try. Is it better?

Tomas

diff -ur /mnt/readline/readline.lisp ../modules/readline/readline.lisp
--- /mnt/readline/readline.lisp  2005-09-30 16:12:10.000000000 +0200
+++ ../modules/readline/readline.lisp  2005-10-01 07:24:15.000000000 +0200
@@ -26,6 +26,8 @@
 (c-lines "#include ~%")

 (def-c-type readline-command (c-function (:arguments (rep int) (char
int))))
+(def-c-type readline-hook-function (c-function (:return-type int)))
+(def-c-type readline-vcpfunc (c-function (:arguments (text c-string))))

 (def-call-out readline (:name "readline")
   (:arguments (prompt c-string))
@@ -56,6 +60,19 @@
   (:arguments (variable c-string) (value c-string))
   (:return-type int))

+(def-call-out bind-keyseq (:name "rl_bind_keyseq")
+  (:arguments (keyseq c-string)
+              (callback readline-command))
+  (:return-type int))
+
+(def-call-out parse-and-bind (:name "rl_parse_and_bind")
+  (:arguments (line c-string))
+  (:return-type int))
+
+(def-call-out read-init-file (:name "rl_read_init_file")
+  (:arguments (name c-string))
+  (:return-type int))
+
 ;;; Associating Function Names and Bindings

 (def-call-out named-function (:name "rl_named_function")
@@ -67,6 +84,30 @@
 (def-call-out redisplay (:name "rl_redisplay")
   (:arguments) (:return-type int))

+(def-call-out forced-update-display (:name "rl_forced_update_display")
+  (:return-type int))
+(def-call-out on-new-line (:name "rl_on_new_line")
+  (:return-type int))
+
+;;; Modifying text
+(def-call-out insert-text (:name "rl_insert_text")
+  (:arguments (text c-string))
+  (:return-type int))
+
+;;; Character input
+
+(def-call-out set-keyboard-input-timeout (:name
"rl_set_keyboard_input_timeout")
+  (:arguments (microseconds int))
+  (:return-type int)) ; returns old value
+
+;;; Alternate interface
+(def-call-out callback-handler-install (:name
"rl_callback_handler_install")
+  (:arguments (prompt c-string) (lhandler readline-vcpfunc)))
+(def-call-out callback-read-char (:name "rl_callback_read_char"))
+(def-call-out callback-handler-remove (:name
"rl_callback_handler_remove"))
+
+
+
 ;;; variables

 (def-c-var library-version (:name "rl_library_version") (:type c-string))
@@ -75,6 +116,10 @@
 (def-c-var insert-mode (:name "rl_insert_mode") (:type int))
 (def-c-var readline-name (:name "rl_readline_name") (:type c-string))
;"CLISP"

+(def-c-var startup-hook (:name "rl_startup_hook") (:type
readline-hook-function))
+(def-c-var pre-input-hook (:name "rl_pre_input_hook") (:type
readline-hook-function))
+(def-c-var event-hook (:name "rl_event_hook") (:type
readline-hook-function))
+
 ;;; ------ history ------

 (c-lines "#include ~%")


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
 
CD: 14ms