New patches: [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. ] { hunk ./c2hs/gen/GenBind.hs 240 +isVariadic :: ExtType -> Bool +isVariadic (FunET s t) = any isVariadic [s,t] +isVariadic (IOET t) = isVariadic t +isVariadic (PtrET t) = isVariadic t +isVariadic (VarFunET _) = True +isVariadic _ = False + hunk ./c2hs/gen/GenBind.hs 390 + when (isVariadic ty) (variadicErr pos (posOf decl)) hunk ./c2hs/gen/GenBind.hs 506 + when (isVariadic et') + (variadicErr pos (posOf cDecl)) hunk ./c2hs/gen/GenBind.hs 680 + when (isVariadic extType) (variadicErr pos (posOf cdecl)) hunk ./c2hs/gen/GenBind.hs 1063 + checkType (VarFunET _ ) = variadicErr pos pos hunk ./c2hs/gen/GenBind.hs 1213 + | VarFunET ExtType -- variadic function hunk ./c2hs/gen/GenBind.hs 1221 + (VarFunET t ) == (VarFunET t' ) = t == t' hunk ./c2hs/gen/GenBind.hs 1232 -isFunExtType (FunET _ _) = True -isFunExtType (IOET _ ) = True -isFunExtType _ = False +isFunExtType (FunET _ _) = True +isFunExtType (VarFunET _ ) = True +isFunExtType (IOET _ ) = True +isFunExtType _ = False hunk ./c2hs/gen/GenBind.hs 1247 +showExtType (VarFunET res) = "( ... -> " ++ showExtType res ++ ")" hunk ./c2hs/gen/GenBind.hs 1294 - when variadic $ - variadicErr pos cpos hunk ./c2hs/gen/GenBind.hs 1298 - let resultType = if isPure - then preResultType - else IOET preResultType + let protoResultType = if isPure + then preResultType + else IOET preResultType + let resultType = if variadic + then VarFunET protoResultType + else protoResultType hunk ./c2hs/gen/GenBind.hs 1668 + align <- alignment CFunPtrPT + return (bitSize CFunPtrPT, align) + ExtType (VarFunET _ ) -> do } Context: [enum define workaround example Manuel M T Chakravarty **20051219124518] [TAG c2hs 0.14.5 Manuel M T Chakravarty **20051212115038] Patch bundle hash: 3866987f6c1c2a491125905e310919aed3a5054e