From 327e957c73780d4248770cf2afc4dbcb8ef34418 Mon Sep 17 00:00:00 2001 From: shugo Date: Thu, 19 May 2005 16:26:50 +0000 Subject: * ext/readline/extconf.rb: check rl_vi_editing_mode() and rl_emacs_editing_mode(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/readline/extconf.rb | 3 +++ ext/readline/readline.c | 32 ++++++++++++++++++++++++++------ 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3463ed8c3..650f6a4778 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri May 20 01:24:33 2005 Shugo Maeda + + * ext/readline/extconf.rb: check rl_vi_editing_mode() and + rl_emacs_editing_mode(). + Thu May 19 23:33:09 2005 Shugo Maeda * ext/readline/readline.c: supported libedit. fixed: [ruby-core:4858] diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb index e3aabeae89..b67a443dad 100644 --- a/ext/readline/extconf.rb +++ b/ext/readline/extconf.rb @@ -55,6 +55,9 @@ have_readline_var("rl_library_version") have_readline_var("rl_event_hook") have_func("rl_cleanup_after_signal") have_func("rl_clear_signals") +have_func("rl_vi_editing_mode") +have_func("rl_emacs_editing_mode") +have_func("rl_clear_signals") have_func("replace_history_entry") have_func("remove_history") create_makefile("readline") diff --git a/ext/readline/readline.c b/ext/readline/readline.c index f93e77ff0d..0b7673b75f 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -205,18 +205,28 @@ static VALUE readline_s_vi_editing_mode(self) VALUE self; { +#ifdef HAVE_RL_VI_EDITING_MODE rb_secure(4); rl_vi_editing_mode(1,0); return Qnil; +#else + rb_notimplement(); + return Qnil; /* not reached */ +#endif /* HAVE_RL_VI_EDITING_MODE */ } static VALUE readline_s_emacs_editing_mode(self) VALUE self; { +#ifdef HAVE_RL_EMACS_EDITING_MODE rb_secure(4); rl_emacs_editing_mode(1,0); return Qnil; +#else + rb_notimplement(); + return Qnil; /* not reached */ +#endif /* HAVE_RL_EMACS_EDITING_MODE */ } static VALUE @@ -236,10 +246,10 @@ readline_s_set_completion_append_character(self, str) rl_completion_append_character = RSTRING(str)->ptr[0]; } } - return self; #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */ } @@ -256,10 +266,10 @@ readline_s_get_completion_append_character(self) str = rb_str_new("", 1); RSTRING(str)->ptr[0] = rl_completion_append_character; - return str; #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */ } @@ -283,10 +293,10 @@ readline_s_set_basic_word_break_characters(self, str) RSTRING(str)->ptr, RSTRING(str)->len); basic_word_break_characters[RSTRING(str)->len] = '\0'; rl_basic_word_break_characters = basic_word_break_characters; - return self; #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */ } @@ -301,6 +311,7 @@ readline_s_get_basic_word_break_characters(self, str) return rb_tainted_str_new2(rl_basic_word_break_characters); #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */ } @@ -324,10 +335,10 @@ readline_s_set_completer_word_break_characters(self, str) RSTRING(str)->ptr, RSTRING(str)->len); completer_word_break_characters[RSTRING(str)->len] = '\0'; rl_completer_word_break_characters = completer_word_break_characters; - return self; #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */ } @@ -342,6 +353,7 @@ readline_s_get_completer_word_break_characters(self, str) return rb_tainted_str_new2(rl_completer_word_break_characters); #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */ } @@ -369,6 +381,7 @@ readline_s_set_basic_quote_characters(self, str) return self; #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */ } @@ -383,6 +396,7 @@ readline_s_get_basic_quote_characters(self, str) return rb_tainted_str_new2(rl_basic_quote_characters); #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */ } @@ -410,6 +424,7 @@ readline_s_set_completer_quote_characters(self, str) return self; #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */ } @@ -424,6 +439,7 @@ readline_s_get_completer_quote_characters(self, str) return rb_tainted_str_new2(rl_completer_quote_characters); #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */ } @@ -451,6 +467,7 @@ readline_s_set_filename_quote_characters(self, str) return self; #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */ } @@ -465,6 +482,7 @@ readline_s_get_filename_quote_characters(self, str) return rb_tainted_str_new2(rl_filename_quote_characters); #else rb_notimplement(); + return Qnil; /* not reached */ #endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */ } @@ -515,10 +533,11 @@ hist_set(self, index, str) if (entry == NULL) { rb_raise(rb_eIndexError, "invalid index"); } + return str; #else rb_notimplement(); + return Qnil; /* not reached */ #endif - return str; } static VALUE @@ -565,10 +584,11 @@ rb_remove_history(index) free(entry); return val; } + return Qnil; #else rb_notimplement(); + return Qnil; /* not reached */ #endif - return Qnil; } static VALUE -- cgit v1.2.3