ext/io/console/console.c File Reference

#include "ruby.h"
#include "rubyio.h"
#include "util.h"

Go to the source code of this file.

Data Structures

struct  rawmode_arg_t

Defines

#define RB_TYPE_P(obj, type)   (TYPE(obj) == type)
#define SET_LAST_ERROR   (0)
#define InitVM(ext)   {void InitVM_##ext(void);InitVM_##ext();}
#define GetReadFD(fptr)   ((fptr)->fd)
#define GetWriteFD(fptr)   get_write_fd(fptr)
#define FD_PER_IO   2
#define CONSOLE_DEVICE_FOR_READING   CONSOLE_DEVICE

Typedefs

typedef OpenFile rb_io_t

Functions

static rawmode_arg_trawmode_opt (int argc, VALUE *argv, rawmode_arg_t *opts)
static void set_rawmode (conmode *t, void *arg)
static void set_cookedmode (conmode *t, void *arg)
static void set_noecho (conmode *t, void *arg)
static void set_echo (conmode *t, void *arg)
static int echo_p (conmode *t)
static int set_ttymode (int fd, conmode *t, void(*setter)(conmode *, void *), void *arg)
static int get_write_fd (const rb_io_t *fptr)
static VALUE ttymode (VALUE io, VALUE(*func)(VALUE), void(*setter)(conmode *, void *), void *arg)
static VALUE console_raw (int argc, VALUE *argv, VALUE io)
static VALUE console_set_raw (int argc, VALUE *argv, VALUE io)
static VALUE console_cooked (VALUE io)
static VALUE console_set_cooked (VALUE io)
static VALUE getc_call (VALUE io)
static VALUE console_getch (int argc, VALUE *argv, VALUE io)
static VALUE console_noecho (VALUE io)
static VALUE console_set_echo (VALUE io, VALUE f)
static VALUE console_echo_p (VALUE io)
static VALUE console_iflush (VALUE io)
static VALUE console_oflush (VALUE io)
static VALUE console_ioflush (VALUE io)
static VALUE console_dev (VALUE klass)
static VALUE io_getch (int argc, VALUE *argv, VALUE io)
void Init_console (void)
void InitVM_console (void)

Variables

static ID id_getc
static ID id_console

Define Documentation

#define CONSOLE_DEVICE_FOR_READING   CONSOLE_DEVICE

Referenced by console_dev().

#define FD_PER_IO   2

Definition at line 256 of file console.c.

Referenced by ttymode().

#define GetReadFD ( fptr   )     ((fptr)->fd)
#define GetWriteFD ( fptr   )     get_write_fd(fptr)

Definition at line 253 of file console.c.

Referenced by console_ioflush(), console_oflush(), and ttymode().

#define InitVM ( ext   )     {void InitVM_##ext(void);InitVM_##ext();}

Definition at line 95 of file console.c.

Referenced by Init_console(), and Init_Enumerator().

#define RB_TYPE_P ( obj,
type   )     (TYPE(obj) == type)

Definition at line 29 of file console.c.

