{-# LANGUAGE DeriveDataTypeable  #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Language.C.Analysis.Syntax
-- Copyright   :  (c) 2008 Benedikt Huber
-- License     :  BSD-style
-- Maintainer  :  benedikt.huber@gmail.com
-- Stability   :  alpha
-- Portability :  ghc
--
-- This module contains definitions for representing C translation units.
-- In contrast to 'Language.C.Syntax.AST', the representation tries to express the semantics of
-- of a translation unit.
---------------------------------------------------------------------------------------------------
module Language.C.Analysis.SemRep(
-- * Sums of tags and identifiers
TagDef(..),typeOfTagDef,
Declaration(..),declIdent,declName,declType,declAttrs,
IdentDecl(..),objKindDescr, splitIdentDecls,
-- * Global definitions
GlobalDecls(..),emptyGlobalDecls,filterGlobalDecls,mergeGlobalDecls,
-- * Events for visitors
DeclEvent(..),
-- * Declarations and definitions
Decl(..),
ObjDef(..),isTentative,
FunDef(..),
ParamDecl(..),MemberDecl(..),
TypeDef(..),identOfTypeDef,
VarDecl(..),
-- * Declaration attributes
DeclAttrs(..),isExtDecl,
FunctionAttrs(..), functionAttrs, noFunctionAttrs,
Storage(..),declStorage,ThreadLocal,Register,
Linkage(..),hasLinkage,declLinkage,
-- * Types
Type(..),
FunType(..),
ArraySize(..),
TypeDefRef(..),
TypeName(..),BuiltinType(..),
IntType(..),FloatType(..),
HasSUERef(..),HasCompTyKind(..),
CompTypeRef(..),CompType(..),typeOfCompDef,CompTyKind(..),
EnumTypeRef(..),EnumType(..),typeOfEnumDef,
Enumerator(..),
TypeQuals(..),noTypeQuals,mergeTypeQuals,
-- * Variable names
VarName(..),identOfVarName,isNoName,AsmName,
-- * Attributes (STUB, not yet analyzed)
Attr(..),Attributes,noAttributes,mergeAttributes,
-- * Statements and Expressions (STUB, aliases to Syntax)
Stmt,Expr,Initializer,AsmBlock,
)
where
import Language.C.Data
import Language.C.Syntax
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
import Data.Data (Data)
import Data.Typeable (Typeable)

-- | accessor class : struct\/union\/enum names
class HasSUERef a where
    sueRef  :: a -> SUERef

-- | accessor class : composite type tags (struct or union)
class HasCompTyKind a where
    compTag :: a -> CompTyKind

-- | Composite type definitions (tags)
data TagDef =  CompDef CompType  --composite definition
             | EnumDef EnumType  --enum definition
               deriving (Typeable, Typeable TagDef
TagDef -> DataType
TagDef -> Constr
(forall b. Data b => b -> b) -> TagDef -> TagDef
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u
forall u. (forall d. Data d => d -> u) -> TagDef -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TagDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TagDef -> c TagDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TagDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TagDef)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TagDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TagDef -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
gmapT :: (forall b. Data b => b -> b) -> TagDef -> TagDef
$cgmapT :: (forall b. Data b => b -> b) -> TagDef -> TagDef
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TagDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TagDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TagDef)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TagDef)
dataTypeOf :: TagDef -> DataType
$cdataTypeOf :: TagDef -> DataType
toConstr :: TagDef -> Constr
$ctoConstr :: TagDef -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TagDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TagDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TagDef -> c TagDef
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TagDef -> c TagDef
Data {-! ,CNode !-}, Int -> TagDef -> ShowS
[TagDef] -> ShowS
TagDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagDef] -> ShowS
$cshowList :: [TagDef] -> ShowS
show :: TagDef -> String
$cshow :: TagDef -> String
showsPrec :: Int -> TagDef -> ShowS
$cshowsPrec :: Int -> TagDef -> ShowS
Show)

instance HasSUERef TagDef where
    sueRef :: TagDef -> SUERef
sueRef (CompDef CompType
ct) = forall a. HasSUERef a => a -> SUERef
sueRef CompType
ct
    sueRef (EnumDef EnumType
et) = forall a. HasSUERef a => a -> SUERef
sueRef EnumType
et

-- | return the type corresponding to a tag definition
typeOfTagDef :: TagDef -> TypeName
typeOfTagDef :: TagDef -> TypeName
typeOfTagDef (CompDef CompType
comptype) =  CompType -> TypeName
typeOfCompDef CompType
comptype
typeOfTagDef (EnumDef EnumType
enumtype) =  EnumType -> TypeName
typeOfEnumDef EnumType
enumtype

-- | All datatypes aggregating a declaration are instances of @Declaration@
class Declaration n where
    -- | get the name, type and declaration attributes of a declaration or definition
    getVarDecl :: n -> VarDecl

-- | get the declaration corresponding to a definition
declOfDef :: (Declaration n, CNode n) => n -> Decl
declOfDef :: forall n. (Declaration n, CNode n) => n -> Decl
declOfDef n
def = let vd :: VarDecl
vd = forall n. Declaration n => n -> VarDecl
getVarDecl n
def in VarDecl -> NodeInfo -> Decl
Decl VarDecl
vd (forall a. CNode a => a -> NodeInfo
nodeInfo n
def)

-- | get the variable identifier of a declaration (only safe if the
--    the declaration is known to have a name)
declIdent :: (Declaration n) => n -> Ident
declIdent :: forall n. Declaration n => n -> Ident
declIdent = VarName -> Ident
identOfVarName forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n. Declaration n => n -> VarName
declName
-- | get the variable name of a @Declaration@
declName ::  (Declaration n) => n -> VarName
declName :: forall n. Declaration n => n -> VarName
declName = (\(VarDecl VarName
n DeclAttrs
_ Type
_) -> VarName
n) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n. Declaration n => n -> VarDecl
getVarDecl
-- | get the type of a @Declaration@
declType ::  (Declaration n) => n -> Type
declType :: forall n. Declaration n => n -> Type
declType = (\(VarDecl VarName
_ DeclAttrs
_ Type
ty) -> Type
ty) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n. Declaration n => n -> VarDecl
getVarDecl
-- | get the declaration attributes of a @Declaration@
declAttrs :: (Declaration n) => n -> DeclAttrs
declAttrs :: forall n. Declaration n => n -> DeclAttrs
declAttrs = (\(VarDecl VarName
_ DeclAttrs
specs Type
_) -> DeclAttrs
specs) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n. Declaration n => n -> VarDecl
getVarDecl

instance (Declaration a, Declaration b) => Declaration (Either a b) where
    getVarDecl :: Either a b -> VarDecl
getVarDecl = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall n. Declaration n => n -> VarDecl
getVarDecl forall n. Declaration n => n -> VarDecl
getVarDecl

-- | identifiers, typedefs and enumeration constants (namespace sum)
data IdentDecl = Declaration Decl           -- ^ object or function declaration
                     | ObjectDef ObjDef           -- ^ object definition
                     | FunctionDef FunDef         -- ^ function definition
                     | EnumeratorDef Enumerator   -- ^ definition of an enumerator
               deriving (Typeable, Typeable IdentDecl
IdentDecl -> DataType
IdentDecl -> Constr
(forall b. Data b => b -> b) -> IdentDecl -> IdentDecl
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
forall u. (forall d. Data d => d -> u) -> IdentDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IdentDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IdentDecl -> c IdentDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IdentDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdentDecl)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> IdentDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IdentDecl -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
gmapT :: (forall b. Data b => b -> b) -> IdentDecl -> IdentDecl
$cgmapT :: (forall b. Data b => b -> b) -> IdentDecl -> IdentDecl
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdentDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdentDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IdentDecl)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IdentDecl)
dataTypeOf :: IdentDecl -> DataType
$cdataTypeOf :: IdentDecl -> DataType
toConstr :: IdentDecl -> Constr
$ctoConstr :: IdentDecl -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IdentDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IdentDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IdentDecl -> c IdentDecl
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IdentDecl -> c IdentDecl
Data {-! ,CNode !-}, Int -> IdentDecl -> ShowS
[IdentDecl] -> ShowS
IdentDecl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentDecl] -> ShowS
$cshowList :: [IdentDecl] -> ShowS
show :: IdentDecl -> String
$cshow :: IdentDecl -> String
showsPrec :: Int -> IdentDecl -> ShowS
$cshowsPrec :: Int -> IdentDecl -> ShowS
Show)

instance Declaration IdentDecl where
  getVarDecl :: IdentDecl -> VarDecl
getVarDecl (Declaration Decl
decl) = forall n. Declaration n => n -> VarDecl
getVarDecl Decl
decl
  getVarDecl (ObjectDef ObjDef
def) = forall n. Declaration n => n -> VarDecl
getVarDecl ObjDef
def
  getVarDecl (FunctionDef FunDef
def) = forall n. Declaration n => n -> VarDecl
getVarDecl FunDef
def
  getVarDecl (EnumeratorDef Enumerator
def) = forall n. Declaration n => n -> VarDecl
getVarDecl Enumerator
def

-- | textual description of the kind of an object
objKindDescr :: IdentDecl -> String
objKindDescr :: IdentDecl -> String
objKindDescr  (Declaration Decl
_ ) = String
"declaration"
objKindDescr (ObjectDef ObjDef
_) = String
"object definition"
objKindDescr (FunctionDef FunDef
_) = String
"function definition"
objKindDescr (EnumeratorDef Enumerator
_) = String
"enumerator definition"

-- | @splitIdentDecls includeAllDecls@ splits a map of object, function and enumerator declarations and definitions into one map
-- holding declarations, and three maps for object definitions, enumerator definitions and function definitions.
-- If @includeAllDecls@ is @True@ all declarations are present in the first map, otherwise only those where no corresponding definition
-- is available.
splitIdentDecls :: Bool -> Map Ident IdentDecl -> (Map Ident Decl,
                                                ( Map Ident Enumerator,
                                                  Map Ident ObjDef,
                                                  Map Ident FunDef ) )
