| 1 | # # This is an abstract class that specifies debugger input output when | ||
| 2 | # # handled by the same channel, e.g. a socket or tty. | ||
| 3 | # # | ||
| 4 | # package Trepan::IO::InOutBase; | ||
| 5 | |||
| 6 | # sub initialize(inout, opts={}) { | ||
| 7 | # @opts = DEFAULT_OPTS.merge(opts); | ||
| 8 | # @inout = inout | ||
| 9 | # } | ||
| 10 | |||
| 11 | # sub close { | ||
| 12 | # @inout.close() if @inout; | ||
| 13 | # } | ||
| 14 | |||
| 15 | # sub is_eof() { | ||
| 16 | # @input.is_eof | ||
| 17 | # } | ||
| 18 | |||
| 19 | # sub flush() { | ||
| 20 | # @inout.flush | ||
| 21 | # } | ||
| 22 | |||
| 23 | # # Read a line of input. EOFError will be raised on EOF. | ||
| 24 | # # | ||
| 25 | # # Note that we don't support prompting first. Instead, arrange to | ||
| 26 | # # call DebuggerOutput.write() first with the prompt. If `use_raw' | ||
| 27 | # # is set raw_input() will be used in that is supported by the | ||
| 28 | # # specific input input. If this option is left nil as is normally | ||
| 29 | # # expected the value from the class initialization is used. | ||
| 30 | # sub readline(use_raw=nil) { | ||
| 31 | # @input.readline; | ||
| 32 | # } | ||
| 33 | |||
| 34 | # # Use this to set where to write to. output can be a | ||
| 35 | # # file object or a string. This code raises IOError on error. | ||
| 36 | # # | ||
| 37 | # # Use this to set where to write to. output can be a | ||
| 38 | # # file object or a string. This code raises IOError on error. | ||
| 39 | # sub write(*args) { | ||
| 40 | # @inout.write(*args); | ||
| 41 | # } | ||
| 42 | |||
| 43 | # # used to write to a debugger that is connected to this | ||
| 44 | # # server; `str' written will have a newline added to it | ||
| 45 | # sub writeline( msg) { | ||
| 46 | # @inout.write("%s\n" % msg); | ||
| 47 | # } | ||
| 48 | |||
| 49 | 1; |