{-# LANGUAGE
RecordWildCards,
DeriveFunctor
#-}
module Data.XCB.Types
( XHeader
, XDecl
, StructElem
, XEnumElem
, BitCase
, XidUnionElem
, XReply
, XExpression
, GenXHeader ( .. )
, GenXDecl ( .. )
, GenStructElem ( .. )
, GenBitCase ( .. )
, GenXReply ( .. )
, GenXidUnionElem ( .. )
, EnumElem ( .. )
, Expression ( .. )
, Binop ( .. )
, Unop ( .. )
, Type ( .. )
, EnumVals
, MaskVals
, Name
, Ref
, MaskName
, ListName
, MaskPadding
, Alignment ( .. )
, AllowedEvent ( .. )
, PadType ( .. )
) where
import Data.Map
data typ =
{ :: Name
, :: Maybe Name
, :: Maybe Name
, :: Maybe Bool
, :: Maybe Int
, :: Maybe Int
, :: [GenXDecl typ]
}
deriving (Int -> GenXHeader typ -> ShowS
forall typ. Show typ => Int -> GenXHeader typ -> ShowS
forall typ. Show typ => [GenXHeader typ] -> ShowS
forall typ. Show typ => GenXHeader typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [GenXHeader typ] -> ShowS
$cshowList :: forall typ. Show typ => [GenXHeader typ] -> ShowS
show :: GenXHeader typ -> Name
$cshow :: forall typ. Show typ => GenXHeader typ -> Name
showsPrec :: Int -> GenXHeader typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> GenXHeader typ -> ShowS
Show, forall a b. a -> GenXHeader b -> GenXHeader a
forall a b. (a -> b) -> GenXHeader a -> GenXHeader b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> GenXHeader b -> GenXHeader a
$c<$ :: forall a b. a -> GenXHeader b -> GenXHeader a
fmap :: forall a b. (a -> b) -> GenXHeader a -> GenXHeader b
$cfmap :: forall a b. (a -> b) -> GenXHeader a -> GenXHeader b
Functor)
type = GenXHeader Type
type XDecl = GenXDecl Type
type StructElem = GenStructElem Type
type BitCase = GenBitCase Type
type XidUnionElem = GenXidUnionElem Type
type XReply = GenXReply Type
type XExpression = Expression Type
type XEnumElem = EnumElem Type
data GenXDecl typ
= XStruct Name (Maybe Alignment) [GenStructElem typ]
| XTypeDef Name typ
| XEvent Name Int (Maybe Alignment) (Maybe Bool) [GenStructElem typ] (Maybe Bool)
| XRequest Name Int (Maybe Alignment) [GenStructElem typ] (Maybe (GenXReply typ))
| XidType Name
| XidUnion Name [GenXidUnionElem typ]
| XEnum Name [EnumElem typ]
| XUnion Name (Maybe Alignment) [GenStructElem typ]
| XImport Name
| XError Name Int (Maybe Alignment) [GenStructElem typ]
| XEventStruct Name [AllowedEvent]
deriving (Int -> GenXDecl typ -> ShowS
forall typ. Show typ => Int -> GenXDecl typ -> ShowS
forall typ. Show typ => [GenXDecl typ] -> ShowS
forall typ. Show typ => GenXDecl typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [GenXDecl typ] -> ShowS
$cshowList :: forall typ. Show typ => [GenXDecl typ] -> ShowS
show :: GenXDecl typ -> Name
$cshow :: forall typ. Show typ => GenXDecl typ -> Name
showsPrec :: Int -> GenXDecl typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> GenXDecl typ -> ShowS
Show, forall a b. a -> GenXDecl b -> GenXDecl a
forall a b. (a -> b) -> GenXDecl a -> GenXDecl b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> GenXDecl b -> GenXDecl a
$c<$ :: forall a b. a -> GenXDecl b -> GenXDecl a
fmap :: forall a b. (a -> b) -> GenXDecl a -> GenXDecl b
$cfmap :: forall a b. (a -> b) -> GenXDecl a -> GenXDecl b
Functor)
data PadType
= PadBytes
| PadAlignment
deriving (Int -> PadType -> ShowS
[PadType] -> ShowS
PadType -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [PadType] -> ShowS
$cshowList :: [PadType] -> ShowS
show :: PadType -> Name
$cshow :: PadType -> Name
showsPrec :: Int -> PadType -> ShowS
$cshowsPrec :: Int -> PadType -> ShowS
Show)
data GenStructElem typ
= Pad PadType Int
| List Name typ (Maybe (Expression typ)) (Maybe (EnumVals typ))
| SField Name typ (Maybe (EnumVals typ)) (Maybe (MaskVals typ))
| ExprField Name typ (Expression typ)
| ValueParam typ Name (Maybe MaskPadding) ListName
| Switch Name (Expression typ) (Maybe Alignment) [GenBitCase typ]
| Doc (Maybe String) (Map Name String) [(String, String)]
| Fd String
| Length typ (Expression typ)
deriving (Int -> GenStructElem typ -> ShowS
forall typ. Show typ => Int -> GenStructElem typ -> ShowS
forall typ. Show typ => [GenStructElem typ] -> ShowS
forall typ. Show typ => GenStructElem typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [GenStructElem typ] -> ShowS
$cshowList :: forall typ. Show typ => [GenStructElem typ] -> ShowS
show :: GenStructElem typ -> Name
$cshow :: forall typ. Show typ => GenStructElem typ -> Name
showsPrec :: Int -> GenStructElem typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> GenStructElem typ -> ShowS
Show, forall a b. a -> GenStructElem b -> GenStructElem a
forall a b. (a -> b) -> GenStructElem a -> GenStructElem b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> GenStructElem b -> GenStructElem a
$c<$ :: forall a b. a -> GenStructElem b -> GenStructElem a
fmap :: forall a b. (a -> b) -> GenStructElem a -> GenStructElem b
$cfmap :: forall a b. (a -> b) -> GenStructElem a -> GenStructElem b
Functor)
data GenBitCase typ
= BitCase (Maybe Name) (Expression typ) (Maybe Alignment) [GenStructElem typ]
deriving (Int -> GenBitCase typ -> ShowS
forall typ. Show typ => Int -> GenBitCase typ -> ShowS
forall typ. Show typ => [GenBitCase typ] -> ShowS
forall typ. Show typ => GenBitCase typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [GenBitCase typ] -> ShowS
$cshowList :: forall typ. Show typ => [GenBitCase typ] -> ShowS
show :: GenBitCase typ -> Name
$cshow :: forall typ. Show typ => GenBitCase typ -> Name
showsPrec :: Int -> GenBitCase typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> GenBitCase typ -> ShowS
Show, forall a b. a -> GenBitCase b -> GenBitCase a
forall a b. (a -> b) -> GenBitCase a -> GenBitCase b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> GenBitCase b -> GenBitCase a
$c<$ :: forall a b. a -> GenBitCase b -> GenBitCase a
fmap :: forall a b. (a -> b) -> GenBitCase a -> GenBitCase b
$cfmap :: forall a b. (a -> b) -> GenBitCase a -> GenBitCase b
Functor)
type EnumVals typ = typ
type MaskVals typ = typ
type Name = String
data GenXReply typ = GenXReply (Maybe Alignment) [GenStructElem typ]
deriving (Int -> GenXReply typ -> ShowS
forall typ. Show typ => Int -> GenXReply typ -> ShowS
forall typ. Show typ => [GenXReply typ] -> ShowS
forall typ. Show typ => GenXReply typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [GenXReply typ] -> ShowS
$cshowList :: forall typ. Show typ => [GenXReply typ] -> ShowS
show :: GenXReply typ -> Name
$cshow :: forall typ. Show typ => GenXReply typ -> Name
showsPrec :: Int -> GenXReply typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> GenXReply typ -> ShowS
Show, forall a b. a -> GenXReply b -> GenXReply a
forall a b. (a -> b) -> GenXReply a -> GenXReply b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> GenXReply b -> GenXReply a
$c<$ :: forall a b. a -> GenXReply b -> GenXReply a
fmap :: forall a b. (a -> b) -> GenXReply a -> GenXReply b
$cfmap :: forall a b. (a -> b) -> GenXReply a -> GenXReply b
Functor)
type Ref = String
type MaskName = Name
type ListName = Name
type MaskPadding = Int
data Type = UnQualType Name
| QualType Name Name
deriving (Int -> Type -> ShowS
[Type] -> ShowS
Type -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [Type] -> ShowS
$cshowList :: [Type] -> ShowS
show :: Type -> Name
$cshow :: Type -> Name
showsPrec :: Int -> Type -> ShowS
$cshowsPrec :: Int -> Type -> ShowS
Show, Type -> Type -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Type -> Type -> Bool
$c/= :: Type -> Type -> Bool
== :: Type -> Type -> Bool
$c== :: Type -> Type -> Bool
Eq, Eq Type
Type -> Type -> Bool
Type -> Type -> Ordering
Type -> Type -> Type
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Type -> Type -> Type
$cmin :: Type -> Type -> Type
max :: Type -> Type -> Type
$cmax :: Type -> Type -> Type
>= :: Type -> Type -> Bool
$c>= :: Type -> Type -> Bool
> :: Type -> Type -> Bool
$c> :: Type -> Type -> Bool
<= :: Type -> Type -> Bool
$c<= :: Type -> Type -> Bool
< :: Type -> Type -> Bool
$c< :: Type -> Type -> Bool
compare :: Type -> Type -> Ordering
$ccompare :: Type -> Type -> Ordering
Ord)
data GenXidUnionElem typ = XidUnionElem typ
deriving (Int -> GenXidUnionElem typ -> ShowS
forall typ. Show typ => Int -> GenXidUnionElem typ -> ShowS
forall typ. Show typ => [GenXidUnionElem typ] -> ShowS
forall typ. Show typ => GenXidUnionElem typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [GenXidUnionElem typ] -> ShowS
$cshowList :: forall typ. Show typ => [GenXidUnionElem typ] -> ShowS
show :: GenXidUnionElem typ -> Name
$cshow :: forall typ. Show typ => GenXidUnionElem typ -> Name
showsPrec :: Int -> GenXidUnionElem typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> GenXidUnionElem typ -> ShowS
Show, forall a b. a -> GenXidUnionElem b -> GenXidUnionElem a
forall a b. (a -> b) -> GenXidUnionElem a -> GenXidUnionElem b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> GenXidUnionElem b -> GenXidUnionElem a
$c<$ :: forall a b. a -> GenXidUnionElem b -> GenXidUnionElem a
fmap :: forall a b. (a -> b) -> GenXidUnionElem a -> GenXidUnionElem b
$cfmap :: forall a b. (a -> b) -> GenXidUnionElem a -> GenXidUnionElem b
Functor)
data EnumElem typ = EnumElem Name (Maybe (Expression typ))
deriving (Int -> EnumElem typ -> ShowS
forall typ. Show typ => Int -> EnumElem typ -> ShowS
forall typ. Show typ => [EnumElem typ] -> ShowS
forall typ. Show typ => EnumElem typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [EnumElem typ] -> ShowS
$cshowList :: forall typ. Show typ => [EnumElem typ] -> ShowS
show :: EnumElem typ -> Name
$cshow :: forall typ. Show typ => EnumElem typ -> Name
showsPrec :: Int -> EnumElem typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> EnumElem typ -> ShowS
Show, forall a b. a -> EnumElem b -> EnumElem a
forall a b. (a -> b) -> EnumElem a -> EnumElem b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> EnumElem b -> EnumElem a
$c<$ :: forall a b. a -> EnumElem b -> EnumElem a
fmap :: forall a b. (a -> b) -> EnumElem a -> EnumElem b
$cfmap :: forall a b. (a -> b) -> EnumElem a -> EnumElem b
Functor)
data Expression typ
= Value Int
| Bit Int
| FieldRef Name
| EnumRef typ Name
| PopCount (Expression typ)
| SumOf Name
| Op Binop (Expression typ) (Expression typ)
| Unop Unop (Expression typ)
| ParamRef Name
deriving (Int -> Expression typ -> ShowS
forall typ. Show typ => Int -> Expression typ -> ShowS
forall typ. Show typ => [Expression typ] -> ShowS
forall typ. Show typ => Expression typ -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [Expression typ] -> ShowS
$cshowList :: forall typ. Show typ => [Expression typ] -> ShowS
show :: Expression typ -> Name
$cshow :: forall typ. Show typ => Expression typ -> Name
showsPrec :: Int -> Expression typ -> ShowS
$cshowsPrec :: forall typ. Show typ => Int -> Expression typ -> ShowS
Show, forall a b. a -> Expression b -> Expression a
forall a b. (a -> b) -> Expression a -> Expression b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Expression b -> Expression a
$c<$ :: forall a b. a -> Expression b -> Expression a
fmap :: forall a b. (a -> b) -> Expression a -> Expression b
$cfmap :: forall a b. (a -> b) -> Expression a -> Expression b
Functor)
data Binop = Add
| Sub
| Mult
| Div
| And
| RShift
deriving (Int -> Binop -> ShowS
[Binop] -> ShowS
Binop -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [Binop] -> ShowS
$cshowList :: [Binop] -> ShowS
show :: Binop -> Name
$cshow :: Binop -> Name
showsPrec :: Int -> Binop -> ShowS
$cshowsPrec :: Int -> Binop -> ShowS
Show)
data Unop = Complement
deriving (Int -> Unop -> ShowS
[Unop] -> ShowS
Unop -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [Unop] -> ShowS
$cshowList :: [Unop] -> ShowS
show :: Unop -> Name
$cshow :: Unop -> Name
showsPrec :: Int -> Unop -> ShowS
$cshowsPrec :: Int -> Unop -> ShowS
Show)
data Alignment = Alignment Int Int deriving (Int -> Alignment -> ShowS
[Alignment] -> ShowS
Alignment -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [Alignment] -> ShowS
$cshowList :: [Alignment] -> ShowS
show :: Alignment -> Name
$cshow :: Alignment -> Name
showsPrec :: Int -> Alignment -> ShowS
$cshowsPrec :: Int -> Alignment -> ShowS
Show)
data AllowedEvent = AllowedEvent Name Bool Int Int deriving (Int -> AllowedEvent -> ShowS
[AllowedEvent] -> ShowS
AllowedEvent -> Name
forall a.
(Int -> a -> ShowS) -> (a -> Name) -> ([a] -> ShowS) -> Show a
showList :: [AllowedEvent] -> ShowS
$cshowList :: [AllowedEvent] -> ShowS
show :: AllowedEvent -> Name
$cshow :: AllowedEvent -> Name
showsPrec :: Int -> AllowedEvent -> ShowS
$cshowsPrec :: Int -> AllowedEvent -> ShowS
Show)