Hi,

At Sat, 7 May 2005 18:01:56 +0900,
Ryan Davis wrote in [ruby-core:04865]:
> > This means libreadline on Mac OSX Tiger has no  
> > rl_attempted_completion_over
> > variable.  Does someone know exact version of libreadline on Tiger?
> 
> I can't tell exactly, bit I can provide you with:
> 
> /*      $NetBSD: readline.h,v 1.11 2004/01/17 17:57:40 christos Exp  
> $   */
> $NetBSD: history.c,v 1.25 2003/10/18 23:48:42 christos Exp $
> $NetBSD: tokenizer.c,v 1.14 2003/12/05 13:37:48 lukem Exp $
> $NetBSD: readline.c,v 1.46 2004/02/27 14:52:18 christos Exp $

Hmmm, it looks like the file contained in libedit.


Index: ext/readline/extconf.rb =================================================================== RCS file: /cvs/ruby/src/ruby/ext/readline/extconf.rb,v retrieving revision 1.8 diff -U2 -p -r1.8 extconf.rb --- ext/readline/extconf.rb 15 Jul 2004 14:04:09 -0000 1.8 +++ ext/readline/extconf.rb 7 May 2005 15:27:35 -0000 @@ -13,18 +13,15 @@ if have_header("readline/readline.h") an have_header("readline/history.h") and have_library("readline", "readline") - if have_func("rl_filename_completion_function") - $CFLAGS += " -DREADLINE_42_OR_LATER" - end - if have_func("rl_cleanup_after_signal") - $CFLAGS += " -DREADLINE_40_OR_LATER" - end - if try_link(<<EOF, $libs) -#include <stdio.h> -#include <readline/readline.h> -main() {rl_completion_append_character = 1;} -EOF - # this feature is implemented in readline-2.1 or later. - $CFLAGS += " -DREADLINE_21_OR_LATER" + headers = %w"stdio.h readline/readline.h" + unless have_macro("RL_READLINE_VERSION", headers) + if have_func("rl_filename_completion_function", headers) + $defs[-1] = "-DRL_READLINE_VERSION=0x402" + elsif have_func("rl_cleanup_after_signal", headers) + $defs[-1] = "-DRL_READLINE_VERSION=0x400" + elsif have_var("rl_completion_append_character", headers) + $defs[-1] = "-DRL_READLINE_VERSION=0x201" + end end + have_var("rl_attempted_completion_over", headers) create_makefile("readline") end Index: ext/readline/readline.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/readline/readline.c,v retrieving revision 1.21 diff -U2 -p -r1.21 readline.c --- ext/readline/readline.c 4 Mar 2005 06:47:37 -0000 1.21 +++ ext/readline/readline.c 7 May 2005 15:31:04 -0000 @@ -23,5 +23,5 @@ static VALUE mReadline; static ID completion_proc, completion_case_fold; -#ifndef READLINE_42_OR_LATER +#if RL_READLINE_VERSION < 0x0402 # define rl_filename_completion_function filename_completion_function # define rl_username_completion_function username_completion_function @@ -29,4 +29,8 @@ static ID completion_proc, completion_ca #endif +#ifndef HAVE_RL_ATTEMPTED_COMPLETION_OVER +extern int rl_attempted_completion_over; +#endif + static int readline_event() @@ -64,8 +68,8 @@ readline_readline(argc, argv, self) &status); if (status) { -#if defined READLINE_40_OR_LATER +#if RL_READLINE_VERSION >= 0x0400 /* restore terminal mode and signal handler*/ rl_cleanup_after_signal(); -#elif defined READLINE_21_OR_LATER +#elif RL_READLINE_VERSION >= 0x0201 /* restore terminal mode */ (*rl_deprep_term_function)(); @@ -210,5 +214,5 @@ readline_s_set_completion_append_charact VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 rb_secure(4); if (NIL_P(str)) { @@ -234,5 +238,5 @@ readline_s_get_completion_append_charact VALUE self; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 VALUE str; @@ -254,5 +258,5 @@ readline_s_set_basic_word_break_characte VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 static char *basic_word_break_characters = NULL; @@ -281,5 +285,5 @@ readline_s_get_basic_word_break_characte VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 rb_secure(4); if (rl_basic_word_break_characters == NULL) @@ -295,5 +299,5 @@ readline_s_set_completer_word_break_char VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 static char *completer_word_break_characters = NULL; @@ -322,5 +326,5 @@ readline_s_get_completer_word_break_char VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 rb_secure(4); if (rl_completer_word_break_characters == NULL) @@ -336,5 +340,5 @@ readline_s_set_basic_quote_characters(se VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 static char *basic_quote_characters = NULL; @@ -363,5 +367,5 @@ readline_s_get_basic_quote_characters(se VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 rb_secure(4); if (rl_basic_quote_characters == NULL) @@ -377,5 +381,5 @@ readline_s_set_completer_quote_character VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 static char *completer_quote_characters = NULL; @@ -404,5 +408,5 @@ readline_s_get_completer_quote_character VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 rb_secure(4); if (rl_completer_quote_characters == NULL) @@ -418,5 +422,5 @@ readline_s_set_filename_quote_characters VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 static char *filename_quote_characters = NULL; @@ -445,5 +449,5 @@ readline_s_get_filename_quote_characters VALUE self, str; { -#ifdef READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 rb_secure(4); if (rl_filename_quote_characters == NULL) @@ -774,5 +778,5 @@ Init_readline() username_completion_proc_call, 1); rb_define_const(mReadline, "USERNAME_COMPLETION_PROC", ucomp); -#if defined READLINE_21_OR_LATER +#if RL_READLINE_VERSION >= 0x0201 rb_define_const(mReadline, "VERSION", rb_str_new2(rl_library_version)); #else @@ -781,5 +785,5 @@ Init_readline() #endif -#if defined READLINE_42_OR_LATER +#if RL_READLINE_VERSION >= 0x0402 rl_attempted_completion_function = (rl_completion_func_t *)readline_attempted_completion_function;
-- Nobu Nakada