Use a single marshal file for entire project

This commit is contained in:
TingPing 2014-02-05 20:42:48 -05:00
parent 5f7321280e
commit 34cf164aa2
17 changed files with 55 additions and 240 deletions

2
.gitignore vendored
View File

@ -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

View File

@ -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)

View File

@ -24,6 +24,7 @@
<ClInclude Include="ignore.h" />
<ClInclude Include="inbound.h" />
<ClInclude Include="inet.h" />
<ClInclude Include="marshal.h" />
<ClInclude Include="modes.h" />
<ClInclude Include="msproxy.h" />
<ClInclude Include="network.h" />
@ -56,6 +57,7 @@
<ClCompile Include="identd.c" />
<ClCompile Include="ignore.c" />
<ClCompile Include="inbound.c" />
<ClCompile Include="marshal.c" />
<ClCompile Include="modes.c" />
<ClCompile Include="msproxy.c" />
<ClCompile Include="network.c" />
@ -156,15 +158,16 @@
</ImportGroup>
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>
<![CDATA[
<Command><![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
powershell "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\config-win32.h.tt" "$(SolutionDir)..\config-win32.h"
powershell "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\win32\version.txt.tt" "$(SolutionDir)..\win32\version.txt.tmp"
REM version.txt must be in UTF-8 without trailing newline
powershell "[string] $content = Get-Content '$(SolutionDir)..\win32\version.txt.tmp' -Encoding UTF8; [System.IO.File]::WriteAllText('$(SolutionDir)..\win32\version.txt', $content); Remove-Item '$(SolutionDir)..\win32\version.txt.tmp';"
]]>
</Command>
"$(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"
]]></Command>
</PreBuildEvent>
</ItemDefinitionGroup>
</Project>

View File

@ -110,6 +110,9 @@
<ClInclude Include="typedef.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="marshal.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="cfgfiles.c">
@ -187,5 +190,11 @@
<ClCompile Include="hexchat.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="marshal.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\config-win32.h.tt" />
</ItemGroup>
</Project>

View File

@ -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

View File

@ -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);

View File

@ -22,7 +22,7 @@
#include <config.h>
#include <dbus/dbus-glib.h>
#include <stdlib.h>
#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);

View File

@ -1 +0,0 @@
VOID:POINTER,POINTER,UINT,UINT

View File

@ -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

View File

@ -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 > $@

View File

@ -97,15 +97,13 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>
<![CDATA[
<Command><![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
powershell "$(SolutionDir)..\version-template.ps1" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.tt" "$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8"
REM hexchat.rc needs to be in UCS-2 or Resource Compiler will complain
powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8' | Out-File '$(SolutionDir)..\src\fe-gtk\hexchat.rc'; Remove-Item '$(SolutionDir)..\src\fe-gtk\hexchat.rc.utf8'"
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --sourcedir $(DataDir) --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"
]]>
</Command>
]]></Command>
<Message>Build hexchat.rc and gresource file</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
@ -131,7 +129,6 @@ powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.u
<ClInclude Include="servlistgui.h" />
<ClInclude Include="setup.h" />
<ClInclude Include="sexy-iso-codes.h" />
<ClInclude Include="sexy-marshal.h" />
<ClInclude Include="sexy-spell-entry.h" />
<ClInclude Include="textgui.h" />
<ClInclude Include="urlgrab.h" />
@ -163,7 +160,6 @@ powershell "Get-Content -Encoding UTF8 '$(SolutionDir)..\src\fe-gtk\hexchat.rc.u
<ClCompile Include="servlistgui.c" />
<ClCompile Include="setup.c" />
<ClCompile Include="sexy-iso-codes.c" />
<ClCompile Include="sexy-marshal.c" />
<ClCompile Include="sexy-spell-entry.c" />
<ClCompile Include="textgui.c" />
<ClCompile Include="urlgrab.c" />

View File

@ -72,9 +72,6 @@
<ClInclude Include="sexy-iso-codes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="sexy-marshal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="sexy-spell-entry.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -167,9 +164,6 @@
<ClCompile Include="sexy-iso-codes.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sexy-marshal.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sexy-spell-entry.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -203,6 +197,7 @@
<None Include="..\..\data\icons\hexchat.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="hexchat.rc.tt" />
</ItemGroup>
<ItemGroup>
<Xml Include="..\..\data\hexchat.gresource.xml" />

View File

@ -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 <glib-object.h>
#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);
}

View File

@ -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 <glib-object.h>
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__ */

View File

@ -31,7 +31,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#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);
}

View File

@ -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);

View File

@ -1,2 +0,0 @@
VOID:OBJECT,OBJECT
VOID:POINTER,POINTER