splitIdentDecls :: Bool
-> Map Ident IdentDecl
-> (Map Ident Decl,
    (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
splitIdentDecls Bool
include_all = forall k a b. (k -> a -> b -> b) -> b -> Map k a -> b
Map.foldrWithKey (if Bool
include_all then forall {k}.
Ord k =>
k
-> IdentDecl
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
deal else forall {k}.
Ord k =>
k
-> IdentDecl
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
deal') (forall k a. Map k a
Map.empty,(forall k a. Map k a
Map.empty,forall k a. Map k a
Map.empty,forall k a. Map k a
Map.empty))
  where
  deal :: k
-> IdentDecl
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
deal k
ident IdentDecl
entry (Map k Decl
decls,(Map k Enumerator, Map k ObjDef, Map k FunDef)
defs) = (forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert k
ident (forall n. (Declaration n, CNode n) => n -> Decl
declOfDef IdentDecl
entry) Map k Decl
decls, forall {k}.
Ord k =>
k
-> IdentDecl
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
addDef k
ident IdentDecl
entry (Map k Enumerator, Map k ObjDef, Map k FunDef)
defs)
  deal' :: k
-> IdentDecl
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
-> (Map k Decl, (Map k Enumerator, Map k ObjDef, Map k FunDef))
deal' k
ident (Declaration Decl
d) (Map k Decl
decls,(Map k Enumerator, Map k ObjDef, Map k FunDef)
defs) = (forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert k
ident Decl
d Map k Decl
decls,(Map k Enumerator, Map k ObjDef, Map k FunDef)
defs)
  deal' k
ident IdentDecl
def (Map k Decl
decls,(Map k Enumerator, Map k ObjDef, Map k FunDef)
defs) = (Map k Decl
decls, forall {k}.
Ord k =>
k
-> IdentDecl
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
addDef k
ident IdentDecl
def (Map k Enumerator, Map k ObjDef, Map k FunDef)
defs)
  addDef :: k
-> IdentDecl
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
addDef k
ident IdentDecl
entry (Map k Enumerator
es,Map k ObjDef
os,Map k FunDef
fs) =
    case IdentDecl
entry of
        Declaration Decl
_   -> (Map k Enumerator
es,Map k ObjDef
os,Map k FunDef
fs)
        EnumeratorDef Enumerator
e -> (forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert k
ident Enumerator
e Map k Enumerator
es,Map k ObjDef
os,Map k FunDef
fs)
        ObjectDef ObjDef
o     -> (Map k Enumerator
es,forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert k
ident ObjDef
o Map k ObjDef
os,Map k FunDef
fs)
        FunctionDef FunDef
f   -> (Map k Enumerator
es, Map k ObjDef
os,forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert k
ident FunDef
f Map k FunDef
fs)


-- | global declaration\/definition table returned by the analysis
data GlobalDecls = GlobalDecls {
                     GlobalDecls -> Map Ident IdentDecl
gObjs     :: Map Ident IdentDecl,
                     GlobalDecls -> Map SUERef TagDef
gTags     :: Map SUERef TagDef,
                     GlobalDecls -> Map Ident TypeDef
gTypeDefs :: Map Ident TypeDef
                   }

-- | empty global declaration table
emptyGlobalDecls :: GlobalDecls
emptyGlobalDecls :: GlobalDecls
emptyGlobalDecls = Map Ident IdentDecl
-> Map SUERef TagDef -> Map Ident TypeDef -> GlobalDecls
GlobalDecls forall k a. Map k a
Map.empty forall k a. Map k a
Map.empty forall k a. Map k a
Map.empty

-- | filter global declarations
filterGlobalDecls :: (DeclEvent -> Bool) -> GlobalDecls -> GlobalDecls
filterGlobalDecls :: (DeclEvent -> Bool) -> GlobalDecls -> GlobalDecls
filterGlobalDecls DeclEvent -> Bool
decl_filter GlobalDecls
gmap = GlobalDecls
    {
        gObjs :: Map Ident IdentDecl
gObjs  = forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (DeclEvent -> Bool
decl_filter forall b c a. (b -> c) -> (a -> b) -> a -> c
. IdentDecl -> DeclEvent
DeclEvent) (GlobalDecls -> Map Ident IdentDecl
gObjs GlobalDecls
gmap),
        gTags :: Map SUERef TagDef
gTags  = forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (DeclEvent -> Bool
decl_filter forall b c a. (b -> c) -> (a -> b) -> a -> c
. TagDef -> DeclEvent
TagEvent) (GlobalDecls -> Map SUERef TagDef
gTags GlobalDecls
gmap),
        gTypeDefs :: Map Ident TypeDef
gTypeDefs = forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (DeclEvent -> Bool
decl_filter forall b c a. (b -> c) -> (a -> b) -> a -> c
. TypeDef -> DeclEvent
TypeDefEvent) (GlobalDecls -> Map Ident TypeDef
gTypeDefs GlobalDecls
gmap)
    }
-- | merge global declarations
mergeGlobalDecls :: GlobalDecls -> GlobalDecls -> GlobalDecls
mergeGlobalDecls :: GlobalDecls -> GlobalDecls -> GlobalDecls
mergeGlobalDecls GlobalDecls
gmap1 GlobalDecls
gmap2 = GlobalDecls
    {
        gObjs :: Map Ident IdentDecl
gObjs  = forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union (GlobalDecls -> Map Ident IdentDecl
gObjs GlobalDecls
gmap1) (GlobalDecls -> Map Ident IdentDecl
gObjs GlobalDecls
gmap2),
        gTags :: Map SUERef TagDef
gTags  = forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union  (GlobalDecls -> Map SUERef TagDef
gTags GlobalDecls
gmap1) (GlobalDecls -> Map SUERef TagDef
gTags GlobalDecls
gmap2),
        gTypeDefs :: Map Ident TypeDef
gTypeDefs = forall k a. Ord k => Map k a -> Map k a -> Map k a
Map.union (GlobalDecls -> Map Ident TypeDef
gTypeDefs GlobalDecls
gmap1) (GlobalDecls -> Map Ident TypeDef
gTypeDefs GlobalDecls
gmap2)
    }


-- * Events

-- | Declaration events
--
-- Those events are reported to callbacks, which are executed during the traversal.
data DeclEvent =
       TagEvent  TagDef
       -- ^ file-scope struct\/union\/enum event
     | DeclEvent IdentDecl
       -- ^ file-scope declaration or definition
     | ParamEvent ParamDecl
       -- ^ parameter declaration
     | LocalEvent IdentDecl
       -- ^ local variable declaration or definition
     | TypeDefEvent TypeDef
       -- ^ a type definition
     | AsmEvent AsmBlock
       -- ^ assembler block
     deriving ({-! CNode !-})

-- * Declarations and definitions

-- | Declarations, which aren't definitions
data Decl = Decl VarDecl NodeInfo
            deriving (Typeable, Typeable Decl
Decl -> DataType
Decl -> Constr
(forall b. Data b => b -> b) -> Decl -> Decl
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u
forall u. (forall d. Data d => d -> u) -> Decl -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Decl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Decl -> c Decl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Decl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Decl)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Decl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Decl -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
gmapT :: (forall b. Data b => b -> b) -> Decl -> Decl
$cgmapT :: (forall b. Data b => b -> b) -> Decl -> Decl
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Decl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Decl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Decl)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Decl)
dataTypeOf :: Decl -> DataType
$cdataTypeOf :: Decl -> DataType
toConstr :: Decl -> Constr
$ctoConstr :: Decl -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Decl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Decl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Decl -> c Decl
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Decl -> c Decl
Data {-! ,CNode !-}, Int -> Decl -> ShowS
[Decl] -> ShowS
Decl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Decl] -> ShowS
$cshowList :: [Decl] -> ShowS
show :: Decl -> String
$cshow :: Decl -> String
showsPrec :: Int -> Decl -> ShowS
$cshowsPrec :: Int -> Decl -> ShowS
Show)

instance Declaration Decl where
    getVarDecl :: Decl -> VarDecl
getVarDecl   (Decl VarDecl
vd NodeInfo
_) =  VarDecl
vd

-- | Object Definitions
--
-- An object definition is a declaration together with an initializer.
--
-- If the initializer is missing, it is a tentative definition, i.e. a
-- definition which might be overriden later on.
data ObjDef = ObjDef VarDecl (Maybe Initializer) NodeInfo
             deriving (Typeable, Typeable ObjDef
ObjDef -> DataType
ObjDef -> Constr
(forall b. Data b => b -> b) -> ObjDef -> ObjDef
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u
forall u. (forall d. Data d => d -> u) -> ObjDef -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ObjDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ObjDef -> c ObjDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ObjDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ObjDef)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ObjDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ObjDef -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
gmapT :: (forall b. Data b => b -> b) -> ObjDef -> ObjDef
$cgmapT :: (forall b. Data b => b -> b) -> ObjDef -> ObjDef
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ObjDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ObjDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ObjDef)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ObjDef)
dataTypeOf :: ObjDef -> DataType
$cdataTypeOf :: ObjDef -> DataType
toConstr :: ObjDef -> Constr
$ctoConstr :: ObjDef -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ObjDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ObjDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ObjDef -> c ObjDef
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ObjDef -> c ObjDef
Data {-! ,CNode !-}, Int -> ObjDef -> ShowS
[ObjDef] -> ShowS
ObjDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjDef] -> ShowS
$cshowList :: [ObjDef] -> ShowS
show :: ObjDef -> String
$cshow :: ObjDef -> String
showsPrec :: Int -> ObjDef -> ShowS
$cshowsPrec :: Int -> ObjDef -> ShowS
Show)
instance Declaration ObjDef where
    getVarDecl :: ObjDef -> VarDecl
getVarDecl  (ObjDef VarDecl
vd Maybe Initializer
_ NodeInfo
_) =  VarDecl
vd

-- | Returns @True@ if the given object definition is tentative.
isTentative :: ObjDef -> Bool
isTentative :: ObjDef -> Bool
isTentative (ObjDef VarDecl
decl Maybe Initializer
init_opt NodeInfo
_) | forall n. Declaration n => n -> Bool
isExtDecl VarDecl
decl = forall a. Maybe a -> Bool
isNothing Maybe Initializer
init_opt
                                     | Bool
otherwise = Bool
False

