rio 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -1
  3. data/README +1 -1
  4. data/lib/rio.rb +5 -4
  5. data/lib/rio/abstract_method.rb +1 -1
  6. data/lib/rio/alturi.rb +10 -69
  7. data/lib/rio/alturi/algorithm.rb +1 -18
  8. data/lib/rio/alturi/escape.rb +0 -4
  9. data/lib/rio/alturi/parse.rb +0 -29
  10. data/lib/rio/alturi/path_parts.rb +0 -2
  11. data/lib/rio/alturi/uri_parts.rb +3 -32
  12. data/lib/rio/argv.rb +1 -1
  13. data/lib/rio/arraynge.rb +1 -3
  14. data/lib/rio/arycopy.rb +1 -1
  15. data/lib/rio/assert.rb +31 -47
  16. data/lib/rio/base.rb +1 -1
  17. data/lib/rio/callstr.rb +1 -1
  18. data/lib/rio/const.rb +1 -1
  19. data/lib/rio/construct.rb +1 -1
  20. data/lib/rio/constructor.rb +1 -1
  21. data/lib/rio/context.rb +8 -4
  22. data/lib/rio/context/autoclose.rb +1 -1
  23. data/lib/rio/context/binmode.rb +1 -7
  24. data/lib/rio/context/copying.rb +1 -1
  25. data/lib/rio/context/cxx.rb +1 -1
  26. data/lib/rio/context/dir.rb +1 -1
  27. data/lib/rio/context/encoding.rb +1 -2
  28. data/lib/rio/context/gzip.rb +1 -1
  29. data/lib/rio/context/methods.rb +1 -6
  30. data/lib/rio/context/skip.rb +1 -1
  31. data/lib/rio/context/stream.rb +1 -8
  32. data/lib/rio/cp.rb +1 -1
  33. data/lib/rio/cxuri.rb +11 -7
  34. data/lib/rio/dbg/trace_states.rb +0 -2
  35. data/lib/rio/def.rb +1 -1
  36. data/lib/rio/dir.rb +2 -2
  37. data/lib/rio/doc.rb +1 -1
  38. data/lib/rio/entrysel.rb +6 -6
  39. data/lib/rio/exception.rb +1 -1
  40. data/lib/rio/exception/copy.rb +1 -1
  41. data/lib/rio/exception/notimplemented.rb +1 -1
  42. data/lib/rio/exception/notsupported.rb +1 -1
  43. data/lib/rio/exception/open.rb +1 -12
  44. data/lib/rio/exception/state.rb +1 -1
  45. data/lib/rio/ext.rb +1 -8
  46. data/lib/rio/ext/csv.rb +1 -25
  47. data/lib/rio/ext/csv/csv-legacy.rb +1 -49
  48. data/lib/rio/ext/csv/csv.rb +1 -24
  49. data/lib/rio/ext/csv/filter.rb +1 -19
  50. data/lib/rio/ext/if.rb +1 -1
  51. data/lib/rio/ext/mp3info.rb +6 -5
  52. data/lib/rio/ext/splitlines.rb +1 -23
  53. data/lib/rio/ext/yaml.rb +1 -16
  54. data/lib/rio/ext/yaml/doc.rb +1 -6
  55. data/lib/rio/ext/yaml/tie.rb +4 -7
  56. data/lib/rio/ext/zipfile.rb +1 -56
  57. data/lib/rio/ext/zipfile/fs.rb +1 -30
  58. data/lib/rio/ext/zipfile/rl.rb +1 -128
  59. data/lib/rio/ext/zipfile/rootdir.rb +1 -30
  60. data/lib/rio/ext/zipfile/state.rb +1 -105
  61. data/lib/rio/ext/zipfile/wrap.rb +1 -86
  62. data/lib/rio/factory.rb +2 -100
  63. data/lib/rio/fibpipe.rb +0 -98
  64. data/lib/rio/file.rb +1 -12
  65. data/lib/rio/filter.rb +1 -1
  66. data/lib/rio/filter/closeoneof.rb +1 -10
  67. data/lib/rio/filter/gzip.rb +1 -16
  68. data/lib/rio/fs.rb +75 -92
  69. data/lib/rio/fs/base.rb +1 -1
  70. data/lib/rio/fs/impl.rb +1 -1
  71. data/lib/rio/fs/native.rb +1 -1
  72. data/lib/rio/fs/stream.rb +1 -1
  73. data/lib/rio/fs/url.rb +1 -1
  74. data/lib/rio/ftp/conncache.rb +1 -15
  75. data/lib/rio/ftp/dir.rb +1 -2
  76. data/lib/rio/ftp/fs.rb +1 -13
  77. data/lib/rio/fwd.rb +31 -8
  78. data/lib/rio/grande.rb +2 -4
  79. data/lib/rio/handle.rb +1 -1
  80. data/lib/rio/if.rb +1 -7
  81. data/lib/rio/if/basic.rb +1 -5
  82. data/lib/rio/if/csv.rb +1 -1
  83. data/lib/rio/if/dir.rb +1 -1
  84. data/lib/rio/if/file.rb +1 -1
  85. data/lib/rio/if/fileordir.rb +1 -1
  86. data/lib/rio/if/grande.rb +1 -1
  87. data/lib/rio/if/grande_entry.rb +1 -1
  88. data/lib/rio/if/grande_stream.rb +1 -1
  89. data/lib/rio/if/internal.rb +1 -1
  90. data/lib/rio/if/path.rb +1 -1
  91. data/lib/rio/if/rubyio.rb +1 -1
  92. data/lib/rio/if/string.rb +1 -1
  93. data/lib/rio/if/temp.rb +1 -1
  94. data/lib/rio/if/test.rb +1 -1
  95. data/lib/rio/if/yaml.rb +1 -1
  96. data/lib/rio/ioh.rb +42 -24
  97. data/lib/rio/iomode.rb +3 -3
  98. data/lib/rio/ios/fail.rb +1 -1
  99. data/lib/rio/ios/generic.rb +1 -1
  100. data/lib/rio/ios/mode.rb +1 -1
  101. data/lib/rio/ios/null.rb +1 -13
  102. data/lib/rio/iowrap.rb +1 -14
  103. data/lib/rio/kernel.rb +1 -2
  104. data/lib/rio/local.rb +1 -13
  105. data/lib/rio/match.rb +1 -2
  106. data/lib/rio/matchrecord.rb +5 -34
  107. data/lib/rio/no_warn.rb +1 -1
  108. data/lib/rio/nullio.rb +1 -1
  109. data/lib/rio/open3.rb +1 -10
  110. data/lib/rio/ops.rb +1 -1
  111. data/lib/rio/ops/construct.rb +1 -1
  112. data/lib/rio/ops/create.rb +1 -3
  113. data/lib/rio/ops/dir.rb +4 -46
  114. data/lib/rio/ops/either.rb +1 -3
  115. data/lib/rio/ops/file.rb +1 -25
  116. data/lib/rio/ops/path.rb +1 -18
  117. data/lib/rio/ops/stream.rb +4 -5
  118. data/lib/rio/ops/stream/input.rb +1 -10
  119. data/lib/rio/ops/stream/output.rb +1 -3
  120. data/lib/rio/ops/stream/read.rb +1 -1
  121. data/lib/rio/ops/stream/write.rb +1 -1
  122. data/lib/rio/ops/symlink.rb +1 -10
  123. data/lib/rio/path.rb +1 -4
  124. data/lib/rio/path/reset.rb +1 -6
  125. data/lib/rio/piper.rb +1 -4
  126. data/lib/rio/piper/cp.rb +1 -16
  127. data/lib/rio/prompt.rb +1 -1
  128. data/lib/rio/rectype.rb +1 -4
  129. data/lib/rio/rl/base.rb +1 -14
  130. data/lib/rio/rl/builder.rb +1 -12
  131. data/lib/rio/rl/chmap.rb +1 -11
  132. data/lib/rio/rl/fs2url.rb +1 -8
  133. data/lib/rio/rl/ioi.rb +1 -2
  134. data/lib/rio/rl/path.rb +1 -20
  135. data/lib/rio/rl/pathmethods.rb +1 -3
  136. data/lib/rio/rl/uri.rb +1 -11
  137. data/lib/rio/rl/withpath.rb +2 -30
  138. data/lib/rio/rrl/base.rb +1 -6
  139. data/lib/rio/rrl/builder.rb +2 -8
  140. data/lib/rio/rrl/chmap.rb +1 -11
  141. data/lib/rio/rrl/ioi.rb +1 -3
  142. data/lib/rio/rrl/path.rb +1 -11
  143. data/lib/rio/rrl/withpath.rb +8 -48
  144. data/lib/rio/scheme/aryio.rb +1 -1
  145. data/lib/rio/scheme/cmdio.rb +3 -15
  146. data/lib/rio/scheme/cmdpipe.rb +1 -5
  147. data/lib/rio/scheme/fd.rb +1 -1
  148. data/lib/rio/scheme/ftp.rb +1 -40
  149. data/lib/rio/scheme/http.rb +10 -7
  150. data/lib/rio/scheme/null.rb +1 -1
  151. data/lib/rio/scheme/path.rb +1 -63
  152. data/lib/rio/scheme/stderr.rb +1 -2
  153. data/lib/rio/scheme/stdio.rb +3 -3
  154. data/lib/rio/scheme/strio.rb +1 -3
  155. data/lib/rio/scheme/sysio.rb +1 -1
  156. data/lib/rio/scheme/tcp.rb +1 -2
  157. data/lib/rio/scheme/temp.rb +9 -38
  158. data/lib/rio/state.rb +4 -38
  159. data/lib/rio/state/data.rb +4 -5
  160. data/lib/rio/state/error.rb +2 -6
  161. data/lib/rio/stream.rb +1 -31
  162. data/lib/rio/stream/base.rb +1 -5
  163. data/lib/rio/stream/duplex.rb +1 -16
  164. data/lib/rio/stream/open.rb +1 -11
  165. data/lib/rio/symantics.rb +1 -1
  166. data/lib/rio/tempdir.rb +0 -2
  167. data/lib/rio/to_rio.rb +1 -1
  168. data/lib/rio/to_rio/all.rb +1 -1
  169. data/lib/rio/to_rio/array.rb +1 -1
  170. data/lib/rio/to_rio/io.rb +1 -1
  171. data/lib/rio/to_rio/object.rb +1 -1
  172. data/lib/rio/to_rio/string.rb +1 -1
  173. data/lib/rio/undef_rake_dsl.rb +3 -0
  174. data/lib/rio/uri/file.rb +1 -18
  175. data/lib/rio/uriref.rb +1 -18
  176. data/lib/rio/util.rb +1 -1
  177. data/lib/rio/version.rb +2 -2
  178. data/misc/update-copyright.rb +2 -2
  179. data/rio.gemspec +2 -3
  180. data/test/env.sh +1 -2
  181. data/test/http/tc/copy_from_http.rb +0 -1
  182. data/test/runhttp.rb +2 -1
  183. data/test/runtests.rb +7 -5
  184. data/test/tc/copyarray.rb +4 -4
  185. data/test/tc/copydir.rb +1 -1
  186. metadata +15 -47
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -22,14 +22,6 @@
22
22
  #++
