19 #include RUBY_EXTCONF_H 22 #include "ruby/config.h" 26 #ifdef HAVE_READLINE_READLINE_H 27 #include <readline/readline.h> 29 #ifdef HAVE_READLINE_HISTORY_H 30 #include <readline/history.h> 32 #ifdef HAVE_EDITLINE_READLINE_H 33 #include <editline/readline.h> 43 #ifdef HAVE_SYS_STAT_H 47 static VALUE mReadline;
49 #define EDIT_LINE_LIBRARY_VERSION "EditLine wrapper" 50 #ifndef USE_INSERT_IGNORE_ESCAPE 51 # if !defined(HAVE_EDITLINE_READLINE_H) && defined(RL_PROMPT_START_IGNORE) && defined(RL_PROMPT_END_IGNORE) 52 # define USE_INSERT_IGNORE_ESCAPE 1 54 # define USE_INSERT_IGNORE_ESCAPE 0 58 #define COMPLETION_PROC "completion_proc" 59 #define COMPLETION_CASE_FOLD "completion_case_fold" 60 static ID id_call, completion_proc, completion_case_fold;
61 #if defined HAVE_RL_CHAR_IS_QUOTED_P 62 #define QUOTING_DETECTION_PROC "quoting_detection_proc" 63 static ID quoting_detection_proc;
65 #if USE_INSERT_IGNORE_ESCAPE 66 static ID id_orig_prompt, id_last_prompt;
68 #if defined(HAVE_RL_PRE_INPUT_HOOK) 69 static ID id_pre_input_hook;
71 #if defined(HAVE_RL_SPECIAL_PREFIXES) 72 static ID id_special_prefixes;
75 #ifndef HAVE_RL_FILENAME_COMPLETION_FUNCTION 76 # define rl_filename_completion_function filename_completion_function 78 #ifndef HAVE_RL_USERNAME_COMPLETION_FUNCTION 79 # define rl_username_completion_function username_completion_function 81 #ifndef HAVE_RL_COMPLETION_MATCHES 82 # define rl_completion_matches completion_matches 85 static int (*history_get_offset_func)(int);
86 static int (*history_replace_offset_func)(int);
87 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER 88 static int readline_completion_append_character;
91 static char **readline_attempted_completion_function(
const char *text,
94 #define OutputStringValue(str) do {\ 95 StringValueCStr(str);\ 96 rb_check_safe_obj(str);\ 97 (str) = rb_str_conv_enc((str), rb_enc_get(str), rb_locale_encoding());\ 134 static VALUE readline_instream;
135 static VALUE readline_outstream;
136 static FILE *readline_rl_instream;
137 static FILE *readline_rl_outstream;
140 mustbe_callable(
VALUE proc)
146 #if defined HAVE_RL_GETC_FUNCTION 149 #define rl_getc(f) EOF 160 getc_body(
struct getc_struct *p)
169 static int prior_key =
'0';
172 if (prior_key > 0xff) {
173 prior_key = rl_getc(p->input);
176 h = (HANDLE)_get_osfhandle(p->fd);
177 if (PeekConsoleInput(h, &ir, 1, &n)) {
179 if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) {
180 prior_key = rl_getc(p->input);
183 ReadConsoleInput(h, &ir, 1, &n);
195 ss = read(p->fd, &ch, 1);
202 return (
unsigned char)ch;
206 getc_func(
void *data1)
208 struct getc_struct *p = data1;
210 p->ret = getc_body(p);
218 struct getc_struct data;
227 if (data.ret ==
EOF) {
231 if (data.err == EINTR) {
235 if (data.err ==
EWOULDBLOCK || data.err == EAGAIN) {
237 if (
fileno(input) != data.fd)
238 rb_bug(
"readline_getc: input closed unexpectedly or memory corrupted");
240 if (ret != -1 ||
errno == EINTR)
249 #elif defined HAVE_RL_EVENT_HOOK 252 static int readline_event(
void);
265 #if USE_INSERT_IGNORE_ESCAPE 267 insert_ignore_escape(
VALUE self,
VALUE prompt)
271 const char *s0, *s, *e;
273 static const char ignore_code[2] = {RL_PROMPT_START_IGNORE, RL_PROMPT_END_IGNORE};
277 if (orig_prompt == prompt)
return last_prompt;
279 if (
NIL_P(last_prompt)) {
286 while (s < e && *s) {
288 case RL_PROMPT_START_IGNORE:
293 case RL_PROMPT_END_IGNORE:
299 if (++s < e && *s ==
'[') {
302 while (++s < e && *s) {
303 if (
ISALPHA(*(
unsigned char *)s)) {
312 else if (!((
'0' <= *s && *s <=
'9') || *s ==
';')) {
341 readline_get(
VALUE prompt)
343 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER 344 readline_completion_append_character = rl_completion_append_character;
346 return (
VALUE)readline((
char *)prompt);
350 clear_rl_instream(
void)
352 if (readline_rl_instream) {
353 fclose(readline_rl_instream);
354 if (rl_instream == readline_rl_instream)
356 readline_rl_instream =
NULL;
358 readline_instream =
Qfalse;
362 clear_rl_outstream(
void)
364 if (readline_rl_outstream) {
365 fclose(readline_rl_outstream);
366 if (rl_outstream == readline_rl_outstream)
368 readline_rl_outstream =
NULL;
370 readline_outstream =
Qfalse;
374 prepare_readline(
void)
376 static int initialized = 0;
382 if (readline_instream) {
391 if (readline_outstream) {
395 clear_rl_outstream();
488 VALUE tmp, add_hist, result;
495 #if USE_INSERT_IGNORE_ESCAPE 496 tmp = insert_ignore_escape(
self, tmp);
508 #if USE_INSERT_IGNORE_ESCAPE 514 #if defined HAVE_RL_CLEANUP_AFTER_SIGNAL 516 #if defined HAVE_RL_FREE_LINE_STATE 517 rl_free_line_state();
519 rl_cleanup_after_signal();
520 #elif defined HAVE_RL_DEPREP_TERM_FUNCTION 522 if (rl_deprep_term_function !=
NULL)
523 (*rl_deprep_term_function)();
526 rl_deprep_terminal();
531 if (
RTEST(add_hist) && buff) {
539 if (buff)
free(buff);
569 int save_errno =
errno;
573 rl_instream = readline_rl_instream =
f;
574 readline_instream =
input;
587 readline_s_set_output(
VALUE self,
VALUE output)
594 clear_rl_outstream();
599 clear_rl_outstream();
605 int save_errno =
errno;
609 rl_outstream = readline_rl_outstream =
f;
610 readline_outstream = output;
615 #if defined(HAVE_RL_PRE_INPUT_HOOK) 633 mustbe_callable(proc);
634 return rb_ivar_set(mReadline, id_pre_input_hook, proc);
654 readline_pre_input_hook(
void)
664 #define readline_s_set_pre_input_hook rb_f_notimplement 665 #define readline_s_get_pre_input_hook rb_f_notimplement 668 #if defined(HAVE_RL_INSERT_TEXT) 687 #define readline_s_insert_text rb_f_notimplement 690 #if defined(HAVE_RL_DELETE_TEXT) 692 str_subpos(
const char *ptr,
const char *end,
long beg,
long *sublen,
rb_encoding *enc)
717 if (rl_line_buffer) {
718 const char *p, *ptr = rl_line_buffer;
720 const char *end = ptr +
len;
726 p = str_subpos(ptr, end, beg, &len, enc);
730 else if (
argc == 1) {
742 #define readline_s_delete_text rb_f_notimplement 745 #if defined(HAVE_RL_REDISPLAY) 764 #define readline_s_redisplay rb_f_notimplement 836 readline_s_set_completion_proc(
VALUE self,
VALUE proc)
838 mustbe_callable(proc);
839 return rb_ivar_set(mReadline, completion_proc, proc);
849 readline_s_get_completion_proc(
VALUE self)
854 #ifdef HAVE_RL_CHAR_IS_QUOTED_P 879 mustbe_callable(proc);
880 return rb_ivar_set(mReadline, quoting_detection_proc, proc);
892 return rb_attr_get(mReadline, quoting_detection_proc);
895 #define readline_s_set_quoting_detection_proc rb_f_notimplement 896 #define readline_s_get_quoting_detection_proc rb_f_notimplement 908 return rb_ivar_set(mReadline, completion_case_fold, val);
926 readline_s_get_completion_case_fold(
VALUE self)
928 return rb_attr_get(mReadline, completion_case_fold);
931 #ifdef HAVE_RL_LINE_BUFFER 948 if (rl_line_buffer ==
NULL)
953 #define readline_s_get_line_buffer rb_f_notimplement 996 #define readline_s_get_point rb_f_notimplement 997 #define readline_s_set_point rb_f_notimplement 1001 readline_attempted_completion_function(
const char *text,
int start,
int end)
1003 VALUE proc, ary, temp;
1013 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER 1014 rl_completion_append_character = readline_completion_append_character;
1016 #ifdef HAVE_RL_ATTEMPTED_COMPLETION_OVER 1017 rl_attempted_completion_over = 1;
1024 if (matches == 0)
return NULL;
1025 result = (
char**)
malloc((matches + 2)*
sizeof(
char*));
1029 for (i = 0; i < matches; i++) {
1037 result[matches + 1] =
NULL;
1040 result[0] =
strdup(result[1]);
1043 const char *result1 = result[1];
1044 long low =
strlen(result1);
1046 for (i = 1; i < matches; ++i) {
1047 register int c1, c2;
1050 const char *p2 = result[i + 1];
1053 for (i1 = i2 = 0; i1 < low && i2 < l2; i1 += n1, i2 += n2) {
1057 c1 = rb_tolower(c1);
1058 c2 = rb_tolower(c2);
1060 if (c1 != c2)
break;
1065 result[0] = (
char*)
malloc(low + 1);
1067 strncpy(result[0], result[1], low);
1068 result[0][low] =
'\0';
1074 #ifdef HAVE_RL_CHAR_IS_QUOTED_P 1076 readline_char_is_quoted(
char *text,
int byte_index)
1078 VALUE proc, result, str;
1082 proc =
rb_attr_get(mReadline, quoting_detection_proc);
1088 if (byte_index < 0 || len < (
size_t)byte_index) {
1096 return RTEST(result);
1100 #ifdef HAVE_RL_SET_SCREEN_SIZE 1118 #define readline_s_set_screen_size rb_f_notimplement 1121 #ifdef HAVE_RL_GET_SCREEN_SIZE 1138 rl_get_screen_size(&rows, &columns);
1145 #define readline_s_get_screen_size rb_f_notimplement 1148 #ifdef HAVE_RL_VI_EDITING_MODE 1161 rl_vi_editing_mode(1,0);
1165 #define readline_s_vi_editing_mode rb_f_notimplement 1168 #ifdef HAVE_RL_EDITING_MODE 1183 #define readline_s_vi_editing_mode_p rb_f_notimplement 1186 #ifdef HAVE_RL_EMACS_EDITING_MODE 1199 rl_emacs_editing_mode(1,0);
1203 #define readline_s_emacs_editing_mode rb_f_notimplement 1206 #ifdef HAVE_RL_EDITING_MODE 1221 #define readline_s_emacs_editing_mode_p rb_f_notimplement 1224 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER 1265 rl_completion_append_character =
'\0';
1270 rl_completion_append_character =
'\0';
1272 rl_completion_append_character =
RSTRING_PTR(str)[0];
1278 #define readline_s_set_completion_append_character rb_f_notimplement 1281 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER 1296 if (rl_completion_append_character ==
'\0')
1299 buf[0] = (char) rl_completion_append_character;
1303 #define readline_s_get_completion_append_character rb_f_notimplement 1306 #ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS 1320 static char *basic_word_break_characters =
NULL;
1323 if (basic_word_break_characters ==
NULL) {
1324 basic_word_break_characters =
1330 strncpy(basic_word_break_characters,
1332 basic_word_break_characters[
RSTRING_LEN(str)] =
'\0';
1333 rl_basic_word_break_characters = basic_word_break_characters;
1337 #define readline_s_set_basic_word_break_characters rb_f_notimplement 1340 #ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS 1353 if (rl_basic_word_break_characters ==
NULL)
1358 #define readline_s_get_basic_word_break_characters rb_f_notimplement 1361 #ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS 1375 static char *completer_word_break_characters =
NULL;
1378 if (completer_word_break_characters ==
NULL) {
1379 completer_word_break_characters =
1385 strncpy(completer_word_break_characters,
1387 completer_word_break_characters[
RSTRING_LEN(str)] =
'\0';
1388 rl_completer_word_break_characters = completer_word_break_characters;
1392 #define readline_s_set_completer_word_break_characters rb_f_notimplement 1395 #ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS 1408 if (rl_completer_word_break_characters ==
NULL)
1413 #define readline_s_get_completer_word_break_characters rb_f_notimplement 1416 #if defined(HAVE_RL_SPECIAL_PREFIXES) 1441 rl_special_prefixes =
NULL;
1465 if (rl_special_prefixes ==
NULL)
return Qnil;
1466 str =
rb_ivar_get(mReadline, id_special_prefixes);
1474 #define readline_s_set_special_prefixes rb_f_notimplement 1475 #define readline_s_get_special_prefixes rb_f_notimplement 1478 #ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS 1490 static char *basic_quote_characters =
NULL;
1493 if (basic_quote_characters ==
NULL) {
1494 basic_quote_characters =
1500 strncpy(basic_quote_characters,
1503 rl_basic_quote_characters = basic_quote_characters;
1508 #define readline_s_set_basic_quote_characters rb_f_notimplement 1511 #ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS 1523 if (rl_basic_quote_characters ==
NULL)
1528 #define readline_s_get_basic_quote_characters rb_f_notimplement 1531 #ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS 1546 static char *completer_quote_characters =
NULL;
1549 if (completer_quote_characters ==
NULL) {
1550 completer_quote_characters =
1557 completer_quote_characters[
RSTRING_LEN(str)] =
'\0';
1558 rl_completer_quote_characters = completer_quote_characters;
1563 #define readline_s_set_completer_quote_characters rb_f_notimplement 1566 #ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS 1579 if (rl_completer_quote_characters ==
NULL)
1584 #define readline_s_get_completer_quote_characters rb_f_notimplement 1587 #ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS 1600 static char *filename_quote_characters =
NULL;
1603 if (filename_quote_characters ==
NULL) {
1604 filename_quote_characters =
1611 filename_quote_characters[
RSTRING_LEN(str)] =
'\0';
1612 rl_filename_quote_characters = filename_quote_characters;
1617 #define readline_s_set_filename_quote_characters rb_f_notimplement 1620 #ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS 1633 if (rl_filename_quote_characters ==
NULL)
1638 #define readline_s_get_filename_quote_characters rb_f_notimplement 1641 #ifdef HAVE_RL_REFRESH_LINE 1652 rl_refresh_line(0, 0);
1656 #define readline_s_refresh_line rb_f_notimplement 1660 hist_to_s(
VALUE self)
1666 history_get_offset_history_base(
int offset)
1668 return history_base + offset;
1672 history_get_offset_0(
int offset)
1680 HIST_ENTRY *entry =
NULL;
1685 i += history_length;
1688 entry = history_get(history_get_offset_func(i));
1690 if (entry ==
NULL) {
1696 #ifdef HAVE_REPLACE_HISTORY_ENTRY 1700 HIST_ENTRY *entry =
NULL;
1706 i += history_length;
1709 entry = replace_history_entry(history_replace_offset_func(i),
RSTRING_PTR(str),
NULL);
1711 if (entry ==
NULL) {
1717 #define hist_set rb_f_notimplement 1742 rb_remove_history(
int index)
1744 #ifdef HAVE_REMOVE_HISTORY 1748 entry = remove_history(index);
1751 free((
void *) entry->line);
1764 hist_pop(
VALUE self)
1766 if (history_length > 0) {
1767 return rb_remove_history(history_length - 1);
1774 hist_shift(
VALUE self)
1776 if (history_length > 0) {
1777 return rb_remove_history(0);
1784 hist_each(
VALUE self)
1791 for (i = 0; i < history_length; i++) {
1792 entry = history_get(history_get_offset_func(i));
1801 hist_length(
VALUE self)
1803 return INT2NUM(history_length);
1807 hist_empty_p(
VALUE self)
1819 i += history_length;
1820 if (i < 0 || i > history_length - 1) {
1823 return rb_remove_history(i);
1826 #ifdef HAVE_CLEAR_HISTORY 1834 #define hist_clear rb_f_notimplement 1838 filename_completion_proc_call(
VALUE self,
VALUE str)
1848 for (i = 0; matches[i]; i++) {
1863 username_completion_proc_call(
VALUE self,
VALUE str)
1873 for (i = 0; matches[i]; i++) {
1891 VALUE history, fcomp, ucomp, version;
1894 rl_readline_name = (
char *)
"Ruby";
1896 #if defined HAVE_RL_GETC_FUNCTION 1900 rl_getc_function = readline_getc;
1901 #elif defined HAVE_RL_EVENT_HOOK 1902 rl_event_hook = readline_event;
1910 #if defined(HAVE_RL_PRE_INPUT_HOOK) 1911 id_pre_input_hook =
rb_intern(
"pre_input_hook");
1913 #if defined(HAVE_RL_SPECIAL_PREFIXES) 1914 id_special_prefixes =
rb_intern(
"special_prefixes");
1916 #if defined HAVE_RL_CHAR_IS_QUOTED_P 1917 quoting_detection_proc =
rb_intern(QUOTING_DETECTION_PROC);
1922 readline_readline, -1);
1924 readline_s_set_input, 1);
1926 readline_s_set_output, 1);
1928 readline_s_set_completion_proc, 1);
1930 readline_s_get_completion_proc, 0);
1936 readline_s_set_completion_case_fold, 1);
1938 readline_s_get_completion_case_fold, 0);
1998 #if USE_INSERT_IGNORE_ESCAPE 1999 CONST_ID(id_orig_prompt,
"orig_prompt");
2000 CONST_ID(id_last_prompt,
"last_prompt");
2029 filename_completion_proc_call, 1);
2038 username_completion_proc_call, 1);
2044 history_get_offset_func = history_get_offset_history_base;
2045 history_replace_offset_func = history_get_offset_0;
2046 #if defined HAVE_RL_LIBRARY_VERSION 2048 #if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY 2052 if (history_get(history_get_offset_func(0)) ==
NULL) {
2053 history_get_offset_func = history_get_offset_0;
2055 #ifdef HAVE_REPLACE_HISTORY_ENTRY 2056 if (replace_history_entry(0,
"a",
NULL) ==
NULL) {
2057 history_replace_offset_func = history_get_offset_history_base;
2060 #ifdef HAVE_CLEAR_HISTORY 2064 HIST_ENTRY *entry = remove_history(0);
2066 free((
char *)entry->line);
2079 rl_attempted_completion_function = readline_attempted_completion_function;
2080 #if defined(HAVE_RL_PRE_INPUT_HOOK) 2081 rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
2083 #if defined HAVE_RL_CHAR_IS_QUOTED_P 2084 rl_char_is_quoted_p = &readline_char_is_quoted;
2086 #ifdef HAVE_RL_CATCH_SIGNALS 2087 rl_catch_signals = 0;
2089 #ifdef HAVE_RL_CLEAR_SIGNALS RUBY_EXTERN VALUE rb_cString
void rb_thread_schedule(void)
VALUE rb_protect(VALUE(*proc)(VALUE), VALUE data, int *pstate)
Protects a function call from potential global escapes from the function.
rb_encoding * rb_enc_check(VALUE str1, VALUE str2)
#define readline_s_get_line_buffer
void rb_bug(const char *fmt,...)
void rb_syserr_fail(int e, const char *mesg)
#define readline_s_get_basic_quote_characters
int rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout)
size_t strlen(const char *)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_str_cat(VALUE, const char *, long)
void rb_jump_tag(int tag)
Continues the exception caught by rb_protect() and rb_eval_string_protect().
void rb_io_check_initialized(rb_io_t *)
VALUE rb_ary_shift(VALUE ary)
void * rb_thread_call_without_gvl2(void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2)
#define readline_s_set_completer_word_break_characters
#define readline_s_emacs_editing_mode
#define readline_s_set_pre_input_hook
VALUE rb_str_unlocktmp(VALUE)
VALUE rb_enc_from_encoding(rb_encoding *encoding)
VALUE rb_ary_push(VALUE ary, VALUE item)
#define readline_s_get_special_prefixes
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
void rb_str_set_len(VALUE, long)
unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len_p, rb_encoding *enc)
#define readline_s_get_quoting_detection_proc
VALUE rb_ivar_get(VALUE, ID)
VALUE rb_io_taint_check(VALUE)
VALUE rb_obj_alloc(VALUE)
Allocates an instance of klass.
#define readline_s_insert_text
#define COMPLETION_CASE_FOLD
char * rb_str_subpos(VALUE, long, long *)
VALUE rb_range_beg_len(VALUE, long *, long *, long, int)
void rb_gc_register_address(VALUE *addr)
void rb_gc_force_recycle(VALUE obj)
VALUE rb_str_dup_frozen(VALUE)
VALUE rb_str_tmp_new(long)
#define GetOpenFile(obj, fp)
#define readline_s_delete_text
#define readline_s_vi_editing_mode_p
VALUE rb_enc_str_new_static(const char *, long, rb_encoding *)
#define OutputStringValue(str)
#define RB_TYPE_P(obj, type)
#define readline_s_get_pre_input_hook
#define rl_filename_completion_function
#define readline_s_set_quoting_detection_proc
#define readline_s_set_completer_quote_characters
VALUE rb_str_new_shared(VALUE)
#define readline_s_get_basic_word_break_characters
RUBY_EXTERN VALUE rb_cObject
#define EDIT_LINE_LIBRARY_VERSION
VALUE rb_obj_as_string(VALUE)
#define readline_s_refresh_line
VALUE rb_locale_str_new(const char *, long)
#define readline_s_get_filename_quote_characters
void rb_define_const(VALUE, const char *, VALUE)
#define readline_s_vi_editing_mode
void rb_notimplement(void)
#define readline_s_emacs_editing_mode_p
VALUE rb_Array(VALUE)
Equivalent to Kernel#Array in Ruby.
#define readline_s_set_point
void rb_sys_fail(const char *mesg)
VALUE rb_locale_str_new_cstr(const char *)
void rb_define_module_function(VALUE module, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a module function for module.
#define REALLOC_N(var, type, n)
VALUE rb_obj_reveal(VALUE obj, VALUE klass)
Make a hidden object visible again.
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
VALUE rb_ivar_set(VALUE, ID, VALUE)
unsigned char buf[MIME_BUF_SIZE]
#define readline_s_set_special_prefixes
rb_encoding * rb_locale_encoding(void)
int rb_wait_for_single_fd(int fd, int events, struct timeval *tv)
VALUE rb_str_new_cstr(const char *)
VALUE rb_obj_hide(VALUE obj)
Make the object invisible from Ruby code.
#define readline_s_get_point
int rb_respond_to(VALUE, ID)
register unsigned int len
#define StringValueCStr(v)
#define readline_s_set_filename_quote_characters
#define readline_s_redisplay
long rb_enc_strlen(const char *, const char *, rb_encoding *)
#define RARRAY_AREF(a, i)
#define readline_s_get_completer_quote_characters
void rb_extend_object(VALUE obj, VALUE module)
Extend the object with the module.
#define readline_s_set_screen_size
void rb_thread_check_ints(void)
VALUE rb_str_locktmp(VALUE)
long rb_str_sublen(VALUE, long)
#define rl_username_completion_function
#define RETURN_ENUMERATOR(obj, argc, argv)
#define rl_completion_matches
#define readline_s_get_screen_size
#define readline_s_set_basic_word_break_characters
RUBY_EXTERN VALUE rb_eIOError
#define readline_s_get_completion_append_character
#define StringValuePtr(v)
int rb_cloexec_dup(int oldfd)
#define CONST_ID(var, str)
VALUE rb_define_module(const char *name)
#define readline_s_set_basic_quote_characters
VALUE rb_attr_get(VALUE, ID)
#define readline_s_get_completer_word_break_characters
#define readline_s_set_completion_append_character