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 ( .. )
) where
import Data.Map
data GenXHeader typ = XHeader
{xheader_header :: Name
,xheader_xname :: Maybe Name
,xheader_name :: Maybe Name
,xheader_multiword :: Maybe Bool
,xheader_major_version :: Maybe Int
,xheader_minor_version :: Maybe Int
,xheader_decls :: [GenXDecl typ]
}
deriving (Show, Functor)
type XHeader = 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) [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 (Show, Functor)
data GenStructElem typ
= Pad 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
deriving (Show, Functor)
data GenBitCase typ
= BitCase (Maybe Name) (Expression typ) (Maybe Alignment) [GenStructElem typ]
deriving (Show, Functor)
type EnumVals typ = typ
type MaskVals typ = typ
type Name = String
data GenXReply typ = GenXReply (Maybe Alignment) [GenStructElem typ]
deriving (Show, Functor)
type Ref = String
type MaskName = Name
type ListName = Name
type MaskPadding = Int
data Type = UnQualType Name
| QualType Name Name
deriving (Show, Eq, Ord)
data GenXidUnionElem typ = XidUnionElem typ
deriving (Show, Functor)
data EnumElem typ = EnumElem Name (Maybe (Expression typ))
deriving (Show, 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 (Show, Functor)
data Binop = Add
| Sub
| Mult
| Div
| And
| RShift
deriving (Show)
data Unop = Complement
deriving (Show)
data Alignment = Alignment Int Int deriving (Show)
data AllowedEvent = AllowedEvent Name Bool Int Int deriving (Show)