{-# 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
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 -> Constr
TagDef -> DataType
(forall b. Data b => b -> b) -> TagDef -> TagDef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u
forall u. (forall d. Data d => d -> u) -> TagDef -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TagDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TagDef -> c TagDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TagDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TagDef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TagDef -> c TagDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TagDef -> c TagDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TagDef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TagDef
$ctoConstr :: TagDef -> Constr
toConstr :: TagDef -> Constr
$cdataTypeOf :: TagDef -> DataType
dataTypeOf :: TagDef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TagDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TagDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TagDef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TagDef)
$cgmapT :: (forall b. Data b => b -> b) -> TagDef -> TagDef
gmapT :: (forall b. Data b => b -> b) -> TagDef -> TagDef
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TagDef -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TagDef -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TagDef -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TagDef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m TagDef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TagDef -> m 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
$cshowsPrec :: Int -> TagDef -> ShowS
showsPrec :: Int -> TagDef -> ShowS
$cshow :: TagDef -> String
show :: TagDef -> String
$cshowList :: [TagDef] -> ShowS
showList :: [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 :: forall n. (Declaration n, CNode n) => 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 :: forall n. Declaration n => 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 :: forall n. Declaration n => 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 :: forall n. Declaration n => 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 :: forall n. Declaration n => 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
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 -> Constr
IdentDecl -> DataType
(forall b. Data b => b -> b) -> IdentDecl -> IdentDecl
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
forall u. (forall d. Data d => d -> u) -> IdentDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IdentDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IdentDecl -> c IdentDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IdentDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdentDecl)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IdentDecl -> c IdentDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IdentDecl -> c IdentDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IdentDecl
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IdentDecl
$ctoConstr :: IdentDecl -> Constr
toConstr :: IdentDecl -> Constr
$cdataTypeOf :: IdentDecl -> DataType
dataTypeOf :: IdentDecl -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IdentDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IdentDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdentDecl)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdentDecl)
$cgmapT :: (forall b. Data b => b -> b) -> IdentDecl -> IdentDecl
gmapT :: (forall b. Data b => b -> b) -> IdentDecl -> IdentDecl
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IdentDecl -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IdentDecl -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> IdentDecl -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IdentDecl -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m IdentDecl
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IdentDecl -> m 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
$cshowsPrec :: Int -> IdentDecl -> ShowS
showsPrec :: Int -> IdentDecl -> ShowS
$cshow :: IdentDecl -> String
show :: IdentDecl -> String
$cshowList :: [IdentDecl] -> ShowS
showList :: [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
    {
        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
    {
        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
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 -> Constr
Decl -> DataType
(forall b. Data b => b -> b) -> Decl -> Decl
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u
forall u. (forall d. Data d => d -> u) -> Decl -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Decl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Decl -> c Decl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Decl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Decl)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Decl -> c Decl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Decl -> c Decl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Decl
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Decl
$ctoConstr :: Decl -> Constr
toConstr :: Decl -> Constr
$cdataTypeOf :: Decl -> DataType
dataTypeOf :: Decl -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Decl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Decl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Decl)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Decl)
$cgmapT :: (forall b. Data b => b -> b) -> Decl -> Decl
gmapT :: (forall b. Data b => b -> b) -> Decl -> Decl
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Decl -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Decl -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Decl -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Decl -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m Decl
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Decl -> m 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
$cshowsPrec :: Int -> Decl -> ShowS
showsPrec :: Int -> Decl -> ShowS
$cshow :: Decl -> String
show :: Decl -> String
$cshowList :: [Decl] -> ShowS
showList :: [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
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 -> Constr
ObjDef -> DataType
(forall b. Data b => b -> b) -> ObjDef -> ObjDef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u
forall u. (forall d. Data d => d -> u) -> ObjDef -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ObjDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ObjDef -> c ObjDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ObjDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ObjDef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ObjDef -> c ObjDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ObjDef -> c ObjDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ObjDef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ObjDef
$ctoConstr :: ObjDef -> Constr
toConstr :: ObjDef -> Constr
$cdataTypeOf :: ObjDef -> DataType
dataTypeOf :: ObjDef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ObjDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ObjDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ObjDef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ObjDef)
$cgmapT :: (forall b. Data b => b -> b) -> ObjDef -> ObjDef
gmapT :: (forall b. Data b => b -> b) -> ObjDef -> ObjDef
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ObjDef -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ObjDef -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ObjDef -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ObjDef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m ObjDef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ObjDef -> m 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
$cshowsPrec :: Int -> ObjDef -> ShowS
showsPrec :: Int -> ObjDef -> ShowS
$cshow :: ObjDef -> String
show :: ObjDef -> String
$cshowList :: [ObjDef] -> ShowS
showList :: [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
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 -> Constr
FunDef -> DataType
(forall b. Data b => b -> b) -> FunDef -> FunDef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u
forall u. (forall d. Data d => d -> u) -> FunDef -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunDef -> c FunDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunDef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunDef -> c FunDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunDef -> c FunDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunDef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunDef
$ctoConstr :: FunDef -> Constr
toConstr :: FunDef -> Constr
$cdataTypeOf :: FunDef -> DataType
dataTypeOf :: FunDef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunDef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunDef)
$cgmapT :: (forall b. Data b => b -> b) -> FunDef -> FunDef
gmapT :: (forall b. Data b => b -> b) -> FunDef -> FunDef
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunDef -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunDef -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> FunDef -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunDef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m FunDef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunDef -> m 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
$cshowsPrec :: Int -> FunDef -> ShowS
showsPrec :: Int -> FunDef -> ShowS
$cshow :: FunDef -> String
show :: FunDef -> String
$cshowList :: [FunDef] -> ShowS
showList :: [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
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 -> Constr
ParamDecl -> DataType
(forall b. Data b => b -> b) -> ParamDecl -> ParamDecl
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
forall u. (forall d. Data d => d -> u) -> ParamDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParamDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParamDecl -> c ParamDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParamDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParamDecl)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParamDecl -> c ParamDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParamDecl -> c ParamDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParamDecl
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParamDecl
$ctoConstr :: ParamDecl -> Constr
toConstr :: ParamDecl -> Constr
$cdataTypeOf :: ParamDecl -> DataType
dataTypeOf :: ParamDecl -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParamDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParamDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParamDecl)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParamDecl)
$cgmapT :: (forall b. Data b => b -> b) -> ParamDecl -> ParamDecl
gmapT :: (forall b. Data b => b -> b) -> ParamDecl -> ParamDecl
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParamDecl -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ParamDecl -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ParamDecl -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ParamDecl -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m ParamDecl
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParamDecl -> m 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
$cshowsPrec :: Int -> ParamDecl -> ShowS
showsPrec :: Int -> ParamDecl -> ShowS
$cshow :: ParamDecl -> String
show :: ParamDecl -> String
$cshowList :: [ParamDecl] -> ShowS
showList :: [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
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 -> Constr
MemberDecl -> DataType
(forall b. Data b => b -> b) -> MemberDecl -> MemberDecl
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
forall u. (forall d. Data d => d -> u) -> MemberDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MemberDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MemberDecl -> c MemberDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MemberDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MemberDecl)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MemberDecl -> c MemberDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MemberDecl -> c MemberDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MemberDecl
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MemberDecl
$ctoConstr :: MemberDecl -> Constr
toConstr :: MemberDecl -> Constr
$cdataTypeOf :: MemberDecl -> DataType
dataTypeOf :: MemberDecl -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MemberDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MemberDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MemberDecl)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MemberDecl)
$cgmapT :: (forall b. Data b => b -> b) -> MemberDecl -> MemberDecl
gmapT :: (forall b. Data b => b -> b) -> MemberDecl -> MemberDecl
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MemberDecl -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> MemberDecl -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> MemberDecl -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MemberDecl -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m MemberDecl
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> MemberDecl -> m 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
$cshowsPrec :: Int -> MemberDecl -> ShowS
showsPrec :: Int -> MemberDecl -> ShowS
$cshow :: MemberDecl -> String
show :: MemberDecl -> String
$cshowList :: [MemberDecl] -> ShowS
showList :: [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
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 -> Constr
TypeDef -> DataType
(forall b. Data b => b -> b) -> TypeDef -> TypeDef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u
forall u. (forall d. Data d => d -> u) -> TypeDef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDef -> c TypeDef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDef -> c TypeDef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDef -> c TypeDef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDef
$ctoConstr :: TypeDef -> Constr
toConstr :: TypeDef -> Constr
$cdataTypeOf :: TypeDef -> DataType
dataTypeOf :: TypeDef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDef)
$cgmapT :: (forall b. Data b => b -> b) -> TypeDef -> TypeDef
gmapT :: (forall b. Data b => b -> b) -> TypeDef -> TypeDef
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDef -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDef -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDef -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m TypeDef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDef -> m 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
$cshowsPrec :: Int -> TypeDef -> ShowS
showsPrec :: Int -> TypeDef -> ShowS
$cshow :: TypeDef -> String
show :: TypeDef -> String
$cshowList :: [TypeDef] -> ShowS
showList :: [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
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 -> Constr
VarDecl -> DataType
(forall b. Data b => b -> b) -> VarDecl -> VarDecl
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u
forall u. (forall d. Data d => d -> u) -> VarDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarDecl -> c VarDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarDecl)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarDecl -> c VarDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarDecl -> c VarDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarDecl
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarDecl
$ctoConstr :: VarDecl -> Constr
toConstr :: VarDecl -> Constr
$cdataTypeOf :: VarDecl -> DataType
dataTypeOf :: VarDecl -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarDecl)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarDecl)
$cgmapT :: (forall b. Data b => b -> b) -> VarDecl -> VarDecl
gmapT :: (forall b. Data b => b -> b) -> VarDecl -> VarDecl
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarDecl -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> VarDecl -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> VarDecl -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarDecl -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m VarDecl
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarDecl -> m 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
$cshowsPrec :: Int -> VarDecl -> ShowS
showsPrec :: Int -> VarDecl -> ShowS
$cshow :: VarDecl -> String
show :: VarDecl -> String
$cshowList :: [VarDecl] -> ShowS
showList :: [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 :: forall n. Declaration n => 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
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 -> Constr
DeclAttrs -> DataType
(forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
forall u. (forall d. Data d => d -> u) -> DeclAttrs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DeclAttrs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DeclAttrs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DeclAttrs)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DeclAttrs -> c DeclAttrs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DeclAttrs
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DeclAttrs
$ctoConstr :: DeclAttrs -> Constr
toConstr :: DeclAttrs -> Constr
$cdataTypeOf :: DeclAttrs -> DataType
dataTypeOf :: DeclAttrs -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DeclAttrs)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DeclAttrs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DeclAttrs)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DeclAttrs)
$cgmapT :: (forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs
gmapT :: (forall b. Data b => b -> b) -> DeclAttrs -> DeclAttrs
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DeclAttrs -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DeclAttrs -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> DeclAttrs -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DeclAttrs -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m DeclAttrs
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DeclAttrs -> m 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
$cshowsPrec :: Int -> DeclAttrs -> ShowS
showsPrec :: Int -> DeclAttrs -> ShowS
$cshow :: DeclAttrs -> String
show :: DeclAttrs -> String
$cshowList :: [DeclAttrs] -> ShowS
showList :: [DeclAttrs] -> ShowS
Show)

