lib/fiddle/cparser.rb in fiddle-1.1.1 vs lib/fiddle/cparser.rb in fiddle-1.1.2
- old
+ new
@@ -163,22 +163,34 @@
when /\A(?:unsigned\s+long\s+long(?:\s+int\s+)?|uint64_t)(?:\s+\w+)?\z/
unless Fiddle.const_defined?(:TYPE_LONG_LONG)
raise(RuntimeError, "unsupported type: #{ty}")
end
return TYPE_ULONG_LONG
- when /\A(?:signed\s+)?long(?:\s+int\s+)?(?:\s+\w+)?\z/
- return TYPE_LONG
- when /\Aunsigned\s+long(?:\s+int\s+)?(?:\s+\w+)?\z/
+ when /\Aunsigned\s+long(?:\s+int\s+)?(?:\s+\w+)?\z/,
+ /\Aunsigned\s+int\s+long(?:\s+\w+)?\z/,
+ /\Along(?:\s+int)?\s+unsigned(?:\s+\w+)?\z/,
+ /\Aint\s+unsigned\s+long(?:\s+\w+)?\z/,
+ /\A(?:int\s+)?long\s+unsigned(?:\s+\w+)?\z/
return TYPE_ULONG
+ when /\A(?:signed\s+)?long(?:\s+int\s+)?(?:\s+\w+)?\z/,
+ /\A(?:signed\s+)?int\s+long(?:\s+\w+)?\z/,
+ /\Along(?:\s+int)?\s+signed(?:\s+\w+)?\z/
+ return TYPE_LONG
+ when /\Aunsigned\s+short(?:\s+int\s+)?(?:\s+\w+)?\z/,
+ /\Aunsigned\s+int\s+short(?:\s+\w+)?\z/,
+ /\Ashort(?:\s+int)?\s+unsigned(?:\s+\w+)?\z/,
+ /\Aint\s+unsigned\s+short(?:\s+\w+)?\z/,
+ /\A(?:int\s+)?short\s+unsigned(?:\s+\w+)?\z/
+ return TYPE_USHORT
+ when /\A(?:signed\s+)?short(?:\s+int\s+)?(?:\s+\w+)?\z/,
+ /\A(?:signed\s+)?int\s+short(?:\s+\w+)?\z/,
+ /\Aint\s+(?:signed\s+)?short(?:\s+\w+)?\z/
+ return TYPE_SHORT
when /\A(?:signed\s+)?int(?:\s+\w+)?\z/
return TYPE_INT
when /\A(?:unsigned\s+int|uint)(?:\s+\w+)?\z/
return TYPE_UINT
- when /\A(?:signed\s+)?short(?:\s+int\s+)?(?:\s+\w+)?\z/
- return TYPE_SHORT
- when /\Aunsigned\s+short(?:\s+int\s+)?(?:\s+\w+)?\z/
- return TYPE_USHORT
when /\A(?:signed\s+)?char(?:\s+\w+)?\z/
return TYPE_CHAR
when /\Aunsigned\s+char(?:\s+\w+)?\z/
return TYPE_UCHAR
when /\Aint8_t(?:\s+\w+)?\z/
@@ -233,9 +245,11 @@
return TYPE_PTRDIFF_T
when /\Aintptr_t(?:\s+\w+)?\z/
return TYPE_INTPTR_T
when /\Auintptr_t(?:\s+\w+)?\z/
return TYPE_UINTPTR_T
+ when "bool"
+ return TYPE_BOOL
when /\*/, /\[[\s\d]*\]/
return TYPE_VOIDP
when "..."
return TYPE_VARIADIC
else