dbus/dbus dbus-signature.h, 1.1, 1.2 dbus-signature.c, 1.2, 1.3 dbus-message.c, 1.166, 1.167 dbus-marshal-recursive.c, 1.48, 1.49 dbus-marshal-recursive-util.c, 1.8, 1.9 dbus-marshal-byteswap.c, 1.3, 1.4 dbus-marshal-basic.c, 1.25, 1.26 dbus-glib.h, 1.8, 1.9

Colin Walters walters at freedesktop.org
Wed Mar 9 09:09:13 PST 2005


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv11593/dbus

Modified Files:
	dbus-signature.h dbus-signature.c dbus-message.c 
	dbus-marshal-recursive.c dbus-marshal-recursive-util.c 
	dbus-marshal-byteswap.c dbus-marshal-basic.c dbus-glib.h 
Log Message:
2005-03-09  Colin Walters  <walters at verbum.org>

	* glib/dbus-gproxy.c (dbus_g_proxy_invoke): New method; calls
	to this are generated for client-side wrappers.  Invokes a
	D-BUS method and returns reply values.  

	* glib/dbus-binding-tool-glib.c (write_args_sig_for_direction): New
	function; writes signature string for argument direction.
	(write_args_for_direction): Change to pass input values directly
	instead of via address, and fix indentation.
	(generate_client_glue): Change to invoke dbus_g_proxy_invoke.  Also
	make generated wrappers inlineable.

	* dbus/dbus-message.c (dbus_message_iter_get_fixed_array): Add
	note about using dbus_type_is_fixed.

	* dbus/dbus-marshal-basic.c (_dbus_type_is_fixed): Moved to
	dbus/dbus-signature.c as dbus_type_is_fixed.

	All callers updated.

	* dbus/dbus-signature.c (dbus_type_is_fixed): Moved here
	from dbus/dbus-marshal-basic.c:_dbus_type_is_fixed.

	* dbus/dbus-signature.h: Prototype.

	* glib/dbus-binding-tool-glib.c (compute_marshaller_name): Fix
	error printf code.

	* test/glib/test-dbus-glib.c (main): Be sure to clear error as
	appropriate instead of just freeing it.
	(main): Free returned strings using g_free.

	* test/glib/Makefile.am (test-service-glib-glue.h)
	(test-service-glib-bindings.h): Add dependency on dbus-binding-tool.

	* glib/dbus-gvalue.c (MAP_BASIC): Refactored from MAP_BASIC_INIT;
	simply maps a simple D-BUS type to GType.
	(dbus_dbus_type_to_gtype): Function which maps D-BUS type to
	GType.
	(dbus_gvalue_init): Just invoke dbus_dbus_type_to_gtype and
	initialize the value with it.
	(dbus_gvalue_binding_type_from_type): Unused, delete.
	(dbus_gvalue_demarshal): Switch to hardcoding demarshalling for
	various types instead of unmarshalling to value data directly.
	Remove can_convert boolean.
	(dbus_gvalue_marshal): Remove duplicate initialization; switch to
	returning directly instead of using can_convert boolean.
	(dbus_gvalue_store): New function; not related to D-BUS per-se.
	Stores a GValue in a pointer to a value of its corresponding C
	type.

	* glib/dbus-gvalue.h: Remove dbus_gvalue_binding_type_from_type,
	add dbus_gvalue_store.


Index: dbus-signature.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-signature.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dbus-signature.h	24 Feb 2005 16:03:56 -0000	1.1
+++ dbus-signature.h	9 Mar 2005 17:09:11 -0000	1.2
@@ -65,6 +65,7 @@
 
 dbus_bool_t     dbus_type_is_basic                   (int            typecode);
 dbus_bool_t     dbus_type_is_container               (int            typecode);
+dbus_bool_t     dbus_type_is_fixed                   (int            typecode);
 
 DBUS_END_DECLS
 

Index: dbus-signature.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-signature.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbus-signature.c	24 Feb 2005 18:37:16 -0000	1.2
+++ dbus-signature.c	9 Mar 2005 17:09:11 -0000	1.3
@@ -262,6 +262,36 @@
   return !(typecode == DBUS_TYPE_INVALID || TYPE_IS_CONTAINER (typecode));
 }
 