Referenced by add(), add_activated_refinement(), argf_close(), argf_getbyte(), argf_next_argv(), argf_readchar(), ary2sv(), ary_join_1(), BigDecimal_add(), BigDecimal_coerce(), BigDecimal_divide(), BigDecimal_divremain(), BigDecimal_DoDivmod(), BigDecimal_mult(), BigDecimal_power(), BigDecimal_sub(), BigDecimal_to_i(), BigDecimal_to_s(), binop(), bit_coerce(), call_trace_func(), case_when_optimizable_literal(), cdhash_hash(), check_exec_redirect(), check_exec_redirect1(), class2path(), classname(), compile_dstr_fragments(), cond0(), console_dev(), copy_stream_body(), count_nodes(), count_objects(), count_objects_size(), count_tdata_objects(), cvar_front_klass(), debug_lines(), decode_jd(), decorate_convpath(), do_coerce(), econv_opts(), enum_sort_by(), enumerator_initialize(), errinfo_place(), error_print(), eval_string_with_cref(), extract_user_token(), f_gcd(), f_minus_one_p(), f_mul(), f_one_p(), f_signbit(), f_to_f(), f_zero_p(), fc_i(), features_index_add_single(), fill_id_and_klass(), fix_and(), fix_cmp(), fix_divide(), fix_divmod(), fix_equal(), fix_fdiv(), fix_ge(), fix_gt(), fix_le(), fix_lt(), fix_minus(), fix_mod(), fix_mul(), fix_or(), fix_plus(), fix_pow(), fix_xor(), flo_cmp(), flo_div(), flo_divmod(), flo_eq(), flo_eql(), flo_ge(), flo_gt(), flo_le(), flo_lt(), flo_minus(), flo_mod(), flo_mul(), flo_plus(), flo_pow(), fun1(), gc_info_decode(), gc_latest_gc_info(), gc_stat(), gc_stat_internal(), get_array(), get_klass(), get_strpath(), group_by_i(), hash_equal(), ignore_closed_stream(), Init_RandomSeed2(), int_round_0(), io_write_nonblock(), is_integer(), is_negative(), iseq_build_from_ary_body(), iseq_build_load_iseq(), lazy_flat_map_func(), load_lock(), make_inspectname(), make_metaclass(), match_equal(), match_op_gen(), method_owner(), mnew_from_me(), mul(), must_be_module(), negative_int_p(), nucomp_coerce(), nucomp_real_check(), nucomp_s_convert(), num_members(), num_step(), numeric_quo(), nurat_add(), nurat_cmp(), nurat_coerce(), nurat_div(), nurat_eqeq_p(), nurat_expt(), nurat_int_check(), nurat_mul(), nurat_s_convert(), nurat_sub(), obj2int(), obj2subsecx(), obj2vint(), original_module(), ossl_bn_initialize(), pack_unpack(), path2class(), path_initialize(), positive_int_p(), proc_binding(), pruby_str_to_var(), pty_close_pty(), quo(), r_byte(), r_bytes0(), r_entry0(), r_object0(), rand_random(), rand_range(), range_bsearch(), range_include(), range_loader(), rb_alias(), rb_any_cmp(), rb_ary_eql(), rb_ary_equal(), rb_ary_rassoc(), rb_builtin_class_name(), rb_check_backtrace(), rb_check_id(), rb_check_inheritable(), rb_check_safe_str(), rb_check_to_float(), rb_check_to_integer(), rb_check_typeddata(), rb_class_inherited_p(), rb_class_superclass(), rb_construct_expanded_load_path(), rb_cstr_to_rat(), rb_define_class(), rb_define_class_id_under(), rb_define_module(), rb_define_module_id_under(), rb_dlcfunc_call(), rb_dlptr_aset(), rb_econv_open_opts(), rb_enc_associate_index(), rb_enc_compatible(), rb_eval_cmd(), rb_export_method(), rb_f_p_internal(), rb_f_printf(), rb_feature_p(), rb_fiddle_ptr_aset(), rb_file_exists_p(), rb_file_join(), rb_get_path_check_to_string(), rb_gzwriter_write(), rb_Hash(), rb_hash(), rb_include_class_new(), rb_include_module(), rb_int_pred(), rb_int_succ(), rb_io_flush_raw(), rb_io_getbyte(), rb_io_putc(), rb_io_puts(), rb_io_set_encoding(), rb_io_syswrite(), rb_io_ungetc(), rb_ioctl(), rb_iseq_compile_with_option(), rb_load_file(), rb_method_call_status(), rb_method_name_error(), rb_mod_const_defined(), rb_mod_const_get(), rb_mod_define_method(), rb_mod_included_modules(), rb_mod_init_copy(), rb_mod_modfunc(), rb_mod_singleton_p(), rb_num2long(), rb_num2ulong_internal(), rb_num_to_uint(), rb_obj_as_string(), rb_obj_singleton_methods(), rb_p(), rb_path_to_class(), rb_print_undef(), rb_print_undef_str(), rb_profile_frame_classpath(), rb_reg_equal(), rb_reg_initialize_m(), rb_reg_match2(), rb_singleton_class(), rb_str_aref_m(), rb_str_aset_m(), rb_str_cmp_m(), rb_str_concat(), rb_str_eql(), rb_str_equal(), rb_str_index_m(), rb_str_partition(), rb_str_rindex_m(), rb_str_rpartition(), rb_str_setter(), rb_str_split_m(), rb_string_value(), rb_struct_aref(), rb_struct_aset(), rb_struct_eql(), rb_struct_equal(), rb_struct_s_members(), rb_tmp_class_path(), rb_to_float(), rb_to_id(), rb_to_integer(), rb_typeddata_is_kind_of(), rb_undef(), rb_using_refinement(), rb_vm_bugreport(), readline_attempted_completion_function(), recursive_check(), recursive_list_access(), recursive_pop(), recursive_push(), rsock_syserr_fail_path(), ruby_cleanup(), ruby_float_step(), ruby_num_interval_step_size(), string_to_r(), string_to_r_strict(), strio_getline(), strio_putc(), strio_reopen(), strio_write(), sub(), syserr_initialize(), test_check(), thread_join(), thread_start_func_2(), time_mdump(), time_to_r(), to_integer(), transcode_loop(), umethod_bind(), unknown_keyword_error(), uscore_get(), usec2subsecx(), v2w(), vm_check_if_namespace(), vm_expandarray(), vm_get_iclass(), vm_getivar(), vm_rewrite_ep_in_errinfo(), vm_search_super_method(), vm_setivar(), vm_stat(), w_object(), wadd(), wmul(), wquo(), wsub(), and yyparse().