-- | Function definitions
--
-- A function definition is a declaration together with a statement (the function body).
data FunDef = FunDef VarDecl Stmt NodeInfo
             deriving (Typeable, Typeable FunDef
FunDef -> DataType
FunDef -> Constr
(forall b. Data b => b -> b) -> FunDef -> FunDef
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u
forall u. (forall d. Data d => d -> u) -> FunDef -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunDef -> c FunDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunDef)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> FunDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunDef -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
gmapT :: (forall b. Data b => b -> b) -> FunDef -> FunDef
$cgmapT :: (forall b. Data b => b -> b) -> FunDef -> FunDef
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunDef)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunDef)
dataTypeOf :: FunDef -> DataType
$cdataTypeOf :: FunDef -> DataType
toConstr :: FunDef -> Constr
$ctoConstr :: FunDef -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunDef -> c FunDef
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunDef -> c FunDef
Data {-! ,CNode !-}, Int -> FunDef -> ShowS
[FunDef] -> ShowS
FunDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunDef] -> ShowS
$cshowList :: [FunDef] -> ShowS
show :: FunDef -> String
$cshow :: FunDef -> String
showsPrec :: Int -> FunDef -> ShowS
$cshowsPrec :: Int -> FunDef -> ShowS
Show)
instance Declaration FunDef where
    getVarDecl :: FunDef -> VarDecl
getVarDecl (FunDef VarDecl
vd Stmt
_ NodeInfo
_) = VarDecl
vd


-- | Parameter declaration
data ParamDecl = ParamDecl VarDecl NodeInfo
               | AbstractParamDecl VarDecl NodeInfo
    deriving (Typeable, Typeable ParamDecl
ParamDecl -> DataType
ParamDecl -> Constr
(forall b. Data b => b -> b) -> ParamDecl -> ParamDecl
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
forall u. (forall d. Data d => d -> u) -> ParamDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParamDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParamDecl -> c ParamDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParamDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParamDecl)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ParamDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ParamDecl -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
gmapT :: (forall b. Data b => b -> b) -> ParamDecl -> ParamDecl
$cgmapT :: (forall b. Data b => b -> b) -> ParamDecl -> ParamDecl
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParamDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParamDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParamDecl)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParamDecl)
dataTypeOf :: ParamDecl -> DataType
$cdataTypeOf :: ParamDecl -> DataType
toConstr :: ParamDecl -> Constr
$ctoConstr :: ParamDecl -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParamDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParamDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParamDecl -> c ParamDecl
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParamDecl -> c ParamDecl
Data {-! ,CNode !-}, Int -> ParamDecl -> ShowS
[ParamDecl] -> ShowS
ParamDecl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParamDecl] -> ShowS
$cshowList :: [ParamDecl] -> ShowS
show :: ParamDecl -> String
$cshow :: ParamDecl -> String
showsPrec :: Int -> ParamDecl -> ShowS
$cshowsPrec :: Int -> ParamDecl -> ShowS
Show)

instance Declaration ParamDecl where
  getVarDecl :: ParamDecl -> VarDecl
getVarDecl (ParamDecl VarDecl
vd NodeInfo
_) = VarDecl
vd
  getVarDecl (AbstractParamDecl VarDecl
vd NodeInfo
_) = VarDecl
vd

-- | Struct\/Union member declaration
data MemberDecl = MemberDecl VarDecl (Maybe Expr) NodeInfo
                  -- ^ @MemberDecl vardecl bitfieldsize node@
                | AnonBitField Type Expr NodeInfo
                  -- ^ @AnonBitField typ size@
    deriving (Typeable, Typeable MemberDecl
MemberDecl -> DataType
MemberDecl -> Constr
(forall b. Data b => b -> b) -> MemberDecl -> MemberDecl
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
forall u. (forall d. Data d => d -> u) -> MemberDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MemberDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MemberDecl -> c MemberDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MemberDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MemberDecl)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> MemberDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> MemberDecl -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
gmapT :: (forall b. Data b => b -> b) -> MemberDecl -> MemberDecl
$cgmapT :: (forall b. Data b => b -> b) -> MemberDecl -> MemberDecl
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MemberDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MemberDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MemberDecl)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MemberDecl)
dataTypeOf :: MemberDecl -> DataType
$cdataTypeOf :: MemberDecl -> DataType
toConstr :: MemberDecl -> Constr
$ctoConstr :: MemberDecl -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MemberDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MemberDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MemberDecl -> c MemberDecl
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MemberDecl -> c MemberDecl
Data {-! ,CNode !-}, Int -> MemberDecl -> ShowS
[MemberDecl] -> ShowS
MemberDecl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemberDecl] -> ShowS
$cshowList :: [MemberDecl] -> ShowS
show :: MemberDecl -> String
$cshow :: MemberDecl -> String
showsPrec :: Int -> MemberDecl -> ShowS
$cshowsPrec :: Int -> MemberDecl -> ShowS
Show)

instance Declaration MemberDecl where
  getVarDecl :: MemberDecl -> VarDecl
getVarDecl (MemberDecl VarDecl
vd Maybe Expr
_ NodeInfo
_) = VarDecl
vd
  getVarDecl (AnonBitField Type
ty Expr
_ NodeInfo
_) = VarName -> DeclAttrs -> Type -> VarDecl
VarDecl VarName
NoName (FunctionAttrs -> Storage -> Attributes -> DeclAttrs
DeclAttrs FunctionAttrs
noFunctionAttrs Storage
NoStorage []) Type
ty

-- | @typedef@ definitions.
--
-- The identifier is a new name for the given type.
data TypeDef = TypeDef Ident Type Attributes NodeInfo
               deriving (Typeable, Typeable TypeDef
TypeDef -> DataType
TypeDef -> Constr
(forall b. Data b => b -> b) -> TypeDef -> TypeDef
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u
forall u. (forall d. Data d => d -> u) -> TypeDef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDef -> c TypeDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDef)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDef -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
gmapT :: (forall b. Data b => b -> b) -> TypeDef -> TypeDef
$cgmapT :: (forall b. Data b => b -> b) -> TypeDef -> TypeDef
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDef)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDef)
dataTypeOf :: TypeDef -> DataType
$cdataTypeOf :: TypeDef -> DataType
toConstr :: TypeDef -> Constr
$ctoConstr :: TypeDef -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDef -> c TypeDef
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDef -> c TypeDef
Data {-! ,CNode !-}, Int -> TypeDef -> ShowS
[TypeDef] -> ShowS
TypeDef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeDef] -> ShowS
$cshowList :: [TypeDef] -> ShowS
show :: TypeDef -> String
$cshow :: TypeDef -> String
showsPrec :: Int -> TypeDef -> ShowS
$cshowsPrec :: Int -> TypeDef -> ShowS
Show)

-- | return the idenitifier of a @typedef@
identOfTypeDef :: TypeDef -> Ident
identOfTypeDef :: TypeDef -> Ident
identOfTypeDef (TypeDef Ident
ide Type
_ Attributes
_ NodeInfo
_) = Ident
ide

-- | Generic variable declarations
data VarDecl = VarDecl VarName DeclAttrs Type
              deriving (Typeable, Typeable VarDecl
VarDecl -> DataType
VarDecl -> Constr
(forall b. Data b => b -> b) -> VarDecl -> VarDecl
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u
forall u. (forall d. Data d => d -> u) -> VarDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarDecl -> c VarDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarDecl)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> VarDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> VarDecl -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
gmapT :: (forall b. Data b => b -> b) -> VarDecl -> VarDecl
$cgmapT :: (forall b. Data b => b -> b) -> VarDecl -> VarDecl
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarDecl)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarDecl)
dataTypeOf :: VarDecl -> DataType
$cdataTypeOf :: VarDecl -> DataType
toConstr :: VarDecl -> Constr
$ctoConstr :: VarDecl -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarDecl -> c VarDecl
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarDecl -> c VarDecl
Data, Int -> VarDecl -> ShowS
[VarDecl] -> ShowS
VarDecl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VarDecl] -> ShowS
$cshowList :: [VarDecl] -> ShowS
show :: VarDecl -> String
$cshow :: VarDecl -> String
showsPrec :: Int -> VarDecl -> ShowS
$cshowsPrec :: Int -> VarDecl -> ShowS
Show)

instance Declaration VarDecl where
  getVarDecl :: VarDecl -> VarDecl
getVarDecl = forall a. a -> a
id

-- @isExtDecl d@ returns true if the declaration has /linkage/
isExtDecl :: (Declaration n) => n -> Bool
isExtDecl :: forall n. Declaration n => n -> Bool
isExtDecl = Storage -> Bool
hasLinkage forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall d. Declaration d => d -> Storage
declStorage

-- | Declaration attributes of the form @DeclAttrs isInlineFunction storage linkage attrs@
--
-- They specify the storage and linkage of a declared object.
data DeclAttrs = DeclAttrs FunctionAttrs Storage Attributes
                 -- ^ @DeclAttrs fspecs storage attrs@
               deriving (Typeable, Typeable DeclAttrs
DeclAttrs -> DataType
DeclAttrs -> Constr
(forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
forall u. (forall d. Data d => d -> u) -> DeclAttrs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DeclAttrs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DeclAttrs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DeclAttrs)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> DeclAttrs -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DeclAttrs -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
gmapT :: (forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs
$cgmapT :: (forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DeclAttrs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DeclAttrs)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DeclAttrs)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DeclAttrs)
dataTypeOf :: DeclAttrs -> DataType
$cdataTypeOf :: DeclAttrs -> DataType
toConstr :: DeclAttrs -> Constr
$ctoConstr :: DeclAttrs -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DeclAttrs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DeclAttrs
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs
Data, Int -> DeclAttrs -> ShowS
[DeclAttrs] -> ShowS
DeclAttrs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeclAttrs] -> ShowS
$cshowList :: [DeclAttrs] -> ShowS
show :: DeclAttrs -> String
$cshow :: DeclAttrs -> String
showsPrec :: Int -> DeclAttrs -> ShowS
$cshowsPrec :: Int -> DeclAttrs -> ShowS
Show)

-- | get the 'Storage' of a declaration
declStorage :: (Declaration d) => d -> Storage
declStorage :: forall d. Declaration d => d -> Storage
declStorage d
d = case forall n. Declaration n => n -> DeclAttrs
declAttrs d
d of (DeclAttrs FunctionAttrs
_ Storage
st Attributes
_) -> Storage
st