+/**
+ * Tells you whether values of this type can change length if you set
+ * them to some other value. For this purpose, you assume that the
+ * first byte of the old and new value would be in the same location,
+ * so alignment padding is not a factor.
+ *
+ * This function is useful to determine whether #dbus_message_iter_get_fixed_array
+ * may be used.
+ *
+ * @returns #FALSE if the type can occupy different lengths
+ */
+dbus_bool_t
+dbus_type_is_fixed (int typecode)
+{
+  switch (typecode)
+    {
+    case DBUS_TYPE_BYTE:
+    case DBUS_TYPE_BOOLEAN:
+    case DBUS_TYPE_INT16:
+    case DBUS_TYPE_UINT16:
+    case DBUS_TYPE_INT32:
+    case DBUS_TYPE_UINT32:
+    case DBUS_TYPE_INT64:
+    case DBUS_TYPE_UINT64:
+    case DBUS_TYPE_DOUBLE:
+      return TRUE;
+    default:
+      return FALSE;
+    }
+}
 
 #ifdef DBUS_BUILD_TESTS
 

Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- dbus-message.c	25 Feb 2005 22:03:30 -0000	1.166
+++ dbus-message.c	9 Mar 2005 17:09:11 -0000	1.167
@@ -1270,7 +1270,7 @@
                                                  &array))
             goto failed;
           
-          if (_dbus_type_is_fixed (element_type))
+          if (dbus_type_is_fixed (element_type))
             {
               const DBusBasicValue **value;
               int n_elements;
@@ -1676,6 +1676,9 @@
  * such as integers, bool, double. The block read will be from the
  * current position in the array until the end of the array.
  *
+ * This function should only be used if #dbus_type_is_fixed returns
+ * #TRUE for the element type.
+ *
  * The value argument should be the address of a location to store the
  * returned array. So for int32 it should be a "const dbus_int32_t**"
  * The returned value is by reference and should not be freed.
@@ -1693,7 +1696,7 @@
 
   _dbus_return_if_fail (_dbus_message_iter_check (real));
   _dbus_return_if_fail (value != NULL);
-  _dbus_return_if_fail (_dbus_type_is_fixed (_dbus_type_reader_get_element_type (&real->u.reader)));
+  _dbus_return_if_fail (dbus_type_is_fixed (_dbus_type_reader_get_element_type (&real->u.reader)));
 
   _dbus_type_reader_read_fixed_multi (&real->u.reader,
                                       value, n_elements);
@@ -1778,7 +1781,7 @@
               goto out;
             }
 
-          if (_dbus_type_is_fixed (spec_element_type))
+          if (dbus_type_is_fixed (spec_element_type))
             {
               ptr = va_arg (var_args, const DBusBasicValue**);
               n_elements_p = va_arg (var_args, int*);
@@ -2138,7 +2141,7 @@
 
   _dbus_return_val_if_fail (_dbus_message_iter_append_check (real), FALSE);
   _dbus_return_val_if_fail (real->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER, FALSE);
-  _dbus_return_val_if_fail (_dbus_type_is_fixed (element_type), FALSE);
+  _dbus_return_val_if_fail (dbus_type_is_fixed (element_type), FALSE);
   _dbus_return_val_if_fail (real->u.writer.container_type == DBUS_TYPE_ARRAY, FALSE);
   _dbus_return_val_if_fail (value != NULL, FALSE);
   _dbus_return_val_if_fail (n_elements >= 0, FALSE);

Index: dbus-marshal-recursive.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-recursive.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- dbus-marshal-recursive.c	24 Feb 2005 16:03:56 -0000	1.48
+++ dbus-marshal-recursive.c	9 Mar 2005 17:09:11 -0000	1.49
@@ -1018,7 +1018,7 @@
                                                 reader->type_pos);
 
   _dbus_assert (element_type != DBUS_TYPE_INVALID); /* why we don't use get_current_type() */
-  _dbus_assert (_dbus_type_is_fixed (element_type));
+  _dbus_assert (dbus_type_is_fixed (element_type));
 
   alignment = _dbus_type_get_alignment (element_type);
 
@@ -1464,7 +1464,7 @@
 
   _dbus_assert (dbus_type_is_basic (current_type));
 
