xcb-types-0.14.0: Parses XML files used by the XCB project

Copyright | (c) Antoine Latter 2008
License | BSD3
Maintainer | Antoine Latter <aslatter@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.XCB.Types

Description

Defines types inteneded to be equivalent to the schema used by the XCB project in their XML protocol description.

Synopsis

- type XHeader = GenXHeader Type
- type XDecl = GenXDecl Type
- type StructElem = GenStructElem Type
- type XEnumElem = EnumElem Type
- type BitCase = GenBitCase Type
- type XidUnionElem = GenXidUnionElem Type
- type XReply = GenXReply Type
- type XExpression = Expression Type
- 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]
  }
- 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]
- 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)
- data GenBitCase typ = BitCase (Maybe Name) (Expression typ) (Maybe Alignment) [GenStructElem typ]
- data GenXReply typ = GenXReply (Maybe Alignment) [GenStructElem typ]
- data GenXidUnionElem typ = XidUnionElem typ
- data EnumElem typ = EnumElem Name (Maybe (Expression typ))
- 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
- data Binop
  - = Add
  - | Sub
  - | Mult
  - | Div
  - | And
  - | RShift
- data Unop = Complement
- data Type
  - = UnQualType Name
  - | QualType Name Name
- type EnumVals typ = typ
- type MaskVals typ = typ
- type Name = String
- type Ref = String
- type MaskName = Name
- type ListName = Name
- type MaskPadding = Int
- data Alignment = Alignment Int Int
- data AllowedEvent = AllowedEvent Name Bool Int Int
- data PadType
  - = PadBytes
  - | PadAlignment

# Documentation

type XHeader = GenXHeader Type Source #

type XDecl = GenXDecl Type Source #

type StructElem = GenStructElem Type Source #

type XEnumElem = EnumElem Type Source #

type BitCase = GenBitCase Type Source #

type XidUnionElem = GenXidUnionElem Type Source #

type XReply = GenXReply Type Source #

type XExpression = Expression Type Source #

data GenXHeader typ Source #

This is what a single XML file maps to. It contains some meta-data then declarations.

Constructors

XHeader |

Fields

- xheader_header :: Name

  Name of module. Used in the other modules as a reference.

- xheader_xname :: Maybe Name

  Name used to indentify extensions between the X client and server.

- xheader_name :: Maybe Name

  InterCaps name.

- xheader_multiword :: Maybe Bool
- xheader_major_version :: Maybe Int
- xheader_minor_version :: Maybe Int
- xheader_decls :: [GenXDecl typ]

  Declarations contained in this module.

#### Instances

Instances details

Functor GenXHeader Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> GenXHeader a -> GenXHeader b Source # (<$) :: a -> GenXHeader b -> GenXHeader a Source #
Show typ => Show (GenXHeader typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> GenXHeader typ -> ShowS Source # show :: GenXHeader typ -> String Source # showList :: [GenXHeader typ] -> ShowS Source #
Pretty a => Pretty (GenXHeader a) Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: GenXHeader a -> Doc Source # pretty :: GenXHeader a -> String Source #

data GenXDecl typ Source #

The different types of declarations which can be made in one of the XML files.

Constructors

XStruct Name (Maybe Alignment) [GenStructElem typ] |
XTypeDef Name typ |
XEvent Name Int (Maybe Alignment) (Maybe Bool) [GenStructElem typ] (Maybe Bool) | bools: #1 if xge is true; #2 if the event includes a sequence number.
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] |

#### Instances

Instances details

Functor GenXDecl Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> GenXDecl a -> GenXDecl b Source # (<$) :: a -> GenXDecl b -> GenXDecl a Source #
Show typ => Show (GenXDecl typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> GenXDecl typ -> ShowS Source # show :: GenXDecl typ -> String Source # showList :: [GenXDecl typ] -> ShowS Source #
Pretty a => Pretty (GenXDecl a) Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: GenXDecl a -> Doc Source # pretty :: GenXDecl a -> String Source #

data GenStructElem typ Source #

Constructors

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) |

#### Instances

Instances details

