xcb-types 0.1.0 → 0.2.0
raw patch · 4 files changed
+23/−19 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.XCB.Types: ExInfo :: Name -> Name -> Version -> ExInfo
- Data.XCB.Types: data ExInfo
- Data.XCB.Types: instance Show ExInfo
- Data.XCB.Types: type Version = (String, String)
- Data.XCB.Types: XEvent :: Name -> Int -> [StructElem] -> XDecl
+ Data.XCB.Types: XEvent :: Name -> Int -> [StructElem] -> (Maybe Bool) -> XDecl
Files
- Data/XCB/FromXML.hs +13/−8
- Data/XCB/Pretty.hs +5/−1
- Data/XCB/Types.hs +4/−9
- xcb-types.cabal +1/−1
Data/XCB/FromXML.hs view
@@ -108,11 +108,12 @@ findEvent pname xs = case List.find f xs of Nothing -> Nothing- Just (XEvent name code elems) -> Just $ EventDetails name code elems- where f (XEvent name _ _) | name == pname = True+ Just (XEvent name code elems noseq) ->+ Just $ EventDetails name code elems noseq+ where f (XEvent name _ _ _) | name == pname = True f _ = False -data EventDetails = EventDetails Name Int [StructElem]+data EventDetails = EventDetails Name Int [StructElem] (Maybe Bool) data ErrorDetails = ErrorDetails Name Int [StructElem] ---@@ -197,9 +198,10 @@ xevent elem = do name <- elem `attr` "name" number <- elem `attr` "number" >>= readM+ let noseq = ensureUpper `liftM` (elem `attr` "no-sequence-number") >>= readM fields <- mapAlt structField $ elChildren elem guard $ not $ null fields- return $ XEvent name number fields+ return $ XEvent name number fields noseq xevcopy :: Element -> Parse XDecl xevcopy elem = do@@ -208,10 +210,13 @@ ref <- elem `attr` "ref" -- do we have a qualified ref? let (mname,evname) = splitRef ref- details <- lookupEvent mname evname - return $ XEvent name number $ case details of- Nothing -> error $ "Unresolved event: " ++ show mname ++ " " ++ ref- Just (EventDetails _ _ x) -> x+ details <- lookupEvent mname evname+ return $ let EventDetails _ _ fields noseq =+ case details of+ Nothing ->+ error $ "Unresolved event: " ++ show mname ++ " " ++ ref+ Just x -> x + in XEvent name number fields noseq -- we need to do string processing to distinguish qualified from -- unqualified types.
Data/XCB/Pretty.hs view
@@ -103,7 +103,11 @@ ,text "as" ,toDoc typ ]- toDoc (XEvent nm n elems) =+ toDoc (XEvent nm n elems (Just True)) =+ hang (text "Event:" <+> text nm <> char ',' <> toDoc n <+>+ parens (text "No sequence number")) 2 $+ vcat $ map toDoc elems+ toDoc (XEvent nm n elems _) = hang (text "Event:" <+> text nm <> char ',' <> toDoc n) 2 $ vcat $ map toDoc elems toDoc (XRequest nm n elems mrep) =
Data/XCB/Types.hs view
@@ -40,7 +40,7 @@ -- XML files. data XDecl = XStruct Name [StructElem] | XTypeDef Name Type- | XEvent Name Int [StructElem]+ | XEvent Name Int [StructElem] (Maybe Bool) -- ^ The boolean indicates if the event includes a sequence number. | XRequest Name Int [StructElem] (Maybe XReply) | XidType Name | XidUnion Name [XidUnionElem]@@ -60,19 +60,14 @@ type Name = String type XReply = [StructElem] type Ref = String+type MaskName = Name+type ListName = Name + -- |Types may include a reference to the containing module. data Type = UnQualType Name | QualType Name Name deriving Show--type MaskName = Name-type ListName = Name--data ExInfo = ExInfo Name Name Version- deriving (Show)--type Version = (String,String) data XidUnionElem = XidUnionElem Type deriving (Show)
xcb-types.cabal view
@@ -1,5 +1,5 @@ Name: xcb-types-Version: 0.1.0+Version: 0.2.0 Cabal-Version: >= 1.2 Synopsis: Parses XML files used by the XCB project Description: This package provides types which mirror the structures