-  if (_dbus_type_is_fixed (current_type))
+  if (dbus_type_is_fixed (current_type))
     {
       reader_set_basic_fixed_length (reader, current_type, value);
       return TRUE;
@@ -2404,7 +2404,7 @@
 
 /**
  * Writes a block of fixed-length basic values, i.e. those that are
- * both _dbus_type_is_fixed() and _dbus_type_is_basic(). The block
+ * both dbus_type_is_fixed() and _dbus_type_is_basic(). The block
  * must be written inside an array.
  *
  * The value parameter should be the address of said array of values,
@@ -2423,7 +2423,7 @@
                                      int                    n_elements)
 {
   _dbus_assert (writer->container_type == DBUS_TYPE_ARRAY);
-  _dbus_assert (_dbus_type_is_fixed (element_type));
+  _dbus_assert (dbus_type_is_fixed (element_type));
   _dbus_assert (writer->type_pos_is_expectation);
   _dbus_assert (n_elements >= 0);
 

Index: dbus-marshal-recursive-util.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-recursive-util.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dbus-marshal-recursive-util.c	24 Feb 2005 16:03:56 -0000	1.8
+++ dbus-marshal-recursive-util.c	9 Mar 2005 17:09:11 -0000	1.9
@@ -3074,7 +3074,7 @@
     goto oom;
 
   if (arrays_write_fixed_in_blocks &&
-      _dbus_type_is_fixed (element_type) &&
+      dbus_type_is_fixed (element_type) &&
       child->klass->write_multi)
     {
       if (!node_write_multi (child, block, &sub, seed, n_copies))
@@ -3138,7 +3138,7 @@
       _dbus_type_reader_recurse (reader, &sub);
 
       if (realign_root == NULL && arrays_write_fixed_in_blocks &&
-          _dbus_type_is_fixed (_dbus_type_reader_get_element_type (reader)) &&
+          dbus_type_is_fixed (_dbus_type_reader_get_element_type (reader)) &&
           child->klass->read_multi)
         {
           if (!node_read_multi (child, &sub, seed, n_copies))

Index: dbus-marshal-byteswap.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-byteswap.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-marshal-byteswap.c	28 Jan 2005 05:30:53 -0000	1.3
+++ dbus-marshal-byteswap.c	9 Mar 2005 17:09:11 -0000	1.4
@@ -23,6 +23,7 @@
 
 #include "dbus-marshal-byteswap.h"
 #include "dbus-marshal-basic.h"
+#include "dbus-signature.h"
 
 /**
  * @addtogroup DBusMarshal
@@ -103,7 +104,7 @@
 
                 p = _DBUS_ALIGN_ADDRESS (p, alignment);
                 
-                if (_dbus_type_is_fixed (elem_type))
+                if (dbus_type_is_fixed (elem_type))
                   {
                     if (alignment > 1)
                       _dbus_swap_array (p, array_len / alignment, alignment);

Index: dbus-marshal-basic.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-basic.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dbus-marshal-basic.c	24 Feb 2005 16:03:56 -0000	1.25
+++ dbus-marshal-basic.c	9 Mar 2005 17:09:11 -0000	1.26
@@ -620,7 +620,7 @@
   int array_len;
   int alignment;
 
-  _dbus_assert (_dbus_type_is_fixed (element_type));
+  _dbus_assert (dbus_type_is_fixed (element_type));
   _dbus_assert (dbus_type_is_basic (element_type));
 
 #if 0
@@ -1054,7 +1054,7 @@
 
 /**
  * Marshals a block of values of fixed-length type all at once, as an
- * optimization.  _dbus_type_is_fixed() returns #TRUE for fixed-length
+ * optimization.  dbus_type_is_fixed() returns #TRUE for fixed-length
  * types, which are the basic types minus the string-like types.
  *
  * The value argument should be the adddress of an
@@ -1080,7 +1080,7 @@
 {
   const void* vp = *(const DBusBasicValue**)value;
   
-  _dbus_assert (_dbus_type_is_fixed (element_type));
+  _dbus_assert (dbus_type_is_fixed (element_type));
   _dbus_assert (n_elements >= 0);
 
 #if 0
@@ -1299,34 +1299,6 @@
 }
 
 /**
- * Tells you whether values of this type can change length if you set
- * them to some other value. For this purpose, you assume that the
- * first byte of the old and new value would be in the same location,
- * so alignment padding is not a factor.
- *
- * @returns #FALSE if the type can occupy different lengths
- */
-dbus_bool_t
-_dbus_type_is_fixed (int typecode)
-{
-  switch (typecode)
-    {
-    case DBUS_TYPE_BYTE:
-    case DBUS_TYPE_BOOLEAN:
-    case DBUS_TYPE_INT16:
-    case DBUS_TYPE_UINT16:
-    case DBUS_TYPE_INT32:
-    case DBUS_TYPE_UINT32:
-    case DBUS_TYPE_INT64:
-    case DBUS_TYPE_UINT64:
-    case DBUS_TYPE_DOUBLE:
-      return TRUE;
-    default:
-      return FALSE;
-    }
-}
-
-/**
  * Returns a string describing the given type.
  *
  * @param typecode the type to describe

Index: dbus-glib.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-glib.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dbus-glib.h	17 Feb 2005 17:41:28 -0000	1.8
+++ dbus-glib.h	9 Mar 2005 17:09:11 -0000	1.9
@@ -174,6 +174,13 @@
 
 const char*       dbus_g_proxy_get_bus_name          (DBusGProxy        *proxy);
 
+gboolean          dbus_g_proxy_invoke                (DBusGProxy        *proxy,
+						      const char        *method,
+						      const char        *insig,
+						      const char        *outsig,
+						      GError           **error,
+						      ...);
+
 #undef DBUS_INSIDE_DBUS_GLIB_H
 
 G_END_DECLS



More information about the dbus-commit mailing list