Copyright | (c) 2007..2008 Duncan Coutts, Benedikt Huber |
---|---|
License | BSD-style |
Maintainer | benedikt.huber@gmail.com |
Stability | experimental |
Portability | ghc |
Safe Haskell | None |
Language | Haskell98 |
This module provides support for representing, checking and exporting c constants, i.e. integral, float, character and string constants.
- escapeChar :: Char -> String
- unescapeChar :: String -> (Char, String)
- unescapeString :: String -> String
- newtype Flags f = Flags Integer
- noFlags :: Flags f
- setFlag :: Enum f => f -> Flags f -> Flags f
- clearFlag :: Enum f => f -> Flags f -> Flags f
- testFlag :: Enum f => f -> Flags f -> Bool
- cChar :: Char -> CChar
- cChar_w :: Char -> CChar
- cChars :: [Char] -> Bool -> CChar
- data CChar
- getCChar :: CChar -> [Char]
- getCCharAsInt :: CChar -> Integer
- isWideChar :: CChar -> Bool
- showCharConst :: Char -> ShowS
- data CIntFlag
- data CIntRepr
- cInteger :: Integer -> CInteger
- data CInteger = CInteger !Integer !CIntRepr !(Flags CIntFlag)
- getCInteger :: CInteger -> Integer
- readCInteger :: CIntRepr -> String -> Either String CInteger
- cFloat :: Float -> CFloat
- data CFloat = CFloat !String
- readCFloat :: String -> CFloat
- cString :: String -> CString
- cString_w :: String -> CString
- data CString = CString [Char] Bool
- getCString :: CString -> String
- showStringLit :: String -> ShowS
- concatCStrings :: [CString] -> CString
Utilities
escapeChar :: Char -> String Source
unescapeChar :: String -> (Char, String) Source
unescapeString :: String -> String Source
C char constants (and multi-character character constants)
construct a character constant from a haskell Char
Use cchar_w
if you want a wide character constant.
C char constants (abstract)
getCCharAsInt :: CChar -> Integer Source
get integer value of a C char constant undefined result for multi-char char constants
isWideChar :: CChar -> Bool Source
return true
if the character constant is wide.
showCharConst :: Char -> ShowS Source
showCharConst c
prepends _a_ String representing the C char constant corresponding to c
.
If necessary uses octal or hexadecimal escape sequences.
C integral constants
datatype representing type flags for integers
datatype for memorizing the representation of an integer
cInteger :: Integer -> CInteger Source
construct a integer constant (without type flags) from a haskell integer
getCInteger :: CInteger -> Integer Source
C floating point constants
Floats (represented as strings)
readCFloat :: String -> CFloat Source
C string literals
C String literals
getCString :: CString -> String Source
showStringLit :: String -> ShowS Source
showStringLiteral s
prepends a String representing the C string literal corresponding to s
.
If necessary it uses octal or hexadecimal escape sequences.
concatCStrings :: [CString] -> CString Source
concatenate a list of C string literals