lib/fiddle/cparser.rb in fiddle-1.0.7 vs lib/fiddle/cparser.rb in fiddle-1.0.8
- old
+ new
@@ -146,12 +146,14 @@
# parse_ctype('const char* const argv[]')
# #=> -Fiddle::TYPE_VOIDP
#
def parse_ctype(ty, tymap=nil)
tymap ||= {}
- case ty
- when Array
+ if ty.is_a?(Array)
return [parse_ctype(ty[0], tymap), ty[1]]
+ end
+ ty = ty.gsub(/\Aconst\s+/, "")
+ case ty
when 'void'
return TYPE_VOID
when /\A(?:(?:signed\s+)?long\s+long(?:\s+int\s+)?|int64_t)(?:\s+\w+)?\z/
unless Fiddle.const_defined?(:TYPE_LONG_LONG)
raise(RuntimeError, "unsupported type: #{ty}")