-- | get the `function attributes' of a declaration
functionAttrs :: (Declaration d) => d -> FunctionAttrs
functionAttrs :: forall d. Declaration d => d -> FunctionAttrs
functionAttrs d
d = case forall n. Declaration n => n -> DeclAttrs
declAttrs d
d of (DeclAttrs FunctionAttrs
fa Storage
_ Attributes
_) -> FunctionAttrs
fa

-- Function attributes (inline, noreturn)
data FunctionAttrs = FunctionAttrs { FunctionAttrs -> Bool
isInline :: Bool, FunctionAttrs -> Bool
isNoreturn :: Bool }
  deriving (FunctionAttrs -> FunctionAttrs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionAttrs -> FunctionAttrs -> Bool
$c/= :: FunctionAttrs -> FunctionAttrs -> Bool
== :: FunctionAttrs -> FunctionAttrs -> Bool
$c== :: FunctionAttrs -> FunctionAttrs -> Bool
Eq, Eq FunctionAttrs
FunctionAttrs -> FunctionAttrs -> Bool
FunctionAttrs -> FunctionAttrs -> Ordering
FunctionAttrs -> FunctionAttrs -> FunctionAttrs
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
$cmin :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
max :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
$cmax :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
>= :: FunctionAttrs -> FunctionAttrs -> Bool
$c>= :: FunctionAttrs -> FunctionAttrs -> Bool
> :: FunctionAttrs -> FunctionAttrs -> Bool
$c> :: FunctionAttrs -> FunctionAttrs -> Bool
<= :: FunctionAttrs -> FunctionAttrs -> Bool
$c<= :: FunctionAttrs -> FunctionAttrs -> Bool
< :: FunctionAttrs -> FunctionAttrs -> Bool
$c< :: FunctionAttrs -> FunctionAttrs -> Bool
compare :: FunctionAttrs -> FunctionAttrs -> Ordering
$ccompare :: FunctionAttrs -> FunctionAttrs -> Ordering
Ord, Typeable, Typeable FunctionAttrs
FunctionAttrs -> DataType
FunctionAttrs -> Constr
(forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
forall u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAttrs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAttrs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAttrs)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
gmapT :: (forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs
$cgmapT :: (forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAttrs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAttrs)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAttrs)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAttrs)
dataTypeOf :: FunctionAttrs -> DataType
$cdataTypeOf :: FunctionAttrs -> DataType
toConstr :: FunctionAttrs -> Constr
$ctoConstr :: FunctionAttrs -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAttrs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAttrs
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs
Data, Int -> FunctionAttrs -> ShowS
[FunctionAttrs] -> ShowS
FunctionAttrs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionAttrs] -> ShowS
$cshowList :: [FunctionAttrs] -> ShowS
show :: FunctionAttrs -> String
$cshow :: FunctionAttrs -> String
showsPrec :: Int -> FunctionAttrs -> ShowS
$cshowsPrec :: Int -> FunctionAttrs -> ShowS
Show)

noFunctionAttrs :: FunctionAttrs
noFunctionAttrs :: FunctionAttrs
noFunctionAttrs = FunctionAttrs { isInline :: Bool
isInline = Bool
False, isNoreturn :: Bool
isNoreturn = Bool
False }


-- In C we have
--  Identifiers can either have internal, external or no linkage
--  (same object everywhere, same object within the translation unit, unique).
--  * top-level identifiers
--      static : internal linkage (objects and function defs)
--      extern : linkage of prior declaration (if specified), external linkage otherwise
--      no-spec: external linkage
--  * storage duration
--      * static storage duration: objects with external or internal linkage, or local ones with the static keyword
--      * automatic storage duration: otherwise (register)
-- See http://publications.gbdirect.co.uk/c_book/chapter8/declarations_and_definitions.html, Table 8.1, 8.2

-- | Storage duration and linkage of a variable
data Storage  =  NoStorage                  -- ^ no storage
               | Auto Register              -- ^ automatic storage (optional: register)
               | Static Linkage ThreadLocal -- ^ static storage, linkage spec and thread local specifier (gnu c)
               | FunLinkage Linkage         -- ^ function, either internal or external linkage
               deriving (Typeable, Typeable Storage
Storage -> DataType
Storage -> Constr
(forall b. Data b => b -> b) -> Storage -> Storage
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Storage -> u
forall u. (forall d. Data d => d -> u) -> Storage -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Storage -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Storage -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Storage
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Storage -> c Storage
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Storage)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Storage)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Storage -> m Storage
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Storage -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Storage -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Storage -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Storage -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Storage -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Storage -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Storage -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Storage -> r
gmapT :: (forall b. Data b => b -> b) -> Storage -> Storage
$cgmapT :: (forall b. Data b => b -> b) -> Storage -> Storage
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Storage)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Storage)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Storage)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Storage)
dataTypeOf :: Storage -> DataType
$cdataTypeOf :: Storage -> DataType
toConstr :: Storage -> Constr
$ctoConstr :: Storage -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Storage
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Storage
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Storage -> c Storage
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Storage -> c Storage
Data, Int -> Storage -> ShowS
[Storage] -> ShowS
Storage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Storage] -> ShowS
$cshowList :: [Storage] -> ShowS
show :: Storage -> String
$cshow :: Storage -> String
showsPrec :: Int -> Storage -> ShowS
$cshowsPrec :: Int -> Storage -> ShowS
Show, Storage -> Storage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Storage -> Storage -> Bool
$c/= :: Storage -> Storage -> Bool
== :: Storage -> Storage -> Bool
$c== :: Storage -> Storage -> Bool
Eq, Eq Storage
Storage -> Storage -> Bool
Storage -> Storage -> Ordering
Storage -> Storage -> Storage
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Storage -> Storage -> Storage
$cmin :: Storage -> Storage -> Storage
max :: Storage -> Storage -> Storage
$cmax :: Storage -> Storage -> Storage
>= :: Storage -> Storage -> Bool
$c>= :: Storage -> Storage -> Bool
> :: Storage -> Storage -> Bool
$c> :: Storage -> Storage -> Bool
<= :: Storage -> Storage -> Bool
$c<= :: Storage -> Storage -> Bool
< :: Storage -> Storage -> Bool
$c< :: Storage -> Storage -> Bool
compare :: Storage -> Storage -> Ordering
$ccompare :: Storage -> Storage -> Ordering
Ord)

type ThreadLocal = Bool
type Register    = Bool

-- | Linkage: Either no linkage, internal to the translation unit or external
data Linkage = NoLinkage | InternalLinkage | ExternalLinkage
               deriving (Typeable, Typeable Linkage
Linkage -> DataType
Linkage -> Constr
(forall b. Data b => b -> b) -> Linkage -> Linkage
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Linkage -> u
forall u. (forall d. Data d => d -> u) -> Linkage -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Linkage -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Linkage -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Linkage
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Linkage -> c Linkage
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Linkage)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Linkage)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Linkage -> m Linkage
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Linkage -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Linkage -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Linkage -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Linkage -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Linkage -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Linkage -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Linkage -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Linkage -> r
gmapT :: (forall b. Data b => b -> b) -> Linkage -> Linkage
$cgmapT :: (forall b. Data b => b -> b) -> Linkage -> Linkage
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Linkage)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Linkage)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Linkage)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Linkage)
dataTypeOf :: Linkage -> DataType
$cdataTypeOf :: Linkage -> DataType
toConstr :: Linkage -> Constr
$ctoConstr :: Linkage -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Linkage
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Linkage
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Linkage -> c Linkage
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Linkage -> c Linkage
Data, Int -> Linkage -> ShowS
[Linkage] -> ShowS
Linkage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Linkage] -> ShowS
$cshowList :: [Linkage] -> ShowS
show :: Linkage -> String
$cshow :: Linkage -> String
showsPrec :: Int -> Linkage -> ShowS
$cshowsPrec :: Int -> Linkage -> ShowS
Show, Linkage -> Linkage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Linkage -> Linkage -> Bool
$c/= :: Linkage -> Linkage -> Bool
== :: Linkage -> Linkage -> Bool
$c== :: Linkage -> Linkage -> Bool
Eq, Eq Linkage
Linkage -> Linkage -> Bool
Linkage -> Linkage -> Ordering
Linkage -> Linkage -> Linkage
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Linkage -> Linkage -> Linkage
$cmin :: Linkage -> Linkage -> Linkage
max :: Linkage -> Linkage -> Linkage
$cmax :: Linkage -> Linkage -> Linkage
>= :: Linkage -> Linkage -> Bool
$c>= :: Linkage -> Linkage -> Bool
> :: Linkage -> Linkage -> Bool
$c> :: Linkage -> Linkage -> Bool
<= :: Linkage -> Linkage -> Bool
$c<= :: Linkage -> Linkage -> Bool
< :: Linkage -> Linkage -> Bool
$c< :: Linkage -> Linkage -> Bool
compare :: Linkage -> Linkage -> Ordering
$ccompare :: Linkage -> Linkage -> Ordering
Ord)

-- | return @True@ if the object has linkage
hasLinkage :: Storage -> Bool
hasLinkage :: Storage -> Bool
hasLinkage (Auto Bool
_) = Bool
False
hasLinkage (Static Linkage
NoLinkage Bool
_) = Bool
False
hasLinkage Storage
_ = Bool
True

-- | Get the linkage of a definition
declLinkage :: (Declaration d) => d -> Linkage
declLinkage :: forall d. Declaration d => d -> Linkage
declLinkage d
decl =
    case forall d. Declaration d => d -> Storage
declStorage d
decl of
        Storage
NoStorage -> forall a. HasCallStack => a
undefined
        Auto Bool
_ -> Linkage
NoLinkage
        Static Linkage
linkage Bool
_ -> Linkage
linkage
        FunLinkage Linkage
linkage -> Linkage
linkage


-- * types

-- | types of C objects
data Type =
       DirectType TypeName TypeQuals Attributes
     -- ^ a non-derived type
     | PtrType Type TypeQuals Attributes
     -- ^ pointer type
     | ArrayType Type ArraySize TypeQuals Attributes
     -- ^ array type
     | FunctionType FunType Attributes
     -- ^ function type
     | TypeDefType TypeDefRef TypeQuals Attributes
     -- ^ a defined type
     deriving (Typeable, Typeable Type
Type -> DataType
Type -> Constr
(forall b. Data b => b -> b) -> Type -> Type
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Type -> u
forall u. (forall d. Data d => d -> u) -> Type -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Type -> m Type
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Type)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Type -> m Type
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Type -> m Type
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Type -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Type -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Type -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Type -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
gmapT :: (forall b. Data b => b -> b) -> Type -> Type
$cgmapT :: (forall b. Data b => b -> b) -> Type -> Type
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Type)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Type)
dataTypeOf :: Type -> DataType
$cdataTypeOf :: Type -> DataType
toConstr :: Type -> Constr
$ctoConstr :: Type -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
Data, Int -> Type -> ShowS
[Type] -> ShowS
Type -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Type] -> ShowS
$cshowList :: [Type] -> ShowS
show :: Type -> String
$cshow :: Type -> String
showsPrec :: Int -> Type -> ShowS
$cshowsPrec :: Int -> Type -> ShowS
Show)

-- | Function types are of the form @FunType return-type params isVariadic@.
--
-- If the parameter types aren't yet known, the function has type @FunTypeIncomplete type attrs@.
data FunType = FunType Type [ParamDecl] Bool
            |  FunTypeIncomplete Type
               deriving (Typeable, Typeable FunType
FunType -> DataType
FunType -> Constr
(forall b. Data b => b -> b) -> FunType -> FunType
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunType -> u
forall u. (forall d. Data d => d -> u) -> FunType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunType -> c FunType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunType)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunType -> m FunType
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunType -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> FunType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunType -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunType -> r
gmapT :: (forall b. Data b => b -> b) -> FunType -> FunType
$cgmapT :: (forall b. Data b => b -> b) -> FunType -> FunType
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunType)
dataTypeOf :: FunType -> DataType
$cdataTypeOf :: FunType -> DataType
toConstr :: FunType -> Constr
$ctoConstr :: FunType -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunType -> c FunType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunType -> c FunType
Data, Int -> FunType -> ShowS
[FunType] -> ShowS
FunType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunType] -> ShowS
$cshowList :: [FunType] -> ShowS
show :: FunType -> String
$cshow :: FunType -> String
showsPrec :: Int -> FunType -> ShowS
$cshowsPrec :: Int -> FunType -> ShowS
Show)

-- | An array type may either have unknown size or a specified array size, the latter either variable or constant.
-- Furthermore, when used as a function parameters, the size may be qualified as /static/.
-- In a function prototype, the size may be `Unspecified variable size' (@[*]@).
data ArraySize =  UnknownArraySize Bool
                -- ^ @UnknownArraySize is-starred@
                | ArraySize Bool Expr
                -- ^ @FixedSizeArray is-static size-expr@
               deriving (Typeable, Typeable ArraySize
ArraySize -> DataType
ArraySize -> Constr
(forall b. Data b => b -> b) -> ArraySize -> ArraySize
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ArraySize -> u
forall u. (forall d. Data d => d -> u) -> ArraySize -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArraySize -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArraySize -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArraySize
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArraySize -> c ArraySize
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArraySize)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArraySize)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArraySize -> m ArraySize
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ArraySize -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ArraySize -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ArraySize -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ArraySize -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArraySize -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArraySize -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArraySize -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArraySize -> r
gmapT :: (forall b. Data b => b -> b) -> ArraySize -> ArraySize
$cgmapT :: (forall b. Data b => b -> b) -> ArraySize -> ArraySize
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArraySize)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArraySize)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArraySize)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArraySize)
dataTypeOf :: ArraySize -> DataType
$cdataTypeOf :: ArraySize -> DataType
toConstr :: ArraySize -> Constr
$ctoConstr :: ArraySize -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArraySize
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArraySize
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArraySize -> c ArraySize
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArraySize -> c ArraySize
Data, Int -> ArraySize -> ShowS
[ArraySize] -> ShowS
ArraySize -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArraySize] -> ShowS
$cshowList :: [ArraySize] -> ShowS
show :: ArraySize -> String
$cshow :: ArraySize -> String
showsPrec :: Int -> ArraySize -> ShowS
$cshowsPrec :: Int -> ArraySize -> ShowS
Show)

