haskell / c2hs

c2hs is a pre-processor for Haskell FFI bindings to C libraries
http://hackage.haskell.org/package/c2hs
Other
198 stars 50 forks source link

c2hs doesn't understand enums on Mac OSX #15

Closed ian-ross closed 9 years ago

ian-ross commented 11 years ago

Bug imported from C2HS Trac

Trac ticket created: 2009-02-16T15:23:33-0800


Mac OSX libraries are full of the following:

enum { kClippingCreator = 'drag', kClippingPictureType = 'clpp', kClippingTextType = 'clpt', kClippingSoundType = 'clps', kClippingUnknownType = 'clpu' };

c2hs has problems dealing with 'characters' in enum definition.

This problem prevents ApplicationServices from being parsed and this constitutes for the most of Mac OSX API

ian-ross commented 11 years ago

Not obvious what to do about this. The C99 standard says:

The value of an integer character constant containing more than one character (e.g., 'ab'), or containing a character or escape sequence that does not map to a single-byte execution character, is implementation-defined.

and language-c raises a corresponding error if you try to do anything that accesses the integer value of a multi-character constant.

mietek commented 10 years ago

FYI, these are FourCCs, or four-character codes, that is, ASCII strings packed into 32-bit big-endian integers.