lib/rio/stream/duplex.rb in rio-0.5.1 vs lib/rio/stream/duplex.rb in rio-0.6.0
- old
+ new
@@ -1,8 +1,8 @@
#--
# ===========================================================================
-# Copyright (c) 2005-2012 Christopher Kleckner
+# Copyright (c) 2005-2017 Christopher Kleckner
# All rights reserved
#
# This file is part of the Rio library for ruby.
#
# Rio is free software; you can redistribute it and/or modify
@@ -30,11 +30,10 @@
module Stream
module Duplex
module Ops
module Output
def wclose()
- p "wclose #{self}"
ioh.close_write
return self.close.softreset if ioh.closed?
self
end
end
@@ -46,32 +45,27 @@
module RIO
module Stream
module Duplex
module Ops
- extend Forwardable
extend RIO::Fwd
def base_state() 'Stream::Duplex::Close' end
- #def ior() fibproc.pipe.rd end
- #def iow() fibproc.pipe.wr end
def ior() ioh() end
def iow() ioh end
end
class Open < RIO::Stream::Open
fwd :data,:fibproc
include Ops
def output() stream_state('Stream::Duplex::Output') end
def input() stream_state('Stream::Duplex::Input') end
def inout() stream_state('Stream::Duplex::InOut') end
- #def fibproc() input.fibproc() end
protected
def open_(*args)
#p callstr('open_',args.inspect)+" mode='#{mode?}' (#{mode?.class}) ioh=#{self.ioh} open?=#{open?}"
self.ioh = self.rl.open(mode?,*args) unless open?
- #p data
self
end
end
class Input < RIO::Stream::Input
@@ -81,31 +75,22 @@
class Output < RIO::Stream::Output
include Ops
fwd :data,:fibproc
def base_state() 'Stream::Duplex::Close' end
- #include Ops::Output
end
class InOut < RIO::Stream::InOut
include Ops
fwd :data,:fibproc
def base_state() 'Stream::Duplex::Close' end
- #include Ops::Output
- #include Ops::Input
def get()
until self.eof?
raw_rec = self._get_rec
return to_rec_(raw_rec) if @get_selrej.match?(raw_rec,@recno)
end
- #loop do
- # raw_rec = self._get_rec
- # return to_rec_(raw_rec) if @get_selrej.match?(raw_rec,@recno)
- # break if self.eof?
- #end
self.close if closeoneof?
nil
-# (closeoneof? ? self.on_eof_close{ nil } : nil)
end
end
class Close < RIO::Stream::Close
end