From 7cac8a63655ad829b915144f447681cb6b25cbe8 Mon Sep 17 00:00:00 2001 From: matz Date: Sun, 6 May 2001 15:06:00 +0000 Subject: forgot some checkins. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/readline/readline.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'ext/readline/readline.c') diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 02b29796a..765a00280 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -1,5 +1,5 @@ /* readline.c -- GNU Readline module - Copyright (C) 1997-1998 Shugo Maeda */ + Copyright (C) 1997-2001 Shugo Maeda */ #include #include @@ -15,6 +15,11 @@ static VALUE mReadline; #define COMPLETION_PROC "completion_proc" #define COMPLETION_CASE_FOLD "completion_case_fold" +#ifndef READLINE_42_OR_LATER +# define rl_filename_completion_function filename_completion_function +# define rl_username_completion_function username_completion_function +#endif + static int readline_event() { @@ -33,7 +38,7 @@ readline_readline(argc, argv, self) char *buff; if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) { - prompt = STR2CSTR(tmp); + prompt = StringValuePtr(tmp); } buff = readline(prompt); if (RTEST(add_hist) && buff) { @@ -190,6 +195,7 @@ hist_set(self, index, str) VALUE str; { HISTORY_STATE *state; + VALUE s = str; int i; state = history_get_history_state(); @@ -197,7 +203,7 @@ hist_set(self, index, str) if (i < 0 || i > state->length - 1) { rb_raise(rb_eIndexError, "Invalid index"); } - replace_history_entry(i, STR2CSTR(str), NULL); + replace_history_entry(i, StringValuePtr(s), NULL); return str; } @@ -206,7 +212,7 @@ hist_push(self, str) VALUE self; VALUE str; { - add_history(STR2CSTR(str)); + add_history(StringValuePtr(str)); return self; } @@ -220,7 +226,7 @@ hist_push_method(argc, argv, self) while (argc--) { str = *argv++; - add_history(STR2CSTR(str)); + add_history(StringValuePtr(str)); } return self; } @@ -321,8 +327,8 @@ filename_completion_proc_call(self, str) char **matches; int i; - matches = completion_matches(STR2CSTR(str), - filename_completion_function); + matches = completion_matches(StringValuePtr(str), + rl_filename_completion_function); if (matches) { result = rb_ary_new(); for (i = 0; matches[i]; i++) { @@ -348,8 +354,8 @@ username_completion_proc_call(self, str) char **matches; int i; - matches = completion_matches(STR2CSTR(str), - username_completion_function); + matches = completion_matches(StringValuePtr(str), + rl_username_completion_function); if (matches) { result = rb_ary_new(); for (i = 0; matches[i]; i++) { -- cgit