xcb-types 0.8.0 → 0.9.0
raw patch · 4 files changed
+31/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.XCB.Pretty: instance Data.XCB.Pretty.Pretty Data.XCB.Types.AllowedEvent
+ Data.XCB.Pretty: instance Data.XCB.Pretty.Pretty GHC.Types.Bool
+ Data.XCB.Types: AllowedEvent :: Name -> Bool -> Int -> Int -> AllowedEvent
+ Data.XCB.Types: XEventStruct :: Name -> [AllowedEvent] -> GenXDecl typ
+ Data.XCB.Types: data AllowedEvent
+ Data.XCB.Types: instance GHC.Show.Show Data.XCB.Types.AllowedEvent
- Data.XCB.Pretty: class Pretty a where pretty = show . toDoc toDoc = text . pretty
+ Data.XCB.Pretty: class Pretty a
Files
- Data/XCB/FromXML.hs +14/−0
- Data/XCB/Pretty.hs +12/−0
- Data/XCB/Types.hs +4/−0
- xcb-types.cabal +1/−1
Data/XCB/FromXML.hs view
@@ -178,6 +178,7 @@ | el `named` "typedef" = xtypedef el | el `named` "enum" = xenum el | el `named` "import" = ximport el+ | el `named` "eventstruct" = xeventstruct el | otherwise = mzero @@ -324,6 +325,19 @@ newname <- el `attr` "newname" return $ XTypeDef newname oldtyp +xeventstruct :: Element -> Parse XDecl+xeventstruct el = do+ name <- el `attr` "name"+ allowed <- mapAlt allowedEvent $ elChildren el+ return $ XEventStruct name allowed++allowedEvent :: (MonadPlus m, Functor m) => Element -> m AllowedEvent+allowedEvent el = do+ extension <- el `attr` "name"+ xge <- el `attr` "xge" >>= readM+ opMin <- el `attr` "opcode-min" >>= readM+ opMax <- el `attr` "opcode-max" >>= readM+ return $ AllowedEvent extension xge opMin opMax structField :: (MonadPlus m, Functor m) => Element -> m StructElem structField el
Data/XCB/Pretty.hs view
@@ -39,6 +39,9 @@ instance Pretty Int where pretty = show +instance Pretty Bool where+ pretty = show+ instance Pretty a => Pretty (Maybe a) where toDoc Nothing = empty toDoc (Just a) = toDoc a@@ -165,6 +168,13 @@ text "align=" <+> toDoc align <+> text "offset=" <+> toDoc offset +instance Pretty AllowedEvent where+ toDoc (AllowedEvent extension xge opMin opMax) = text "allowed" <+>+ text "extension=" <+> text extension <+>+ text "xge=" <> toDoc xge <>+ text "opcode-min" <> toDoc opMin <>+ text "opcode-max" <> toDoc opMax+ instance Pretty a => Pretty (GenXDecl a) where toDoc (XStruct nm alignment elems) = hang (text "Struct:" <+> text nm <+> toDoc alignment) 2 $ vcat $ map toDoc elems@@ -199,6 +209,8 @@ toDoc (XImport nm) = text "Import:" <+> text nm toDoc (XError nm _n alignment elems) = hang (text "Error:" <+> text nm <+> toDoc alignment) 2 $ vcat $ map toDoc elems+ toDoc (XEventStruct name allowed) =+ hang (text "Event struct:" <+> text name) 2 $ vcat $ map toDoc allowed instance Pretty a => Pretty (GenXHeader a) where toDoc xhd = text (xheader_header xhd) $$
Data/XCB/Types.hs view
@@ -45,6 +45,7 @@ , ListName , MaskPadding , Alignment ( .. )+ , AllowedEvent ( .. ) ) where import Data.Map@@ -89,6 +90,7 @@ | XUnion Name (Maybe Alignment) [GenStructElem typ] | XImport Name | XError Name Int (Maybe Alignment) [GenStructElem typ]+ | XEventStruct Name [AllowedEvent] deriving (Show, Functor) data GenStructElem typ@@ -155,3 +157,5 @@ deriving (Show) data Alignment = Alignment Int Int deriving (Show)++data AllowedEvent = AllowedEvent Name Bool Int Int deriving (Show)
xcb-types.cabal view
@@ -1,5 +1,5 @@ Name: xcb-types-Version: 0.8.0+Version: 0.9.0 Cabal-Version: >= 1.6 Synopsis: Parses XML files used by the XCB project Description: This package provides types which mirror the structures