{-# 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
DataType
Constr
Typeable TagDef
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TagDef -> c TagDef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TagDef)
-> (TagDef -> Constr)
-> (TagDef -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> TagDef -> TagDef)
-> (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 u. (forall d. Data d => d -> u) -> TagDef -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TagDef -> m TagDef)
-> Data TagDef
TagDef -> DataType
TagDef -> Constr
(forall b. Data b => b -> b) -> TagDef -> TagDef
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TagDef -> c TagDef
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cEnumDef :: Constr
$cCompDef :: Constr
$tTagDef :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> TagDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u
gmapQ :: (forall d. Data d => d -> u) -> TagDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TagDef -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable TagDef
Data {-! ,CNode !-}, Int -> TagDef -> ShowS
[TagDef] -> ShowS
TagDef -> String
(Int -> TagDef -> ShowS)
-> (TagDef -> String) -> ([TagDef] -> ShowS) -> Show TagDef
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) = CompType -> SUERef
forall a. HasSUERef a => a -> SUERef
sueRef CompType
ct
    sueRef (EnumDef EnumType
et) = EnumType -> SUERef
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 :: n -> Decl
declOfDef n
def = let vd :: VarDecl
vd = n -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl n
def in VarDecl -> NodeInfo -> Decl
Decl VarDecl
vd (n -> NodeInfo
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 :: n -> Ident
declIdent = VarName -> Ident
identOfVarName (VarName -> Ident) -> (n -> VarName) -> n -> Ident
forall b c a. (b -> c) -> (a -> b) -> a -> c
. n -> VarName
forall n. Declaration n => n -> VarName
declName
-- | get the variable name of a @Declaration@
declName ::  (Declaration n) => n -> VarName
declName :: n -> VarName
declName = (\(VarDecl VarName
n DeclAttrs
_ Type
_) -> VarName
n) (VarDecl -> VarName) -> (n -> VarDecl) -> n -> VarName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. n -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl
-- | get the type of a @Declaration@
declType ::  (Declaration n) => n -> Type
declType :: n -> Type
declType = (\(VarDecl VarName
_ DeclAttrs
_ Type
ty) -> Type
ty) (VarDecl -> Type) -> (n -> VarDecl) -> n -> Type
forall b c a. (b -> c) -> (a -> b) -> a -> c
. n -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl
-- | get the declaration attributes of a @Declaration@
declAttrs :: (Declaration n) => n -> DeclAttrs
declAttrs :: n -> DeclAttrs
declAttrs = (\(VarDecl VarName
_ DeclAttrs
specs Type
_) -> DeclAttrs
specs) (VarDecl -> DeclAttrs) -> (n -> VarDecl) -> n -> DeclAttrs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. n -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl

instance (Declaration a, Declaration b) => Declaration (Either a b) where
    getVarDecl :: Either a b -> VarDecl
getVarDecl = (a -> VarDecl) -> (b -> VarDecl) -> Either a b -> VarDecl
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either a -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl b -> VarDecl
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
DataType
Constr
Typeable IdentDecl
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IdentDecl -> c IdentDecl)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IdentDecl)
-> (IdentDecl -> Constr)
-> (IdentDecl -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> IdentDecl -> IdentDecl)
-> (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 u. (forall d. Data d => d -> u) -> IdentDecl -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> IdentDecl -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl)
-> Data IdentDecl
IdentDecl -> DataType
IdentDecl -> Constr
(forall b. Data b => b -> b) -> IdentDecl -> IdentDecl
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IdentDecl -> c IdentDecl
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cEnumeratorDef :: Constr
$cFunctionDef :: Constr
$cObjectDef :: Constr
$cDeclaration :: Constr
$tIdentDecl :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
gmapQ :: (forall d. Data d => d -> u) -> IdentDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IdentDecl -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable IdentDecl
Data {-! ,CNode !-}, Int -> IdentDecl -> ShowS
[IdentDecl] -> ShowS
IdentDecl -> String
(Int -> IdentDecl -> ShowS)
-> (IdentDecl -> String)
-> ([IdentDecl] -> ShowS)
-> Show IdentDecl
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) = Decl -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl Decl
decl
  getVarDecl (ObjectDef ObjDef
def) = ObjDef -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl ObjDef
def
  getVarDecl (FunctionDef FunDef
def) = FunDef -> VarDecl
forall n. Declaration n => n -> VarDecl
getVarDecl FunDef
def
  getVarDecl (EnumeratorDef Enumerator
def) = Enumerator -> VarDecl
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 = (Ident
 -> IdentDecl
 -> (Map Ident Decl,
     (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
 -> (Map Ident Decl,
     (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef)))
-> (Map Ident Decl,
    (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
-> Map Ident IdentDecl
-> (Map Ident Decl,
    (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
forall k a b. (k -> a -> b -> b) -> b -> Map k a -> b
Map.foldrWithKey (if Bool
include_all then Ident
-> IdentDecl
-> (Map Ident Decl,
    (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
-> (Map Ident Decl,
    (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
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 Ident
-> IdentDecl
-> (Map Ident Decl,
    (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
-> (Map Ident Decl,
    (Map Ident Enumerator, Map Ident ObjDef, Map Ident FunDef))
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') (Map Ident Decl
forall k a. Map k a
Map.empty,(Map Ident Enumerator
forall k a. Map k a
Map.empty,Map Ident ObjDef
forall k a. Map k a
Map.empty,Map Ident FunDef
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) = (k -> Decl -> Map k Decl -> Map k Decl
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert k
ident (IdentDecl -> Decl
forall n. (Declaration n, CNode n) => n -> Decl
declOfDef IdentDecl
entry) Map k Decl
decls, k
-> IdentDecl
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
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) = (k -> Decl -> Map k Decl -> Map k Decl
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, k
-> IdentDecl
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
-> (Map k Enumerator, Map k ObjDef, Map k FunDef)
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 -> (k -> Enumerator -> Map k Enumerator -> Map k Enumerator
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,k -> ObjDef -> Map k ObjDef -> Map k ObjDef
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,k -> FunDef -> Map k FunDef -> Map k FunDef
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 Map Ident IdentDecl
forall k a. Map k a
Map.empty Map SUERef TagDef
forall k a. Map k a
Map.empty Map Ident TypeDef
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 :: Map Ident IdentDecl
-> Map SUERef TagDef -> Map Ident TypeDef -> GlobalDecls
GlobalDecls
    {
        gObjs :: Map Ident IdentDecl
gObjs  = (IdentDecl -> Bool) -> Map Ident IdentDecl -> Map Ident IdentDecl
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (DeclEvent -> Bool
decl_filter (DeclEvent -> Bool)
-> (IdentDecl -> DeclEvent) -> IdentDecl -> Bool
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  = (TagDef -> Bool) -> Map SUERef TagDef -> Map SUERef TagDef
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (DeclEvent -> Bool
decl_filter (DeclEvent -> Bool) -> (TagDef -> DeclEvent) -> TagDef -> Bool
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 = (TypeDef -> Bool) -> Map Ident TypeDef -> Map Ident TypeDef
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (DeclEvent -> Bool
decl_filter (DeclEvent -> Bool) -> (TypeDef -> DeclEvent) -> TypeDef -> Bool
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 :: Map Ident IdentDecl
-> Map SUERef TagDef -> Map Ident TypeDef -> GlobalDecls
GlobalDecls
    {
        gObjs :: Map Ident IdentDecl
gObjs  = Map Ident IdentDecl -> Map Ident IdentDecl -> Map Ident IdentDecl
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  = Map SUERef TagDef -> Map SUERef TagDef -> Map SUERef TagDef
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 = Map Ident TypeDef -> Map Ident TypeDef -> Map Ident TypeDef
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
DataType
Constr
Typeable Decl
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Decl -> c Decl)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Decl)
-> (Decl -> Constr)
-> (Decl -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> Decl -> Decl)
-> (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 u. (forall d. Data d => d -> u) -> Decl -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Decl -> m Decl)
-> Data Decl
Decl -> DataType
Decl -> Constr
(forall b. Data b => b -> b) -> Decl -> Decl
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Decl -> c Decl
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cDecl :: Constr
$tDecl :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> Decl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u
gmapQ :: (forall d. Data d => d -> u) -> Decl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Decl -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable Decl
Data {-! ,CNode !-}, Int -> Decl -> ShowS
[Decl] -> ShowS
Decl -> String
(Int -> Decl -> ShowS)
-> (Decl -> String) -> ([Decl] -> ShowS) -> Show Decl
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
DataType
Constr
Typeable ObjDef
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ObjDef -> c ObjDef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ObjDef)
-> (ObjDef -> Constr)
-> (ObjDef -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> ObjDef -> ObjDef)
-> (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 u. (forall d. Data d => d -> u) -> ObjDef -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ObjDef -> m ObjDef)
-> Data ObjDef
ObjDef -> DataType
ObjDef -> Constr
(forall b. Data b => b -> b) -> ObjDef -> ObjDef
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ObjDef -> c ObjDef
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cObjDef :: Constr
$tObjDef :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> ObjDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u
gmapQ :: (forall d. Data d => d -> u) -> ObjDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ObjDef -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable ObjDef
Data {-! ,CNode !-}, Int -> ObjDef -> ShowS
[ObjDef] -> ShowS
ObjDef -> String
(Int -> ObjDef -> ShowS)
-> (ObjDef -> String) -> ([ObjDef] -> ShowS) -> Show ObjDef
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
_) | VarDecl -> Bool
forall n. Declaration n => n -> Bool
isExtDecl VarDecl
decl = Maybe Initializer -> Bool
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
DataType
Constr
Typeable FunDef
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FunDef -> c FunDef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FunDef)
-> (FunDef -> Constr)
-> (FunDef -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> FunDef -> FunDef)
-> (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 u. (forall d. Data d => d -> u) -> FunDef -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FunDef -> m FunDef)
-> Data FunDef
FunDef -> DataType
FunDef -> Constr
(forall b. Data b => b -> b) -> FunDef -> FunDef
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunDef -> c FunDef
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cFunDef :: Constr
$tFunDef :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> FunDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u
gmapQ :: (forall d. Data d => d -> u) -> FunDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunDef -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable FunDef
Data {-! ,CNode !-}, Int -> FunDef -> ShowS
[FunDef] -> ShowS
FunDef -> String
(Int -> FunDef -> ShowS)
-> (FunDef -> String) -> ([FunDef] -> ShowS) -> Show FunDef
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
DataType
Constr
Typeable ParamDecl
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ParamDecl -> c ParamDecl)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ParamDecl)
-> (ParamDecl -> Constr)
-> (ParamDecl -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> ParamDecl -> ParamDecl)
-> (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 u. (forall d. Data d => d -> u) -> ParamDecl -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ParamDecl -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl)
-> Data ParamDecl
ParamDecl -> DataType
ParamDecl -> Constr
(forall b. Data b => b -> b) -> ParamDecl -> ParamDecl
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParamDecl -> c ParamDecl
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cAbstractParamDecl :: Constr
$cParamDecl :: Constr
$tParamDecl :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
gmapQ :: (forall d. Data d => d -> u) -> ParamDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ParamDecl -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable ParamDecl
Data {-! ,CNode !-}, Int -> ParamDecl -> ShowS
[ParamDecl] -> ShowS
ParamDecl -> String
(Int -> ParamDecl -> ShowS)
-> (ParamDecl -> String)
-> ([ParamDecl] -> ShowS)
-> Show ParamDecl
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
DataType
Constr
Typeable MemberDecl
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MemberDecl -> c MemberDecl)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MemberDecl)
-> (MemberDecl -> Constr)
-> (MemberDecl -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> MemberDecl -> MemberDecl)
-> (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 u. (forall d. Data d => d -> u) -> MemberDecl -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> MemberDecl -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl)
-> Data MemberDecl
MemberDecl -> DataType
MemberDecl -> Constr
(forall b. Data b => b -> b) -> MemberDecl -> MemberDecl
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MemberDecl -> c MemberDecl
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cAnonBitField :: Constr
$cMemberDecl :: Constr
$tMemberDecl :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
gmapQ :: (forall d. Data d => d -> u) -> MemberDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> MemberDecl -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable MemberDecl
Data {-! ,CNode !-}, Int -> MemberDecl -> ShowS
[MemberDecl] -> ShowS
MemberDecl -> String
(Int -> MemberDecl -> ShowS)
-> (MemberDecl -> String)
-> ([MemberDecl] -> ShowS)
-> Show MemberDecl
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
DataType
Constr
Typeable TypeDef
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TypeDef -> c TypeDef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TypeDef)
-> (TypeDef -> Constr)
-> (TypeDef -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> TypeDef -> TypeDef)
-> (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 u. (forall d. Data d => d -> u) -> TypeDef -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TypeDef -> m TypeDef)
-> Data TypeDef
TypeDef -> DataType
TypeDef -> Constr
(forall b. Data b => b -> b) -> TypeDef -> TypeDef
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDef -> c TypeDef
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTypeDef :: Constr
$tTypeDef :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> TypeDef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u
gmapQ :: (forall d. Data d => d -> u) -> TypeDef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDef -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable TypeDef
Data {-! ,CNode !-}, Int -> TypeDef -> ShowS
[TypeDef] -> ShowS
TypeDef -> String
(Int -> TypeDef -> ShowS)
-> (TypeDef -> String) -> ([TypeDef] -> ShowS) -> Show TypeDef
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
DataType
Constr
Typeable VarDecl
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> VarDecl -> c VarDecl)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c VarDecl)
-> (VarDecl -> Constr)
-> (VarDecl -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> VarDecl -> VarDecl)
-> (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 u. (forall d. Data d => d -> u) -> VarDecl -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> VarDecl -> m VarDecl)
-> Data VarDecl
VarDecl -> DataType
VarDecl -> Constr
(forall b. Data b => b -> b) -> VarDecl -> VarDecl
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarDecl -> c VarDecl
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cVarDecl :: Constr
$tVarDecl :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> VarDecl -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u
gmapQ :: (forall d. Data d => d -> u) -> VarDecl -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> VarDecl -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable VarDecl
Data, Int -> VarDecl -> ShowS
[VarDecl] -> ShowS
VarDecl -> String
(Int -> VarDecl -> ShowS)
-> (VarDecl -> String) -> ([VarDecl] -> ShowS) -> Show VarDecl
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 = VarDecl -> VarDecl
forall a. a -> a
id

-- @isExtDecl d@ returns true if the declaration has /linkage/
isExtDecl :: (Declaration n) => n -> Bool
isExtDecl :: n -> Bool
isExtDecl = Storage -> Bool
hasLinkage (Storage -> Bool) -> (n -> Storage) -> n -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. n -> Storage
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
DataType
Constr
Typeable DeclAttrs
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DeclAttrs)
-> (DeclAttrs -> Constr)
-> (DeclAttrs -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs)
-> (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 u. (forall d. Data d => d -> u) -> DeclAttrs -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs)
-> Data DeclAttrs
DeclAttrs -> DataType
DeclAttrs -> Constr
(forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cDeclAttrs :: Constr
$tDeclAttrs :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
gmapQ :: (forall d. Data d => d -> u) -> DeclAttrs -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DeclAttrs -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable DeclAttrs
Data, Int -> DeclAttrs -> ShowS
[DeclAttrs] -> ShowS
DeclAttrs -> String
(Int -> DeclAttrs -> ShowS)
-> (DeclAttrs -> String)
-> ([DeclAttrs] -> ShowS)
-> Show DeclAttrs
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 :: d -> Storage
declStorage d
d = case d -> DeclAttrs
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 :: d -> FunctionAttrs
functionAttrs d
d = case d -> DeclAttrs
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
(FunctionAttrs -> FunctionAttrs -> Bool)
-> (FunctionAttrs -> FunctionAttrs -> Bool) -> Eq FunctionAttrs
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
Eq FunctionAttrs
-> (FunctionAttrs -> FunctionAttrs -> Ordering)
-> (FunctionAttrs -> FunctionAttrs -> Bool)
-> (FunctionAttrs -> FunctionAttrs -> Bool)
-> (FunctionAttrs -> FunctionAttrs -> Bool)
-> (FunctionAttrs -> FunctionAttrs -> Bool)
-> (FunctionAttrs -> FunctionAttrs -> FunctionAttrs)
-> (FunctionAttrs -> FunctionAttrs -> FunctionAttrs)
-> Ord 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
$cp1Ord :: Eq FunctionAttrs
Ord, Typeable, Typeable FunctionAttrs
DataType
Constr
Typeable FunctionAttrs
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FunctionAttrs)
-> (FunctionAttrs -> Constr)
-> (FunctionAttrs -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs)
-> (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 u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs)
-> Data FunctionAttrs
FunctionAttrs -> DataType
FunctionAttrs -> Constr
(forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cFunctionAttrs :: Constr
$tFunctionAttrs :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
gmapQ :: (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable FunctionAttrs
Data, Int -> FunctionAttrs -> ShowS
[FunctionAttrs] -> ShowS
FunctionAttrs -> String
(Int -> FunctionAttrs -> ShowS)
-> (FunctionAttrs -> String)
-> ([FunctionAttrs] -> ShowS)
-> Show FunctionAttrs
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 :: Bool -> Bool -> FunctionAttrs
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
DataType
Constr
Typeable Storage
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Storage -> c Storage)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Storage)
-> (Storage -> Constr)
-> (Storage -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> Storage -> Storage)
-> (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 u. (forall d. Data d => d -> u) -> Storage -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Storage -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Storage -> m Storage)
-> Data Storage
Storage -> DataType
Storage -> Constr
(forall b. Data b => b -> b) -> Storage -> Storage
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Storage -> c Storage
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cFunLinkage :: Constr
$cStatic :: Constr
$cAuto :: Constr
$cNoStorage :: Constr
$tStorage :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> Storage -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Storage -> u
gmapQ :: (forall d. Data d => d -> u) -> Storage -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Storage -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable Storage
Data, Int -> Storage -> ShowS
[Storage] -> ShowS
Storage -> String
(Int -> Storage -> ShowS)
-> (Storage -> String) -> ([Storage] -> ShowS) -> Show Storage
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
(Storage -> Storage -> Bool)
-> (Storage -> Storage -> Bool) -> Eq Storage
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
Eq Storage
-> (Storage -> Storage -> Ordering)
-> (Storage -> Storage -> Bool)
-> (Storage -> Storage -> Bool)
-> (Storage -> Storage -> Bool)
-> (Storage -> Storage -> Bool)
-> (Storage -> Storage -> Storage)
-> (Storage -> Storage -> Storage)
-> Ord 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
$cp1Ord :: Eq Storage
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
DataType
Constr
Typeable Linkage
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Linkage -> c Linkage)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Linkage)
-> (Linkage -> Constr)
-> (Linkage -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> Linkage -> Linkage)
-> (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 u. (forall d. Data d => d -> u) -> Linkage -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Linkage -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Linkage -> m Linkage)
-> Data Linkage
Linkage -> DataType
Linkage -> Constr
(forall b. Data b => b -> b) -> Linkage -> Linkage
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Linkage -> c Linkage
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cExternalLinkage :: Constr
$cInternalLinkage :: Constr
$cNoLinkage :: Constr
$tLinkage :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> Linkage -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Linkage -> u
gmapQ :: (forall d. Data d => d -> u) -> Linkage -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Linkage -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable Linkage
Data, Int -> Linkage -> ShowS
[Linkage] -> ShowS
Linkage -> String
(Int -> Linkage -> ShowS)
-> (Linkage -> String) -> ([Linkage] -> ShowS) -> Show Linkage
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
(Linkage -> Linkage -> Bool)
-> (Linkage -> Linkage -> Bool) -> Eq Linkage
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
Eq Linkage
-> (Linkage -> Linkage -> Ordering)
-> (Linkage -> Linkage -> Bool)
-> (Linkage -> Linkage -> Bool)
-> (Linkage -> Linkage -> Bool)
-> (Linkage -> Linkage -> Bool)
-> (Linkage -> Linkage -> Linkage)
-> (Linkage -> Linkage -> Linkage)
-> Ord 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
$cp1Ord :: Eq Linkage
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 :: d -> Linkage
declLinkage d
decl =
    case d -> Storage
forall d. Declaration d => d -> Storage
declStorage d
decl of
        Storage
NoStorage -> Linkage
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
DataType
Constr
Typeable Type
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Type -> c Type)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Type)
-> (Type -> Constr)
-> (Type -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> Type -> Type)
-> (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 u. (forall d. Data d => d -> u) -> Type -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Type -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Type -> m Type)
-> Data Type
Type -> DataType
Type -> Constr
(forall b. Data b => b -> b) -> Type -> Type
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTypeDefType :: Constr
$cFunctionType :: Constr
$cArrayType :: Constr
$cPtrType :: Constr
$cDirectType :: Constr
$tType :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> Type -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Type -> u
gmapQ :: (forall d. Data d => d -> u) -> Type -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Type -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable Type
Data, Int -> Type -> ShowS
[Type] -> ShowS
Type -> String
(Int -> Type -> ShowS)
-> (Type -> String) -> ([Type] -> ShowS) -> Show Type
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
DataType
Constr
Typeable FunType
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FunType -> c FunType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FunType)
-> (FunType -> Constr)
-> (FunType -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> FunType -> FunType)
-> (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 u. (forall d. Data d => d -> u) -> FunType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FunType -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FunType -> m FunType)
-> Data FunType
FunType -> DataType
FunType -> Constr
(forall b. Data b => b -> b) -> FunType -> FunType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunType -> c FunType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cFunTypeIncomplete :: Constr
$cFunType :: Constr
$tFunType :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> FunType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunType -> u
gmapQ :: (forall d. Data d => d -> u) -> FunType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunType -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable FunType
Data, Int -> FunType -> ShowS
[FunType] -> ShowS
FunType -> String
(Int -> FunType -> ShowS)
-> (FunType -> String) -> ([FunType] -> ShowS) -> Show FunType
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
DataType
Constr
Typeable ArraySize
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ArraySize -> c ArraySize)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ArraySize)
-> (ArraySize -> Constr)
-> (ArraySize -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> ArraySize -> ArraySize)
-> (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 u. (forall d. Data d => d -> u) -> ArraySize -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ArraySize -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ArraySize -> m ArraySize)
-> Data ArraySize
ArraySize -> DataType
ArraySize -> Constr
(forall b. Data b => b -> b) -> ArraySize -> ArraySize
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArraySize -> c ArraySize
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cArraySize :: Constr
$cUnknownArraySize :: Constr
$tArraySize :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> ArraySize -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ArraySize -> u
gmapQ :: (forall d. Data d => d -> u) -> ArraySize -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ArraySize -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable ArraySize
Data, Int -> ArraySize -> ShowS
[ArraySize] -> ShowS
ArraySize -> String
(Int -> ArraySize -> ShowS)
-> (ArraySize -> String)
-> ([ArraySize] -> ShowS)
-> Show ArraySize
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
DataType
Constr
Typeable TypeName
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TypeName -> c TypeName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TypeName)
-> (TypeName -> Constr)
-> (TypeName -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> TypeName -> TypeName)
-> (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 u. (forall d. Data d => d -> u) -> TypeName -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TypeName -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TypeName -> m TypeName)
-> Data TypeName
TypeName -> DataType
TypeName -> Constr
(forall b. Data b => b -> b) -> TypeName -> TypeName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeName -> c TypeName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTyBuiltin :: Constr
$cTyEnum :: Constr
$cTyComp :: Constr
$cTyComplex :: Constr
$cTyFloating :: Constr
$cTyIntegral :: Constr
$cTyVoid :: Constr
$tTypeName :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> TypeName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeName -> u
gmapQ :: (forall d. Data d => d -> u) -> TypeName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeName -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable TypeName
Data, Int -> TypeName -> ShowS
[TypeName] -> ShowS
TypeName -> String
(Int -> TypeName -> ShowS)
-> (TypeName -> String) -> ([TypeName] -> ShowS) -> Show TypeName
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
DataType
Constr
Typeable BuiltinType
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> BuiltinType -> c BuiltinType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BuiltinType)
-> (BuiltinType -> Constr)
-> (BuiltinType -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> BuiltinType -> BuiltinType)
-> (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 u. (forall d. Data d => d -> u) -> BuiltinType -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> BuiltinType -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType)
-> Data BuiltinType
BuiltinType -> DataType
BuiltinType -> Constr
(forall b. Data b => b -> b) -> BuiltinType -> BuiltinType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinType -> c BuiltinType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTyAny :: Constr
$cTyVaList :: Constr
$tBuiltinType :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
gmapQ :: (forall d. Data d => d -> u) -> BuiltinType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinType -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable BuiltinType
Data, Int -> BuiltinType -> ShowS
[BuiltinType] -> ShowS
BuiltinType -> String
(Int -> BuiltinType -> ShowS)
-> (BuiltinType -> String)
-> ([BuiltinType] -> ShowS)
-> Show BuiltinType
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
DataType
Constr
Typeable TypeDefRef
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TypeDefRef)
-> (TypeDefRef -> Constr)
-> (TypeDefRef -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef)
-> (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 u. (forall d. Data d => d -> u) -> TypeDefRef -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef)
-> Data TypeDefRef
TypeDefRef -> DataType
TypeDefRef -> Constr
(forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTypeDefRef :: Constr
$tTypeDefRef :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
gmapQ :: (forall d. Data d => d -> u) -> TypeDefRef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDefRef -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable TypeDefRef
Data {-! ,CNode !-}, Int -> TypeDefRef -> ShowS
[TypeDefRef] -> ShowS
TypeDefRef -> String
(Int -> TypeDefRef -> ShowS)
-> (TypeDefRef -> String)
-> ([TypeDefRef] -> ShowS)
-> Show TypeDefRef
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
DataType
Constr
Typeable IntType
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IntType -> c IntType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IntType)
-> (IntType -> Constr)
-> (IntType -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> IntType -> IntType)
-> (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 u. (forall d. Data d => d -> u) -> IntType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IntType -> m IntType)
-> Data IntType
IntType -> DataType
IntType -> Constr
(forall b. Data b => b -> b) -> IntType -> IntType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntType -> c IntType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTyULLong :: Constr
$cTyLLong :: Constr
$cTyULong :: Constr
$cTyLong :: Constr
$cTyUInt128 :: Constr
$cTyInt128 :: Constr
$cTyUInt :: Constr
$cTyInt :: Constr
$cTyUShort :: Constr
$cTyShort :: Constr
$cTyUChar :: Constr
$cTySChar :: Constr
$cTyChar :: Constr
$cTyBool :: Constr
$tIntType :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> IntType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u
gmapQ :: (forall d. Data d => d -> u) -> IntType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IntType -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable IntType
Data, IntType -> IntType -> Bool
(IntType -> IntType -> Bool)
-> (IntType -> IntType -> Bool) -> Eq IntType
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
Eq IntType
-> (IntType -> IntType -> Ordering)
-> (IntType -> IntType -> Bool)
-> (IntType -> IntType -> Bool)
-> (IntType -> IntType -> Bool)
-> (IntType -> IntType -> Bool)
-> (IntType -> IntType -> IntType)
-> (IntType -> IntType -> IntType)
-> Ord 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
$cp1Ord :: Eq IntType
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
DataType
Constr
Typeable FloatType
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FloatType -> c FloatType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FloatType)
-> (FloatType -> Constr)
-> (FloatType -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> FloatType -> FloatType)
-> (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 u. (forall d. Data d => d -> u) -> FloatType -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> FloatType -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FloatType -> m FloatType)
-> Data FloatType
FloatType -> DataType
FloatType -> Constr
(forall b. Data b => b -> b) -> FloatType -> FloatType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FloatType -> c FloatType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTyFloatN :: Constr
$cTyLDouble :: Constr
$cTyDouble :: Constr
$cTyFloat :: Constr
$tFloatType :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> FloatType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FloatType -> u
gmapQ :: (forall d. Data d => d -> u) -> FloatType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FloatType -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable FloatType
Data, FloatType -> FloatType -> Bool
(FloatType -> FloatType -> Bool)
-> (FloatType -> FloatType -> Bool) -> Eq FloatType
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
Eq FloatType
-> (FloatType -> FloatType -> Ordering)
-> (FloatType -> FloatType -> Bool)
-> (FloatType -> FloatType -> Bool)
-> (FloatType -> FloatType -> Bool)
-> (FloatType -> FloatType -> Bool)
-> (FloatType -> FloatType -> FloatType)
-> (FloatType -> FloatType -> FloatType)
-> Ord 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
$cp1Ord :: Eq FloatType
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" String -> ShowS
forall a. [a] -> [a] -> [a]
++ (Int -> String
forall a. Show a => a -> String
show Int
n) String -> ShowS
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
DataType
Constr
Typeable CompTypeRef
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CompTypeRef)
-> (CompTypeRef -> Constr)
-> (CompTypeRef -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef)
-> (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 u. (forall d. Data d => d -> u) -> CompTypeRef -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef)
-> Data CompTypeRef
CompTypeRef -> DataType
CompTypeRef -> Constr
(forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cCompTypeRef :: Constr
$tCompTypeRef :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
gmapQ :: (forall d. Data d => d -> u) -> CompTypeRef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompTypeRef -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable CompTypeRef
Data {-! ,CNode !-}, Int -> CompTypeRef -> ShowS
[CompTypeRef] -> ShowS
CompTypeRef -> String
(Int -> CompTypeRef -> ShowS)
-> (CompTypeRef -> String)
-> ([CompTypeRef] -> ShowS)
-> Show CompTypeRef
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
DataType
Constr
Typeable EnumTypeRef
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EnumTypeRef)
-> (EnumTypeRef -> Constr)
-> (EnumTypeRef -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef)
-> (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 u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef)
-> Data EnumTypeRef
EnumTypeRef -> DataType
EnumTypeRef -> Constr
(forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cEnumTypeRef :: Constr
$tEnumTypeRef :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
gmapQ :: (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable EnumTypeRef
Data {-! ,CNode !-}, Int -> EnumTypeRef -> ShowS
[EnumTypeRef] -> ShowS
EnumTypeRef -> String
(Int -> EnumTypeRef -> ShowS)
-> (EnumTypeRef -> String)
-> ([EnumTypeRef] -> ShowS)
-> Show EnumTypeRef
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
DataType
Constr
Typeable CompType
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CompType -> c CompType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CompType)
-> (CompType -> Constr)
-> (CompType -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> CompType -> CompType)
-> (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 u. (forall d. Data d => d -> u) -> CompType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CompType -> m CompType)
-> Data CompType
CompType -> DataType
CompType -> Constr
(forall b. Data b => b -> b) -> CompType -> CompType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompType -> c CompType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cCompType :: Constr
$tCompType :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> CompType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u
gmapQ :: (forall d. Data d => d -> u) -> CompType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompType -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable CompType
Data {-! ,CNode !-}, Int -> CompType -> ShowS
[CompType] -> ShowS
CompType -> String
(Int -> CompType -> ShowS)
-> (CompType -> String) -> ([CompType] -> ShowS) -> Show CompType
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
(CompTyKind -> CompTyKind -> Bool)
-> (CompTyKind -> CompTyKind -> Bool) -> Eq CompTyKind
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
Eq CompTyKind
-> (CompTyKind -> CompTyKind -> Ordering)
-> (CompTyKind -> CompTyKind -> Bool)
-> (CompTyKind -> CompTyKind -> Bool)
-> (CompTyKind -> CompTyKind -> Bool)
-> (CompTyKind -> CompTyKind -> Bool)
-> (CompTyKind -> CompTyKind -> CompTyKind)
-> (CompTyKind -> CompTyKind -> CompTyKind)
-> Ord 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
$cp1Ord :: Eq CompTyKind
Ord,Typeable,Typeable CompTyKind
DataType
Constr
Typeable CompTyKind
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CompTyKind -> c CompTyKind)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CompTyKind)
-> (CompTyKind -> Constr)
-> (CompTyKind -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> CompTyKind -> CompTyKind)
-> (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 u. (forall d. Data d => d -> u) -> CompTyKind -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CompTyKind -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind)
-> Data CompTyKind
CompTyKind -> DataType
CompTyKind -> Constr
(forall b. Data b => b -> b) -> CompTyKind -> CompTyKind
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTyKind -> c CompTyKind
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cUnionTag :: Constr
$cStructTag :: Constr
$tCompTyKind :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
gmapQ :: (forall d. Data d => d -> u) -> CompTyKind -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompTyKind -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable 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
DataType
Constr
Typeable EnumType
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> EnumType -> c EnumType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EnumType)
-> (EnumType -> Constr)
-> (EnumType -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> EnumType -> EnumType)
-> (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 u. (forall d. Data d => d -> u) -> EnumType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> EnumType -> m EnumType)
-> Data EnumType
EnumType -> DataType
EnumType -> Constr
(forall b. Data b => b -> b) -> EnumType -> EnumType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumType -> c EnumType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cEnumType :: Constr
$tEnumType :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> EnumType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u
gmapQ :: (forall d. Data d => d -> u) -> EnumType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EnumType -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable EnumType
Data {-! ,CNode !-}, Int -> EnumType -> ShowS
[EnumType] -> ShowS
EnumType -> String
(Int -> EnumType -> ShowS)
-> (EnumType -> String) -> ([EnumType] -> ShowS) -> Show EnumType
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
DataType
Constr
Typeable Enumerator
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Enumerator -> c Enumerator)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Enumerator)
-> (Enumerator -> Constr)
-> (Enumerator -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> Enumerator -> Enumerator)
-> (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 u. (forall d. Data d => d -> u) -> Enumerator -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Enumerator -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Enumerator -> m Enumerator)
-> Data Enumerator
Enumerator -> DataType
Enumerator -> Constr
(forall b. Data b => b -> b) -> Enumerator -> Enumerator
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Enumerator -> c Enumerator
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cEnumerator :: Constr
$tEnumerator :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> Enumerator -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Enumerator -> u
gmapQ :: (forall d. Data d => d -> u) -> Enumerator -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Enumerator -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable Enumerator
Data {-! ,CNode !-}, Int -> Enumerator -> ShowS
[Enumerator] -> ShowS
Enumerator -> String
(Int -> Enumerator -> ShowS)
-> (Enumerator -> String)
-> ([Enumerator] -> ShowS)
-> Show Enumerator
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 Maybe AsmName
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
DataType
Constr
Typeable TypeQuals
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TypeQuals -> c TypeQuals)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TypeQuals)
-> (TypeQuals -> Constr)
-> (TypeQuals -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> TypeQuals -> TypeQuals)
-> (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 u. (forall d. Data d => d -> u) -> TypeQuals -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TypeQuals -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals)
-> Data TypeQuals
TypeQuals -> DataType
TypeQuals -> Constr
(forall b. Data b => b -> b) -> TypeQuals -> TypeQuals
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeQuals -> c TypeQuals
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cTypeQuals :: Constr
$tTypeQuals :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
gmapQ :: (forall d. Data d => d -> u) -> TypeQuals -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeQuals -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable TypeQuals
Data, Int -> TypeQuals -> ShowS
[TypeQuals] -> ShowS
TypeQuals -> String
(Int -> TypeQuals -> ShowS)
-> (TypeQuals -> String)
-> ([TypeQuals] -> ShowS)
-> Show TypeQuals
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 Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
c2 Bool -> Bool -> Bool
&& Bool
v1 Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
v2 Bool -> Bool -> Bool
&& Bool
r1 Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
r2 Bool -> Bool -> Bool
&& Bool
a1 Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
a2 Bool -> Bool -> Bool
&& Bool
n1 Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
n2 Bool -> Bool -> Bool
&& Bool
nn1 Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
nn2
    Bool -> Bool -> Bool