#define SET_LAST_ERROR   (0)

Definition at line 91 of file console.c.


Typedef Documentation

typedef OpenFile rb_io_t

Definition at line 15 of file console.c.


Function Documentation

static VALUE console_cooked ( VALUE  io  )  [static]

Definition at line 373 of file console.c.

References NULL, rb_yield(), set_cookedmode(), and ttymode().

Referenced by InitVM_console().

static VALUE console_dev ( VALUE  klass  )  [static]
static VALUE console_echo_p ( VALUE  io  )  [static]

Definition at line 479 of file console.c.

References echo_p(), GetOpenFile, GetReadFD, Qfalse, Qtrue, and rb_sys_fail().

Referenced by InitVM_console().

static VALUE console_getch ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 418 of file console.c.

References getc_call(), rawmode_opt(), set_rawmode(), and ttymode().

Referenced by InitVM_console().

static VALUE console_iflush ( VALUE  io  )  [static]

Definition at line 603 of file console.c.

References GetOpenFile, GetReadFD, and rb_sys_fail().

Referenced by InitVM_console().

static VALUE console_ioflush ( VALUE  io  )  [static]

Definition at line 649 of file console.c.

References GetOpenFile, GetReadFD, GetWriteFD, and rb_sys_fail().

Referenced by InitVM_console().

static VALUE console_noecho ( VALUE  io  )  [static]

Definition at line 437 of file console.c.

References NULL, rb_yield(), set_noecho(), and ttymode().

Referenced by InitVM_console().

static VALUE console_oflush ( VALUE  io  )  [static]

Definition at line 626 of file console.c.

References GetOpenFile, GetWriteFD, and rb_sys_fail().

Referenced by InitVM_console().

static VALUE console_raw ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 328 of file console.c.

References rawmode_opt(), rb_yield(), set_rawmode(), and ttymode().

Referenced by InitVM_console().

static VALUE console_set_cooked ( VALUE  io  )  [static]

Definition at line 389 of file console.c.

References GetOpenFile, GetReadFD, NULL, rb_sys_fail(), and set_cookedmode().

Referenced by InitVM_console().

static VALUE console_set_echo ( VALUE  io,
VALUE  f 
) [static]

Definition at line 453 of file console.c.

References GetOpenFile, GetReadFD, NULL, rb_sys_fail(), RTEST, set_echo(), and set_noecho().

Referenced by InitVM_console().

static VALUE console_set_raw ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 345 of file console.c.

References GetOpenFile, GetReadFD, rawmode_opt(), rb_sys_fail(), and set_rawmode().

Referenced by InitVM_console().

static int echo_p ( conmode *  t  )  [static]

Definition at line 214 of file console.c.

Referenced by console_echo_p().

static int get_write_fd ( const rb_io_t fptr  )  [inline, static]

Definition at line 245 of file console.c.

References rb_io_t::fd, GetOpenFile, and rb_io_t::tied_io_for_writing.

static VALUE getc_call ( VALUE  io  )  [static]

Definition at line 404 of file console.c.

References rb_funcall2.

Referenced by console_getch().

void Init_console ( void   ) 

Definition at line 770 of file console.c.

References InitVM, and rb_intern.

void InitVM_console ( void   ) 
static VALUE io_getch ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 761 of file console.c.

References rb_funcall2, and rb_intern.

Referenced by InitVM_console().

static rawmode_arg_t* rawmode_opt ( int  argc,
VALUE *  argv,
rawmode_arg_t opts 
) [static]
static void set_cookedmode ( conmode *  t,
void *  arg 
) [static]

Definition at line 175 of file console.c.

Referenced by console_cooked(), and console_set_cooked().

static void set_echo ( conmode *  t,
void *  arg 
) [static]

Definition at line 202 of file console.c.

Referenced by console_set_echo().

static void set_noecho ( conmode *  t,
void *  arg 
) [static]

Definition at line 190 of file console.c.

Referenced by console_noecho(), and console_set_echo().

static void set_rawmode ( conmode *  t,
void *  arg 
) [static]

Definition at line 148 of file console.c.

References rawmode_arg_t::vmin, and rawmode_arg_t::vtime.

Referenced by console_getch(), console_raw(), and console_set_raw().

static int set_ttymode ( int  fd,
conmode *  t,
void(*)(conmode *, void *)  setter,
void *  arg 
) [static]

Definition at line 226 of file console.c.

Referenced by ttymode().

static VALUE ttymode ( VALUE  io,
VALUE(*)(VALUE)  func,
void(*)(conmode *, void *)  setter,
void *  arg 
) [static]

Variable Documentation

ID id_console [static]

Definition at line 98 of file console.c.

ID id_getc [static]

Definition at line 98 of file console.c.


Generated on 18 May 2020 for Ruby by  doxygen 1.6.1