23
23
  #
24
24
 
25
-
26
- #require 'rio/context'
27
- #require 'rio/context/methods'
28
- #require 'rio/ext'
29
- #require 'rio/filter'
30
- #require 'rio/fs/native'
31
- #require 'rio/fwd'
32
-
33
25
  require 'rio/exception/state'
34
26
  require 'rio/state/data'
35
27
  require 'rio/symantics'
@@ -65,13 +57,6 @@ module RIO
65
57
  kiosyms << :eql?
66
58
  kiosyms << :load
67
59
  kiosyms << :to_a
68
- #kiosyms << :split
69
- #kiosyms << :sub
70
- #kiosyms << :sub!
71
- #kiosyms << :gsub
72
- #kiosyms << :gsub!
73
- #kiosyms << :chop
74
- #kiosyms << :getc
75
60
 
76
61
  # In 1.8 #to_a is inherited from Object
77
62
  # For 1.9 we create this -- only to undef it immediatly.
@@ -95,7 +80,6 @@ module RIO
95
80
 
96
81
  attr_reader :data
97
82
  def initialize(iv)
98
- #p "State#initialize(#{iv.keys.inspect})"
99
83
  @data = State::Data.new
100
84
  iv.keys.each do |k|
101
85
  @data[k] = iv[k]
