mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/readline/readline.c: r20662 reverted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
58740ef881
commit
02a37bee67
2 changed files with 19 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Dec 12 21:41:36 2008 TAKAO Kouji <kouji@takao7.net>
|
||||||
|
|
||||||
|
* ext/readline/readline.c: r20662 reverted.
|
||||||
|
|
||||||
Fri Dec 12 19:29:07 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
Fri Dec 12 19:29:07 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||||
|
|
||||||
* encoding.c (rb_enc_set_default_external): default_internal can be
|
* encoding.c (rb_enc_set_default_external): default_internal can be
|
||||||
|
|
|
@ -63,6 +63,11 @@ static int (*history_get_offset_func)(int);
|
||||||
static char **readline_attempted_completion_function(const char *text,
|
static char **readline_attempted_completion_function(const char *text,
|
||||||
int start, int end);
|
int start, int end);
|
||||||
|
|
||||||
|
#define OutputStringValue(str) do {\
|
||||||
|
SafeStringValue(str);\
|
||||||
|
str = rb_str_conv_enc(str, rb_enc_get(str), rb_locale_encoding());\
|
||||||
|
} while (0)\
|
||||||
|
|
||||||
#ifdef HAVE_RL_EVENT_HOOK
|
#ifdef HAVE_RL_EVENT_HOOK
|
||||||
#define BUSY_WAIT 0
|
#define BUSY_WAIT 0
|
||||||
|
|
||||||
|
@ -214,7 +219,7 @@ readline_readline(int argc, VALUE *argv, VALUE self)
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
|
if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
|
||||||
ExportStringValue(tmp);
|
OutputStringValue(tmp);
|
||||||
prompt = RSTRING_PTR(tmp);
|
prompt = RSTRING_PTR(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +573,7 @@ readline_s_set_completion_append_character(VALUE self, VALUE str)
|
||||||
rl_completion_append_character = '\0';
|
rl_completion_append_character = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
if (RSTRING_LEN(str) == 0) {
|
if (RSTRING_LEN(str) == 0) {
|
||||||
rl_completion_append_character = '\0';
|
rl_completion_append_character = '\0';
|
||||||
} else {
|
} else {
|
||||||
|
@ -631,7 +636,7 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
|
||||||
static char *basic_word_break_characters = NULL;
|
static char *basic_word_break_characters = NULL;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
if (basic_word_break_characters == NULL) {
|
if (basic_word_break_characters == NULL) {
|
||||||
basic_word_break_characters =
|
basic_word_break_characters =
|
||||||
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
||||||
|
@ -694,7 +699,7 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
|
||||||
static char *completer_word_break_characters = NULL;
|
static char *completer_word_break_characters = NULL;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
if (completer_word_break_characters == NULL) {
|
if (completer_word_break_characters == NULL) {
|
||||||
completer_word_break_characters =
|
completer_word_break_characters =
|
||||||
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
||||||
|
@ -755,7 +760,7 @@ readline_s_set_basic_quote_characters(VALUE self, VALUE str)
|
||||||
static char *basic_quote_characters = NULL;
|
static char *basic_quote_characters = NULL;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
if (basic_quote_characters == NULL) {
|
if (basic_quote_characters == NULL) {
|
||||||
basic_quote_characters =
|
basic_quote_characters =
|
||||||
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
||||||
|
@ -819,7 +824,7 @@ readline_s_set_completer_quote_characters(VALUE self, VALUE str)
|
||||||
static char *completer_quote_characters = NULL;
|
static char *completer_quote_characters = NULL;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
if (completer_quote_characters == NULL) {
|
if (completer_quote_characters == NULL) {
|
||||||
completer_quote_characters =
|
completer_quote_characters =
|
||||||
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
||||||
|
@ -881,7 +886,7 @@ readline_s_set_filename_quote_characters(VALUE self, VALUE str)
|
||||||
static char *filename_quote_characters = NULL;
|
static char *filename_quote_characters = NULL;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
if (filename_quote_characters == NULL) {
|
if (filename_quote_characters == NULL) {
|
||||||
filename_quote_characters =
|
filename_quote_characters =
|
||||||
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
ALLOC_N(char, RSTRING_LEN(str) + 1);
|
||||||
|
@ -972,7 +977,7 @@ hist_set(VALUE self, VALUE index, VALUE str)
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
i = NUM2INT(index);
|
i = NUM2INT(index);
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
i += history_length;
|
i += history_length;
|
||||||
}
|
}
|
||||||
|
@ -993,7 +998,7 @@ static VALUE
|
||||||
hist_push(VALUE self, VALUE str)
|
hist_push(VALUE self, VALUE str)
|
||||||
{
|
{
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
add_history(RSTRING_PTR(str));
|
add_history(RSTRING_PTR(str));
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1011,7 @@ hist_push_method(int argc, VALUE *argv, VALUE self)
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
while (argc--) {
|
while (argc--) {
|
||||||
str = *argv++;
|
str = *argv++;
|
||||||
ExportStringValue(str);
|
OutputStringValue(str);
|
||||||
add_history(RSTRING_PTR(str));
|
add_history(RSTRING_PTR(str));
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|
Loading…
Reference in a new issue