-- | normalized type representation
data TypeName =
      TyVoid
    | TyIntegral IntType
    | TyFloating FloatType
    | TyComplex  FloatType
    | TyComp CompTypeRef
    | TyEnum EnumTypeRef
    | TyBuiltin BuiltinType
    deriving (Typeable, Typeable TypeName
TypeName -> DataType
TypeName -> Constr
(forall b. Data b => b -> b) -> TypeName -> TypeName
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeName -> u
forall u. (forall d. Data d => d -> u) -> TypeName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeName -> c TypeName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeName)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeName -> m TypeName
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeName -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypeName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeName -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeName -> r
gmapT :: (forall b. Data b => b -> b) -> TypeName -> TypeName
$cgmapT :: (forall b. Data b => b -> b) -> TypeName -> TypeName
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeName)
dataTypeOf :: TypeName -> DataType
$cdataTypeOf :: TypeName -> DataType
toConstr :: TypeName -> Constr
$ctoConstr :: TypeName -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeName -> c TypeName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeName -> c TypeName
Data, Int -> TypeName -> ShowS
[TypeName] -> ShowS
TypeName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeName] -> ShowS
$cshowList :: [TypeName] -> ShowS
show :: TypeName -> String
$cshow :: TypeName -> String
showsPrec :: Int -> TypeName -> ShowS
$cshowsPrec :: Int -> TypeName -> ShowS
Show)

-- | Builtin type (va_list, anything)
data BuiltinType = TyVaList
                 | TyAny
                   deriving (Typeable, Typeable BuiltinType
BuiltinType -> DataType
BuiltinType -> Constr
(forall b. Data b => b -> b) -> BuiltinType -> BuiltinType
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
forall u. (forall d. Data d => d -> u) -> BuiltinType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinType -> c BuiltinType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinType)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinType -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
gmapT :: (forall b. Data b => b -> b) -> BuiltinType -> BuiltinType
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinType -> BuiltinType
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinType)
dataTypeOf :: BuiltinType -> DataType
$cdataTypeOf :: BuiltinType -> DataType
toConstr :: BuiltinType -> Constr
$ctoConstr :: BuiltinType -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinType -> c BuiltinType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinType -> c BuiltinType
Data, Int -> BuiltinType -> ShowS
[BuiltinType] -> ShowS
BuiltinType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuiltinType] -> ShowS
$cshowList :: [BuiltinType] -> ShowS
show :: BuiltinType -> String
$cshow :: BuiltinType -> String
showsPrec :: Int -> BuiltinType -> ShowS
$cshowsPrec :: Int -> BuiltinType -> ShowS
Show)

-- | typdef references
-- If the actual type is known, it is attached for convenience
data TypeDefRef = TypeDefRef Ident Type NodeInfo
               deriving (Typeable, Typeable TypeDefRef
TypeDefRef -> DataType
TypeDefRef -> Constr
(forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
forall u. (forall d. Data d => d -> u) -> TypeDefRef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDefRef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDefRef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDefRef)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDefRef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDefRef -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
gmapT :: (forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef
$cgmapT :: (forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDefRef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDefRef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDefRef)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDefRef)
dataTypeOf :: TypeDefRef -> DataType
$cdataTypeOf :: TypeDefRef -> DataType
toConstr :: TypeDefRef -> Constr
$ctoConstr :: TypeDefRef -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDefRef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDefRef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef
Data {-! ,CNode !-}, Int -> TypeDefRef -> ShowS
[TypeDefRef] -> ShowS
TypeDefRef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeDefRef] -> ShowS
$cshowList :: [TypeDefRef] -> ShowS
show :: TypeDefRef -> String
$cshow :: TypeDefRef -> String
showsPrec :: Int -> TypeDefRef -> ShowS
$cshowsPrec :: Int -> TypeDefRef -> ShowS
Show)

-- | integral types (C99 6.7.2.2)
data IntType =
      TyBool
    | TyChar
    | TySChar
    | TyUChar
    | TyShort
    | TyUShort
    | TyInt
    | TyUInt
    | TyInt128
    | TyUInt128
    | TyLong
    | TyULong
    | TyLLong
    | TyULLong
    deriving (Typeable, Typeable IntType
IntType -> DataType
IntType -> Constr
(forall b. Data b => b -> b) -> IntType -> IntType
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u
forall u. (forall d. Data d => d -> u) -> IntType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntType -> c IntType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntType)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> IntType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IntType -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
gmapT :: (forall b. Data b => b -> b) -> IntType -> IntType
$cgmapT :: (forall b. Data b => b -> b) -> IntType -> IntType
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntType)
dataTypeOf :: IntType -> DataType
$cdataTypeOf :: IntType -> DataType
toConstr :: IntType -> Constr
$ctoConstr :: IntType -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntType -> c IntType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntType -> c IntType
Data, IntType -> IntType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntType -> IntType -> Bool
$c/= :: IntType -> IntType -> Bool
== :: IntType -> IntType -> Bool
$c== :: IntType -> IntType -> Bool
Eq, Eq IntType
IntType -> IntType -> Bool
IntType -> IntType -> Ordering
IntType -> IntType -> IntType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IntType -> IntType -> IntType
$cmin :: IntType -> IntType -> IntType
max :: IntType -> IntType -> IntType
$cmax :: IntType -> IntType -> IntType
>= :: IntType -> IntType -> Bool
$c>= :: IntType -> IntType -> Bool
> :: IntType -> IntType -> Bool
$c> :: IntType -> IntType -> Bool
<= :: IntType -> IntType -> Bool
$c<= :: IntType -> IntType -> Bool
< :: IntType -> IntType -> Bool
$c< :: IntType -> IntType -> Bool
compare :: IntType -> IntType -> Ordering
$ccompare :: IntType -> IntType -> Ordering
Ord)

instance Show IntType where
    show :: IntType -> String
show IntType
TyBool = String
"_Bool"
    show IntType
TyChar = String
"char"
    show IntType
TySChar = String
"signed char"
    show IntType
TyUChar = String
"unsigned char"
    show IntType
TyShort = String
"short"
    show IntType
TyUShort = String
"unsigned short"
    show IntType
TyInt = String
"int"
    show IntType
TyUInt = String
"unsigned int"
    show IntType
TyInt128 = String
"__int128"
    show IntType
TyUInt128 = String
"unsigned __int128"
    show IntType
TyLong = String
"long"
    show IntType
TyULong = String
"unsigned long"
    show IntType
TyLLong = String
"long long"
    show IntType
TyULLong = String
"unsigned long long"