@@ -111,12 +95,9 @@ module RIO
111
95
  data.ioh = other.data.ioh.clone if other.data.ioh
112
96
  end
113
97
 
114
- extend Forwardable
115
- def_instance_delegators(:rl,:path,:netpath,:to_s,:fspath,:length)
116
-
117
98
  extend RIO::Fwd
118
- fwd :data,:rl,:cx
119
- fwd :data,:ioh
99
+ fwd_readers :rl,:path,:netpath,:to_s,:fspath,:length
100
+ fwd :data,:rl,:cx,:ioh
120
101
  alias :ior :ioh
121
102
  alias :iow :ioh
122
103
 
@@ -127,10 +108,6 @@ module RIO
127
108
  new(other.data)
128
109
  end
129
110
 
130
-
131
-
132
-
133
-
134
111
  # Section: State Switching
135
112
 
136
113
  # the method for changing states
@@ -138,7 +115,6 @@ module RIO
138
115
  # and change the value in the handle that is shared with the rio object
139
116
  def become(new_class,*args)
140
117
  p "become : #{self.class.to_s} => #{new_class.to_s} (#{self.mode?})" if $trace_states
141
- #p "BECOME #{new_class}: #{cx['ss_type']}"
142
118
  return self if new_class == self.class
143
119
 
