From 34cf164aa28c45c15ecf39b855f2de833a9b7c2d Mon Sep 17 00:00:00 2001 From: TingPing Date: Wed, 5 Feb 2014 20:42:48 -0500 Subject: [PATCH] Use a single marshal file for entire project --- .gitignore | 2 +- src/common/Makefile.am | 13 ++- src/common/common.vcxproj | 11 ++- src/common/common.vcxproj.filters | 9 ++ src/common/dbus/Makefile.am | 7 +- src/common/dbus/dbus-plugin.c | 8 +- src/common/dbus/example.c | 4 +- src/common/dbus/marshallers.list | 1 - src/common/marshalers.list | 8 ++ src/fe-gtk/Makefile.am | 14 +-- src/fe-gtk/fe-gtk.vcxproj | 8 +- src/fe-gtk/fe-gtk.vcxproj.filters | 7 +- src/fe-gtk/sexy-marshal.c | 146 ------------------------------ src/fe-gtk/sexy-marshal.h | 45 --------- src/fe-gtk/sexy-spell-entry.c | 4 +- src/fe-gtk/xtext.c | 6 +- src/fe-gtk/xtext_marshalers.list | 2 - 17 files changed, 55 insertions(+), 240 deletions(-) delete mode 100644 src/common/dbus/marshallers.list create mode 100644 src/common/marshalers.list delete mode 100644 src/fe-gtk/sexy-marshal.c delete mode 100644 src/fe-gtk/sexy-marshal.h delete mode 100644 src/fe-gtk/xtext_marshalers.list diff --git a/.gitignore b/.gitignore index a82e37f5..c63a691d 100644 --- a/.gitignore +++ b/.gitignore @@ -41,10 +41,10 @@ osx/Info.plist data/pkgconfig/hexchat-plugin.pc data/misc/hexchat.appdata.xml src/common/dbus/example -src/common/dbus/marshallers.h src/common/dbus/org.hexchat.service.service src/common/dbus/remote-object-glue.h src/common/make-te +src/common/marshal.* src/common/textenums.h src/common/textevents.h src/fe-gtk/hexchat diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 9c2d443e..8a177fa9 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -62,7 +62,7 @@ endif noinst_PROGRAMS = make-te libhexchatcommon_a_SOURCES = cfgfiles.c chanopt.c ctcp.c dcc.c hexchat.c \ - history.c ignore.c inbound.c modes.c $(msproxy_c) network.c notify.c \ + history.c ignore.c inbound.c marshal.c modes.c $(msproxy_c) network.c notify.c \ outbound.c plugin.c plugin-timer.c proto-irc.c server.c servlist.c \ $(ssl_c) text.c tree.c url.c userlist.c util.c libhexchatcommon_a_CFLAGS = $(LIBPROXY_CFLAGS) @@ -72,4 +72,13 @@ textenums.h: textevents.h textevents.h: textevents.in make-te $(AM_V_GEN) ./make-te < textevents.in > textevents.h 2> textenums.h -BUILT_SOURCES = textenums.h textevents.h +marshal.h: marshalers.list + $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_hexchat_marshal --header $(srcdir)/marshalers.list > $@ + +marshal.c: marshalers.list + $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_hexchat_marshal --body $(srcdir)/marshalers.list > $@ + + +BUILT_SOURCES = textenums.h textevents.h marshal.c marshal.h + +CLEANFILES = $(BUILT_SOURCES) diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj index 720faae7..17a8d829 100644 --- a/src/common/common.vcxproj +++ b/src/common/common.vcxproj @@ -24,6 +24,7 @@ + @@ -56,6 +57,7 @@ + @@ -156,15 +158,16 @@ - - - +"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --header "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.h" +"$(DepsRoot)\bin\glib-genmarshal.exe" --prefix=_hexchat_marshal --body "$(ProjectDir)marshalers.list" > "$(ProjectDir)marshal.c" + + ]]> \ No newline at end of file diff --git a/src/common/common.vcxproj.filters b/src/common/common.vcxproj.filters index d543992d..800d8daa 100644 --- a/src/common/common.vcxproj.filters +++ b/src/common/common.vcxproj.filters @@ -110,6 +110,9 @@ Header Files + + Header Files + @@ -187,5 +190,11 @@ Source Files + + Source Files + + + + \ No newline at end of file diff --git a/src/common/dbus/Makefile.am b/src/common/dbus/Makefile.am index bad6f611..4fa30452 100644 --- a/src/common/dbus/Makefile.am +++ b/src/common/dbus/Makefile.am @@ -7,12 +7,10 @@ libhexchatdbus_a_SOURCES = \ EXTRA_DIST = \ remote-object.xml \ - marshallers.list \ example.py \ org.hexchat.service.service.in BUILT_SOURCES = \ - marshallers.h \ remote-object-glue.h CLEANFILES = $(BUILT_SOURCES) @@ -20,15 +18,12 @@ CLEANFILES = $(BUILT_SOURCES) AM_CPPFLAGS = $(COMMON_CFLAGS) $(DBUS_CFLAGS) noinst_PROGRAMS = example -example_SOURCES = example.c +example_SOURCES = example.c example_LDADD = $(DBUS_LIBS) $(GLIB_LIBS) remote-object-glue.h: remote-object.xml $(AM_V_GEN) $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) --prefix=remote_object --mode=glib-server --output=$@ $< -marshallers.h: marshallers.list - $(AM_V_GEN) $(LIBTOOL) --mode=execute $(GLIB_GENMARSHAL) --header --body $< > $@ - # Dbus service file servicedir = $(DBUS_SERVICES_DIR) service_in_files = org.hexchat.service.service.in diff --git a/src/common/dbus/dbus-plugin.c b/src/common/dbus/dbus-plugin.c index 62b83bb1..ce079982 100644 --- a/src/common/dbus/dbus-plugin.c +++ b/src/common/dbus/dbus-plugin.c @@ -241,7 +241,7 @@ static gboolean remote_object_send_modes (RemoteObject *obj, GError **error); #include "remote-object-glue.h" -#include "marshallers.h" +#include "../marshal.h" /* Useful functions */ @@ -317,7 +317,7 @@ remote_object_class_init (RemoteObjectClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_user_marshal_VOID__POINTER_POINTER_UINT_UINT, + _hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT, G_TYPE_NONE, 4, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT); @@ -327,7 +327,7 @@ remote_object_class_init (RemoteObjectClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_user_marshal_VOID__POINTER_POINTER_UINT_UINT, + _hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT, G_TYPE_NONE, 4, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT); @@ -337,7 +337,7 @@ remote_object_class_init (RemoteObjectClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_user_marshal_VOID__POINTER_POINTER_UINT_UINT, + _hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT, G_TYPE_NONE, 3, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT); diff --git a/src/common/dbus/example.c b/src/common/dbus/example.c index ee1833d3..c3ad4ff3 100644 --- a/src/common/dbus/example.c +++ b/src/common/dbus/example.c @@ -22,7 +22,7 @@ #include #include #include -#include "marshallers.h" +#include "../marshal.c" #define DBUS_SERVICE "org.hexchat.service" #define DBUS_REMOTE "/org/hexchat/Remote" @@ -159,7 +159,7 @@ main (int argc, char **argv) g_print ("Server hook id=%d\n", server_id); dbus_g_object_register_marshaller ( - g_cclosure_user_marshal_VOID__POINTER_POINTER_UINT_UINT, + _hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT, G_TYPE_NONE, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID); diff --git a/src/common/dbus/marshallers.list b/src/common/dbus/marshallers.list deleted file mode 100644 index bc3c4ad5..00000000 --- a/src/common/dbus/marshallers.list +++ /dev/null @@ -1 +0,0 @@ -VOID:POINTER,POINTER,UINT,UINT diff --git a/src/common/marshalers.list b/src/common/marshalers.list new file mode 100644 index 00000000..0cafca81 --- /dev/null +++ b/src/common/marshalers.list @@ -0,0 +1,8 @@ +# xtext +VOID:OBJECT,OBJECT +VOID:POINTER,POINTER +# sexy-entry +BOOLEAN:STRING +OBJECT:OBJECT,OBJECT +# dbus-plugin & dbus-example +VOID:POINTER,POINTER,UINT,UINT diff --git a/src/fe-gtk/Makefile.am b/src/fe-gtk/Makefile.am index 07f2ffc0..4ce02dbc 100644 --- a/src/fe-gtk/Makefile.am +++ b/src/fe-gtk/Makefile.am @@ -11,10 +11,10 @@ EXTRA_DIST = \ chanview-tree.c custom-list.h editlist.h fe-gtk.h fkeys.h gtkutil.h joind.h \ maingui.h menu.h notifygui.h palette.h pixmaps.h \ plugin-tray.h plugingui.c plugingui.h rawlog.h sexy-iso-codes.h \ - sexy-spell-entry.h sexy-marshal.h textgui.h urlgrab.h userlistgui.h xtext.h \ + sexy-spell-entry.h textgui.h urlgrab.h userlistgui.h xtext.h \ ../../data/hexchat.gresource.xml -BUILT_SOURCES = resources.c xtext_marshalers.h xtext_marshalers.c +BUILT_SOURCES = resources.c CLEANFILES = $(BUILT_SOURCES) @@ -29,14 +29,8 @@ endif hexchat_SOURCES = ascii.c banlist.c chanlist.c chanview.c custom-list.c \ dccgui.c editlist.c fe-gtk.c fkeys.c gtkutil.c ignoregui.c joind.c menu.c \ maingui.c notifygui.c palette.c pixmaps.c plugin-tray.c $(plugingui_c) \ - rawlog.c resources.c servlistgui.c setup.c $(iso_codes_c) sexy-marshal.c \ - sexy-spell-entry.c textgui.c urlgrab.c userlistgui.c xtext.c xtext_marshalers.c + rawlog.c resources.c servlistgui.c setup.c $(iso_codes_c) \ + sexy-spell-entry.c textgui.c urlgrab.c userlistgui.c xtext.c resources.c: ../../data/hexchat.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=../../data --generate-dependencies ../../data/hexchat.gresource.xml) $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../../data --generate-source $< - -xtext_marshalers.h: xtext_marshalers.list - $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_xtext_marshal --header $(srcdir)/xtext_marshalers.list > $@ - -xtext_marshalers.c: xtext_marshalers.list - $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_xtext_marshal --body $(srcdir)/xtext_marshalers.list > $@ diff --git a/src/fe-gtk/fe-gtk.vcxproj b/src/fe-gtk/fe-gtk.vcxproj index 6b6301b2..f5e2dace 100644 --- a/src/fe-gtk/fe-gtk.vcxproj +++ b/src/fe-gtk/fe-gtk.vcxproj @@ -97,15 +97,13 @@ - - - + ]]> Build hexchat.rc and gresource file @@ -131,7 +129,6 @@ powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.u - @@ -163,7 +160,6 @@ powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.u - diff --git a/src/fe-gtk/fe-gtk.vcxproj.filters b/src/fe-gtk/fe-gtk.vcxproj.filters index eb6e2281..4598b1f2 100644 --- a/src/fe-gtk/fe-gtk.vcxproj.filters +++ b/src/fe-gtk/fe-gtk.vcxproj.filters @@ -72,9 +72,6 @@ Header Files - - Header Files - Header Files @@ -167,9 +164,6 @@ Source Files - - Source Files - Source Files @@ -203,6 +197,7 @@ Resource Files + diff --git a/src/fe-gtk/sexy-marshal.c b/src/fe-gtk/sexy-marshal.c deleted file mode 100644 index 363842ca..00000000 --- a/src/fe-gtk/sexy-marshal.c +++ /dev/null @@ -1,146 +0,0 @@ -/* libsexy - * Copyright (C) 2005-2006 Christian Hammond. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include - - -#ifdef G_ENABLE_DEBUG -#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) -#define g_marshal_value_peek_char(v) g_value_get_char (v) -#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) -#define g_marshal_value_peek_int(v) g_value_get_int (v) -#define g_marshal_value_peek_uint(v) g_value_get_uint (v) -#define g_marshal_value_peek_long(v) g_value_get_long (v) -#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) -#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) -#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) -#define g_marshal_value_peek_enum(v) g_value_get_enum (v) -#define g_marshal_value_peek_flags(v) g_value_get_flags (v) -#define g_marshal_value_peek_float(v) g_value_get_float (v) -#define g_marshal_value_peek_double(v) g_value_get_double (v) -#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) -#define g_marshal_value_peek_param(v) g_value_get_param (v) -#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) -#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) -#define g_marshal_value_peek_object(v) g_value_get_object (v) -#else /* !G_ENABLE_DEBUG */ -/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. - * Do not access GValues directly in your code. Instead, use the - * g_value_get_*() functions - */ -#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int -#define g_marshal_value_peek_char(v) (v)->data[0].v_int -#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint -#define g_marshal_value_peek_int(v) (v)->data[0].v_int -#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint -#define g_marshal_value_peek_long(v) (v)->data[0].v_long -#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 -#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 -#define g_marshal_value_peek_enum(v) (v)->data[0].v_long -#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_float(v) (v)->data[0].v_float -#define g_marshal_value_peek_double(v) (v)->data[0].v_double -#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer -#endif /* !G_ENABLE_DEBUG */ - - -/* BOOLEAN:STRING (./marshal.list:1) */ -void -sexy_marshal_BOOLEAN__STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__STRING) (gpointer data1, - gpointer arg_1, - gpointer data2); - register GMarshalFunc_BOOLEAN__STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 2); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__STRING) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_string (param_values + 1), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* OBJECT:OBJECT,OBJECT (./marshal.list:2) */ -void -sexy_marshal_OBJECT__OBJECT_OBJECT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef GObject* (*GMarshalFunc_OBJECT__OBJECT_OBJECT) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_OBJECT__OBJECT_OBJECT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - GObject* v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_OBJECT__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_object (param_values + 1), - g_marshal_value_peek_object (param_values + 2), - data2); - - g_value_take_object (return_value, v_return); -} - diff --git a/src/fe-gtk/sexy-marshal.h b/src/fe-gtk/sexy-marshal.h deleted file mode 100644 index aa560767..00000000 --- a/src/fe-gtk/sexy-marshal.h +++ /dev/null @@ -1,45 +0,0 @@ -/* libsexy - * Copyright (C) 2005-2006 Christian Hammond. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef __sexy_marshal_MARSHAL_H__ -#define __sexy_marshal_MARSHAL_H__ - -#include - -G_BEGIN_DECLS - -/* BOOLEAN:STRING (./marshal.list:1) */ -extern void sexy_marshal_BOOLEAN__STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* OBJECT:OBJECT,OBJECT (./marshal.list:2) */ -extern void sexy_marshal_OBJECT__OBJECT_OBJECT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -G_END_DECLS - -#endif /* __sexy_marshal_MARSHAL_H__ */ - diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index e7d54777..db52eecb 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -31,7 +31,7 @@ #include #include #include "sexy-iso-codes.h" -#include "sexy-marshal.h" +#include "../common/marshal.h" #ifdef WIN32 #include "../common/typedef.h" @@ -237,7 +237,7 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(SexySpellEntryClass, word_check), (GSignalAccumulator) spell_accumulator, NULL, - sexy_marshal_BOOLEAN__STRING, + _hexchat_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); } diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 53658b09..6a6b1215 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -42,10 +42,10 @@ #include "../common/util.h" #include "../common/hexchatc.h" #include "../common/url.h" +#include "../common/marshal.h" #include "fe-gtk.h" #include "xtext.h" #include "fkeys.h" -#include "xtext_marshalers.h" #define charlen(str) g_utf8_skip[*(guchar *)(str)] @@ -2260,7 +2260,7 @@ gtk_xtext_class_init (GtkXTextClass * class) G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkXTextClass, word_click), NULL, NULL, - _xtext_marshal_VOID__POINTER_POINTER, + _hexchat_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); xtext_signals[SET_SCROLL_ADJUSTMENTS] = @@ -2269,7 +2269,7 @@ gtk_xtext_class_init (GtkXTextClass * class) G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkXTextClass, set_scroll_adjustments), NULL, NULL, - _xtext_marshal_VOID__OBJECT_OBJECT, + _hexchat_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); diff --git a/src/fe-gtk/xtext_marshalers.list b/src/fe-gtk/xtext_marshalers.list deleted file mode 100644 index 2f708bb3..00000000 --- a/src/fe-gtk/xtext_marshalers.list +++ /dev/null @@ -1,2 +0,0 @@ -VOID:OBJECT,OBJECT -VOID:POINTER,POINTER