-- | floating point type (C99 6.7.2.2)
data FloatType =
      TyFloat
    | TyDouble
    | TyLDouble
    | TyFloatN Int Bool
    deriving (Typeable, Typeable FloatType
FloatType -> DataType
FloatType -> Constr
(forall b. Data b => b -> b) -> FloatType -> FloatType
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FloatType -> u
forall u. (forall d. Data d => d -> u) -> FloatType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FloatType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FloatType -> c FloatType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FloatType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FloatType)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FloatType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FloatType -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> FloatType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FloatType -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
gmapT :: (forall b. Data b => b -> b) -> FloatType -> FloatType
$cgmapT :: (forall b. Data b => b -> b) -> FloatType -> FloatType
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FloatType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FloatType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FloatType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FloatType)
dataTypeOf :: FloatType -> DataType
$cdataTypeOf :: FloatType -> DataType
toConstr :: FloatType -> Constr
$ctoConstr :: FloatType -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FloatType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FloatType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FloatType -> c FloatType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FloatType -> c FloatType
Data, FloatType -> FloatType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FloatType -> FloatType -> Bool
$c/= :: FloatType -> FloatType -> Bool
== :: FloatType -> FloatType -> Bool
$c== :: FloatType -> FloatType -> Bool
Eq, Eq FloatType
FloatType -> FloatType -> Bool
FloatType -> FloatType -> Ordering
FloatType -> FloatType -> FloatType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FloatType -> FloatType -> FloatType
$cmin :: FloatType -> FloatType -> FloatType
max :: FloatType -> FloatType -> FloatType
$cmax :: FloatType -> FloatType -> FloatType
>= :: FloatType -> FloatType -> Bool
$c>= :: FloatType -> FloatType -> Bool
> :: FloatType -> FloatType -> Bool
$c> :: FloatType -> FloatType -> Bool
<= :: FloatType -> FloatType -> Bool
$c<= :: FloatType -> FloatType -> Bool
< :: FloatType -> FloatType -> Bool
$c< :: FloatType -> FloatType -> Bool
compare :: FloatType -> FloatType -> Ordering
$ccompare :: FloatType -> FloatType -> Ordering
Ord)

instance Show FloatType where
    show :: FloatType -> String
show FloatType
TyFloat = String
"float"
    show FloatType
TyDouble = String
"double"
    show FloatType
TyLDouble = String
"long double"
    show (TyFloatN Int
n Bool
x) = String
"_Float" forall a. [a] -> [a] -> [a]
++ (forall a. Show a => a -> String
show Int
n) forall a. [a] -> [a] -> [a]
++ (if Bool
x then String
"x" else String
"")

-- | composite type declarations
data CompTypeRef = CompTypeRef SUERef CompTyKind NodeInfo
                    deriving (Typeable, Typeable CompTypeRef
CompTypeRef -> DataType
CompTypeRef -> Constr
(forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
forall u. (forall d. Data d => d -> u) -> CompTypeRef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTypeRef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTypeRef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CompTypeRef)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> CompTypeRef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompTypeRef -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
gmapT :: (forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef
$cgmapT :: (forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CompTypeRef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CompTypeRef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTypeRef)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTypeRef)
dataTypeOf :: CompTypeRef -> DataType
$cdataTypeOf :: CompTypeRef -> DataType
toConstr :: CompTypeRef -> Constr
$ctoConstr :: CompTypeRef -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTypeRef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTypeRef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef
Data {-! ,CNode !-}, Int -> CompTypeRef -> ShowS
[CompTypeRef] -> ShowS
CompTypeRef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompTypeRef] -> ShowS
$cshowList :: [CompTypeRef] -> ShowS
show :: CompTypeRef -> String
$cshow :: CompTypeRef -> String
showsPrec :: Int -> CompTypeRef -> ShowS
$cshowsPrec :: Int -> CompTypeRef -> ShowS
Show)

instance HasSUERef  CompTypeRef where sueRef :: CompTypeRef -> SUERef
sueRef  (CompTypeRef SUERef
ref CompTyKind
_ NodeInfo
_) = SUERef
ref
instance HasCompTyKind CompTypeRef where compTag :: CompTypeRef -> CompTyKind
compTag (CompTypeRef SUERef
_ CompTyKind
tag NodeInfo
_)  = CompTyKind
tag

data EnumTypeRef = EnumTypeRef SUERef NodeInfo
    deriving (Typeable, Typeable EnumTypeRef
EnumTypeRef -> DataType
EnumTypeRef -> Constr
(forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
forall u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumTypeRef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumTypeRef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumTypeRef)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
gmapT :: (forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef
$cgmapT :: (forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumTypeRef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumTypeRef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumTypeRef)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumTypeRef)
dataTypeOf :: EnumTypeRef -> DataType
$cdataTypeOf :: EnumTypeRef -> DataType
toConstr :: EnumTypeRef -> Constr
$ctoConstr :: EnumTypeRef -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumTypeRef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumTypeRef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef
Data {-! ,CNode !-}, Int -> EnumTypeRef -> ShowS
[EnumTypeRef] -> ShowS
EnumTypeRef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnumTypeRef] -> ShowS
$cshowList :: [EnumTypeRef] -> ShowS
show :: EnumTypeRef -> String
$cshow :: EnumTypeRef -> String
showsPrec :: Int -> EnumTypeRef -> ShowS
$cshowsPrec :: Int -> EnumTypeRef -> ShowS
Show)
instance HasSUERef  EnumTypeRef where sueRef :: EnumTypeRef -> SUERef
sueRef  (EnumTypeRef SUERef
ref NodeInfo
_) = SUERef
ref

-- | Composite type (struct or union).
data CompType =  CompType SUERef CompTyKind [MemberDecl] Attributes NodeInfo
                 deriving (Typeable, Typeable CompType
CompType -> DataType
CompType -> Constr
(forall b. Data b => b -> b) -> CompType -> CompType
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u
forall u. (forall d. Data d => d -> u) -> CompType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompType -> c CompType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompType)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> CompType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompType -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
gmapT :: (forall b. Data b => b -> b) -> CompType -> CompType
$cgmapT :: (forall b. Data b => b -> b) -> CompType -> CompType
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompType)
dataTypeOf :: CompType -> DataType
$cdataTypeOf :: CompType -> DataType
toConstr :: CompType -> Constr
$ctoConstr :: CompType -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompType -> c CompType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompType -> c CompType
Data {-! ,CNode !-}, Int -> CompType -> ShowS
[CompType] -> ShowS
CompType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompType] -> ShowS
$cshowList :: [CompType] -> ShowS
show :: CompType -> String
$cshow :: CompType -> String
showsPrec :: Int -> CompType -> ShowS
$cshowsPrec :: Int -> CompType -> ShowS
Show)
instance HasSUERef  CompType where sueRef :: CompType -> SUERef
sueRef  (CompType SUERef
ref CompTyKind
_ [MemberDecl]
_ Attributes
_ NodeInfo
_) = SUERef
ref
instance HasCompTyKind CompType where compTag :: CompType -> CompTyKind
compTag (CompType SUERef
_ CompTyKind
tag [MemberDecl]
_ Attributes
_ NodeInfo
_) = CompTyKind
tag

-- | return the type of a composite type definition
typeOfCompDef :: CompType -> TypeName
typeOfCompDef :: CompType -> TypeName
typeOfCompDef (CompType SUERef
ref CompTyKind
tag [MemberDecl]
_ Attributes
_ NodeInfo
_) = CompTypeRef -> TypeName
TyComp (SUERef -> CompTyKind -> NodeInfo -> CompTypeRef
CompTypeRef SUERef
ref CompTyKind
tag NodeInfo
undefNode)

-- | a tag to determine wheter we refer to a @struct@ or @union@, see 'CompType'.
data CompTyKind =  StructTag
                 | UnionTag
    deriving (CompTyKind -> CompTyKind -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompTyKind -> CompTyKind -> Bool
$c/= :: CompTyKind -> CompTyKind -> Bool
== :: CompTyKind -> CompTyKind -> Bool
$c== :: CompTyKind -> CompTyKind -> Bool
Eq,Eq CompTyKind
CompTyKind -> CompTyKind -> Bool
CompTyKind -> CompTyKind -> Ordering
CompTyKind -> CompTyKind -> CompTyKind
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CompTyKind -> CompTyKind -> CompTyKind
$cmin :: CompTyKind -> CompTyKind -> CompTyKind
max :: CompTyKind -> CompTyKind -> CompTyKind
$cmax :: CompTyKind -> CompTyKind -> CompTyKind
>= :: CompTyKind -> CompTyKind -> Bool
$c>= :: CompTyKind -> CompTyKind -> Bool
> :: CompTyKind -> CompTyKind -> Bool
$c> :: CompTyKind -> CompTyKind -> Bool
<= :: CompTyKind -> CompTyKind -> Bool
$c<= :: CompTyKind -> CompTyKind -> Bool
< :: CompTyKind -> CompTyKind -> Bool
$c< :: CompTyKind -> CompTyKind -> Bool
compare :: CompTyKind -> CompTyKind -> Ordering
$ccompare :: CompTyKind -> CompTyKind -> Ordering
Ord,Typeable,Typeable CompTyKind
CompTyKind -> DataType
CompTyKind -> Constr
(forall b. Data b => b -> b) -> CompTyKind -> CompTyKind
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
forall u. (forall d. Data d => d -> u) -> CompTyKind -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTyKind
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTyKind -> c CompTyKind
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTyKind)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompTyKind)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> CompTyKind -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompTyKind -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
gmapT :: (forall b. Data b => b -> b) -> CompTyKind -> CompTyKind
$cgmapT :: (forall b. Data b => b -> b) -> CompTyKind -> CompTyKind
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompTyKind)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompTyKind)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTyKind)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTyKind)
dataTypeOf :: CompTyKind -> DataType
$cdataTypeOf :: CompTyKind -> DataType
toConstr :: CompTyKind -> Constr
$ctoConstr :: CompTyKind -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTyKind
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTyKind
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTyKind -> c CompTyKind
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTyKind -> c CompTyKind
Data)

instance Show CompTyKind where
    show :: CompTyKind -> String
show CompTyKind
StructTag = String
"struct"
    show CompTyKind
UnionTag  = String
"union"

-- | Representation of C enumeration types
data EnumType = EnumType SUERef [Enumerator] Attributes NodeInfo
                 -- ^ @EnumType name enumeration-constants attrs node@
                 deriving (Typeable, Typeable EnumType
EnumType -> DataType
EnumType -> Constr
(forall b. Data b => b -> b) -> EnumType -> EnumType
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u
forall u. (forall d. Data d => d -> u) -> EnumType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumType -> c EnumType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumType)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> EnumType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EnumType -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
gmapT :: (forall b. Data b => b -> b) -> EnumType -> EnumType
$cgmapT :: (forall b. Data b => b -> b) -> EnumType -> EnumType
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumType)
dataTypeOf :: EnumType -> DataType
$cdataTypeOf :: EnumType -> DataType
toConstr :: EnumType -> Constr
$ctoConstr :: EnumType -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumType -> c EnumType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumType -> c EnumType
Data {-! ,CNode !-}, Int -> EnumType -> ShowS
[EnumType] -> ShowS
EnumType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnumType] -> ShowS
$cshowList :: [EnumType] -> ShowS
show :: EnumType -> String
$cshow :: EnumType -> String
showsPrec :: Int -> EnumType -> ShowS
$cshowsPrec :: Int -> EnumType -> ShowS
Show)