144
120
  new_state = try_state[new_class,*args]
@@ -146,12 +122,9 @@ module RIO
146
122
  new_state
147
123
  end
148
124
  def became(obj)
149
- #RIO::Ext.became(obj)
150
125
  end
151
126
  def method_missing_trace_str(sym,*args)
152
- # "missing: "+self.class.to_s+'['+self.to_url+" {#{self.rl.fs}}"+']'+'.'+sym.to_s+'('+args.join(',')+')'
153
127
  "missing: "+self.class.to_s+'['+self.to_url+']'+'.'+sym.to_s+'('+args.join(',')+')'
154
- #"missing: "+self.class.to_s+'['+self.to_url+""+']'+'.'+sym.to_s+'('+args.join(',')+')'
155
128
  end
156
129
 
157
130
  def method_missing(sym,*args,&block)
@@ -159,7 +132,6 @@ module RIO
159
132
 
160
133
  obj = when_missing(sym,*args)
161
134
  raise RuntimeError,"when_missing returns nil" if obj.nil?
162
- #p "STATE: METHOD_MISSING",obj.to_s,sym,args
163
135
  obj.__send__(sym,*args,&block) #unless obj == self
164
136
  end
165
137
 
@@ -169,12 +141,10 @@ module RIO
169
141
  def base_state() Factory.instance.reset_state(rl) end
170
142
 
171
143
  def softreset
172
- #p "softreset(#{self.class}) => #{self.base_state}"
173
144
  cx['retrystate'] = nil
174
145
  become(self.base_state)
175
146
  end
176
147
  def retryreset
177
- #p "retryreset(#{self.class}) => #{self.base_state}"
178
148
  become(self.base_state)
179
149
  end
180
150
  def reset
@@ -196,8 +166,6 @@ module RIO
196
166
  def to_rl() self.rl.rl end
