diff options
author | Colin Walters <walters@verbum.org> | 2005-05-11 19:02:31 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2005-05-11 19:02:31 +0000 |
commit | ad5bafed044278dac991924dcde2a49cc2850b26 (patch) | |
tree | 5b3816ae4d5573b305fee74528642bd22ac8342c /glib | |
parent | 3fa4c2f4044bc06a9ce166a4f44d7b0a54ed4843 (diff) |
2005-05-11 Ross Burton <ross@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.
Diffstat (limited to 'glib')
-rw-r--r-- | glib/dbus-binding-tool-glib.c | 16 | ||||
-rw-r--r-- | glib/dbus-binding-tool-glib.h | 2 | ||||
-rw-r--r-- | glib/dbus-glib-tool.c | 8 |
3 files changed, 18 insertions, 8 deletions
diff --git a/glib/dbus-binding-tool-glib.c b/glib/dbus-binding-tool-glib.c index 75e2c733..3c86d81f 100644 --- a/glib/dbus-binding-tool-glib.c +++ b/glib/dbus-binding-tool-glib.c @@ -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 @@ compute_marshaller (MethodInfo *method, GError **error) } 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 @@ generate_glue (BaseInfo *base, DBusBindingToolCData *data, GError **error) 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 @@ write_marshaller (gpointer key, gpointer value, gpointer user_data) } 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 @@ dbus_binding_tool_output_glib_server (BaseInfo *info, GIOChannel *channel, GErro 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 @@ dbus_binding_tool_output_glib_server (BaseInfo *info, GIOChannel *channel, GErro 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, diff --git a/glib/dbus-binding-tool-glib.h b/glib/dbus-binding-tool-glib.h index 411c024e..9988df29 100644 --- a/glib/dbus-binding-tool-glib.h +++ b/glib/dbus-binding-tool-glib.h @@ -28,7 +28,7 @@ G_BEGIN_DECLS #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 diff --git a/glib/dbus-glib-tool.c b/glib/dbus-glib-tool.c index 1be0be7e..53ae42b2 100644 --- a/glib/dbus-glib-tool.c +++ b/glib/dbus-glib-tool.c @@ -265,6 +265,7 @@ main (int argc, char **argv) { const char *prev_arg; const char *output_file; + const char *prefix; char *output_file_tmp; int i; GSList *files; @@ -291,6 +292,7 @@ main (int argc, char **argv) files = NULL; prev_arg = NULL; output_file = NULL; + prefix = ""; ignore_unsupported = FALSE; force = FALSE; i = 1; @@ -330,6 +332,10 @@ main (int argc, char **argv) { 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 @@ main (int argc, char **argv) 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: |