instance HasSUERef EnumType where sueRef :: EnumType -> SUERef
sueRef  (EnumType SUERef
ref [Enumerator]
_ Attributes
_ NodeInfo
_) = SUERef
ref

-- | return the type of an enum definition
typeOfEnumDef :: EnumType -> TypeName
typeOfEnumDef :: EnumType -> TypeName
typeOfEnumDef (EnumType SUERef
ref [Enumerator]
_ Attributes
_ NodeInfo
_) = EnumTypeRef -> TypeName
TyEnum (SUERef -> NodeInfo -> EnumTypeRef
EnumTypeRef SUERef
ref NodeInfo
undefNode)

-- | An Enumerator consists of an identifier, a constant expressions and the link to its type
data Enumerator = Enumerator Ident Expr EnumType NodeInfo
                  deriving (Typeable, Typeable Enumerator
Enumerator -> DataType
Enumerator -> Constr
(forall b. Data b => b -> b) -> Enumerator -> Enumerator
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Enumerator -> u
forall u. (forall d. Data d => d -> u) -> Enumerator -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Enumerator
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Enumerator -> c Enumerator
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Enumerator)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Enumerator)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Enumerator -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Enumerator -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Enumerator -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Enumerator -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
gmapT :: (forall b. Data b => b -> b) -> Enumerator -> Enumerator
$cgmapT :: (forall b. Data b => b -> b) -> Enumerator -> Enumerator
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Enumerator)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Enumerator)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Enumerator)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Enumerator)
dataTypeOf :: Enumerator -> DataType
$cdataTypeOf :: Enumerator -> DataType
toConstr :: Enumerator -> Constr
$ctoConstr :: Enumerator -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Enumerator
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Enumerator
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Enumerator -> c Enumerator
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Enumerator -> c Enumerator
Data {-! ,CNode !-}, Int -> Enumerator -> ShowS
[Enumerator] -> ShowS
Enumerator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Enumerator] -> ShowS
$cshowList :: [Enumerator] -> ShowS
show :: Enumerator -> String
$cshow :: Enumerator -> String
showsPrec :: Int -> Enumerator -> ShowS
$cshowsPrec :: Int -> Enumerator -> ShowS
Show)
instance Declaration Enumerator where
  getVarDecl :: Enumerator -> VarDecl
getVarDecl (Enumerator Ident
ide Expr
_ EnumType
enumty NodeInfo
_) =
    VarName -> DeclAttrs -> Type -> VarDecl
VarDecl
      (Ident -> Maybe AsmName -> VarName
VarName Ident
ide forall a. Maybe a
Nothing)
      (FunctionAttrs -> Storage -> Attributes -> DeclAttrs
DeclAttrs FunctionAttrs
noFunctionAttrs Storage
NoStorage [])
      (TypeName -> TypeQuals -> Attributes -> Type
DirectType (EnumType -> TypeName
typeOfEnumDef EnumType
enumty) TypeQuals
noTypeQuals Attributes
noAttributes)

-- | Type qualifiers: constant, volatile and restrict
data TypeQuals = TypeQuals { TypeQuals -> Bool
constant :: Bool, TypeQuals -> Bool
volatile :: Bool,
                             TypeQuals -> Bool
restrict :: Bool, TypeQuals -> Bool
atomic :: Bool,
                             TypeQuals -> Bool
nullable :: Bool, TypeQuals -> Bool
nonnull  :: Bool,
                             TypeQuals -> Bool
clrdonly :: Bool, TypeQuals -> Bool
clwronly :: Bool }
    deriving (Typeable, Typeable TypeQuals
TypeQuals -> DataType
TypeQuals -> Constr
(forall b. Data b => b -> b) -> TypeQuals -> TypeQuals
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
forall u. (forall d. Data d => d -> u) -> TypeQuals -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeQuals
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeQuals -> c TypeQuals
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeQuals)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeQuals)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypeQuals -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeQuals -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
gmapT :: (forall b. Data b => b -> b) -> TypeQuals -> TypeQuals
$cgmapT :: (forall b. Data b => b -> b) -> TypeQuals -> TypeQuals
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeQuals)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeQuals)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeQuals)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeQuals)
dataTypeOf :: TypeQuals -> DataType
$cdataTypeOf :: TypeQuals -> DataType
toConstr :: TypeQuals -> Constr
$ctoConstr :: TypeQuals -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeQuals
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeQuals
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeQuals -> c TypeQuals
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeQuals -> c TypeQuals
Data, Int -> TypeQuals -> ShowS
[TypeQuals] -> ShowS
TypeQuals -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeQuals] -> ShowS
$cshowList :: [TypeQuals] -> ShowS
show :: TypeQuals -> String
$cshow :: TypeQuals -> String
showsPrec :: Int -> TypeQuals -> ShowS
$cshowsPrec :: Int -> TypeQuals -> ShowS
Show)

instance Eq TypeQuals where
 == :: TypeQuals -> TypeQuals -> Bool
(==) (TypeQuals Bool
c1 Bool
v1 Bool
r1 Bool
a1 Bool
n1 Bool
nn1 Bool
rd1 Bool
wr1) (TypeQuals Bool
c2 Bool
v2 Bool
r2 Bool
a2 Bool
n2 Bool
nn2 Bool
rd2 Bool
wr2) =
    Bool
c1 forall a. Eq a => a -> a -> Bool
== Bool
c2 Bool -> Bool -> Bool
&& Bool
v1 forall a. Eq a => a -> a -> Bool
== Bool
v2 Bool -> Bool -> Bool
&& Bool
r1 forall a. Eq a => a -> a -> Bool
== Bool
r2 Bool -> Bool -> Bool
&& Bool
a1 forall a. Eq a => a -> a -> Bool
== Bool
a2 Bool -> Bool -> Bool
&& Bool
n1 forall a. Eq a => a -> a -> Bool
== Bool
n2 Bool -> Bool -> Bool
&& Bool
nn1 forall a. Eq a => a -> a -> Bool
== Bool
nn2
    Bool -> Bool -> Bool
&& Bool
rd1 forall a. Eq a => a -> a -> Bool
== Bool
rd2 Bool -> Bool -> Bool
&& Bool
wr1 forall a. Eq a => a -> a -> Bool
== Bool
wr2

instance Ord TypeQuals where
  <= :: TypeQuals -> TypeQuals -> Bool
(<=) (TypeQuals Bool
c1 Bool
v1 Bool
r1 Bool
a1 Bool
n1 Bool
nn1 Bool
rd1 Bool
wr1) (TypeQuals Bool
c2 Bool
v2 Bool
r2 Bool
a2 Bool
n2 Bool
nn2 Bool
rd2 Bool
wr2) =
    Bool
c1 forall a. Ord a => a -> a -> Bool
<= Bool
c2 Bool -> Bool -> Bool
&& Bool
v1 forall a. Ord a => a -> a -> Bool
<= Bool
v2 Bool -> Bool -> Bool
&& Bool
r1 forall a. Ord a => a -> a -> Bool
<= Bool
r2 Bool -> Bool -> Bool
&& Bool
a1 forall a. Ord a => a -> a -> Bool
<= Bool
a2 Bool -> Bool -> Bool
&& Bool
n1 forall a. Ord a => a -> a -> Bool
<= Bool
n2 Bool -> Bool -> Bool
&& Bool
nn1 forall a. Ord a => a -> a -> Bool
<= Bool
nn2
    Bool -> Bool -> Bool
&& Bool
rd1 forall a. Ord a => a -> a -> Bool
<= Bool
rd2 Bool -> Bool -> Bool
&& Bool
wr1 forall a. Ord a => a -> a -> Bool
<= Bool
wr2


-- | no type qualifiers
noTypeQuals :: TypeQuals
noTypeQuals :: TypeQuals
noTypeQuals = Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> TypeQuals
TypeQuals Bool
False Bool
False Bool
False Bool
False Bool
False Bool
False Bool
False Bool
False

-- | merge (/&&/) two type qualifier sets
mergeTypeQuals :: TypeQuals -> TypeQuals -> TypeQuals
mergeTypeQuals :: TypeQuals -> TypeQuals -> TypeQuals
mergeTypeQuals (TypeQuals Bool
c1 Bool
v1 Bool
r1 Bool
a1 Bool
n1 Bool
nn1 Bool
rd1 Bool
wr1) (TypeQuals Bool
c2 Bool
v2 Bool
r2 Bool
a2 Bool
n2 Bool
nn2 Bool
rd2 Bool
wr2) =
  Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> TypeQuals
TypeQuals (Bool
c1 Bool -> Bool -> Bool
&& Bool
c2) (Bool
v1 Bool -> Bool -> Bool
&& Bool
v2) (Bool
r1 Bool -> Bool -> Bool
&& Bool
r2) (Bool
a1 Bool -> Bool -> Bool
&& Bool
a2) (Bool
n1 Bool -> Bool -> Bool
&& Bool
n2) (Bool
nn1 Bool -> Bool -> Bool
&& Bool
nn2)
            (Bool
rd1 Bool -> Bool -> Bool
&& Bool
rd2) (Bool
wr1 Bool -> Bool -> Bool
&& Bool
wr2)

-- * initializers

-- | 'Initializer' is currently an alias for 'CInit'.
--
-- We're planning a normalized representation, but this depends on the implementation of
-- constant expression evaluation
type Initializer = CInit

-- | Normalized C Initializers
-- * If the expression has scalar type, the initializer is an expression
-- * If the expression has struct type, the initializer is a map from designators to initializers
-- * If the expression has array type, the initializer is a list of values
-- Not implemented yet, as it depends on constant expression evaluation


-- * names and attributes