197
167
  def fs() self.rl.fs end
198
168
 
199
- #def_instance_delegators(:uri,:path,:netpath,:to_s,:fspath,:length)
200
-
201
169
  def ==(other) rl == other end
202
170
  def ===(other) self == other end
203
171
  def =~(other) other =~ self.to_str end
@@ -209,7 +177,6 @@ module RIO
209
177
  def to_ary() nil end
210
178
 
211
179
  def hash() rl.to_s.hash end
212
- #def eql?(other) @rl.to_s.eql?(other.to_s) end
213
180
 
214
181
  def stream?() false end
215
182
 
@@ -227,7 +194,6 @@ module RIO
227
194
  def clone_rio()
228
195
  cp = Rio.new(self.rl)
229
196
  cp.cx = self.cx.clone
230
- #cp.ioh = self.ioh.clone unless self.ioh.nil?
231
197
  cp.rl = self.rl.clone
232
198
  cp
233
199
  end
@@ -242,7 +208,7 @@ module RIO
242
208
  def ensure_cmd_rio(arg)
243
209
  case arg
244
210
  when ::String then new_rio("cmdio:"+arg)
245
- when ::Fixnum then new_rio(arg)
211
+ when ::Integer then new_rio(arg)
246
212
  when Rio then arg.clone
247
213
  else ensure_rio(arg)
248
214
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -22,8 +22,6 @@
22
22
  #++
23
23
  #
24
24
 
25
- require 'forwardable'
26
-
27
25
  module RIO
28
26
  module State
29
27
 
@@ -38,8 +36,9 @@ module RIO
38
36
  def initialize_copy(other)
39
37
  @store = other.store.clone
40
38
  end
41
- extend Forwardable
42
- def_delegators :@store,:[],:[]=,:keys
39
+ extend RIO::Fwd
40
+ fwd :@store,:[]
41
+ fwd_readers :@store,:keys
43
42
 
44
43
  def method_missing(sym,*args,&block)
45
44
  if sym.to_s.end_with?('=')
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -34,17 +34,13 @@ module RIO
34
34
  def when_missing(sym,*args) self end
35
35
  def method_missing(sym,*args,&block)
36
36
  emsg = sprintf("Can't Handle %s[%s].%s(%s)",@obj.class.to_s,@obj.to_s,sym.to_s,args.join(','))
37
- # emsg += "\n "+@msg unless @msg.nil? or @msg.empty?
38
- # emsg = @msg
39
37
  raise Exception::CantHandle.new(@obj,sym,*args),emsg
40
38
  end
41
39
  def self.error(emsg,obj,sym,*args)
42
40
  require 'rio/exception'
43
41
  msg = sprintf("%s[%s].%s(%s)",obj.class.to_s,obj.to_s,sym.to_s,args.join(','))
44
42
  msg += "\n "+emsg unless emsg.nil? or emsg.empty?
45
- state = new(obj: obj, sym: sym, msg: msg)
46
- state
47
- # raise CantHandle.new(obj,sym,*args),emsg
43
+ new(obj: obj, sym: sym, msg: msg)
48
44
  end
49
45
  end
50
46
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -38,17 +38,12 @@ require 'rio/ops/stream/input'
38
38
  require 'rio/ops/stream/output'
39
39
  require 'rio/ext'
40
40
  require 'rio/filter/gzip'
41
- #require 'rio/filter/yaml'
42
- #require 'rio/filter/chomp'
43
- #require 'rio/filter/strip'
44
- #require 'rio/filter/closeoneof'
45
41
 
46
42
  module RIO
47
43
 
48
44
  module Stream #:nodoc: all
49
45
  class Reset < Base
50
46
  # Mixin the appropriate ops
51
- #include Ops::Path::Str
52
47
  include Ops::Stream::Reset
53
48
 
54
49
  def check?() true end
@@ -56,8 +51,6 @@ module RIO
56
51
  end
57
52
 
