c-dsl-0.1.0.0: A higher level DSL on top of language-c

Safe HaskellNone

Language.C.DSL.Decl

Synopsis

Documentation

decl :: CDeclSpec -> CDeclr -> Maybe CExpr -> CDeclSource

A low level way to declare something.

voidTy :: CDeclSpecSource

Simple types that can be used in declarations.

floatTy :: CDeclSpecSource

Simple types that can be used in declarations.

longTy :: CDeclSpecSource

Simple types that can be used in declarations.

intTy :: CDeclSpecSource

Simple types that can be used in declarations.

shortTy :: CDeclSpecSource

Simple types that can be used in declarations.

charTy :: CDeclSpecSource

Simple types that can be used in declarations.

ptr :: CDeclr -> CDeclrSource

Modifies a declarator to be a pointer. For example ptr x would be *x in C.

char :: CDeclr -> Maybe CExpr -> CDeclSource

Clever functions that can be applied to declarators, for example int x .= 1 is equivalent to int x = 1. To leave a variable uninitialized int x Nothing does the job.

double :: CDeclr -> Maybe CExpr -> CDeclSource

Clever functions that can be applied to declarators, for example int x .= 1 is equivalent to int x = 1. To leave a variable uninitialized int x Nothing does the job.

float :: CDeclr -> Maybe CExpr -> CDeclSource

Clever functions that can be applied to declarators, for example int x .= 1 is equivalent to int x = 1. To leave a variable uninitialized int x Nothing does the job.

long :: CDeclr -> Maybe CExpr -> CDeclSource

Clever functions that can be applied to declarators, for example int x .= 1 is equivalent to int x = 1. To leave a variable uninitialized int x Nothing does the job.

int :: CDeclr -> Maybe CExpr -> CDeclSource

Clever functions that can be applied to declarators, for example int x .= 1 is equivalent to int x = 1. To leave a variable uninitialized int x Nothing does the job.

short :: CDeclr -> Maybe CExpr -> CDeclSource

Clever functions that can be applied to declarators, for example int x .= 1 is equivalent to int x = 1. To leave a variable uninitialized int x Nothing does the job.

charPtr :: CDeclr -> Maybe CExpr -> CDeclSource

Equivalent to the above but with pointer wrappers.

doublePtr :: CDeclr -> Maybe CExpr -> CDeclSource

Equivalent to the above but with pointer wrappers.

floatPtr :: CDeclr -> Maybe CExpr -> CDeclSource

Equivalent to the above but with pointer wrappers.

longPtr :: CDeclr -> Maybe CExpr -> CDeclSource

Equivalent to the above but with pointer wrappers.

intPtr :: CDeclr -> Maybe CExpr -> CDeclSource

Equivalent to the above but with pointer wrappers.

shortPtr :: CDeclr -> Maybe CExpr -> CDeclSource

Equivalent to the above but with pointer wrappers.

(.=) :: (Maybe CExpr -> CDecl) -> CExpr -> CDeclSource

Supplies an initializer for an expression.

uninit :: (Maybe CExpr -> CDecl) -> CDeclSource

Leave a declaration uninitialized. For example uninit $ char x.

struct :: String -> [(String, CTypeSpec)] -> CDeclSource

Create a structure or union, for example struct foo [(bar, intTy)] is typedef struct foo {int bar;} foo;

union :: String -> [(String, CTypeSpec)] -> CDeclSource

Create a structure or union, for example struct foo [(bar, intTy)] is typedef struct foo {int bar;} foo;

transUnit :: [CExtDecl] -> CTranslUnitSource

Exports a series of declarations to a translation unit.