-- | get the 'Storage' of a declaration
declStorage :: (Declaration d) => d -> Storage
declStorage :: forall d. Declaration d => d -> Storage
declStorage d
d = case 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 :: forall d. Declaration d => 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
$c== :: FunctionAttrs -> FunctionAttrs -> Bool
== :: FunctionAttrs -> FunctionAttrs -> Bool
$c/= :: FunctionAttrs -> FunctionAttrs -> Bool
/= :: 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
$ccompare :: FunctionAttrs -> FunctionAttrs -> Ordering
compare :: FunctionAttrs -> FunctionAttrs -> Ordering
$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
>= :: FunctionAttrs -> FunctionAttrs -> Bool
$cmax :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
max :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
$cmin :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
min :: FunctionAttrs -> FunctionAttrs -> FunctionAttrs
Ord, Typeable, Typeable FunctionAttrs
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 -> Constr
FunctionAttrs -> DataType
(forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
forall u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAttrs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAttrs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAttrs)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAttrs -> c FunctionAttrs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAttrs
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAttrs
$ctoConstr :: FunctionAttrs -> Constr
toConstr :: FunctionAttrs -> Constr
$cdataTypeOf :: FunctionAttrs -> DataType
dataTypeOf :: FunctionAttrs -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAttrs)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAttrs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAttrs)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAttrs)
$cgmapT :: (forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs
gmapT :: (forall b. Data b => b -> b) -> FunctionAttrs -> FunctionAttrs
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAttrs -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionAttrs -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionAttrs -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m FunctionAttrs
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAttrs -> m 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
$cshowsPrec :: Int -> FunctionAttrs -> ShowS
showsPrec :: Int -> FunctionAttrs -> ShowS
$cshow :: FunctionAttrs -> String
show :: FunctionAttrs -> String
$cshowList :: [FunctionAttrs] -> ShowS
showList :: [FunctionAttrs] -> ShowS
Show)

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


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

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

