Module: GR3::CheckError

Included in:
GR3
Defined in:
lib/gr3.rb

Overview

This module is for adding error checking to all methods in GR3.

Instance Method Summary collapse

Instance Method Details

#geterrorObject



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/gr3.rb', line 107

def geterror
  line = GRCommons::Fiddley::MemoryPointer.new(:int)
  file = GRCommons::Fiddley::MemoryPointer.new(:pointer)
  e = super(1, line, file)
  return [0, nil, nil] if e == 0

  line = line.read_int
  # to_ptr: Fiddley::MemoryPointer -> Fiddle::Pointer
  file = file.to_ptr.ptr.to_s
  [e, line, file]
end