module BinData

def trace_message(&block) #:nodoc:

:nodoc:
def trace_message(&block) #:nodoc:
  yield @tracer if @tracer
end

def trace_reading(io = STDERR, &block)

This is useful for debugging a BinData declaration.
If +block+ is given then the tracing only occurs for that block.
Turn on trace information when reading a BinData object.
def trace_reading(io = STDERR, &block)
  @tracer = Tracer.new(io)
  if block_given?
    begin
      block.call
    ensure
      @tracer = nil
    end
  end
end