Functor GenStructElem Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> GenStructElem a -> GenStructElem b Source # (<$) :: a -> GenStructElem b -> GenStructElem a Source #
Show typ => Show (GenStructElem typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> GenStructElem typ -> ShowS Source # show :: GenStructElem typ -> String Source # showList :: [GenStructElem typ] -> ShowS Source #
Pretty a => Pretty (GenStructElem a) Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: GenStructElem a -> Doc Source # pretty :: GenStructElem a -> String Source #

data GenBitCase typ Source #

Constructors

BitCase (Maybe Name) (Expression typ) (Maybe Alignment) [GenStructElem typ] |

#### Instances

Instances details

Functor GenBitCase Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> GenBitCase a -> GenBitCase b Source # (<$) :: a -> GenBitCase b -> GenBitCase a Source #
Show typ => Show (GenBitCase typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> GenBitCase typ -> ShowS Source # show :: GenBitCase typ -> String Source # showList :: [GenBitCase typ] -> ShowS Source #
Pretty a => Pretty (GenBitCase a) Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: GenBitCase a -> Doc Source # pretty :: GenBitCase a -> String Source #

data GenXReply typ Source #

Constructors

GenXReply (Maybe Alignment) [GenStructElem typ] |

#### Instances

Instances details

Functor GenXReply Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> GenXReply a -> GenXReply b Source # (<$) :: a -> GenXReply b -> GenXReply a Source #
Show typ => Show (GenXReply typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> GenXReply typ -> ShowS Source # show :: GenXReply typ -> String Source # showList :: [GenXReply typ] -> ShowS Source #

data GenXidUnionElem typ Source #

Constructors

XidUnionElem typ |

#### Instances

Instances details

Functor GenXidUnionElem Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> GenXidUnionElem a -> GenXidUnionElem b Source # (<$) :: a -> GenXidUnionElem b -> GenXidUnionElem a Source #
Show typ => Show (GenXidUnionElem typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> GenXidUnionElem typ -> ShowS Source # show :: GenXidUnionElem typ -> String Source # showList :: [GenXidUnionElem typ] -> ShowS Source #
Pretty a => Pretty (GenXidUnionElem a) Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: GenXidUnionElem a -> Doc Source # pretty :: GenXidUnionElem a -> String Source #

data EnumElem typ Source #

Constructors

EnumElem Name (Maybe (Expression typ)) |

#### Instances

Instances details

Functor EnumElem Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> EnumElem a -> EnumElem b Source # (<$) :: a -> EnumElem b -> EnumElem a Source #
Show typ => Show (EnumElem typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> EnumElem typ -> ShowS Source # show :: EnumElem typ -> String Source # showList :: [EnumElem typ] -> ShowS Source #
Pretty a => Pretty (EnumElem a) Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: EnumElem a -> Doc Source # pretty :: EnumElem a -> String Source #

data Expression typ Source #

Declarations may contain expressions from this small language

Constructors

Value Int | A literal value
Bit Int | A log-base-2 literal value
FieldRef Name | A reference to a field in the same declaration
EnumRef typ Name | A reference to a member of an enum.
PopCount (Expression typ) | Calculate the number of set bits in the argument
SumOf Name | Note sure. The argument should be a reference to a list
Op Binop (Expression typ) (Expression typ) | A binary opeation
Unop Unop (Expression typ) | A unary operation
ParamRef Name | I think this is the name of an argument passed to the request. See fffbd04d63 in xcb-proto.

#### Instances

Instances details

Functor Expression Source # |
Instance details Defined in Data.XCB.Types Methods fmap :: (a -> b) -> Expression a -> Expression b Source # (<$) :: a -> Expression b -> Expression a Source #
Show typ => Show (Expression typ) Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> Expression typ -> ShowS Source # show :: Expression typ -> String Source # showList :: [Expression typ] -> ShowS Source #
Pretty a => Pretty (Expression a) Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: Expression a -> Doc Source # pretty :: Expression a -> String Source #

data Binop Source #

Supported Binary operations.

Constructors

Add |
Sub |
Mult |
Div |
And |
RShift |

#### Instances

Instances details

Show Binop Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> Binop -> ShowS Source # show :: Binop -> String Source # showList :: [Binop] -> ShowS Source #
Pretty Binop Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: Binop -> Doc Source # pretty :: Binop -> String Source #

data Unop Source #

Constructors

Complement |

#### Instances

Instances details

Show Unop Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> Unop -> ShowS Source # show :: Unop -> String Source # showList :: [Unop] -> ShowS Source #
Pretty Unop Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: Unop -> Doc Source # pretty :: Unop -> String Source #

data Type Source #

Types may include a reference to the containing module.

Constructors

UnQualType Name |
QualType Name Name |

#### Instances

Instances details

Show Type Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> Type -> ShowS Source # show :: Type -> String Source # showList :: [Type] -> ShowS Source #
Eq Type Source # |
Instance details Defined in Data.XCB.Types Methods (==) :: Type -> Type -> Bool Source # (/=) :: Type -> Type -> Bool Source #
Ord Type Source # |
Instance details Defined in Data.XCB.Types Methods compare :: Type -> Type -> Ordering Source # (<) :: Type -> Type -> Bool Source # (<=) :: Type -> Type -> Bool Source # (>) :: Type -> Type -> Bool Source # (>=) :: Type -> Type -> Bool Source # max :: Type -> Type -> Type Source # min :: Type -> Type -> Type Source #
Pretty Type Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: Type -> Doc Source # pretty :: Type -> String Source #

type EnumVals typ = typ Source #

type MaskVals typ = typ Source #

type Name = String Source #

type Ref = String Source #

type MaskName = Name Source #

type ListName = Name Source #

type MaskPadding = Int Source #

data Alignment Source #

Constructors

Alignment Int Int |

#### Instances

Instances details

Show Alignment Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> Alignment -> ShowS Source # show :: Alignment -> String Source # showList :: [Alignment] -> ShowS Source #
Pretty Alignment Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: Alignment -> Doc Source # pretty :: Alignment -> String Source #

data AllowedEvent Source #

Constructors

AllowedEvent Name Bool Int Int |

#### Instances

Instances details

Show AllowedEvent Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> AllowedEvent -> ShowS Source # show :: AllowedEvent -> String Source # showList :: [AllowedEvent] -> ShowS Source #
Pretty AllowedEvent Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: AllowedEvent -> Doc Source # pretty :: AllowedEvent -> String Source #

data PadType Source #

Constructors

PadBytes |
PadAlignment |

#### Instances

Instances details

Show PadType Source # |
Instance details Defined in Data.XCB.Types Methods showsPrec :: Int -> PadType -> ShowS Source # show :: PadType -> String Source # showList :: [PadType] -> ShowS Source #
Pretty PadType Source # |
Instance details Defined in Data.XCB.Pretty Methods toDoc :: PadType -> Doc Source # pretty :: PadType -> String Source #