Skip to content

Instantly share code, notes, and snippets.

@koichiro
Created February 4, 2009 07:15
Show Gist options
  • Save koichiro/57998 to your computer and use it in GitHub Desktop.
Save koichiro/57998 to your computer and use it in GitHub Desktop.
typedef char *rl_compentry_func_t PARAMS((const char *, int));
READLINE_DLL_IMPEXP rl_compentry_func_t *rl_completion_entry_function;
READLINE_DLL_IMPEXP char**
rl_completion_matches (text, entry_function)
const char *text;
rl_compentry_func_t *entry_function;
{
....snip...
while (string = (*entry_function)(text, matches)) /* Need NULL return */
{
....
}
....snip...
}
module Readline
extend FFI::Library
ffi_lib 'readline'
callback :compentry_function, [:pointer, :int], :pointer
attach_function :completion_matches, :rl_completion_matches, [:string, :compentry_function], :pointer
end
Readline.completion_matches(text) do |str_p, stat|
# return NULL
# nil convert NULL pointer
nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment