Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Macros | Functions | Variables
readline.c File Reference
`#include "ruby/config.h"`
`#include <errno.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include "ruby/ruby.h"`
`#include "ruby/io.h"`
Include dependency graph for readline.c:

Go to the source code of this file.

## Macros
#define | EDIT_LINE_LIBRARY_VERSION "EditLine wrapper"
#define | USE_INSERT_IGNORE_ESCAPE 0
#define | COMPLETION_PROC "completion_proc"
#define | COMPLETION_CASE_FOLD "completion_case_fold"
#define | rl_filename_completion_function filename_completion_function
#define | rl_username_completion_function username_completion_function
#define | rl_completion_matches completion_matches
#define | OutputStringValue(str)
#define | readline_s_set_pre_input_hook rb_f_notimplement
#define | readline_s_get_pre_input_hook rb_f_notimplement
#define | readline_s_insert_text rb_f_notimplement
#define | readline_s_redisplay rb_f_notimplement
#define | readline_s_get_line_buffer rb_f_notimplement
#define | readline_s_get_point rb_f_notimplement
#define | readline_s_set_screen_size rb_f_notimplement
#define | readline_s_get_screen_size rb_f_notimplement
#define | readline_s_vi_editing_mode rb_f_notimplement
#define | readline_s_vi_editing_mode_p rb_f_notimplement
#define | readline_s_emacs_editing_mode rb_f_notimplement
#define | readline_s_emacs_editing_mode_p rb_f_notimplement
#define | readline_s_set_completion_append_character rb_f_notimplement
#define | readline_s_get_completion_append_character rb_f_notimplement
#define | readline_s_set_basic_word_break_characters rb_f_notimplement
#define | readline_s_get_basic_word_break_characters rb_f_notimplement
#define | readline_s_set_completer_word_break_characters rb_f_notimplement
#define | readline_s_get_completer_word_break_characters rb_f_notimplement
#define | readline_s_set_special_prefixes rb_f_notimplement
#define | readline_s_get_special_prefixes rb_f_notimplement
#define | readline_s_set_basic_quote_characters rb_f_notimplement
#define | readline_s_get_basic_quote_characters rb_f_notimplement
#define | readline_s_set_completer_quote_characters rb_f_notimplement
#define | readline_s_get_completer_quote_characters rb_f_notimplement
#define | readline_s_set_filename_quote_characters rb_f_notimplement
#define | readline_s_get_filename_quote_characters rb_f_notimplement
#define | readline_s_refresh_line rb_f_notimplement
#define | hist_set rb_f_notimplement
#define | hist_clear rb_f_notimplement

## Functions
static char ** | readline_attempted_completion_function (const char *text, int start, int end)
static VALUE | readline_get (VALUE prompt)
static VALUE | readline_readline (int argc, VALUE *argv, VALUE self)
static VALUE | readline_s_set_input (VALUE self, VALUE input)
static VALUE | readline_s_set_output (VALUE self, VALUE output)
static VALUE | readline_s_set_completion_proc (VALUE self, VALUE proc)
static VALUE | readline_s_get_completion_proc (VALUE self)
static VALUE | readline_s_set_completion_case_fold (VALUE self, VALUE val)
static VALUE | readline_s_get_completion_case_fold (VALUE self)
static VALUE | hist_to_s (VALUE self)
static int | history_get_offset_history_base (int offset)
static int | history_get_offset_0 (int offset)
static VALUE | hist_get (VALUE self, VALUE index)
static VALUE | hist_push (VALUE self, VALUE str)
static VALUE | hist_push_method (int argc, VALUE *argv, VALUE self)
static VALUE | rb_remove_history (int index)
static VALUE | hist_pop (VALUE self)
static VALUE | hist_shift (VALUE self)
static VALUE | hist_each (VALUE self)
static VALUE | hist_length (VALUE self)
static VALUE | hist_empty_p (VALUE self)
static VALUE | hist_delete_at (VALUE self, VALUE index)
static VALUE | filename_completion_proc_call (VALUE self, VALUE str)
static VALUE | username_completion_proc_call (VALUE self, VALUE str)
void | Init_readline ()

## Variables
static VALUE | mReadline
static ID | completion_proc
static ID | completion_case_fold
static int(* | history_get_offset_func )(int)
static int(* | history_replace_offset_func )(int)

## Macro Definition Documentation

#define COMPLETION_CASE_FOLD "completion_case_fold"

Definition at line 59 of file readline.c.

Referenced by Init_readline().

#define COMPLETION_PROC "completion_proc"

Definition at line 58 of file readline.c.

Referenced by Init_readline().

#define EDIT_LINE_LIBRARY_VERSION "EditLine wrapper"

Definition at line 49 of file readline.c.

Referenced by Init_readline().

#define hist_clear rb_f_notimplement

Definition at line 1652 of file readline.c.

Referenced by Init_readline().

#define hist_set rb_f_notimplement

Definition at line 1525 of file readline.c.

Referenced by Init_readline().

#define OutputStringValue | ( |  | str | ) |

Value:
do {\
SafeStringValue(str);\
(str) = rb_str_conv_enc((str), rb_enc_get(str), rb_locale_encoding());\
} while (0)\
SafeStringValue
#define SafeStringValue(v)
str
static VALUE char * str
Definition: tcltklib.c:3547
rb_locale_encoding
rb_encoding * rb_locale_encoding(void)
Definition: encoding.c:1214
rb_enc_get
rb_encoding * rb_enc_get(VALUE obj)
Definition: encoding.c:772
rb_str_conv_enc
VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to)
Definition: string.c:563

Definition at line 90 of file readline.c.

Referenced by hist_push(), hist_push_method(), and readline_readline().

#define readline_s_emacs_editing_mode rb_f_notimplement

Definition at line 962 of file readline.c.

Referenced by Init_readline().

#define readline_s_emacs_editing_mode_p rb_f_notimplement

Definition at line 983 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_basic_quote_characters rb_f_notimplement

Definition at line 1320 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_basic_word_break_characters rb_f_notimplement

Definition at line 1132 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_completer_quote_characters rb_f_notimplement

Definition at line 1382 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_completer_word_break_characters rb_f_notimplement

Definition at line 1193 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_completion_append_character rb_f_notimplement

Definition at line 1071 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_filename_quote_characters rb_f_notimplement

Definition at line 1442 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_line_buffer rb_f_notimplement

Definition at line 743 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_point rb_f_notimplement

Definition at line 767 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_pre_input_hook rb_f_notimplement

Definition at line 541 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_screen_size rb_f_notimplement

Definition at line 895 of file readline.c.

Referenced by Init_readline().

#define readline_s_get_special_prefixes rb_f_notimplement

Definition at line 1261 of file readline.c.

Referenced by Init_readline().

#define readline_s_insert_text rb_f_notimplement

Definition at line 564 of file readline.c.

Referenced by Init_readline().

#define readline_s_redisplay rb_f_notimplement

Definition at line 587 of file readline.c.

Referenced by Init_readline().

#define readline_s_refresh_line rb_f_notimplement

Definition at line 1462 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_basic_quote_characters rb_f_notimplement

Definition at line 1297 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_basic_word_break_characters rb_f_notimplement

Definition at line 1108 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_completer_quote_characters rb_f_notimplement

Definition at line 1358 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_completer_word_break_characters rb_f_notimplement

Definition at line 1169 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_completion_append_character rb_f_notimplement

Definition at line 1043 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_filename_quote_characters rb_f_notimplement

Definition at line 1418 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_pre_input_hook rb_f_notimplement

Definition at line 540 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_screen_size rb_f_notimplement

Definition at line 865 of file readline.c.

Referenced by Init_readline().

#define readline_s_set_special_prefixes rb_f_notimplement

Definition at line 1260 of file readline.c.

Referenced by Init_readline().

#define readline_s_vi_editing_mode rb_f_notimplement

Definition at line 918 of file readline.c.

Referenced by Init_readline().

#define readline_s_vi_editing_mode_p rb_f_notimplement

Definition at line 939 of file readline.c.

Referenced by Init_readline().

#define rl_completion_matches completion_matches

Definition at line 78 of file readline.c.

Referenced by filename_completion_proc_call(), and username_completion_proc_call().

#define rl_filename_completion_function filename_completion_function

Definition at line 72 of file readline.c.

Referenced by filename_completion_proc_call().

#define rl_username_completion_function username_completion_function

Definition at line 75 of file readline.c.

Referenced by username_completion_proc_call().

#define USE_INSERT_IGNORE_ESCAPE 0

Definition at line 54 of file readline.c.

## Function Documentation

static VALUE filename_completion_proc_call | ( | VALUE | self,
|  | VALUE | str
| ) |  |
| static

Definition at line 1656 of file readline.c.

References free, i, Qnil, RARRAY_LEN, rb_ary_new(), rb_ary_push(), rb_ary_shift(), rb_locale_str_new_cstr(), result, rl_completion_matches, rl_filename_completion_function, and StringValuePtr.

Referenced by Init_readline().

static VALUE hist_delete_at | ( | VALUE | self,
|  | VALUE | index
| ) |  |
| static

Definition at line 1629 of file readline.c.

References i, NUM2INT, rb_eIndexError, rb_raise(), rb_remove_history(), and rb_secure().

Referenced by Init_readline().

static VALUE hist_each | ( | VALUE | self | ) |
| static

Definition at line 1597 of file readline.c.

References history_get_offset_func, i, NULL, rb_locale_str_new_cstr(), rb_secure(), rb_yield(), and RETURN_ENUMERATOR.

Referenced by Init_readline().

static VALUE hist_empty_p | ( | VALUE | self | ) |
| static

Definition at line 1622 of file readline.c.

References Qfalse, Qtrue, and rb_secure().

Referenced by Init_readline().

static VALUE hist_get | ( | VALUE | self,
|  | VALUE | index
| ) |  |
| static

Definition at line 1484 of file readline.c.

References history_get_offset_func, i, NULL, NUM2INT, rb_eIndexError, rb_locale_str_new_cstr(), rb_raise(), and rb_secure().

Referenced by Init_readline().

static VALUE hist_length | ( | VALUE | self | ) |
| static

Definition at line 1615 of file readline.c.

References INT2NUM, and rb_secure().

Referenced by Init_readline().

static VALUE hist_pop | ( | VALUE | self | ) |
| static

Definition at line 1575 of file readline.c.

References Qnil, rb_remove_history(), and rb_secure().

Referenced by Init_readline().

static VALUE hist_push | ( | VALUE | self,
|  | VALUE | str
| ) |  |
| static

Definition at line 1529 of file readline.c.

References OutputStringValue, rb_secure(), and RSTRING_PTR.

Referenced by Init_readline().

static VALUE hist_push_method | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 1538 of file readline.c.

References OutputStringValue, rb_secure(), RSTRING_PTR, and str.

Referenced by Init_readline().

static VALUE hist_shift | ( | VALUE | self | ) |
| static

Definition at line 1586 of file readline.c.

References Qnil, rb_remove_history(), and rb_secure().

Referenced by Init_readline().

static VALUE hist_to_s | ( | VALUE | self | ) |
| static

Definition at line 1466 of file readline.c.

References rb_str_new_cstr().

Referenced by Init_readline().

static int history_get_offset_0 | ( | int | offset | ) |
| static

Definition at line 1478 of file readline.c.

Referenced by Init_readline().

static int history_get_offset_history_base | ( | int | offset | ) |
| static

Definition at line 1472 of file readline.c.

Referenced by Init_readline().

void Init_readline | ( |  | ) |

Definition at line 1706 of file readline.c.

References COMPLETION_CASE_FOLD, completion_case_fold, COMPLETION_PROC, completion_proc, CONST_ID, EDIT_LINE_LIBRARY_VERSION, filename_completion_proc_call(), free, hist_clear, hist_delete_at(), hist_each(), hist_empty_p(), hist_get(), hist_length(), hist_pop(), hist_push(), hist_push_method(), hist_set, hist_shift(), hist_to_s(), history_get_offset_0(), history_get_offset_func, history_get_offset_history_base(), history_replace_offset_func, mReadline, NULL, rb_cObject, rb_define_const(), rb_define_module(), rb_define_module_function(), rb_define_singleton_method(), rb_extend_object(), rb_intern, rb_mEnumerable, rb_obj_alloc(), rb_stdin, rb_str_new_cstr(), readline_attempted_completion_function(), readline_readline(), readline_s_emacs_editing_mode, readline_s_emacs_editing_mode_p, readline_s_get_basic_quote_characters, readline_s_get_basic_word_break_characters, readline_s_get_completer_quote_characters, readline_s_get_completer_word_break_characters, readline_s_get_completion_append_character, readline_s_get_completion_case_fold(), readline_s_get_completion_proc(), readline_s_get_filename_quote_characters, readline_s_get_line_buffer, readline_s_get_point, readline_s_get_pre_input_hook, readline_s_get_screen_size, readline_s_get_special_prefixes, readline_s_insert_text, readline_s_redisplay, readline_s_refresh_line, readline_s_set_basic_quote_characters, readline_s_set_basic_word_break_characters, readline_s_set_completer_quote_characters, readline_s_set_completer_word_break_characters, readline_s_set_completion_append_character, readline_s_set_completion_case_fold(), readline_s_set_completion_proc(), readline_s_set_filename_quote_characters, readline_s_set_input(), readline_s_set_output(), readline_s_set_pre_input_hook, readline_s_set_screen_size, readline_s_set_special_prefixes, readline_s_vi_editing_mode, readline_s_vi_editing_mode_p, strlen(), username_completion_proc_call(), and version().

static VALUE rb_remove_history | ( | int | index | ) |
| static

Definition at line 1552 of file readline.c.

References free, Qnil, rb_locale_str_new_cstr(), rb_notimplement(), rb_secure(), UNREACHABLE, and val.