&& Bool
rd1 Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
rd2 Bool -> Bool -> Bool
&& Bool
wr1 Bool -> Bool -> Bool
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 Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= Bool
c2 Bool -> Bool -> Bool
&& Bool
v1 Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= Bool
v2 Bool -> Bool -> Bool
&& Bool
r1 Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= Bool
r2 Bool -> Bool -> Bool
&& Bool
a1 Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= Bool
a2 Bool -> Bool -> Bool
&& Bool
n1 Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= Bool
n2 Bool -> Bool -> Bool
&& Bool
nn1 Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= Bool
nn2
    Bool -> Bool -> Bool
&& Bool
rd1 Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= Bool
rd2 Bool -> Bool -> Bool
&& Bool
wr1 Bool -> Bool -> Bool
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
DataType
Constr
Typeable VarName
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> VarName -> c VarName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c VarName)
-> (VarName -> Constr)
-> (VarName -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> VarName -> VarName)
-> (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 u. (forall d. Data d => d -> u) -> VarName -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> VarName -> m VarName)
-> Data VarName
VarName -> DataType
VarName -> Constr
(forall b. Data b => b -> b) -> VarName -> VarName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarName -> c VarName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cNoName :: Constr
$cVarName :: Constr
$tVarName :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> VarName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u
gmapQ :: (forall d. Data d => d -> u) -> VarName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> VarName -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable VarName
Data, Int -> VarName -> ShowS
[VarName] -> ShowS
VarName -> String
(Int -> VarName -> ShowS)
-> (VarName -> String) -> ([VarName] -> ShowS) -> Show VarName
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            = String -> Ident
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
DataType
Constr
Typeable Attr
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Attr -> c Attr)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Attr)
-> (Attr -> Constr)
-> (Attr -> DataType)
-> (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))
-> ((forall b. Data b => b -> b) -> Attr -> Attr)
-> (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 u. (forall d. Data d => d -> u) -> Attr -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u)
-> (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 (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Attr -> m Attr)
-> Data Attr
Attr -> DataType
Attr -> Constr
(forall b. Data b => b -> b) -> Attr -> Attr
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c 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)
$cAttr :: Constr
$tAttr :: DataType
gmapMo :: (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 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 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 :: Int -> (forall d. Data d => d -> u) -> Attr -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
gmapQ :: (forall d. Data d => d -> u) -> Attr -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
gmapQr :: (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 :: (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 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 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 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 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
$cp1Data :: Typeable Attr
Data {-! ,CNode !-}, Int -> Attr -> ShowS
Attributes -> ShowS
Attr -> String
(Int -> Attr -> ShowS)
-> (Attr -> String) -> (Attributes -> ShowS) -> Show Attr
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 = Attributes -> Attributes -> Attributes
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) = CompType -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo CompType
d
        nodeInfo (EnumDef EnumType
d) = EnumType -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo EnumType
d
instance Pos TagDef where
        posOf :: TagDef -> Position
posOf TagDef
x = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (TagDef -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo TagDef
x)

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

instance CNode DeclEvent where
        nodeInfo :: DeclEvent -> NodeInfo
nodeInfo (TagEvent TagDef
d) = TagDef -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo TagDef
d
        nodeInfo (DeclEvent IdentDecl
d) = IdentDecl -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo IdentDecl
d
        nodeInfo (ParamEvent ParamDecl
d) = ParamDecl -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo ParamDecl
d
        nodeInfo (LocalEvent IdentDecl
d) = IdentDecl -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo IdentDecl
d
        nodeInfo (TypeDefEvent TypeDef
d) = TypeDef -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo TypeDef
d
        nodeInfo (AsmEvent AsmName
d) = AsmName -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo AsmName
d
instance Pos DeclEvent where
        posOf :: DeclEvent -> Position
posOf DeclEvent
x = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (DeclEvent -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (Decl -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (ObjDef -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (FunDef -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (ParamDecl -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (MemberDecl -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (TypeDef -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (TypeDefRef -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (CompTypeRef -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (EnumTypeRef -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (CompType -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (EnumType -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (Enumerator -> NodeInfo
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 = NodeInfo -> Position
forall a. Pos a => a -> Position
posOf (Attr -> NodeInfo
forall a. CNode a => a -> NodeInfo
nodeInfo Attr
x)
-- GENERATED STOP