Encupsalates termios parameters.
See also: termios(3)
Returns new Termios::Termios object.
static VALUE termios_initialize(argc, argv, self) int argc; VALUE *argv; VALUE self; { VALUE c_iflag, c_oflag, c_cflag, c_lflag, c_cc, c_ispeed, c_ospeed; VALUE cc_ary; int i; cc_ary = rb_ary_new2(NCCS); for (i = 0; i < NCCS; i++) { rb_ary_store(cc_ary, i, INT2FIX(0)); } rb_ivar_set(self, id_iflag, INT2FIX(0)); rb_ivar_set(self, id_oflag, INT2FIX(0)); rb_ivar_set(self, id_cflag, INT2FIX(0)); rb_ivar_set(self, id_lflag, INT2FIX(0)); rb_ivar_set(self, id_cc, cc_ary); rb_ivar_set(self, id_ispeed, INT2FIX(0)); rb_ivar_set(self, id_ospeed, INT2FIX(0)); rb_scan_args(argc, argv, "07", &c_iflag, &c_oflag, &c_cflag, &c_lflag, &c_cc, &c_ispeed, &c_ospeed); if (!NIL_P(c_iflag)) termios_set_iflag(self, c_iflag); if (!NIL_P(c_oflag)) termios_set_oflag(self, c_oflag); if (!NIL_P(c_cflag)) termios_set_cflag(self, c_cflag); if (!NIL_P(c_lflag)) termios_set_lflag(self, c_lflag); if (!NIL_P(c_cc)) termios_set_cc(self, c_cc); if (!NIL_P(c_ispeed)) termios_set_ispeed(self, c_ispeed); if (!NIL_P(c_ospeed)) termios_set_ispeed(self, c_ospeed); return self; }
Updates control characters of the object.
static VALUE termios_set_cc(self, value) VALUE self, value; { Check_Type(value, T_ARRAY); rb_ivar_set(self, id_cc, value); return value; }
Updates control modes of the object.
static VALUE termios_set_cflag(self, value) VALUE self, value; { rb_ivar_set(self, id_cflag, validate_ulong(value)); return value; }
Produces a shallow copy of the object.
static VALUE termios_dup(self) VALUE self; { VALUE result; VALUE cc_ary; result = rb_call_super(0, 0); cc_ary = rb_ivar_get(self, id_cc); rb_ivar_set(result, id_cc, rb_ary_dup(cc_ary)); return result; }
Produces a shallow copy of the object.
static VALUE termios_dup(self) VALUE self; { VALUE result; VALUE cc_ary; result = rb_call_super(0, 0); cc_ary = rb_ivar_get(self, id_cc); rb_ivar_set(result, id_cc, rb_ary_dup(cc_ary)); return result; }
Updates input modes of the object.
static VALUE termios_set_iflag(self, value) VALUE self, value; { rb_ivar_set(self, id_iflag, validate_ulong(value)); return value; }
# File lib/termios.rb, line 46 def inspect str = "\#<#{self.class}" if self.ispeed == self.ospeed speed = (BAUDS[self.ispeed] || "B???").to_s[1..-1] str << " speed #{speed} baud;" else ispeed = (BAUDS[self.ispeed] || "B???").to_s[1..-1] ospeed = (BAUDS[self.ospeed] || "B???").to_s[1..-1] str << " ispeed #{ispeed} baud; ospeed #{ospeed} baud;" end CCINDEX_NAMES.each {|ccindex| next if ccindex == :VMIN || ccindex == :VTIME str << " #{ccindex.to_s[1..-1].downcase}" str << "=#{VISIBLE_CHAR[self.cc[::Termios.const_get(ccindex)]]}" } str << " min=#{self.cc[VMIN]}" str << " time=#{self.cc[VTIME]}" [ [:cflag, CFLAG_NAMES-[:CBAUD, :CBAUDEX, :CIBAUD, :EXTA, :EXTB], CFLAG_CHOICES], [:iflag, IFLAG_NAMES, nil], [:oflag, OFLAG_NAMES, OFLAG_CHOICES], [:lflag, LFLAG_NAMES, nil] ].each {|l| str << ";" flag_type, flag_names, choices = l flags = self.send(flag_type) choice_names = choices ? choices.values.flatten : [] (flag_names-choice_names).each {|name| str << " " if choices and ns = choices[name] mask = ::Termios.const_get(name) ns.each {|n| if (flags & mask) == ::Termios.const_get(n) str << n.to_s.downcase break end } else str << "-" if (flags & ::Termios.const_get(name)) == 0 str << name.to_s.downcase end } } str << ">" str end
Updates input baud rate of the object.
static VALUE termios_set_ispeed(self, value) VALUE self, value; { rb_ivar_set(self, id_ispeed, validate_ulong(value)); return value; }
Updates local modes of the object.
static VALUE termios_set_lflag(self, value) VALUE self, value; { rb_ivar_set(self, id_lflag, validate_ulong(value)); return value; }
Updates output modes of the object.
static VALUE termios_set_oflag(self, value) VALUE self, value; { rb_ivar_set(self, id_oflag, validate_ulong(value)); return value; }
Updates output baud rate of the object.
static VALUE termios_set_ospeed(self, value) VALUE self, value; { rb_ivar_set(self, id_ospeed, validate_ulong(value)); return value; }
Generated with the Darkfish Rdoc Generator 2.