58
53
  class IOBase < Base
59
-
60
-
61
54
  # Mixin the appropriate ops
62
55
  include Ops::Path::Str
63
56
  include Ops::Stream::Status
@@ -84,9 +77,6 @@ module RIO
84
77
  ioh.extend(mod)
85
78
  end
86
79
  end
87
- # def open_(*args)
88
- # self
89
- # end
90
80
  def rectype_mod
91
81
  case cx['stream_rectype']
92
82
  when 'lines' then RIO::RecType::Lines
@@ -103,7 +93,6 @@ module RIO
103
93
  super
104
94
  @recno = -1
105
95
  @get_selrej,@get_rangetops = create_selrej()
106
- # @cursor = io_enum
107
96
  self
108
97
  end
109
98
  end
@@ -112,13 +101,11 @@ module RIO
112
101
  include Ini
113
102
  include Filters
114
103
 
115
-
116
104
  def add_extensions()
117
105
  #p callstr('add_extensions')
118
106
  Ext::Input.add_extensions(self)
119
107
  end
120
108
  def add_filters
121
- #p "IN stream#add_filters"
122
109
  if gzip?
123
110
  gz = Zlib::GzipReader.new(self.ioh.ios)
124
111
  gz.extend Filter::GZipMissing
@@ -130,16 +117,8 @@ module RIO
130
117
  require 'rio/ext/csv/filter' if $USE_FASTER_CSV
131
118
  self.extend(::RIO::Ext::CSV::Input)
132
119
  add_csv_filter() if $USE_FASTER_CSV
133
- # csvio = CSV.new(self.ioh.ios,*cx['csv_args'])
134
- # self.ioh.ios = csvio
135
120
  end
136
- #add_filter(Filter::YAML) if yaml?
137
121
  add_line_filters()
138
- # add_filter(Filter::FasterCSV) if csv?
139
- # if closeoneof?
140
- # add_filter(Filter::CloseOnEOF)
141
- # ioh.oncloseproc = proc { self.on_closeoneof }
142
- # end
143
122
  self
144
123
  end
145
124
  def add_rec_methods()
@@ -167,11 +146,7 @@ module RIO
167
146
  require 'rio/ext/csv/filter' if $USE_FASTER_CSV
168
147
  self.extend(::RIO::Ext::CSV::Output)
169
148
  add_csv_filter() if $USE_FASTER_CSV
170
- # csvio = CSV.new(self.ioh.ios,*cx['csv_args'])
171
- # self.ioh.ios = csvio
172
149
  end
173
- #add_filter(Filter::FasterCSV) if csv?
174
- #add_filter(Filter::YAML) if yaml?
175
150
  self
176
151
  end
177
152
 
@@ -194,11 +169,6 @@ module RIO
194
169
 
195
170
  def add_filters
196
171
  add_line_filters()
197
-
198
- # if closeoneof?
199
- # add_filter(Filter::CloseOnEOF)
200
- # ioh.oncloseproc = proc { self.on_closeoneof }
201
- # end
202
172
  self
203
173
  end
204
174
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -33,11 +33,7 @@ module RIO
33
33
  end
34
34
  def initialize_copy(other)
35
35
  super
36
- #data.ioh = other.data.ioh
37
36
  end
38
- #fwd :data,:ioh
39
- #alias :ior :ioh
40
- #alias :iow :ioh
41
37
 
42
38
  def iostate(*args) self end
43
39
  def stream?() true end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -32,7 +32,6 @@ module RIO
32
32
  module Ops
33
33
  module Output
34
34
  def wclose()
35
- p "wclose #{self}"
36
35
  ioh.close_write
37
36
  return self.close.softreset if ioh.closed?
38
37
  self
@@ -48,11 +47,8 @@ module RIO
48
47
  module Stream
49
48
  module Duplex
50
49
  module Ops
51
- extend Forwardable
52
50
  extend RIO::Fwd
53
51
  def base_state() 'Stream::Duplex::Close' end