-- | Builtin type (va_list, anything)
data BuiltinType = TyVaList
                 | TyAny
                   deriving (Typeable, Typeable BuiltinType
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 -> Constr
BuiltinType -> DataType
(forall b. Data b => b -> b) -> BuiltinType -> BuiltinType
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
forall u. (forall d. Data d => d -> u) -> BuiltinType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinType -> c BuiltinType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinType -> c BuiltinType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BuiltinType -> c BuiltinType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BuiltinType
$ctoConstr :: BuiltinType -> Constr
toConstr :: BuiltinType -> Constr
$cdataTypeOf :: BuiltinType -> DataType
dataTypeOf :: BuiltinType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BuiltinType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c BuiltinType)
$cgmapT :: (forall b. Data b => b -> b) -> BuiltinType -> BuiltinType
gmapT :: (forall b. Data b => b -> b) -> BuiltinType -> BuiltinType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BuiltinType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> BuiltinType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BuiltinType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m BuiltinType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BuiltinType -> m 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
$cshowsPrec :: Int -> BuiltinType -> ShowS
showsPrec :: Int -> BuiltinType -> ShowS
$cshow :: BuiltinType -> String
show :: BuiltinType -> String
$cshowList :: [BuiltinType] -> ShowS
showList :: [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
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 -> Constr
TypeDefRef -> DataType
(forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
forall u. (forall d. Data d => d -> u) -> TypeDefRef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDefRef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDefRef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDefRef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeDefRef -> c TypeDefRef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDefRef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeDefRef
$ctoConstr :: TypeDefRef -> Constr
toConstr :: TypeDefRef -> Constr
$cdataTypeOf :: TypeDefRef -> DataType
dataTypeOf :: TypeDefRef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDefRef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeDefRef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDefRef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDefRef)
$cgmapT :: (forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef
gmapT :: (forall b. Data b => b -> b) -> TypeDefRef -> TypeDefRef
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeDefRef -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDefRef -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypeDefRef -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeDefRef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m TypeDefRef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeDefRef -> m 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
$cshowsPrec :: Int -> TypeDefRef -> ShowS
showsPrec :: Int -> TypeDefRef -> ShowS
$cshow :: TypeDefRef -> String
show :: TypeDefRef -> String
$cshowList :: [TypeDefRef] -> ShowS
showList :: [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
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 -> Constr
IntType -> DataType
(forall b. Data b => b -> b) -> IntType -> IntType
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u
forall u. (forall d. Data d => d -> u) -> IntType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntType -> c IntType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntType -> c IntType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntType -> c IntType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntType
$ctoConstr :: IntType -> Constr
toConstr :: IntType -> Constr
$cdataTypeOf :: IntType -> DataType
dataTypeOf :: IntType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntType)
$cgmapT :: (forall b. Data b => b -> b) -> IntType -> IntType
gmapT :: (forall b. Data b => b -> b) -> IntType -> IntType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IntType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> IntType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IntType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntType -> m IntType
Data, IntType -> IntType -> Bool
(IntType -> IntType -> Bool)
-> (IntType -> IntType -> Bool) -> Eq IntType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IntType -> IntType -> Bool
== :: IntType -> IntType -> Bool
$c/= :: IntType -> IntType -> Bool
/= :: 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
$ccompare :: IntType -> IntType -> Ordering
compare :: IntType -> IntType -> Ordering
$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
>= :: IntType -> IntType -> Bool
$cmax :: IntType -> IntType -> IntType
max :: IntType -> IntType -> IntType
$cmin :: IntType -> IntType -> IntType
min :: IntType -> IntType -> 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
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 -> Constr
FloatType -> DataType
(forall b. Data b => b -> b) -> FloatType -> FloatType
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FloatType -> u
forall u. (forall d. Data d => d -> u) -> FloatType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FloatType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FloatType -> c FloatType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FloatType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FloatType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FloatType -> c FloatType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FloatType -> c FloatType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FloatType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FloatType
$ctoConstr :: FloatType -> Constr
toConstr :: FloatType -> Constr
$cdataTypeOf :: FloatType -> DataType
dataTypeOf :: FloatType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FloatType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FloatType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FloatType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FloatType)
$cgmapT :: (forall b. Data b => b -> b) -> FloatType -> FloatType
gmapT :: (forall b. Data b => b -> b) -> FloatType -> FloatType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FloatType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FloatType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> FloatType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FloatType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FloatType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FloatType -> m FloatType
Data, FloatType -> FloatType -> Bool
(FloatType -> FloatType -> Bool)
-> (FloatType -> FloatType -> Bool) -> Eq FloatType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FloatType -> FloatType -> Bool
== :: FloatType -> FloatType -> Bool
$c/= :: FloatType -> FloatType -> Bool
/= :: 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
$ccompare :: FloatType -> FloatType -> Ordering
compare :: FloatType -> FloatType -> Ordering
$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
>= :: FloatType -> FloatType -> Bool
$cmax :: FloatType -> FloatType -> FloatType
max :: FloatType -> FloatType -> FloatType
$cmin :: FloatType -> FloatType -> FloatType
min :: FloatType -> FloatType -> 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
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 -> Constr
CompTypeRef -> DataType
(forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
forall u. (forall d. Data d => d -> u) -> CompTypeRef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTypeRef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTypeRef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CompTypeRef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTypeRef -> c CompTypeRef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTypeRef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTypeRef
$ctoConstr :: CompTypeRef -> Constr
toConstr :: CompTypeRef -> Constr
$cdataTypeOf :: CompTypeRef -> DataType
dataTypeOf :: CompTypeRef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTypeRef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTypeRef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CompTypeRef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CompTypeRef)
$cgmapT :: (forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef
gmapT :: (forall b. Data b => b -> b) -> CompTypeRef -> CompTypeRef
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTypeRef -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompTypeRef -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CompTypeRef -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTypeRef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m CompTypeRef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTypeRef -> m 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
$cshowsPrec :: Int -> CompTypeRef -> ShowS
showsPrec :: Int -> CompTypeRef -> ShowS
$cshow :: CompTypeRef -> String
show :: CompTypeRef -> String
$cshowList :: [CompTypeRef] -> ShowS
showList :: [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
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 -> Constr
EnumTypeRef -> DataType
(forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
forall u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumTypeRef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumTypeRef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumTypeRef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumTypeRef -> c EnumTypeRef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumTypeRef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumTypeRef
$ctoConstr :: EnumTypeRef -> Constr
toConstr :: EnumTypeRef -> Constr
$cdataTypeOf :: EnumTypeRef -> DataType
dataTypeOf :: EnumTypeRef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumTypeRef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumTypeRef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumTypeRef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EnumTypeRef)
$cgmapT :: (forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef
gmapT :: (forall b. Data b => b -> b) -> EnumTypeRef -> EnumTypeRef
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumTypeRef -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> EnumTypeRef -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumTypeRef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m EnumTypeRef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumTypeRef -> m 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
$cshowsPrec :: Int -> EnumTypeRef -> ShowS
showsPrec :: Int -> EnumTypeRef -> ShowS
$cshow :: EnumTypeRef -> String
show :: EnumTypeRef -> String
$cshowList :: [EnumTypeRef] -> ShowS
showList :: [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
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 -> Constr
CompType -> DataType
(forall b. Data b => b -> b) -> CompType -> CompType
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u
forall u. (forall d. Data d => d -> u) -> CompType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompType -> c CompType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompType -> c CompType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompType -> c CompType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompType
$ctoConstr :: CompType -> Constr
toConstr :: CompType -> Constr
$cdataTypeOf :: CompType -> DataType
dataTypeOf :: CompType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompType)
$cgmapT :: (forall b. Data b => b -> b) -> CompType -> CompType
gmapT :: (forall b. Data b => b -> b) -> CompType -> CompType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CompType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m CompType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompType -> m 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
$cshowsPrec :: Int -> CompType -> ShowS
showsPrec :: Int -> CompType -> ShowS
$cshow :: CompType -> String
show :: CompType -> String
$cshowList :: [CompType] -> ShowS
showList :: [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
$c== :: CompTyKind -> CompTyKind -> Bool
== :: CompTyKind -> CompTyKind -> Bool
$c/= :: CompTyKind -> CompTyKind -> Bool
/= :: 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
$ccompare :: CompTyKind -> CompTyKind -> Ordering
compare :: CompTyKind -> CompTyKind -> Ordering
$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
>= :: CompTyKind -> CompTyKind -> Bool
$cmax :: CompTyKind -> CompTyKind -> CompTyKind
max :: CompTyKind -> CompTyKind -> CompTyKind
$cmin :: CompTyKind -> CompTyKind -> CompTyKind
min :: CompTyKind -> CompTyKind -> CompTyKind
Ord,Typeable,Typeable CompTyKind
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 -> Constr
CompTyKind -> DataType
(forall b. Data b => b -> b) -> CompTyKind -> CompTyKind
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
forall u. (forall d. Data d => d -> u) -> CompTyKind -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTyKind
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTyKind -> c CompTyKind
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTyKind)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompTyKind)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTyKind -> c CompTyKind
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompTyKind -> c CompTyKind
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTyKind
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompTyKind
$ctoConstr :: CompTyKind -> Constr
toConstr :: CompTyKind -> Constr
$cdataTypeOf :: CompTyKind -> DataType
dataTypeOf :: CompTyKind -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTyKind)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompTyKind)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompTyKind)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompTyKind)
$cgmapT :: (forall b. Data b => b -> b) -> CompTyKind -> CompTyKind
gmapT :: (forall b. Data b => b -> b) -> CompTyKind -> CompTyKind
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompTyKind -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompTyKind -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CompTyKind -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompTyKind -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m CompTyKind
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompTyKind -> m 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
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 -> Constr
EnumType -> DataType
(forall b. Data b => b -> b) -> EnumType -> EnumType
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u
forall u. (forall d. Data d => d -> u) -> EnumType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumType -> c EnumType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumType)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumType -> c EnumType
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EnumType -> c EnumType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumType
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EnumType
$ctoConstr :: EnumType -> Constr
toConstr :: EnumType -> Constr
$cdataTypeOf :: EnumType -> DataType
dataTypeOf :: EnumType -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumType)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EnumType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumType)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumType)
$cgmapT :: (forall b. Data b => b -> b) -> EnumType -> EnumType
gmapT :: (forall b. Data b => b -> b) -> EnumType -> EnumType
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EnumType -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EnumType -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> EnumType -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> EnumType -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m EnumType
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> EnumType -> m 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
$cshowsPrec :: Int -> EnumType -> ShowS
showsPrec :: Int -> EnumType -> ShowS
$cshow :: EnumType -> String
show :: EnumType -> String
$cshowList :: [EnumType] -> ShowS
showList :: [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
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 -> Constr
Enumerator -> DataType
(forall b. Data b => b -> b) -> Enumerator -> Enumerator
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Enumerator -> u
forall u. (forall d. Data d => d -> u) -> Enumerator -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Enumerator
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Enumerator -> c Enumerator
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Enumerator)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Enumerator)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Enumerator -> c Enumerator
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Enumerator -> c Enumerator
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Enumerator
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Enumerator
$ctoConstr :: Enumerator -> Constr
toConstr :: Enumerator -> Constr
$cdataTypeOf :: Enumerator -> DataType
dataTypeOf :: Enumerator -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Enumerator)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Enumerator)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Enumerator)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Enumerator)
$cgmapT :: (forall b. Data b => b -> b) -> Enumerator -> Enumerator
gmapT :: (forall b. Data b => b -> b) -> Enumerator -> Enumerator
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Enumerator -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Enumerator -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Enumerator -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Enumerator -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Enumerator -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m Enumerator
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Enumerator -> m 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
$cshowsPrec :: Int -> Enumerator -> ShowS
showsPrec :: Int -> Enumerator -> ShowS
$cshow :: Enumerator -> String
show :: Enumerator -> String
$cshowList :: [Enumerator] -> ShowS
showList :: [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
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 -> Constr
TypeQuals -> DataType
(forall b. Data b => b -> b) -> TypeQuals -> TypeQuals
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
forall u. (forall d. Data d => d -> u) -> TypeQuals -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeQuals
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeQuals -> c TypeQuals
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeQuals)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeQuals)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeQuals -> c TypeQuals
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeQuals -> c TypeQuals
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeQuals
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeQuals
$ctoConstr :: TypeQuals -> Constr
toConstr :: TypeQuals -> Constr
$cdataTypeOf :: TypeQuals -> DataType
dataTypeOf :: TypeQuals -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeQuals)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeQuals)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeQuals)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeQuals)
$cgmapT :: (forall b. Data b => b -> b) -> TypeQuals -> TypeQuals
gmapT :: (forall b. Data b => b -> b) -> TypeQuals -> TypeQuals
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeQuals -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeQuals -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TypeQuals -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeQuals -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m TypeQuals
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeQuals -> m 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
$cshowsPrec :: Int -> TypeQuals -> ShowS
showsPrec :: Int -> TypeQuals -> ShowS
$cshow :: TypeQuals -> String
show :: TypeQuals -> String
$cshowList :: [TypeQuals] -> ShowS
showList :: [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
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 -> Constr
VarName -> DataType
(forall b. Data b => b -> b) -> VarName -> VarName
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u
forall u. (forall d. Data d => d -> u) -> VarName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarName -> c VarName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarName)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarName -> c VarName
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> VarName -> c VarName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarName
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VarName
$ctoConstr :: VarName -> Constr
toConstr :: VarName -> Constr
$cdataTypeOf :: VarName -> DataType
dataTypeOf :: VarName -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarName)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VarName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarName)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VarName)
$cgmapT :: (forall b. Data b => b -> b) -> VarName -> VarName
gmapT :: (forall b. Data b => b -> b) -> VarName -> VarName
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VarName -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> VarName -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> VarName -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> VarName -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m VarName
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> VarName -> m 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
$cshowsPrec :: Int -> VarName -> ShowS
showsPrec :: Int -> VarName -> ShowS
$cshow :: VarName -> String
show :: VarName -> String
$cshowList :: [VarName] -> ShowS
showList :: [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
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 -> Constr
Attr -> DataType
(forall b. Data b => b -> b) -> Attr -> Attr
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
forall u. (forall d. Data d => d -> u) -> Attr -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
$ctoConstr :: Attr -> Constr
toConstr :: Attr -> Constr
$cdataTypeOf :: Attr -> DataType
dataTypeOf :: Attr -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
$cgmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
gmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m 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
$cshowsPrec :: Int -> Attr -> ShowS
showsPrec :: Int -> Attr -> ShowS
$cshow :: Attr -> String
show :: Attr -> String
$cshowList :: Attributes -> ShowS
showList :: Attributes -> 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