-- | @VarName name assembler-name@ is a name of an declared object
data VarName =  VarName Ident (Maybe AsmName)
              | NoName
               deriving (Typeable, Typeable VarName
VarName -> DataType
VarName -> Constr
(forall b. Data b => b -> b) -> VarName -> VarName
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u
forall u. (forall d. Data d => d -> u) -> VarName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarName -> c VarName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarName)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> VarName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> VarName -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
gmapT :: (forall b. Data b => b -> b) -> VarName -> VarName
$cgmapT :: (forall b. Data b => b -> b) -> VarName -> VarName
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarName)
dataTypeOf :: VarName -> DataType
$cdataTypeOf :: VarName -> DataType
toConstr :: VarName -> Constr
$ctoConstr :: VarName -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarName -> c VarName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarName -> c VarName
Data, Int -> VarName -> ShowS
[VarName] -> ShowS
VarName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VarName] -> ShowS
$cshowList :: [VarName] -> ShowS
show :: VarName -> String
$cshow :: VarName -> String
showsPrec :: Int -> VarName -> ShowS
$cshowsPrec :: Int -> VarName -> ShowS
Show)
identOfVarName :: VarName -> Ident
identOfVarName :: VarName -> Ident
identOfVarName VarName
NoName            = forall a. HasCallStack => String -> a
error String
"identOfVarName: NoName"
identOfVarName (VarName Ident
ident Maybe AsmName
_) = Ident
ident

isNoName :: VarName -> Bool
isNoName :: VarName -> Bool
isNoName VarName
NoName = Bool
True
isNoName VarName
_ = Bool
False

-- | Top level assembler block (alias for @CStrLit@)
type AsmBlock = CStrLit

-- | Assembler name (alias for @CStrLit@)
type AsmName = CStrLit

-- | @__attribute__@ annotations
--
-- Those are of the form @Attr attribute-name attribute-parameters@,
-- and serve as generic properties of some syntax tree elements.
--
-- Some examples:
--
-- * labels can be attributed with /unused/ to indicate that their not used
--
-- * struct definitions can be attributed with /packed/ to tell the compiler to use the most compact representation
--
-- * declarations can be attributed with /deprecated/
--
-- * function declarations can be attributes with /noreturn/ to tell the compiler that the function will never return,
--
-- * or with /const/ to indicate that it is a pure function
--
-- /TODO/: ultimatively, we want to parse attributes and represent them in a typed way
data Attr = Attr Ident [Expr] NodeInfo
            deriving (Typeable, Typeable Attr
Attr -> DataType
Attr -> Constr
(forall b. Data b => b -> b) -> Attr -> Attr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
forall u. (forall d. Data d => d -> u) -> Attr -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
$cgmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
dataTypeOf :: Attr -> DataType
$cdataTypeOf :: Attr -> DataType
toConstr :: Attr -> Constr
$ctoConstr :: Attr -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
Data {-! ,CNode !-}, Int -> Attr -> ShowS
Attributes -> ShowS
Attr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: Attributes -> ShowS
$cshowList :: Attributes -> ShowS
show :: Attr -> String
$cshow :: Attr -> String
showsPrec :: Int -> Attr -> ShowS
$cshowsPrec :: Int -> Attr -> ShowS
Show)

type Attributes = [Attr]

-- |Empty attribute list
noAttributes :: Attributes
noAttributes :: Attributes
noAttributes = []

-- |Merge attribute lists
-- /TODO/: currently does not remove duplicates
mergeAttributes :: Attributes -> Attributes -> Attributes
mergeAttributes :: Attributes -> Attributes -> Attributes
mergeAttributes = forall a. [a] -> [a] -> [a]
(++)

-- * statements and expressions (Type aliases)

-- | 'Stmt' is an alias for 'CStat' (Syntax)
type Stmt = CStat
-- | 'Expr' is currently an alias for 'CExpr' (Syntax)
type Expr = CExpr
-- GENERATED START

instance CNode TagDef where
        nodeInfo :: TagDef -> NodeInfo
nodeInfo (CompDef CompType
d) = forall a. CNode a => a -> NodeInfo
nodeInfo CompType
d
        nodeInfo (EnumDef EnumType
d) = forall a. CNode a => a -> NodeInfo
nodeInfo EnumType
d
instance Pos TagDef where
        posOf :: TagDef -> Position
posOf TagDef
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo TagDef
x)

instance CNode IdentDecl where
        nodeInfo :: IdentDecl -> NodeInfo
nodeInfo (Declaration Decl
d) = forall a. CNode a => a -> NodeInfo
nodeInfo Decl
d
        nodeInfo (ObjectDef ObjDef
d) = forall a. CNode a => a -> NodeInfo
nodeInfo ObjDef
d
        nodeInfo (FunctionDef FunDef
d) = forall a. CNode a => a -> NodeInfo
nodeInfo FunDef
d
        nodeInfo (EnumeratorDef Enumerator
d) = forall a. CNode a => a -> NodeInfo
nodeInfo Enumerator
d
instance Pos IdentDecl where
        posOf :: IdentDecl -> Position
posOf IdentDecl
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo IdentDecl
x)

instance CNode DeclEvent where
        nodeInfo :: DeclEvent -> NodeInfo
nodeInfo (TagEvent TagDef
d) = forall a. CNode a => a -> NodeInfo
nodeInfo TagDef
d
        nodeInfo (DeclEvent IdentDecl
d) = forall a. CNode a => a -> NodeInfo
nodeInfo IdentDecl
d
        nodeInfo (ParamEvent ParamDecl
d) = forall a. CNode a => a -> NodeInfo
nodeInfo ParamDecl
d
        nodeInfo (LocalEvent IdentDecl
d) = forall a. CNode a => a -> NodeInfo
nodeInfo IdentDecl
d
        nodeInfo (TypeDefEvent TypeDef
d) = forall a. CNode a => a -> NodeInfo
nodeInfo TypeDef
d
        nodeInfo (AsmEvent AsmName
d) = forall a. CNode a => a -> NodeInfo
nodeInfo AsmName
d
instance Pos DeclEvent where
        posOf :: DeclEvent -> Position
posOf DeclEvent
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo DeclEvent
x)

instance CNode Decl where
        nodeInfo :: Decl -> NodeInfo
nodeInfo (Decl VarDecl
_ NodeInfo
n) = NodeInfo
n
instance Pos Decl where
        posOf :: Decl -> Position
posOf Decl
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo Decl
x)

instance CNode ObjDef where
        nodeInfo :: ObjDef -> NodeInfo
nodeInfo (ObjDef VarDecl
_ Maybe Initializer
_ NodeInfo
n) = NodeInfo
n
instance Pos ObjDef where
        posOf :: ObjDef -> Position
posOf ObjDef
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo ObjDef
x)

instance CNode FunDef where
        nodeInfo :: FunDef -> NodeInfo
nodeInfo (FunDef VarDecl
_ Stmt
_ NodeInfo
n) = NodeInfo
n
instance Pos FunDef where
        posOf :: FunDef -> Position
posOf FunDef
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo FunDef
x)

instance CNode ParamDecl where
        nodeInfo :: ParamDecl -> NodeInfo
nodeInfo (ParamDecl VarDecl
_ NodeInfo
n) = NodeInfo
n
        nodeInfo (AbstractParamDecl VarDecl
_ NodeInfo
n) = NodeInfo
n
instance Pos ParamDecl where
        posOf :: ParamDecl -> Position
posOf ParamDecl
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo ParamDecl
x)

instance CNode MemberDecl where
        nodeInfo :: MemberDecl -> NodeInfo
nodeInfo (MemberDecl VarDecl
_ Maybe Expr
_ NodeInfo
n) = NodeInfo
n
        nodeInfo (AnonBitField Type
_ Expr
_ NodeInfo
n) = NodeInfo
n
instance Pos MemberDecl where
        posOf :: MemberDecl -> Position
posOf MemberDecl
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo MemberDecl
x)

instance CNode TypeDef where
        nodeInfo :: TypeDef -> NodeInfo
nodeInfo (TypeDef Ident
_ Type
_ Attributes
_ NodeInfo
n) = NodeInfo
n
instance Pos TypeDef where
        posOf :: TypeDef -> Position
posOf TypeDef
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo TypeDef
x)

instance CNode TypeDefRef where
        nodeInfo :: TypeDefRef -> NodeInfo
nodeInfo (TypeDefRef Ident
_ Type
_ NodeInfo
n) = NodeInfo
n
instance Pos TypeDefRef where
        posOf :: TypeDefRef -> Position
posOf TypeDefRef
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo TypeDefRef
x)

instance CNode CompTypeRef where
        nodeInfo :: CompTypeRef -> NodeInfo
nodeInfo (CompTypeRef SUERef
_ CompTyKind
_ NodeInfo
n) = NodeInfo
n
instance Pos CompTypeRef where
        posOf :: CompTypeRef -> Position
posOf CompTypeRef
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo CompTypeRef
x)

instance CNode EnumTypeRef where
        nodeInfo :: EnumTypeRef -> NodeInfo
nodeInfo (EnumTypeRef SUERef
_ NodeInfo
n) = NodeInfo
n
instance Pos EnumTypeRef where
        posOf :: EnumTypeRef -> Position
posOf EnumTypeRef
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo EnumTypeRef
x)

instance CNode CompType where
        nodeInfo :: CompType -> NodeInfo
nodeInfo (CompType SUERef
_ CompTyKind
_ [MemberDecl]
_ Attributes
_ NodeInfo
n) = NodeInfo
n
instance Pos CompType where
        posOf :: CompType -> Position
posOf CompType
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo CompType
x)

instance CNode EnumType where
        nodeInfo :: EnumType -> NodeInfo
nodeInfo (EnumType SUERef
_ [Enumerator]
_ Attributes
_ NodeInfo
n) = NodeInfo
n
instance Pos EnumType where
        posOf :: EnumType -> Position
posOf EnumType
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo EnumType
x)

instance CNode Enumerator where
        nodeInfo :: Enumerator -> NodeInfo
nodeInfo (Enumerator Ident
_ Expr
_ EnumType
_ NodeInfo
n) = NodeInfo
n
instance Pos Enumerator where
        posOf :: Enumerator -> Position
posOf Enumerator
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo Enumerator
x)

instance CNode Attr where
        nodeInfo :: Attr -> NodeInfo
nodeInfo (Attr Ident
_ [Expr]
_ NodeInfo
n) = NodeInfo
n
instance Pos Attr where
        posOf :: Attr -> Position
posOf Attr
x = forall a. Pos a => a -> Position
posOf (forall a. CNode a => a -> NodeInfo
nodeInfo Attr
x)
-- GENERATED STOP