Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contians the DSL for writing CExpr
s.
It doesn't export the orphan instance for IsString CExpr
which
can be found in Language.C.DSL.StringLike.
- str :: String -> CExpr
- cOp :: CBinaryOp -> CExpr -> CExpr -> CExpr
- (==:) :: CExpr -> CExpr -> CExpr
- (/=:) :: CExpr -> CExpr -> CExpr
- (<:) :: CExpr -> CExpr -> CExpr
- (>:) :: CExpr -> CExpr -> CExpr
- (<=:) :: CExpr -> CExpr -> CExpr
- (>=:) :: CExpr -> CExpr -> CExpr
- ternary :: CExpr -> CExpr -> CExpr -> CExpr
- var :: Ident -> CExpr
- (#) :: CExpr -> [CExpr] -> CExpr
- (<--) :: CExpr -> CExpr -> CExpr
- assign :: CAssignOp -> CExpr -> CExpr -> CExpr
- data UnOp
- toCUnaryOp :: UnOp -> CUnaryOp
- pre :: UnOp -> CExpr -> CExpr
- post :: CExpr -> UnOp -> CExpr
- star :: CExpr -> CExpr
- comma :: [CExpr] -> CExpr
- castTo :: CExpr -> CDecl -> CExpr
- sizeOfDecl :: CDecl -> CExpr
- sizeOf :: CExpr -> CExpr
- (&) :: CExpr -> String -> CExpr
- (&*) :: CExpr -> String -> CExpr
- (!) :: CExpr -> CExpr -> CExpr
Documentation
ternary :: CExpr -> CExpr -> CExpr -> CExpr Source
The ternary operator in C. ternary a b c
will turn into a ? b : c
.
A function mapping identifier in C to be used as variables. Normally this can be
avoided since Language.C.DSL.StringLike provides an IsString
instance.
(#) :: CExpr -> [CExpr] -> CExpr Source
Function calls, f#[a, b, c]
will become f(a, b, c)
. Note
that f
is also an expression.
(<--) :: CExpr -> CExpr -> CExpr infixl 3 Source
The assignment operator. var <-- value
will become var = value;
in C.
assign :: CAssignOp -> CExpr -> CExpr -> CExpr Source
This is the more generalized version of '(<--)'. It allows
any CAssignOp
to be passed in to facilitate writing a += b
and
similar.
A simplified unary operator type. It
can be converted to C
s version using
toCUnaryOp
.
pre :: UnOp -> CExpr -> CExpr Source
Apply a unary operator prefix, op
will transform into something like pre
expop exp
in C. This only matters for PlusPlus
and MinusMinus
.
comma :: [CExpr] -> CExpr Source
The C comma operator, comma [a, b, c]
is equivalent to a, b, c
in C.
sizeOfDecl :: CDecl -> CExpr Source
size of
for types.