Referenced by hist_delete_at(), hist_pop(), and hist_shift().

static char ** readline_attempted_completion_function | ( | const char * | text,
|  | int | start,
|  | int | end
| ) |  |
| static

Definition at line 771 of file readline.c.

References ary, completion_case_fold, completion_proc, enc, encobj, i, malloc(), mReadline, NIL_P(), NULL, proc, RARRAY_LEN, RARRAY_PTR(), rb_Array(), rb_attr_get(), rb_enc_check(), rb_enc_codepoint_len(), rb_enc_from_encoding(), rb_funcall(), rb_intern, rb_locale_encoding(), rb_locale_str_new_cstr(), rb_memerror(), rb_obj_as_string(), rb_tolower(), RB_TYPE_P, result, RSTRING_LEN, RSTRING_PTR, RTEST, strcpy(), strdup, StringValueCStr, strlen(), and T_ARRAY.

Referenced by Init_readline().

static VALUE readline_get | ( | VALUE | prompt | ) |
| static

Definition at line 283 of file readline.c.

Referenced by readline_readline().

static VALUE readline_readline | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 378 of file readline.c.

References errno, fileno, free, fstat, NULL, OutputStringValue, Qnil, rb_eIOError, rb_jump_tag(), rb_locale_str_new_cstr(), rb_protect(), rb_raise(), rb_scan_args(), rb_secure(), rb_str_locktmp(), rb_str_unlocktmp(), readline_get(), result, RSTRING_PTR, RTEST, stat, status, and tmp.

Referenced by Init_readline().

static VALUE readline_s_get_completion_case_fold | ( | VALUE | self | ) |
| static

Definition at line 716 of file readline.c.

References completion_case_fold, mReadline, rb_attr_get(), and rb_secure().

Referenced by Init_readline().

static VALUE readline_s_get_completion_proc | ( | VALUE | self | ) |
| static

Definition at line 678 of file readline.c.

References completion_proc, mReadline, rb_attr_get(), and rb_secure().

Referenced by Init_readline().

static VALUE readline_s_set_completion_case_fold | ( | VALUE | self,
|  | VALUE | val
| ) |  |
| static

Definition at line 693 of file readline.c.

References completion_case_fold, mReadline, rb_ivar_set(), and rb_secure().

Referenced by Init_readline().

static VALUE readline_s_set_completion_proc | ( | VALUE | self,
|  | VALUE | proc
| ) |  |
| static

Definition at line 661 of file readline.c.

References completion_proc, mReadline, NIL_P(), rb_eArgError, rb_intern, rb_ivar_set(), rb_raise(), rb_respond_to(), and rb_secure().

Referenced by Init_readline().

static VALUE readline_s_set_input | ( | VALUE | self,
|  | VALUE | input
| ) |  |
| static

Definition at line 453 of file readline.c.

References Check_Type, GetOpenFile, input, rb_io_stdio_file(), rb_secure(), and T_FILE.

Referenced by Init_readline().

static VALUE readline_s_set_output | ( | VALUE | self,
|  | VALUE | output
| ) |  |
| static

Definition at line 477 of file readline.c.

References Check_Type, GetOpenFile, output, rb_io_stdio_file(), rb_secure(), and T_FILE.

Referenced by Init_readline().

static VALUE username_completion_proc_call | ( | VALUE | self,
|  | VALUE | str
| ) |  |
| static

Definition at line 1681 of file readline.c.

References free, i, Qnil, RARRAY_LEN, rb_ary_new(), rb_ary_push(), rb_ary_shift(), rb_locale_str_new_cstr(), result, rl_completion_matches, rl_username_completion_function, and StringValuePtr.

Referenced by Init_readline().

## Variable Documentation

ID completion_case_fold
| static

Definition at line 60 of file readline.c.

Referenced by Init_readline(), readline_attempted_completion_function(), readline_s_get_completion_case_fold(), and readline_s_set_completion_case_fold().

ID completion_proc
| static

Definition at line 60 of file readline.c.

Referenced by Init_readline(), readline_attempted_completion_function(), readline_s_get_completion_proc(), and readline_s_set_completion_proc().

int(* history_get_offset_func)(int)
| static

Definition at line 81 of file readline.c.

Referenced by hist_each(), hist_get(), and Init_readline().

int(* history_replace_offset_func)(int)
| static

Definition at line 82 of file readline.c.

Referenced by Init_readline().

VALUE mReadline
| static

Definition at line 47 of file readline.c.

Referenced by Init_readline(), readline_attempted_completion_function(), readline_s_get_completion_case_fold(), readline_s_get_completion_proc(), readline_s_set_completion_case_fold(), and readline_s_set_completion_proc().