54
- #def ior() fibproc.pipe.rd end
55
- #def iow() fibproc.pipe.wr end
56
52
  def ior() ioh() end
57
53
  def iow() ioh end
58
54
  end
@@ -63,13 +59,11 @@ module RIO
63
59
  def output() stream_state('Stream::Duplex::Output') end
64
60
  def input() stream_state('Stream::Duplex::Input') end
65
61
  def inout() stream_state('Stream::Duplex::InOut') end
66
- #def fibproc() input.fibproc() end
67
62
  protected
68
63
 
69
64
  def open_(*args)
70
65
  #p callstr('open_',args.inspect)+" mode='#{mode?}' (#{mode?.class}) ioh=#{self.ioh} open?=#{open?}"
71
66
  self.ioh = self.rl.open(mode?,*args) unless open?
72
- #p data
73
67
  self
74
68
  end
75
69
  end
@@ -83,28 +77,19 @@ module RIO
83
77
  include Ops
84
78
  fwd :data,:fibproc
85
79
  def base_state() 'Stream::Duplex::Close' end
86
- #include Ops::Output
87
80
  end
88
81
 
89
82
  class InOut < RIO::Stream::InOut
90
83
  include Ops
91
84
  fwd :data,:fibproc
92
85
  def base_state() 'Stream::Duplex::Close' end
93
- #include Ops::Output
94
- #include Ops::Input
95
86
  def get()
96
87
  until self.eof?
97
88
  raw_rec = self._get_rec
98
89
  return to_rec_(raw_rec) if @get_selrej.match?(raw_rec,@recno)
99
90
  end
100
- #loop do
101
- # raw_rec = self._get_rec
102
- # return to_rec_(raw_rec) if @get_selrej.match?(raw_rec,@recno)
103
- # break if self.eof?
104
- #end
105
91
  self.close if closeoneof?
106
92
  nil
107
- # (closeoneof? ? self.on_eof_close{ nil } : nil)
108
93
  end
109
94
 
110
95
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.
@@ -22,11 +22,7 @@
22
22
  #++
23
23
  #
24
24
 
25
-
26
- #require 'rio/ioh'
27
25
  require 'rio/stream/base'
28
- #require 'rio/ops/stream'
29
- #require 'rio/ops/path'
30
26
  require 'rio/cp'
31
27
  require 'rio/piper/cp'
32
28
  require 'rio/util'
@@ -39,7 +35,6 @@ module RIO
39
35
  include Ops::Path::URI
40
36
  include Cp::Open::Output
41
37
  include Cp::Open::Input
42
- ##include Piper::Cp::Input
43
38
 
44
39
  def check?() true end
45
40
 
@@ -72,9 +67,6 @@ module RIO
72
67
 
73
68
  public
74
69
 
75
- #def size() self.contents.size end
76
- #def empty?() self.eof? end
77
-
78
70
  def iostate(sym)
79
71
  if mode? && mode?.allows_both?
80
72
  open_.inout()
@@ -98,7 +90,6 @@ module RIO
98
90
 
99
91
  def stream_state(cl)
100
92
  #p callstr('stream_state',cl)
101
- #p "LOOP: retry:#{cx['retrystate']} => #{cl}"
102
93
  return nil if cx['retrystate'] == cl
103
94
  cx['retrystate'] = cl
104
95
 
@@ -172,7 +163,6 @@ module RIO
172
163
  def close_()
173
164
  #p callstr('close_')+" mode='#{mode?}' ioh=#{self.ioh} open?=#{open?}"
174
165
  return self unless self.open?
175
- #clear_selection
176
166
  self.ioh.close
177
167
  self.ioh = nil
178
168
  self.rl.close
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # ===========================================================================
3
- # Copyright (c) 2005-2012 Christopher Kleckner
3
+ # Copyright (c) 2005-2017 Christopher Kleckner
4
4
  # All rights reserved
5
5
  #
6
6
  # This file is part of the Rio library for ruby.