dbus/glib dbus-glib-tool.c, 1.13, 1.14 dbus-binding-tool-glib.h, 1.3, 1.4 dbus-binding-tool-glib.c, 1.7, 1.8

Colin Walters walters at freedesktop.org
Wed May 11 12:02:33 PDT 2005


Update of /cvs/dbus/dbus/glib
In directory gabe:/tmp/cvs-serv20911/glib

Modified Files:
	dbus-glib-tool.c dbus-binding-tool-glib.h 
	dbus-binding-tool-glib.c 
Log Message:
2005-05-11  Ross Burton  <ross at burtonini.com>

	* glib/dbus-glib-tool.c: Add --prefix argument.
	* glib/dbus-binding-tool-glib.h: Add prefix argument.
	* glib/dbus-binding-tool-glib.c (compute_marshaller_name):
	Add prefix argument.
	(generate_glue): Pass prefix argument down.
	(dbus_binding_tool_output_glib_server): Pass prefix to
	glib-genmarshal.


Index: dbus-glib-tool.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-glib-tool.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dbus-glib-tool.c	9 Apr 2005 23:50:58 -0000	1.13
+++ dbus-glib-tool.c	11 May 2005 19:02:31 -0000	1.14
@@ -265,6 +265,7 @@
 {
   const char *prev_arg;
   const char *output_file;
+  const char *prefix;
   char *output_file_tmp;
   int i;
   GSList *files;
@@ -291,6 +292,7 @@
   files = NULL;
   prev_arg = NULL;
   output_file = NULL;
+  prefix = "";
   ignore_unsupported = FALSE;
   force = FALSE;
   i = 1;
@@ -330,6 +332,10 @@
 	    {
 	      output_file = arg + 9;
 	    }
+          else if (strncmp (arg, "--prefix=", 9) == 0)
+            {
+              prefix = arg + 9;
+            }
           else if (arg[0] == '-' &&
                    arg[1] == '-' &&
                    arg[2] == '\0')
@@ -414,7 +420,7 @@
 	      pretty_print ((BaseInfo*) node, 0);
 	      break;
 	    case DBUS_BINDING_OUTPUT_GLIB_SERVER:
-	      if (!dbus_binding_tool_output_glib_server ((BaseInfo *) node, channel, &error))
+	      if (!dbus_binding_tool_output_glib_server ((BaseInfo *) node, channel, prefix, &error))
 		lose_gerror (_("Compilation failed"), error);
 	      break;
 	    case DBUS_BINDING_OUTPUT_GLIB_CLIENT:

Index: dbus-binding-tool-glib.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-binding-tool-glib.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-binding-tool-glib.h	12 Mar 2005 20:07:21 -0000	1.3
+++ dbus-binding-tool-glib.h	11 May 2005 19:02:31 -0000	1.4
@@ -28,7 +28,7 @@
 #define DBUS_GLIB_ANNOTATION_C_SYMBOL "org.freedesktop.DBus.GLib.CSymbol"
 
 gboolean dbus_binding_tool_output_glib_client (BaseInfo *info, GIOChannel *channel, gboolean ignore_unsupported, GError **error);
-gboolean dbus_binding_tool_output_glib_server (BaseInfo *info, GIOChannel *channel, GError **error);
+gboolean dbus_binding_tool_output_glib_server (BaseInfo *info, GIOChannel *channel, const char *prefix, GError **error);
 
 G_END_DECLS
 

Index: dbus-binding-tool-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-binding-tool-glib.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dbus-binding-tool-glib.c	9 Apr 2005 23:50:58 -0000	1.7
+++ dbus-binding-tool-glib.c	11 May 2005 19:02:31 -0000	1.8
@@ -34,11 +34,12 @@
 #include <string.h>
 #include <unistd.h>
 
-#define MARSHAL_PREFIX "dbus_glib_marshal"
+#define MARSHAL_PREFIX "dbus_glib_marshal_"
 
 typedef struct
 {
   gboolean ignore_unsupported;
+  const char* prefix;
   GIOChannel *channel;
   
   GError **error;
@@ -115,14 +116,16 @@
 }
 
 static char *
-compute_marshaller_name (MethodInfo *method, GError **error)
+compute_marshaller_name (MethodInfo *method, const char *prefix, GError **error)
 {
   GSList *elt;
   GString *ret;
 
   /* All methods required to return boolean for now;
    * will be conditional on method info later */
-  ret = g_string_new (MARSHAL_PREFIX "_BOOLEAN_");
+  ret = g_string_new (MARSHAL_PREFIX);
+  g_string_append (ret, prefix);
+  g_string_append (ret, "_BOOLEAN_");
 
   /* Append input arguments */
   for (elt = method_info_get_args (method); elt; elt = elt->next)
@@ -342,7 +345,7 @@
 					  method_c_name))
 	    goto io_lose;
 
-          marshaller_name = compute_marshaller_name (method, error);
+          marshaller_name = compute_marshaller_name (method, data->prefix, error);
 	  if (!marshaller_name)
 	    goto io_lose;
 
@@ -452,7 +455,7 @@
 }
 
 gboolean
-dbus_binding_tool_output_glib_server (BaseInfo *info, GIOChannel *channel, GError **error)
+dbus_binding_tool_output_glib_server (BaseInfo *info, GIOChannel *channel, const char *prefix, GError **error)
 {
   gboolean ret;
   GPtrArray *argv;
@@ -468,6 +471,7 @@
 
   memset (&data, 0, sizeof (data));
 
+  data.prefix = prefix;
   data.generated = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
   data.error = error;
   genmarshal_stdout = NULL;
@@ -501,7 +505,7 @@
   g_ptr_array_add (argv, "glib-genmarshal");
   g_ptr_array_add (argv, "--header");
   g_ptr_array_add (argv, "--body");
-  g_ptr_array_add (argv, "--prefix=" MARSHAL_PREFIX);
+  g_ptr_array_add (argv, g_strdup_printf ("--prefix=%s%s", MARSHAL_PREFIX, prefix));
   g_ptr_array_add (argv, tempfile_name);
   g_ptr_array_add (argv, NULL);
   if (!g_spawn_async_with_pipes (NULL, (char**)argv->pdata, NULL,



More information about the dbus-commit mailing list