New patches: [calculate size of embedded arrays correctly Udo Stenzel **20060502231635] { hunk ./c2hs/gen/GenBind.hs 1604 +-- multiply a bit size by a constant (gives size of an array) +-- +-- * not sure if this makes sense if the number of bits is non-zero. +-- +scaleBitSize :: Int -> BitSize -> BitSize +scaleBitSize n (BitSize o1 b1) = BitSize (n * o1 + overflow) rest + where + bitsPerBitfield = size CIntPT * 8 + (overflow, rest) = (n * b1) `divMod` bitsPerBitfield + hunk ./c2hs/gen/GenBind.hs 1669 +sizeAlignOfSingle :: CDecl -> GB (BitSize, Int) hunk ./c2hs/gen/GenBind.hs 1673 +-- * for arrays, alignment is the same as for the base type and the size +-- is the size of the base type multiplied by the number of elements. +-- FIXME: I'm not sure whether anything of this is guaranteed by ISO C +-- and I have no idea what happens when an array-of-bitfield is +-- declared. At this time I don't care. -- U.S. 05/2006 hunk ./c2hs/gen/GenBind.hs 1679 -sizeAlignOf cdecl = +sizeAlignOf (CDecl dclspec + [(Just (CArrDeclr declr (Just lexpr) _), init, expr)] + attr) = + do + (bitsize, align) <- sizeAlignOf (CDecl dclspec + [(Just declr, init, expr)] + attr) + IntResult length <- evalConstCExpr lexpr + return (fromIntegral length `scaleBitSize` bitsize, align) +sizeAlignOf (CDecl _ [(Just (CArrDeclr cdecl Nothing _), _, _)] _) = + interr "GenBind.sizeAlignOf: array of undeclared size." +sizeAlignOf cdecl = + sizeAlignOfSingle cdecl + + +sizeAlignOfSingle cdecl = } Context: [tolerate variadic functions Udo Stenzel **20060423234358 This adds support for pointers to variadic functions in structs. They cannot be called, but the rest of the struct is accessible without c2hs bombing out. ] [enum define workaround example Manuel M T Chakravarty **20051219124518] [TAG c2hs 0.14.5 Manuel M T Chakravarty **20051212115038] Patch bundle hash: cecc350db9fdf0218eb7d28e3c2e92baea3191ac