dbus/bus driver.c,1.68,1.69 Makefile.am,1.34,1.35

Colin Walters walters at freedesktop.org
Sat Mar 12 12:07:23 PST 2005


Update of /cvs/dbus/dbus/bus
In directory gabe:/tmp/cvs-serv23478/bus

Modified Files:
	driver.c Makefile.am 
Log Message:
2005-03-12  Colin Walters  <walters at verbum.org>

	* bus/driver.c (write_args_for_direction): New function,
	parses a type signature into arguments and outputs to
	XML.
	(bus_driver_handle_introspect): Use it instead of
	hardcoding XML for certain signatures.
	
	* bus/Makefile.am (dbus-bus-introspect.xml): Add
	dependency on dbus-daemon.

	* glib/dbus-glib-tool.c (main): Parse ignore_unsupported
	argument, pass it to dbus_binding_tool_output_glib_client.

	* glib/dbus-binding-tool-glib.c
	(generate_client_glue): Protect against multiple inclusion.
	(dbus_binding_tool_output_glib_client): Add
	G_BEGIN_DECLS/G_END_DECLS.

	* glib/dbus-binding-tool-glib.c (compute_client_method_name):
	Change to just take iface prefix directly.
	(write_formal_parameters): Clarify error message.
	(check_supported_parameters): New function; checks to see type
	signatures of method parameters are supported.
	(generate_client_glue): Handle ignore_unsupported flag.
	(dbus_binding_tool_output_glib_client): Handle ignore_unsupported
	parameter.

	* glib/Makefile.am (dbus-glib-bindings.h): Pass
	--ignore-unsupported by default until glib bindings
	support arrays.


Index: driver.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/driver.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- driver.c	12 Mar 2005 16:33:00 -0000	1.68
+++ driver.c	12 Mar 2005 20:07:21 -0000	1.69
@@ -31,6 +31,7 @@
 #include "utils.h"
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-marshal-recursive.h>
 #include <string.h>
 
 static dbus_bool_t bus_driver_send_welcome_message (DBusConnection *connection,
@@ -1099,6 +1100,34 @@
 };
 
 static dbus_bool_t
+write_args_for_direction (DBusString *xml,
+			  const char *signature,
+			  dbus_bool_t in)
+{
+  DBusTypeReader typereader;
+  DBusString sigstr;
+  int current_type;
+  
+  _dbus_string_init_const (&sigstr, signature);
+  _dbus_type_reader_init_types_only (&typereader, &sigstr, 0);
+      
+  while ((current_type = _dbus_type_reader_get_current_type (&typereader)) != DBUS_TYPE_INVALID)
+    {
+      const DBusString *subsig;
+      int start, len;
+
+      _dbus_type_reader_get_signature (&typereader, &subsig, &start, &len);
+      if (!_dbus_string_append_printf (xml, "      <arg direction=\"%s\" type=\"%s\"/>\n", in ? "in" : "out", _dbus_string_get_const_data_len (subsig, start, len)))
+	goto oom;
+
+      _dbus_type_reader_next (&typereader);
+    }
+  return TRUE;
+ oom:
+  return FALSE;
+}
+
+static dbus_bool_t
 bus_driver_handle_introspect (DBusConnection *connection,
                               BusTransaction *transaction,
                               DBusMessage    *message,
@@ -1150,73 +1179,19 @@
   i = 0;
   while (i < _DBUS_N_ELEMENTS (message_handlers))
     {
+	  
       if (!_dbus_string_append_printf (&xml, "    <method name=\"%s\">\n",
                                        message_handlers[i].name))
         goto oom;
 
-      /* This hacky mess can probably get mopped up eventually when the
-       * introspection format is related to the signature format
-       */
-      
-      if (strcmp (message_handlers[i].in_args, "") == 0)
-        ;
-      else if (strcmp (message_handlers[i].in_args,
-                       DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING) == 0)
-        {
-          if (!_dbus_string_append_printf (&xml, "      <arg direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING))
-            goto oom;
-          if (!_dbus_string_append_printf (&xml, "      <arg direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_UINT32_AS_STRING))
-            goto oom;
-        }
-      else if (strcmp (message_handlers[i].in_args,
-                       DBUS_TYPE_STRING_AS_STRING) == 0)
-        {
-          if (!_dbus_string_append_printf (&xml, "      <arg direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING))
-            goto oom;
-        }
-      else
-        {
-          _dbus_warn ("Lack introspection code for in sig '%s'\n",
-                      message_handlers[i].in_args);
-          _dbus_assert_not_reached ("FIXME introspection missing");
-        }
+      if (!write_args_for_direction (&xml, message_handlers[i].in_args, TRUE))
+	goto oom;
+
+      if (!write_args_for_direction (&xml, message_handlers[i].out_args, FALSE))
+	goto oom;
 
-      if (strcmp (message_handlers[i].out_args, "") == 0)
-        ;
-      else if (strcmp (message_handlers[i].out_args,
-                       DBUS_TYPE_STRING_AS_STRING) == 0)
-        {
-          if (!_dbus_string_append_printf (&xml, "      <arg direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING))
-            goto oom;
-        }
-      else if (strcmp (message_handlers[i].out_args,
-                       DBUS_TYPE_BOOLEAN_AS_STRING) == 0)
-        {
-          if (!_dbus_string_append_printf (&xml, "      <arg direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_BOOLEAN_AS_STRING))
-            goto oom;
-        }
-      else if (strcmp (message_handlers[i].out_args,
-                       DBUS_TYPE_UINT32_AS_STRING) == 0)
-        {
-          if (!_dbus_string_append_printf (&xml, "      <arg direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_UINT32_AS_STRING))
-            goto oom;
-        }
-      else if (strcmp (message_handlers[i].out_args,
-                       DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING) == 0)
-        {
-          /* FIXME introspection format doesn't handle arrays yet */
-          if (!_dbus_string_append_printf (&xml, "      <arg direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING))
-            goto oom;
-        }
-      else
-        {
-          _dbus_warn ("Lack introspection code for out sig '%s'\n",
-                      message_handlers[i].out_args);
-          _dbus_assert_not_reached ("FIXME introspection missing");
-        }
-      
       if (!_dbus_string_append (&xml, "    </method>\n"))
-        goto oom;
+	goto oom;
       
       ++i;
     }

Index: Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/bus/Makefile.am,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- Makefile.am	12 Mar 2005 16:33:00 -0000	1.34
+++ Makefile.am	12 Mar 2005 20:07:21 -0000	1.35
@@ -92,7 +92,7 @@
 
 all-local: dbus-bus-introspect.xml
 
-dbus-bus-introspect.xml: $(srcdir)/run-with-tmp-session-bus.sh
+dbus-bus-introspect.xml: $(srcdir)/run-with-tmp-session-bus.sh dbus-daemon
 	DBUS_TOP_BUILDDIR=$(top_builddir) $(srcdir)/run-with-tmp-session-bus.sh ./print-introspect org.freedesktop.DBus /org/freedesktop/DBus > dbus-bus-introspect.xml.tmp && mv dbus-bus-introspect.xml.tmp dbus-bus-introspect.xml
 
 ## mop up the gcov files



More information about the dbus-commit mailing list