DBus 0.3 → 0.4
raw patch · 3 files changed
+15/−3 lines, 3 files
Files
- DBus.buildinfo.in +2/−0
- DBus.cabal +2/−2
- DBus/Message.hsc +11/−1
+ DBus.buildinfo.in view
@@ -0,0 +1,2 @@+cc-options: @DBUS_CFLAGS@+ld-options: @DBUS_LIBS@
DBus.cabal view
@@ -1,5 +1,5 @@ name: DBus-version: 0.3+version: 0.4 license: BSD3 license-file: LICENSE copyright: Copyright (C) 2006 Evan Martin <martine@danga.com>@@ -17,5 +17,5 @@ ExistentialQuantification exposed-modules: DBus, DBus.Message, DBus.Connection other-modules: DBus.Internal, DBus.Shared-extra-source-files: configure configure.ac+extra-source-files: configure configure.ac DBus.buildinfo.in extra-tmp-files: autom4te.cache config.log config.status DBus.buildinfo
DBus/Message.hsc view
@@ -123,7 +123,7 @@ data Arg = Byte Word8 | Boolean Bool | Int16 Int16 | Word16 Word16 | Int32 Int32 | Word32 Word32 | Int64 Int64 | Word64 Word64 | Double Double | String String | ObjectPath {- ? -}- | TypeSignature {- ? -} | Array String [Arg] | Variant Arg | Struct {- ? -} | DictEntry Arg Arg+ | TypeSignature {- ? -} | Array String [Arg] | Variant Arg | Struct [Arg] | DictEntry Arg Arg | ByteString B.ByteString | Invalid deriving (Show,Read,Typeable) @@ -140,6 +140,7 @@ signature (DictEntry argA argB) = "{"++signature argA ++ signature argB ++ "}" signature Variant{} = #{const_str DBUS_TYPE_VARIANT_AS_STRING} signature String{} = #{const_str DBUS_TYPE_STRING_AS_STRING}+signature (Struct args) = "{" ++ concatMap signature args ++ "}" signature arg = error $ "DBus.Message.signature: " ++ show arg decodeArgs iter@@ -159,6 +160,7 @@ #{const DBUS_TYPE_ARRAY} -> decodeArray iter #{const DBUS_TYPE_BOOLEAN}-> fmap Boolean getBasic #{const DBUS_TYPE_INVALID}-> return Invalid+ #{const DBUS_TYPE_STRUCT} -> decodeStruct iter _ -> error $ "Unknown argument type: " ++ show arg_type ++ " ("++show (chr arg_type)++")" where getBasic :: Storable a => IO a getBasic = alloca $ \ptr -> do@@ -194,6 +196,14 @@ fptr <- newForeignPtr_ byte_ptr return $ ByteString $ B.fromForeignPtr fptr 0 (fromIntegral len) +decodeStruct iter+ = withIter $ \sub ->+ do message_iter_recurse iter sub+ let fetch = do arg <- decodeArg sub+ has_next <- message_iter_next sub+ if has_next then fmap (arg:) fetch+ else return [arg]+ fmap Struct fetch encodeArg iter arg = case arg of