Portability | portable |
---|---|
Stability | provisional |
Maintainer | Antoine Latter <aslatter@gmail.com> |
Safe Haskell | Safe-Inferred |
Defines types inteneded to be equivalent to the schema used by the XCB project in their XML protocol description.
- 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 {}
- data GenXDecl typ
- = XStruct Name [GenStructElem typ]
- | XTypeDef Name typ
- | XEvent Name Int [GenStructElem typ] (Maybe Bool)
- | XRequest Name Int [GenStructElem typ] (Maybe (GenXReply typ))
- | XidType Name
- | XidUnion Name [GenXidUnionElem typ]
- | XEnum Name [EnumElem typ]
- | XUnion Name [GenStructElem typ]
- | XImport Name
- | XError Name Int [GenStructElem typ]
- 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) [GenBitCase typ]
- | Doc (Maybe String) (Map Name String) [(String, String)]
- | Fd String
- data GenBitCase typ = BitCase (Maybe Name) (Expression typ) [GenStructElem typ]
- type GenXReply typ = [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)
- data Binop
- 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
Documentation
type XHeader = GenXHeader TypeSource
type StructElem = GenStructElem TypeSource
type BitCase = GenBitCase TypeSource
type XExpression = Expression TypeSource
data GenXHeader typ Source
This is what a single XML file maps to. It contains some meta-data then declarations.
XHeader | |
|
Functor GenXHeader | |
Show typ => Show (GenXHeader typ) | |
Pretty a => Pretty (GenXHeader a) |
The different types of declarations which can be made in one of the XML files.
XStruct Name [GenStructElem typ] | |
XTypeDef Name typ | |
XEvent Name Int [GenStructElem typ] (Maybe Bool) | The boolean indicates if the event includes a sequence number. |
XRequest Name Int [GenStructElem typ] (Maybe (GenXReply typ)) | |
XidType Name | |
XidUnion Name [GenXidUnionElem typ] | |
XEnum Name [EnumElem typ] | |
XUnion Name [GenStructElem typ] | |
XImport Name | |
XError Name Int [GenStructElem typ] |
data GenStructElem typ Source
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) [GenBitCase typ] | |
Doc (Maybe String) (Map Name String) [(String, String)] | |
Fd String |
Functor GenStructElem | |
Show typ => Show (GenStructElem typ) | |
Pretty a => Pretty (GenStructElem a) |
data GenBitCase typ Source
BitCase (Maybe Name) (Expression typ) [GenStructElem typ] |
Functor GenBitCase | |
Show typ => Show (GenBitCase typ) | |
Pretty a => Pretty (GenBitCase a) |
type GenXReply typ = [GenStructElem typ]Source
data GenXidUnionElem typ Source
XidUnionElem typ |
Functor GenXidUnionElem | |
Show typ => Show (GenXidUnionElem typ) | |
Pretty a => Pretty (GenXidUnionElem a) |
EnumElem Name (Maybe (Expression typ)) |
data Expression typ Source
Declarations may contain expressions from this small language
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 |
Functor Expression | |
Show typ => Show (Expression typ) | |
Pretty a => Pretty (Expression a) |
Types may include a reference to the containing module.
type MaskPadding = IntSource