Sat Jan 24 21:28:18 CET 2009 benedikt.huber@gmail.com * Add test/system/structs.expect Sat Jan 24 21:31:27 CET 2009 benedikt.huber@gmail.com * Add files for system test 'sizeof' New patches: [Add test/system/structs.expect benedikt.huber@gmail.com**20090124202818 Ignore-this: 52ca0285b0451b2322d306f5c73b5100 ] { addfile ./tests/system/structs.expect hunk ./tests/system/structs.expect 1 +42 & -1 & 2 & 200 & ' ' } [Add files for system test 'sizeof' benedikt.huber@gmail.com**20090124203127 Ignore-this: 8ce93018d19e040d91f357268938fa15 ] { addfile ./tests/system/SizeOf.chs hunk ./tests/system/SizeOf.chs 1 +module Main where +import Monad (liftM, when) +import C2HS + +main = do + let sz1 = {# sizeof S1 #} + sz1expect <- liftM cIntConv $ {# call size_of_s1 #} + when (sz1 /= sz1expect) $ error "Fatal: sizeof s1 != size_of_s1()" + let sz2 = {# sizeof S2 #} + sz2expect <- liftM cIntConv $ {# call size_of_s2 #} + when (sz2 /= sz2expect) $ error "Fatal: sizeof s2 != size_of_s2()" + let sz3 = {# sizeof S3 #} + sz3expect <- liftM cIntConv $ {# call size_of_s3 #} + when (sz3 /= sz3expect) $ error $ "Fatal: sizeof s3 != size_of_s3(): " ++ show sz3 ++ " but expected " ++ show sz3expect + putStrLn (show sz1 ++ " & " ++ show sz2 ++ " & " ++ show sz3) addfile ./tests/system/sizeof.c hunk ./tests/system/sizeof.c 1 +#include "sizeof.h" +size_t size_of_s1() { + return sizeof(struct s1); +} +size_t size_of_s2() { + return sizeof(struct s2); +} +size_t size_of_s3() { + return sizeof(struct s3); +} addfile ./tests/system/sizeof.h hunk ./tests/system/sizeof.h 1 +#include +#define BFSZ(ty,bits) bits +size_t size_of_s1(); +size_t size_of_s2(); +size_t size_of_s3(); + +typedef struct s1 { + int x; + char y; + void* z; + } S1; +typedef struct s2 { + int* x[5]; + int (*y)[7]; + int (*f1)(void); + int (*f2)[11]; +} S2; +typedef struct s3 { + struct { + int a : BFSZ(int,13); + int b : BFSZ(int,13); + int b_1: BFSZ(int,13); + int b_2: BFSZ(int,13); + int b_3: BFSZ(int,13); + } f0; + /* NOT SUPPORTED: c2hs does not allow char/short etc. as bitfield types + struct { + signed char c:BFSZ(signed char,4); + unsigned char d; + short e:BFSZ(short,7); + short f:BFSZ(short,7); + short f_1:BFSZ(short,7); + long long g; + long long h:BFSZ(long long, 15); + */ +} S3; } Context: [Describe enum define hooks in manual benedikt.huber@gmail.com**20080820161740] [Add `bugs' directory in tests, and add `Capital' test benedikt.huber@gmail.com**20080820155508] [do not normalize haskell name in a simple call hook (consistent with docs) benedikt.huber@gmail.com**20080820155345] [Add enum define hooks benedikt.huber@gmail.com**20080820155306] [raise error, then return empty translation unit on parse error benedikt.huber@gmail.com**20080820155108] [c2hs.cabal: bump version, add dependency on language-c benedikt.huber@gmail.com**20080815191010] [Version.hs: add note that this is a patched version using Language.C benedikt.huber@gmail.com**20080815190907] [C2HS/CHS: Use Language.C benedikt.huber@gmail.com**20080815190845] [C2HS/Gen: Use Language.C.Data benedikt.huber@gmail.com**20080815190829] [CHS/Lexer: use getNameSupply / setNameSupply benedikt.huber@gmail.com**20080815190814] [C.hs: use Language.C benedikt.huber@gmail.com**20080815190801] [Remove Parser stuff benedikt.huber@gmail.com**20080815190705] [Control: add getNameSupply and setNameSupply benedikt.huber@gmail.com**20080815190638] [Data.Attributes: Use IntMap instead of Map benedikt.huber@gmail.com**20080815190442] [src/Text: Use Language.C.Data benedikt.huber@gmail.com**20080815190418] [tests/system: Change the Makefile to work on case insensitive systems. Document known bugs. benedikt.huber@gmail.com**20080815184244] [tests/system: elaborate the structs and calls tests a little benedikt.huber@gmail.com**20080815184136] [Update CHS.Lexer to use Language.C.Data benedikt.huber@gmail.com**20080814161718] [Update C2HS.C.Trav to use Language.C benedikt.huber@gmail.com**20080814161647] [Update C2HS.C.{Builtin,Info,Names} to use Language.C benedikt.huber@gmail.com**20080814161546] [Update C2HS.C to use Language.C.Data. Add Show instances for Debugging purposes. benedikt.huber@gmail.com**20080814161512] [Data.Attributes: add function to generate unused names benedikt.huber@gmail.com**20080814161419] [src/Control: Update to use Language.C.Data benedikt.huber@gmail.com**20080814160850] [Data: remove modules replaced by Language.C.Data benedikt.huber@gmail.com**20080814160823] [Data.Errors: Use Language.C.Data.Error benedikt.huber@gmail.com**20080814160759] [Data.Attributes: Use Language.C.Data.Node benedikt.huber@gmail.com**20080814160739] [Expose liftIO in CIO.hs benedikt.huber@gmail.com**20080814160231] [Fix dereferencing of pointers when following a path benedikt.huber@gmail.com**20080731010424] [Support parentheses in parsePath benedikt.huber@gmail.com**20080731005839] [Fix a non-exhaustive pattern match in Trav.hs benedikt.huber@gmail.com**20080731005703] [Add a function which converts haskell keyword tokens into identifier tokens and use it in parsePath benedikt.huber@gmail.com**20080731004903] [Use gcc for preprocessing on darwin benedikt.huber@gmail.com**20080731001756] [Bump version number Duncan Coutts **20080620223920 Just so it's different from the last released version ] [Partially convert to haddock style documentation markup Duncan Coutts **20080620223445] [White space changes Duncan Coutts **20080620191827 Convert tabs to spaces and remove trailing space ] [Use qualified names for System.CIO Duncan Coutts **20080620173239 Always use import qualified System.CIO as CIO instead of putting a CIO suffix on everything. ] [Import System.CIO directly rather than by re-exporting Duncan Coutts **20080620170755] [Use qualified names for DList module Duncan Coutts **20080620163002] [Fix up module names and imports Duncan Coutts **20080620161843] [Move c2hs modules under src/ Duncan Coutts **20080620161108 and rename them to use hierarchical module names ] [Move the base modules under src/ Duncan Coutts **20080620140132 and tests under tests/ and remove tests modules which are testing now non-existant modules. ] [Remove test code for FiniteMap module that no longer exists Duncan Coutts **20080620134904] [Remove obsolete build system files Duncan Coutts **20080620134539] [TAG 0.15.1 Duncan Coutts **20071123165525] Patch bundle hash: 8e31d27dc942559684a28ce9ce7670e7ce65027b