-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Parses XML files used by the XCB project
--   
--   This package provides types which mirror the structures used in the
--   XCB code generation XML files.
--   
--   See project <a>http://xcb.freedesktop.org/</a> for more information
--   about the XCB project.
--   
--   The XML files describe the data-types, events and requests used by the
--   X Protocol, and are used to auto-generate large parts of the XCB
--   project.
--   
--   This package parses these XML files into Haskell data structures.
--   
--   If you want to do something with these XML descriptions but don't want
--   to learn XSLT, this package should help.
--   
--   This version of xcb-types is intended to fully parse the X Protocol
--   description version 1.16.
@package xcb-types
@version 0.14.0


-- | Defines types inteneded to be equivalent to the schema used by the XCB
--   project in their XML protocol description.
module Data.XCB.Types
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

-- | This is what a single XML file maps to. It contains some meta-data
--   then declarations.
data GenXHeader typ
XHeader :: Name -> Maybe Name -> Maybe Name -> Maybe Bool -> Maybe Int -> Maybe Int -> [GenXDecl typ] -> GenXHeader typ

-- | Name of module. Used in the other modules as a reference.
[xheader_header] :: GenXHeader typ -> Name

-- | Name used to indentify extensions between the X client and server.
[xheader_xname] :: GenXHeader typ -> Maybe Name

-- | InterCaps name.
[xheader_name] :: GenXHeader typ -> Maybe Name
[xheader_multiword] :: GenXHeader typ -> Maybe Bool
[xheader_major_version] :: GenXHeader typ -> Maybe Int
[xheader_minor_version] :: GenXHeader typ -> Maybe Int

-- | Declarations contained in this module.
[xheader_decls] :: GenXHeader typ -> [GenXDecl typ]

-- | The different types of declarations which can be made in one of the
--   XML files.
data GenXDecl typ
XStruct :: Name -> Maybe Alignment -> [GenStructElem typ] -> GenXDecl typ
XTypeDef :: Name -> typ -> GenXDecl typ

-- | bools: #1 if xge is true; #2 if the event includes a sequence number.
XEvent :: Name -> Int -> Maybe Alignment -> Maybe Bool -> [GenStructElem typ] -> Maybe Bool -> GenXDecl typ
XRequest :: Name -> Int -> Maybe Alignment -> [GenStructElem typ] -> Maybe (GenXReply typ) -> GenXDecl typ
XidType :: Name -> GenXDecl typ
XidUnion :: Name -> [GenXidUnionElem typ] -> GenXDecl typ
XEnum :: Name -> [EnumElem typ] -> GenXDecl typ
XUnion :: Name -> Maybe Alignment -> [GenStructElem typ] -> GenXDecl typ
XImport :: Name -> GenXDecl typ
XError :: Name -> Int -> Maybe Alignment -> [GenStructElem typ] -> GenXDecl typ
XEventStruct :: Name -> [AllowedEvent] -> GenXDecl typ
data GenStructElem typ
Pad :: PadType -> Int -> GenStructElem typ
List :: Name -> typ -> Maybe (Expression typ) -> Maybe (EnumVals typ) -> GenStructElem typ
SField :: Name -> typ -> Maybe (EnumVals typ) -> Maybe (MaskVals typ) -> GenStructElem typ
ExprField :: Name -> typ -> Expression typ -> GenStructElem typ
ValueParam :: typ -> Name -> Maybe MaskPadding -> ListName -> GenStructElem typ
Switch :: Name -> Expression typ -> Maybe Alignment -> [GenBitCase typ] -> GenStructElem typ
Doc :: Maybe String -> Map Name String -> [(String, String)] -> GenStructElem typ
Fd :: String -> GenStructElem typ
Length :: typ -> Expression typ -> GenStructElem typ
data GenBitCase typ
BitCase :: Maybe Name -> Expression typ -> Maybe Alignment -> [GenStructElem typ] -> GenBitCase typ
data GenXReply typ
GenXReply :: Maybe Alignment -> [GenStructElem typ] -> GenXReply typ
data GenXidUnionElem typ
XidUnionElem :: typ -> GenXidUnionElem typ
data EnumElem typ
EnumElem :: Name -> Maybe (Expression typ) -> EnumElem typ

-- | Declarations may contain expressions from this small language
data Expression typ

-- | A literal value
Value :: Int -> Expression typ

-- | A log-base-2 literal value
Bit :: Int -> Expression typ

-- | A reference to a field in the same declaration
FieldRef :: Name -> Expression typ

-- | A reference to a member of an enum.
EnumRef :: typ -> Name -> Expression typ

-- | Calculate the number of set bits in the argument
PopCount :: Expression typ -> Expression typ

-- | Note sure. The argument should be a reference to a list
SumOf :: Name -> Expression typ

-- | A binary opeation
Op :: Binop -> Expression typ -> Expression typ -> Expression typ

-- | A unary operation
Unop :: Unop -> Expression typ -> Expression typ

-- | I think this is the name of an argument passed to the request. See
--   fffbd04d63 in xcb-proto.
ParamRef :: Name -> Expression typ

-- | Supported Binary operations.
data Binop
Add :: Binop
Sub :: Binop
Mult :: Binop
Div :: Binop
And :: Binop
RShift :: Binop
data Unop
Complement :: Unop

-- | Types may include a reference to the containing module.
data Type
UnQualType :: Name -> Type
QualType :: Name -> Name -> Type
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 -> Alignment
data AllowedEvent
AllowedEvent :: Name -> Bool -> Int -> Int -> AllowedEvent
data PadType
PadBytes :: PadType
PadAlignment :: PadType
instance GHC.Classes.Eq Data.XCB.Types.Type
instance GHC.Internal.Base.Functor Data.XCB.Types.EnumElem
instance GHC.Internal.Base.Functor Data.XCB.Types.Expression
instance GHC.Internal.Base.Functor Data.XCB.Types.GenBitCase
instance GHC.Internal.Base.Functor Data.XCB.Types.GenStructElem
instance GHC.Internal.Base.Functor Data.XCB.Types.GenXDecl
instance GHC.Internal.Base.Functor Data.XCB.Types.GenXHeader
instance GHC.Internal.Base.Functor Data.XCB.Types.GenXReply
instance GHC.Internal.Base.Functor Data.XCB.Types.GenXidUnionElem
instance GHC.Classes.Ord Data.XCB.Types.Type
instance GHC.Internal.Show.Show Data.XCB.Types.Alignment
instance GHC.Internal.Show.Show Data.XCB.Types.AllowedEvent
instance GHC.Internal.Show.Show Data.XCB.Types.Binop
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.EnumElem typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.Expression typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.GenBitCase typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.GenStructElem typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.GenXDecl typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.GenXHeader typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.GenXReply typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Data.XCB.Types.GenXidUnionElem typ)
instance GHC.Internal.Show.Show Data.XCB.Types.PadType
instance GHC.Internal.Show.Show Data.XCB.Types.Type
instance GHC.Internal.Show.Show Data.XCB.Types.Unop


-- | Pretty-printers for the tyes declared in this package. This does NOT
--   ouput XML - it produces human-readable information intended to aid in
--   debugging.
module Data.XCB.Pretty

-- | Minimal complete definition:
--   
--   One of <a>pretty</a> or <a>toDoc</a>.
class Pretty a
toDoc :: Pretty a => a -> Doc
pretty :: Pretty a => a -> String
bitCaseHeader :: Pretty a => Maybe Name -> Expression a -> Doc
instance Data.XCB.Pretty.Pretty Data.XCB.Types.Alignment
instance Data.XCB.Pretty.Pretty Data.XCB.Types.AllowedEvent
instance Data.XCB.Pretty.Pretty Data.XCB.Types.Binop
instance Data.XCB.Pretty.Pretty GHC.Types.Bool
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (Data.XCB.Types.EnumElem a)
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (Data.XCB.Types.Expression a)
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (Data.XCB.Types.GenBitCase a)
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (Data.XCB.Types.GenStructElem a)
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (Data.XCB.Types.GenXDecl a)
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (Data.XCB.Types.GenXHeader a)
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (Data.XCB.Types.GenXidUnionElem a)
instance Data.XCB.Pretty.Pretty GHC.Types.Int
instance Data.XCB.Pretty.Pretty GHC.Internal.Base.String
instance Data.XCB.Pretty.Pretty a => Data.XCB.Pretty.Pretty (GHC.Internal.Maybe.Maybe a)
instance Data.XCB.Pretty.Pretty Data.XCB.Types.PadType
instance Data.XCB.Pretty.Pretty Data.XCB.Types.Type
instance Data.XCB.Pretty.Pretty Data.XCB.Types.Unop


-- | Handls parsing the data structures from XML files.
--   
--   In order to support copying events and errors across module
--   boundaries, all modules which may have cross-module event copies and
--   error copies must be parsed at once.
--   
--   There is no provision for preserving the event copy and error copy
--   declarations - the copies are handled during parsing.
module Data.XCB.FromXML

-- | Process the listed XML files. Any files which fail to parse are
--   silently dropped. Any declaration in an XML file which fail to parse
--   are silently dropped.
fromFiles :: [FilePath] -> IO [XHeader]

-- | Process the strings as if they were XML files. Any files which fail to
--   parse are silently dropped. Any declaration in an XML file which fail
--   to parse are silently dropped.
fromStrings :: [String] -> [XHeader]


-- | The <a>XCB</a> module can parse the contents of the xcb-proto XML
--   files into Haskell data structures.
--   
--   Pretty-printers are provided to aid in the debugging - they do not
--   pretty-print to XML, but to a custom human-readable format.
module Data.XCB
