Imported Upstream version 2.12.43
This commit is contained in:
Родитель
5ff613fb34
Коммит
33494a3f28
49
Makefile.in
49
Makefile.in
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -14,7 +14,17 @@
|
|||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -79,16 +89,12 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) \
|
||||
$(srcdir)/config.h.in $(srcdir)/AssemblyInfo.cs.in \
|
||||
$(srcdir)/policy.config.in AUTHORS COPYING ChangeLog NEWS \
|
||||
README compile config.guess config.sub depcomp install-sh \
|
||||
missing ltmain.sh
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
|
||||
$(am__configure_deps) $(am__DIST_COMMON)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
@ -152,6 +158,10 @@ ETAGS = etags
|
|||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/AssemblyInfo.cs.in $(srcdir)/Makefile.in \
|
||||
$(srcdir)/config.h.in $(srcdir)/policy.config.in AUTHORS \
|
||||
COPYING ChangeLog NEWS README compile config.guess config.sub \
|
||||
install-sh ltmain.sh missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
@ -260,6 +270,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -343,6 +354,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -385,7 +397,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -620,15 +631,15 @@ dist-xz: distdir
|
|||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
@ -664,17 +675,17 @@ distcheck: dist
|
|||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_inst
|
||||
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure \
|
||||
&& $(am__cd) $(distdir)/_build/sub \
|
||||
&& ../../configure \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=.. --prefix="$$dc_install_base" \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
|
@ -851,6 +862,8 @@ uninstall-am:
|
|||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
configure.in: bootstrap.status configure.in.in
|
||||
$(SHELL) $<
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -39,4 +39,16 @@
|
|||
<attr path="/api/namespace/interface[@cname='AtkText']/*[@name='GetDefaultAttributes']/return-type" name="element_type">AtkAttribute*</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkEditableText']/*[@name='GetRunAttributes']/return-type" name="element_type">AtkAttribute*</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkEditableText']/*[@name='GetDefaultAttributes']/return-type" name="element_type">AtkAttribute*</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkHyperlinkImpl']/*[@cname='atk_hyperlink_impl_get_hyperlink']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='AtkObjectFactory']/*[@cname='atk_object_factory_create_accessible']/return-type" name="owned">true</attr>
|
||||
<!-- Says transfer full, but it's actually a static variable being saved.
|
||||
<attr path="/api/namespace/object[@cname='AtkRegistry']/*[@cname='atk_get_default_registry']/return-type" name="owned">true</attr>
|
||||
-->
|
||||
<attr path="/api/namespace/object[@cname='AtkStateSet']/*[@cname='atk_state_set_and_sets']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='AtkStateSet']/*[@cname='atk_state_set_or_sets']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='AtkStateSet']/*[@cname='atk_state_set_xor_sets']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkTable']/*[@cname='atk_table_get_summary']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='AtkObject']/*[@cname='atk_object_get_attributes']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkText']/*[@cname='atk_text_get_run_attributes']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkText']/*[@cname='atk_text_get_default_attributes']" name="hidden">1</attr>
|
||||
</metadata>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -79,13 +89,12 @@ POST_UNINSTALL = :
|
|||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
DIST_COMMON = $(top_srcdir)/Makefile.include $(srcdir)/Makefile.in \
|
||||
$(srcdir)/Makefile.am $(srcdir)/atk-sharp.dll.config.in
|
||||
subdir = atk
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES = atk-sharp.dll.config
|
||||
|
@ -174,6 +183,9 @@ am__define_uniq_tagged_files = \
|
|||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in \
|
||||
$(srcdir)/atk-sharp.dll.config.in \
|
||||
$(top_srcdir)/Makefile.include
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
|
@ -266,6 +278,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -349,6 +362,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -423,7 +437,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign atk/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign atk/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -432,7 +445,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
$(top_srcdir)/Makefile.include:
|
||||
$(top_srcdir)/Makefile.include $(am__empty):
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
@ -749,6 +762,8 @@ uninstall-am: uninstall-gapiDATA uninstall-local
|
|||
tags tags-am uninstall uninstall-am uninstall-gapiDATA \
|
||||
uninstall-local
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
$(API): $(METADATA) $(RAW_API) $(SYMBOLS) $(top_builddir)/parser/gapi-fixup.exe
|
||||
cp $(srcdir)/$(RAW_API) $(API)
|
||||
|
|
|
@ -292,12 +292,10 @@
|
|||
{
|
||||
GLib.Value ret = GLib.Value.Empty;
|
||||
GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
|
||||
GLib.Value[] vals = new GLib.Value [1];
|
||||
vals [0] = new GLib.Value (this);
|
||||
inst_and_params.Append (vals [0]);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
foreach (GLib.Value v in vals)
|
||||
v.Dispose ();
|
||||
using (var val0 = new GLib.Value (this)) {
|
||||
inst_and_params.Append (val0);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
}
|
||||
}
|
||||
|
||||
[GLib.Signal("column_reordered")]
|
||||
|
@ -339,16 +337,16 @@
|
|||
{
|
||||
GLib.Value ret = GLib.Value.Empty;
|
||||
GLib.ValueArray inst_and_params = new GLib.ValueArray (3);
|
||||
GLib.Value[] vals = new GLib.Value [3];
|
||||
vals [0] = new GLib.Value (this);
|
||||
inst_and_params.Append (vals [0]);
|
||||
vals [1] = new GLib.Value (column);
|
||||
inst_and_params.Append (vals [1]);
|
||||
vals [2] = new GLib.Value (num_deleted);
|
||||
inst_and_params.Append (vals [2]);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
foreach (GLib.Value v in vals)
|
||||
v.Dispose ();
|
||||
using (var val0 = new GLib.Value (this)) {
|
||||
inst_and_params.Append (val0);
|
||||
using (var val1 = new GLib.Value (column)) {
|
||||
inst_and_params.Append (val1);
|
||||
using (var val2 = new GLib.Value (num_deleted)) {
|
||||
inst_and_params.Append (val2);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[GLib.Signal("column_deleted")]
|
||||
|
@ -390,12 +388,10 @@
|
|||
{
|
||||
GLib.Value ret = GLib.Value.Empty;
|
||||
GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
|
||||
GLib.Value[] vals = new GLib.Value [1];
|
||||
vals [0] = new GLib.Value (this);
|
||||
inst_and_params.Append (vals [0]);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
foreach (GLib.Value v in vals)
|
||||
v.Dispose ();
|
||||
using (var val0 = new GLib.Value (this)) {
|
||||
inst_and_params.Append (val0);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
}
|
||||
}
|
||||
|
||||
[GLib.Signal("row_reordered")]
|
||||
|
@ -437,16 +433,16 @@
|
|||
{
|
||||
GLib.Value ret = GLib.Value.Empty;
|
||||
GLib.ValueArray inst_and_params = new GLib.ValueArray (3);
|
||||
GLib.Value[] vals = new GLib.Value [3];
|
||||
vals [0] = new GLib.Value (this);
|
||||
inst_and_params.Append (vals [0]);
|
||||
vals [1] = new GLib.Value (column);
|
||||
inst_and_params.Append (vals [1]);
|
||||
vals [2] = new GLib.Value (num_inserted);
|
||||
inst_and_params.Append (vals [2]);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
foreach (GLib.Value v in vals)
|
||||
v.Dispose ();
|
||||
using (var val0 = new GLib.Value (this)) {
|
||||
inst_and_params.Append (val0);
|
||||
using (var val1 = new GLib.Value (column)) {
|
||||
inst_and_params.Append (val1);
|
||||
using (var val2 = new GLib.Value (num_inserted)) {
|
||||
inst_and_params.Append (val2);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[GLib.Signal("column_inserted")]
|
||||
|
@ -488,12 +484,10 @@
|
|||
{
|
||||
GLib.Value ret = GLib.Value.Empty;
|
||||
GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
|
||||
GLib.Value[] vals = new GLib.Value [1];
|
||||
vals [0] = new GLib.Value (this);
|
||||
inst_and_params.Append (vals [0]);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
foreach (GLib.Value v in vals)
|
||||
v.Dispose ();
|
||||
using (var val0 = new GLib.Value (this)) {
|
||||
inst_and_params.Append (val0);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
}
|
||||
}
|
||||
|
||||
[GLib.Signal("model_changed")]
|
||||
|
@ -535,16 +529,16 @@
|
|||
{
|
||||
GLib.Value ret = GLib.Value.Empty;
|
||||
GLib.ValueArray inst_and_params = new GLib.ValueArray (3);
|
||||
GLib.Value[] vals = new GLib.Value [3];
|
||||
vals [0] = new GLib.Value (this);
|
||||
inst_and_params.Append (vals [0]);
|
||||
vals [1] = new GLib.Value (row);
|
||||
inst_and_params.Append (vals [1]);
|
||||
vals [2] = new GLib.Value (num_inserted);
|
||||
inst_and_params.Append (vals [2]);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
foreach (GLib.Value v in vals)
|
||||
v.Dispose ();
|
||||
using (var val0 = new GLib.Value (this)) {
|
||||
inst_and_params.Append (val0);
|
||||
using (var val1 = new GLib.Value (row)) {
|
||||
inst_and_params.Append (val1);
|
||||
using (var val2 = new GLib.Value (num_inserted)) {
|
||||
inst_and_params.Append (val2);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[GLib.Signal("row_inserted")]
|
||||
|
@ -586,16 +580,16 @@
|
|||
{
|
||||
GLib.Value ret = GLib.Value.Empty;
|
||||
GLib.ValueArray inst_and_params = new GLib.ValueArray (3);
|
||||
GLib.Value[] vals = new GLib.Value [3];
|
||||
vals [0] = new GLib.Value (this);
|
||||
inst_and_params.Append (vals [0]);
|
||||
vals [1] = new GLib.Value (row);
|
||||
inst_and_params.Append (vals [1]);
|
||||
vals [2] = new GLib.Value (num_deleted);
|
||||
inst_and_params.Append (vals [2]);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
foreach (GLib.Value v in vals)
|
||||
v.Dispose ();
|
||||
using (var val0 = new GLib.Value (this)) {
|
||||
inst_and_params.Append (val0);
|
||||
using (var val1 = new GLib.Value (row)) {
|
||||
inst_and_params.Append (val1);
|
||||
using (var val2 = new GLib.Value (num_deleted)) {
|
||||
inst_and_params.Append (val2);
|
||||
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[GLib.Signal("row_deleted")]
|
||||
|
@ -609,3 +603,27 @@
|
|||
sig.RemoveDelegate (value);
|
||||
}
|
||||
}
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void atk_attribute_set_free(IntPtr raw);
|
||||
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr atk_text_get_run_attributes(IntPtr raw, int offset, out int start_offset, out int end_offset);
|
||||
|
||||
public Atk.Attribute[] GetRunAttributes(int offset, out int start_offset, out int end_offset) {
|
||||
IntPtr raw_ret = atk_text_get_run_attributes(Handle, offset, out start_offset, out end_offset);
|
||||
Atk.Attribute[] ret = GLib.Marshaller.ListPtrToArray<Atk.Attribute> (raw_ret, typeof(GLib.SList), false, false);
|
||||
atk_attribute_set_free(raw_ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr atk_text_get_default_attributes(IntPtr raw);
|
||||
|
||||
public Atk.Attribute[] DefaultAttributes {
|
||||
get {
|
||||
IntPtr raw_ret = atk_text_get_default_attributes(Handle);
|
||||
Atk.Attribute[] ret = GLib.Marshaller.ListPtrToArray<Atk.Attribute> (raw_ret, typeof(GLib.SList), false, false);
|
||||
atk_attribute_set_free(raw_ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,3 +268,18 @@
|
|||
{
|
||||
GLib.Signal.Emit (this, "focus-event", gained);
|
||||
}
|
||||
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr atk_attribute_set_free(IntPtr raw);
|
||||
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr atk_object_get_attributes(IntPtr raw);
|
||||
|
||||
public Atk.Attribute[] Attributes {
|
||||
get {
|
||||
IntPtr raw_ret = atk_object_get_attributes(Handle);
|
||||
Atk.Attribute[] ret = GLib.Marshaller.ListPtrToArray<Atk.Attribute> (raw_ret, typeof(GLib.SList), false, false);
|
||||
atk_attribute_set_free(raw_ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ namespace Atk {
|
|||
Atk.TableImplementor __obj = GLib.Object.GetObject (table, false) as Atk.TableImplementor;
|
||||
int [] selected = __obj.SelectedColumns;
|
||||
if (selected.Length > 0) {
|
||||
selected_ptr = GLib.Marshaller.Malloc ((ulong)(Marshal.SizeOf (typeof(int)) * selected.Length));
|
||||
selected_ptr = GLib.Marshaller.Malloc ((ulong)(sizeof(int) * selected.Length));
|
||||
Marshal.Copy (selected, 0, selected_ptr, selected.Length);
|
||||
} else {
|
||||
selected_ptr = IntPtr.Zero;
|
||||
|
@ -422,7 +422,7 @@ namespace Atk {
|
|||
Atk.TableImplementor __obj = GLib.Object.GetObject (table, false) as Atk.TableImplementor;
|
||||
int [] selected = __obj.SelectedRows;
|
||||
if (selected.Length > 0) {
|
||||
selected_ptr = GLib.Marshaller.Malloc ((ulong)(Marshal.SizeOf (typeof(int)) * selected.Length));
|
||||
selected_ptr = GLib.Marshaller.Malloc ((ulong)(sizeof (int) * selected.Length));
|
||||
Marshal.Copy (selected, 0, selected_ptr, selected.Length);
|
||||
} else {
|
||||
selected_ptr = IntPtr.Zero;
|
||||
|
|
|
@ -27,3 +27,28 @@
|
|||
"text_changed::" + detail.ToString ().ToLower (),
|
||||
position, length);
|
||||
}
|
||||
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void atk_attribute_set_free(IntPtr raw);
|
||||
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr atk_text_get_run_attributes(IntPtr raw, int offset, out int start_offset, out int end_offset);
|
||||
|
||||
public Atk.Attribute[] GetRunAttributes(int offset, out int start_offset, out int end_offset) {
|
||||
IntPtr raw_ret = atk_text_get_run_attributes(Handle, offset, out start_offset, out end_offset);
|
||||
Atk.Attribute[] ret = GLib.Marshaller.ListPtrToArray<Atk.Attribute> (raw_ret, typeof(GLib.SList), false, false);
|
||||
atk_attribute_set_free(raw_ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[DllImport("libatk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr atk_text_get_default_attributes(IntPtr raw);
|
||||
|
||||
public Atk.Attribute[] DefaultAttributes {
|
||||
get {
|
||||
IntPtr raw_ret = atk_text_get_default_attributes(Handle);
|
||||
Atk.Attribute[] ret = GLib.Marshaller.ListPtrToArray<Atk.Attribute> (raw_ret, typeof(GLib.SList), false, false);
|
||||
atk_attribute_set_free(raw_ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,11 +97,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
int InvokeNative (KeyEventStruct evnt)
|
||||
int InvokeNative (Atk.KeyEventStruct evnt)
|
||||
{
|
||||
IntPtr native_evnt = GLib.Marshaller.StructureToPtrAlloc (evnt);
|
||||
int result = native_cb (native_evnt, data);
|
||||
evnt = KeyEventStruct.New (native_evnt);
|
||||
Marshal.FreeHGlobal (native_evnt);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -80,12 +90,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = atk/glue
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/depcomp
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -195,6 +204,7 @@ am__define_uniq_tagged_files = \
|
|||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AL = @AL@
|
||||
|
@ -262,6 +272,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -345,6 +356,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -390,7 +402,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign atk/glue/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign atk/glue/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -694,6 +705,8 @@ uninstall-am: uninstall-libLTLIBRARIES
|
|||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
libatksharpglue.dll: $(libatksharpglue_2_la_OBJECTS) libatksharpglue.rc libatksharpglue.def
|
||||
./build-dll libatksharpglue-2 $(VERSION)
|
||||
|
|
|
@ -163,8 +163,8 @@ namespace Cairo {
|
|||
// except in the case of Win64 where sizeof(long)
|
||||
// is 32 bits
|
||||
//
|
||||
int ptr_size = Marshal.SizeOf (typeof (IntPtr));
|
||||
|
||||
int ptr_size = IntPtr.Size;
|
||||
|
||||
PlatformID platform = Environment.OSVersion.Platform;
|
||||
if (platform == PlatformID.Win32NT ||
|
||||
platform == PlatformID.Win32S ||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -80,11 +90,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = cairo
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -110,6 +120,7 @@ am__can_run_installinfo = \
|
|||
esac
|
||||
DATA = $(noinst_DATA)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AL = @AL@
|
||||
|
@ -177,6 +188,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -260,6 +272,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -350,7 +363,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cairo/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign cairo/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -527,6 +539,8 @@ uninstall-am: uninstall-local
|
|||
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
|
||||
uninstall-am uninstall-local
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
mono.snk: $(top_srcdir)/mono.snk
|
||||
cp $(top_srcdir)/mono.snk .
|
||||
|
|
2
compile
2
compile
|
@ -3,7 +3,7 @@
|
|||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2013-06-10'
|
||||
timestamp='2015-08-20'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -24,12 +24,12 @@ timestamp='2013-06-10'
|
|||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
#
|
||||
# Originally written by Per Bothner.
|
||||
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
|
||||
#
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
#
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
@ -50,7 +50,7 @@ version="\
|
|||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
|
|||
LIBC=gnu
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -168,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
# Note: NetBSD doesn't particularly care about the vendor
|
||||
# portion of the name. We always set it to "unknown".
|
||||
sysctl="sysctl -n hw.machine_arch"
|
||||
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
|
||||
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
|
||||
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
|
||||
/sbin/$sysctl 2>/dev/null || \
|
||||
/usr/sbin/$sysctl 2>/dev/null || \
|
||||
echo unknown)`
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
armeb) machine=armeb-unknown ;;
|
||||
arm*) machine=arm-unknown ;;
|
||||
sh3el) machine=shl-unknown ;;
|
||||
sh3eb) machine=sh-unknown ;;
|
||||
sh5el) machine=sh5le-unknown ;;
|
||||
earmv*)
|
||||
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
|
||||
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
|
||||
machine=${arch}${endian}-unknown
|
||||
;;
|
||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||
esac
|
||||
# The Operating System including object format, if it has switched
|
||||
# to ELF recently, or will in the future.
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ELF__
|
||||
|
@ -197,6 +204,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
os=netbsd
|
||||
;;
|
||||
esac
|
||||
# Determine ABI tags.
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
earm*)
|
||||
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
|
||||
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
|
||||
;;
|
||||
esac
|
||||
# The OS release
|
||||
# Debian GNU/NetBSD machines have a different userland, and
|
||||
# thus, need a distinct triplet. However, they do not need
|
||||
|
@ -207,13 +221,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
release='-gnu'
|
||||
;;
|
||||
*)
|
||||
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
|
||||
;;
|
||||
esac
|
||||
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
|
||||
# contains redundant information, the shorter form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
echo "${machine}-${os}${release}${abi}"
|
||||
exit ;;
|
||||
*:Bitrig:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||
|
@ -235,6 +249,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
*:MirBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:Sortix:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-sortix
|
||||
exit ;;
|
||||
alpha:OSF1:*:*)
|
||||
case $UNAME_RELEASE in
|
||||
*4.0)
|
||||
|
@ -579,8 +596,9 @@ EOF
|
|||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
if [ -x /usr/bin/lslpp ] ; then
|
||||
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
|
||||
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
|
||||
else
|
||||
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
|
||||
fi
|
||||
|
@ -826,7 +844,7 @@ EOF
|
|||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
i*:MSYS*:*)
|
||||
*:MSYS*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msys
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
|
@ -932,6 +950,9 @@ EOF
|
|||
crisv32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
e2k:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
|
@ -969,10 +990,10 @@ EOF
|
|||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||
;;
|
||||
or1k:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
openrisc*:Linux:*:*)
|
||||
echo or1k-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
or32:Linux:*:*)
|
||||
or32:Linux:*:* | or1k*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
|
@ -1020,7 +1041,7 @@ EOF
|
|||
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
|
@ -1260,16 +1281,26 @@ EOF
|
|||
if test "$UNAME_PROCESSOR" = unknown ; then
|
||||
UNAME_PROCESSOR=powerpc
|
||||
fi
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc64 ;;
|
||||
esac
|
||||
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc64 ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
elif test "$UNAME_PROCESSOR" = i386 ; then
|
||||
# Avoid executing cc on OS X 10.9, as it ships with a stub
|
||||
# that puts up a graphical alert prompting to install
|
||||
# developer tools. Any system running Mac OS X 10.7 or
|
||||
# later (Darwin 11 and later) is required to have a 64-bit
|
||||
# processor. This is not true of the ARM version of Darwin
|
||||
# that Apple uses in portable devices.
|
||||
UNAME_PROCESSOR=x86_64
|
||||
fi
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit ;;
|
||||
|
@ -1361,154 +1392,6 @@ EOF
|
|||
exit ;;
|
||||
esac
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
if (version < 4)
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
else
|
||||
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
# if !defined (ultrix)
|
||||
# include <sys/param.h>
|
||||
# if defined (BSD)
|
||||
# if BSD == 43
|
||||
printf ("vax-dec-bsd4.3\n"); exit (0);
|
||||
# else
|
||||
# if BSD == 199006
|
||||
printf ("vax-dec-bsd4.3reno\n"); exit (0);
|
||||
# else
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
# endif
|
||||
# else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
|
||||
{ echo "$SYSTEM_NAME"; exit; }
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
cat >&2 <<EOF
|
||||
$0: unable to guess system type
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2013-08-10'
|
||||
timestamp='2015-08-20'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -25,7 +25,7 @@ timestamp='2013-08-10'
|
|||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
|
||||
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
|
@ -68,7 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2013 Free Software Foundation, Inc.
|
||||
Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -117,7 +117,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
|||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
|
||||
kopensolaris*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
|
@ -255,16 +255,18 @@ case $basic_machine in
|
|||
| arc | arceb \
|
||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||
| avr | avr32 \
|
||||
| ba \
|
||||
| be32 | be64 \
|
||||
| bfin \
|
||||
| c4x | c8051 | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| epiphany \
|
||||
| fido | fr30 | frv \
|
||||
| e2k | epiphany \
|
||||
| fido | fr30 | frv | ft32 \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
|
@ -282,8 +284,10 @@ case $basic_machine in
|
|||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa32r6 | mipsisa32r6el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64r6 | mipsisa64r6el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
|
@ -295,14 +299,14 @@ case $basic_machine in
|
|||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
| ns16k | ns32k \
|
||||
| open8 \
|
||||
| or1k | or32 \
|
||||
| open8 | or1k | or1knd | or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| pyramid \
|
||||
| riscv32 | riscv64 \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
|
@ -310,6 +314,7 @@ case $basic_machine in
|
|||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| visium \
|
||||
| we32k \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
|
@ -324,7 +329,10 @@ case $basic_machine in
|
|||
c6x)
|
||||
basic_machine=tic6x-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
|
||||
leon|leon[3-9])
|
||||
basic_machine=sparc-$basic_machine
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
|
@ -369,18 +377,20 @@ case $basic_machine in
|
|||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| ba-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| e2k-* | elxsi-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| k1om-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
|
@ -400,8 +410,10 @@ case $basic_machine in
|
|||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa32r6-* | mipsisa32r6el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64r6-* | mipsisa64r6el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipsr5900-* | mipsr5900el-* \
|
||||
|
@ -413,16 +425,18 @@ case $basic_machine in
|
|||
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| or1k*-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pyramid-* \
|
||||
| riscv32-* | riscv64-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
|
@ -430,6 +444,7 @@ case $basic_machine in
|
|||
| ubicom32-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| visium-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
|
@ -506,6 +521,9 @@ case $basic_machine in
|
|||
basic_machine=i386-pc
|
||||
os=-aros
|
||||
;;
|
||||
asmjs)
|
||||
basic_machine=asmjs-unknown
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
|
@ -767,6 +785,9 @@ case $basic_machine in
|
|||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
leon-*|leon[3-9]-*)
|
||||
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
|
@ -822,6 +843,10 @@ case $basic_machine in
|
|||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
moxiebox)
|
||||
basic_machine=moxie-unknown
|
||||
os=-moxiebox
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
|
@ -1354,7 +1379,7 @@ case $os in
|
|||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -aos* | -aros* | -cloudabi* | -sortix* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
|
@ -1367,14 +1392,14 @@ case $os in
|
|||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
|
@ -1592,9 +1617,6 @@ case $basic_machine in
|
|||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
or1k-*)
|
||||
os=-elf
|
||||
;;
|
||||
or32-*)
|
||||
os=-coff
|
||||
;;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
17
configure.in
17
configure.in
|
@ -1,5 +1,5 @@
|
|||
|
||||
AC_INIT([gtk-sharp], [2.12.26])
|
||||
AC_INIT([gtk-sharp], [2.12.43])
|
||||
AC_CONFIG_SRCDIR(README)
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
@ -106,9 +106,19 @@ OFF_T_FLAGS="-define:OFF_T_$ac_cv_sizeof_off_t"
|
|||
AC_SUBST(OFF_T_FLAGS)
|
||||
|
||||
MONO_REQUIRED_VERSION=1.0
|
||||
FIRST_MONO_VERSION_WITH_NET_4_6_SUPPORT=4.4
|
||||
PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)
|
||||
if test "x$has_mono" = "xfalse" ; then
|
||||
PKG_CHECK_MODULES(MONO_DEPENDENCY, mono-2 >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)
|
||||
if test "x$has_mono" = "xtrue" ; then
|
||||
PKG_CHECK_MODULES(MONO_DEPENDENCY, mono-2 >= $FIRST_MONO_VERSION_WITH_NET_4_6_SUPPORT, NET_4_6_SUPPORT=true, NET_4_6_SUPPORT=false)
|
||||
fi
|
||||
else
|
||||
PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $FIRST_MONO_VERSION_WITH_NET_4_6_SUPPORT, NET_4_6_SUPPORT=true, NET_4_6_SUPPORT=false)
|
||||
fi
|
||||
|
||||
if test "x$platform_win32" = "xyes"; then
|
||||
NET_4_6_SUPPORT=true
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(GACUTIL, gacutil, no)
|
||||
|
@ -222,8 +232,11 @@ AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes")
|
|||
AM_CONDITIONAL(ENABLE_MSI, test "x$enable_msi" = "xyes")
|
||||
AM_CONDITIONAL(ENABLE_MONOGETOPTIONS, test "x$has_mono" = "xtrue")
|
||||
|
||||
CSFLAGS="$DEBUG_FLAGS $CSDEFINES $WIN64DEFINES"
|
||||
CSFLAGS="$DEBUG_FLAGS $CSDEFINES $WIN64DEFINES -unsafe"
|
||||
|
||||
if test "x$NET_4_6_SUPPORT" = "xtrue" ; then
|
||||
CSFLAGS="$CSFLAGS -define:HAVE_NET_4_6"
|
||||
fi
|
||||
PKG_CHECK_MODULES(GLIB_2_31,
|
||||
glib-2.0 >= 2.31,
|
||||
HAVE_GLIB_2_31_OR_HIGHER=yes, HAVE_GLIB_2_31_OR_HIGHER=no)
|
||||
|
|
2
depcomp
2
depcomp
|
@ -3,7 +3,7 @@
|
|||
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -80,12 +90,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = doc
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ChangeLog \
|
||||
README
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -139,6 +148,7 @@ am__uninstall_files_from_dir = { \
|
|||
am__installdirs = "$(DESTDIR)$(monodocdir)"
|
||||
DATA = $(monodoc_DATA)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog README
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AL = @AL@
|
||||
|
@ -206,6 +216,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -289,6 +300,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -346,7 +358,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign doc/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -549,6 +560,8 @@ uninstall-am: uninstall-monodocDATA
|
|||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags-am uninstall uninstall-am uninstall-monodocDATA
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
assemble: gtk-sharp-docs.zip gtk-sharp-docs.tree
|
||||
|
||||
|
|
|
@ -67,10 +67,7 @@
|
|||
if (raw_ret == IntPtr.Zero)
|
||||
return new Device [0];
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Device[] result = new Device [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Device;
|
||||
return result;
|
||||
return GLib.Marshaller.ListToArray<Device> (list);
|
||||
}
|
||||
|
||||
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
IntPtr raw_ret = gdk_display_manager_list_displays (Handle);
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Display [0];
|
||||
GLib.SList list = new GLib.SList(raw_ret);
|
||||
Display[] result = new Display [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Display;
|
||||
return result;
|
||||
return GLib.Marshaller.ListPtrToArray<Display> (raw_ret, typeof (GLib.SList), true, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,6 @@ static extern IntPtr gtksharp_drag_context_get_targets (IntPtr ptr);
|
|||
public Atom [] Targets {
|
||||
get {
|
||||
GLib.List list = new GLib.List (gtksharp_drag_context_get_targets (this.Handle), typeof (Atom));
|
||||
|
||||
Atom [] entries = new Atom [list.Count];
|
||||
|
||||
int i = 0;
|
||||
foreach (Atom a in list)
|
||||
entries [i ++] = a;
|
||||
|
||||
return entries;
|
||||
return GLib.Marshaller.ListToArray<Atom> (list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,10 @@ namespace Gdk {
|
|||
}
|
||||
}
|
||||
|
||||
static GLib.GType _gtype = new GLib.GType (gdk_event_get_type ());
|
||||
public static GLib.GType GType {
|
||||
get {
|
||||
return new GLib.GType (gdk_event_get_type ());
|
||||
return _gtype;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkDrawable']/method[@name='DrawPolygon']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDrawable']/method[@name='GetSize']/*/*[@type='gint*']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDrawable']/method[@name='SetData']/*/*[@name='destroy_func']" name="type">gpointer</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkGC']/method[@name='GetValues']/parameters/parameter[@name='values']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkImage']/field[@name='Mem']" name="access">private</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkImage']/field[@name='WindowingData']" name="access">private</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkKeymap']/method[@name='GetEntriesForKeycode']" name="hidden">1</attr>
|
||||
|
@ -118,13 +119,14 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToCallbackv']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='ScaleSimple']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RotateSimple']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Flip']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property[@name='Pixels']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property" name="readable">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property" name="writeable">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property" name="construct-only">true</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkPixbufFormat']/method[@name='GetExtensions']/return-type" name="null_term_array">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkPixbufFormat']/method[@name='GetMimeTypes']/return-type" name="null_term_array">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufLoader']/method[@name='GetPixbuf']" name="needs_ref">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufLoader']/method[@name='GetPixbuf']/return-type" name="needs_ref">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufLoader']/method[@name='Write']/*/*[@name='buf']" name="array">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixmap']" name="parent">GdkDrawable</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixmap']/method[@name='CreateFromXpm']/*/*[@name='mask']" name="pass_as">out</attr>
|
||||
|
@ -205,7 +207,17 @@
|
|||
<attr path="/api/namespace/struct[@cname='GdkRgbCmap']/field[@name='NColors']" name="writeable">false</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkTimeCoord']/field[@cname='axes']" name="array_len">128</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkWindowObject']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkPixbufFormat']/method[@cname='gdk_pixbuf_format_get_extensions']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkPixbufFormat']/method[@cname='gdk_pixbuf_format_get_mime_types ']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkChar_']/method[@cname='gdk_char_height']/parameters/parameter[@name='character']" name="type">guchar</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkChar_']/method[@cname='gdk_char_width']/parameters/parameter[@name='character']" name="type">guchar</attr>
|
||||
<attr path="/api/namespace/class[@cname='GdkChar_']/method[@cname='gdk_char_measure']/parameters/parameter[@name='character']" name="type">guchar</attr>
|
||||
<add-node path="/api"><symbol type="manual" cname="cairo_t" name="Cairo.Context"/></add-node>
|
||||
<add-node path="/api"><symbol type="manual" cname="cairo_font_options_t" name="Cairo.FontOptions"/></add-node>
|
||||
<add-node path="/api/namespace/object[@cname='GdkWindow']">
|
||||
<method name="GetType" cname="gdk_window_object_get_type" shared="true">
|
||||
<return-type type="GType" />
|
||||
</method>
|
||||
</add-node>
|
||||
</metadata>
|
||||
|
||||
|
|
|
@ -28,10 +28,7 @@
|
|||
if (raw_ret == IntPtr.Zero)
|
||||
return new Device [0];
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Device[] result = new Device [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Device;
|
||||
return result;
|
||||
return GLib.Marshaller.ListToArray<Device> (list);
|
||||
}
|
||||
|
||||
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
|
@ -42,11 +39,7 @@
|
|||
IntPtr raw_ret = gdk_list_visuals ();
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Visual [0];
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Visual[] result = new Visual [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Visual;
|
||||
return result;
|
||||
return GLib.Marshaller.ListPtrToArray<Visual> (raw_ret, typeof (GLib.List), true, false);
|
||||
}
|
||||
|
||||
[DllImport("gdksharpglue-2", CallingConvention=CallingConvention.Cdecl)]
|
||||
|
@ -57,12 +50,7 @@
|
|||
IntPtr raw_ret = gtksharp_get_gdk_net_supported ();
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Gdk.Atom [0];
|
||||
GLib.List list = new GLib.List (raw_ret, typeof (Gdk.Atom));
|
||||
Gdk.Atom[] atoms = new Gdk.Atom [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
atoms [i] = list [i] as Gdk.Atom;
|
||||
|
||||
return atoms;
|
||||
return GLib.Marshaller.ListPtrToArray<Gdk.Atom> (raw_ret, typeof (GLib.List), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,6 +71,7 @@
|
|||
offset += IntPtr.Size;
|
||||
windows [i] = Gdk.Window.ForeignNew ((uint) windowID);
|
||||
}
|
||||
GLib.Marshaller.Free (raw_ret);
|
||||
return windows;
|
||||
}
|
||||
}
|
||||
|
@ -127,12 +116,7 @@
|
|||
IntPtr raw_ret = gtksharp_get_gdk_net_workarea ();
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Gdk.Rectangle [0];
|
||||
GLib.List list = new GLib.List (raw_ret, typeof (Gdk.Rectangle));
|
||||
Gdk.Rectangle[] workareas = new Gdk.Rectangle [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
workareas [i] = (Gdk.Rectangle) list [i];
|
||||
|
||||
return workareas;
|
||||
return GLib.Marshaller.ListPtrToArray<Gdk.Rectangle> (raw_ret, typeof(GLib.List), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@
|
|||
keyvals = new uint [count];
|
||||
int[] tmp = new int [count];
|
||||
Marshal.Copy (keyval_ptr, tmp, 0, count);
|
||||
int keymapKeySize = Marshal.SizeOf (typeof (Gdk.KeymapKey));
|
||||
for (int i = 0; i < count; i++) {
|
||||
IntPtr ptr = new IntPtr ((long) key_ptr + i * Marshal.SizeOf (typeof (KeymapKey)));
|
||||
IntPtr ptr = new IntPtr ((long) key_ptr + i * keymapKeySize);
|
||||
keyvals [i] = (uint) tmp [i];
|
||||
keys [i] = KeymapKey.New (ptr);
|
||||
}
|
||||
|
@ -56,8 +57,9 @@
|
|||
int count;
|
||||
if (gdk_keymap_get_entries_for_keyval(Handle, keyval, out key_ptr, out count)) {
|
||||
KeymapKey[] result = new KeymapKey [count];
|
||||
int keymapKeySize = Marshal.SizeOf (typeof (Gdk.KeymapKey));
|
||||
for (int i = 0; i < count; i++) {
|
||||
IntPtr ptr = new IntPtr ((long) key_ptr + i * Marshal.SizeOf (typeof (KeymapKey)));
|
||||
IntPtr ptr = new IntPtr ((long) key_ptr + i * keymapKeySize);
|
||||
result [i] = KeymapKey.New (ptr);
|
||||
}
|
||||
g_free (key_ptr);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -79,13 +89,12 @@ POST_UNINSTALL = :
|
|||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
DIST_COMMON = $(top_srcdir)/Makefile.include $(srcdir)/Makefile.in \
|
||||
$(srcdir)/Makefile.am $(srcdir)/gdk-sharp.dll.config.in
|
||||
subdir = gdk
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES = gdk-sharp.dll.config
|
||||
|
@ -174,6 +183,9 @@ am__define_uniq_tagged_files = \
|
|||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in \
|
||||
$(srcdir)/gdk-sharp.dll.config.in \
|
||||
$(top_srcdir)/Makefile.include
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
|
@ -266,6 +278,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -349,6 +362,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -463,7 +477,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gdk/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign gdk/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -472,7 +485,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
$(top_srcdir)/Makefile.include:
|
||||
$(top_srcdir)/Makefile.include $(am__empty):
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
@ -789,6 +802,8 @@ uninstall-am: uninstall-gapiDATA uninstall-local
|
|||
tags tags-am uninstall uninstall-am uninstall-gapiDATA \
|
||||
uninstall-local
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
$(API): $(METADATA) $(RAW_API) $(SYMBOLS) $(top_builddir)/parser/gapi-fixup.exe
|
||||
cp $(srcdir)/$(RAW_API) $(API)
|
||||
|
|
|
@ -36,12 +36,13 @@
|
|||
static extern IntPtr gdk_pixbuf_get_from_drawable(IntPtr raw, IntPtr src, IntPtr cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height);
|
||||
|
||||
public Gdk.Pixbuf GetFromDrawable(Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) {
|
||||
var oldHandle = Handle;
|
||||
IntPtr raw_ret = gdk_pixbuf_get_from_drawable(Handle, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height);
|
||||
Gdk.Pixbuf ret;
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
ret = null;
|
||||
else
|
||||
ret = (Gdk.Pixbuf) GLib.Object.GetObject(raw_ret);
|
||||
ret = (Gdk.Pixbuf) GLib.Object.GetObject(raw_ret, oldHandle == IntPtr.Zero);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -49,12 +50,13 @@
|
|||
static extern IntPtr gdk_pixbuf_get_from_image(IntPtr raw, IntPtr src, IntPtr cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height);
|
||||
|
||||
public Gdk.Pixbuf GetFromImage(Gdk.Image src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) {
|
||||
var oldHandle = Handle;
|
||||
IntPtr raw_ret = gdk_pixbuf_get_from_image(Handle, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height);
|
||||
Gdk.Pixbuf ret;
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
ret = null;
|
||||
else
|
||||
ret = (Gdk.Pixbuf) GLib.Object.GetObject(raw_ret);
|
||||
ret = (Gdk.Pixbuf) GLib.Object.GetObject(raw_ret, oldHandle == IntPtr.Zero);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -104,6 +106,7 @@
|
|||
public Pixbuf (System.IO.Stream stream) : base (IntPtr.Zero)
|
||||
{
|
||||
using (PixbufLoader pl = new PixbufLoader (stream)) {
|
||||
owned = true;
|
||||
Raw = pl.PixbufHandle;
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +114,7 @@
|
|||
public Pixbuf (System.IO.Stream stream, int width, int height) : base (IntPtr.Zero)
|
||||
{
|
||||
using (PixbufLoader pl = new PixbufLoader (stream, width, height)) {
|
||||
owned = true;
|
||||
Raw = pl.PixbufHandle;
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +122,7 @@
|
|||
public Pixbuf (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero)
|
||||
{
|
||||
using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource)) {
|
||||
owned = true;
|
||||
Raw = pl.PixbufHandle;
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +130,7 @@
|
|||
public Pixbuf (System.Reflection.Assembly assembly, string resource, int width, int height) : base (IntPtr.Zero)
|
||||
{
|
||||
using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource, width, height)) {
|
||||
owned = true;
|
||||
Raw = pl.PixbufHandle;
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +138,7 @@
|
|||
public Pixbuf (byte[] buffer) : base (IntPtr.Zero)
|
||||
{
|
||||
using (PixbufLoader pl = new PixbufLoader (buffer)) {
|
||||
owned = true;
|
||||
Raw = pl.PixbufHandle;
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +146,7 @@
|
|||
public Pixbuf (byte[] buffer, int width, int height) : base (IntPtr.Zero)
|
||||
{
|
||||
using (PixbufLoader pl = new PixbufLoader (buffer, width, height)) {
|
||||
owned = true;
|
||||
Raw = pl.PixbufHandle;
|
||||
}
|
||||
}
|
||||
|
@ -262,13 +270,13 @@
|
|||
|
||||
public static Gdk.Pixbuf FromDrawable (Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) {
|
||||
IntPtr raw_ret = gdk_pixbuf_get_from_drawable(IntPtr.Zero, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height);
|
||||
return new Pixbuf (raw_ret);
|
||||
return GLib.Object.GetObject (raw_ret, true) as Gdk.Pixbuf;
|
||||
}
|
||||
|
||||
[Obsolete ("Replaced by static FromDrawable method")]
|
||||
public Gdk.Pixbuf CreateFromDrawable (Gdk.Drawable src, Gdk.Colormap cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) {
|
||||
IntPtr raw_ret = gdk_pixbuf_get_from_drawable((IntPtr) 0, src.Handle, cmap.Handle, src_x, src_y, dest_x, dest_y, width, height);
|
||||
return new Pixbuf (raw_ret);
|
||||
return GLib.Object.GetObject (raw_ret, true) as Gdk.Pixbuf;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -292,11 +300,7 @@
|
|||
IntPtr list_ptr = gdk_pixbuf_get_formats ();
|
||||
if (list_ptr == IntPtr.Zero)
|
||||
return new PixbufFormat [0];
|
||||
GLib.SList list = new GLib.SList (list_ptr, typeof (PixbufFormat));
|
||||
PixbufFormat[] result = new PixbufFormat [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = (PixbufFormat) list [i];
|
||||
return result;
|
||||
return GLib.Marshaller.ListPtrToArray<PixbufFormat> (list_ptr, typeof (GLib.SList), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
{
|
||||
if (assembly == null)
|
||||
assembly = System.Reflection.Assembly.GetCallingAssembly ();
|
||||
owned = true;
|
||||
Raw = new PixbufLoader (assembly, resource).AnimationHandle;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,8 @@
|
|||
IntPtr raw_ret = gdk_screen_get_toplevel_windows (Handle);
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Window [0];
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Window[] result = new Window [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Window;
|
||||
return result;
|
||||
|
||||
return GLib.Marshaller.ListPtrToArray<Window> (raw_ret, typeof (GLib.List), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,11 +40,8 @@
|
|||
IntPtr raw_ret = gdk_screen_list_visuals (Handle);
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Visual [0];
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Visual[] result = new Visual [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Visual;
|
||||
return result;
|
||||
|
||||
return GLib.Marshaller.ListPtrToArray<Visual> (raw_ret, typeof (GLib.List), true, false);
|
||||
}
|
||||
|
||||
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
|
|
|
@ -32,11 +32,7 @@
|
|||
IntPtr raw_ret = gdk_window_get_children(Handle);
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Window [0];
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Window[] result = new Window [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Window;
|
||||
return result;
|
||||
return GLib.Marshaller.ListPtrToArray<Window> (raw_ret, typeof (GLib.List), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +41,7 @@
|
|||
|
||||
public Pixbuf[] IconList {
|
||||
set {
|
||||
GLib.List list = new GLib.List(IntPtr.Zero);
|
||||
GLib.List list = new GLib.List(IntPtr.Zero, typeof(Pixbuf), true, false);
|
||||
foreach (Pixbuf val in value)
|
||||
list.Append (val.Handle);
|
||||
gdk_window_set_icon_list(Handle, list.Handle);
|
||||
|
@ -60,11 +56,7 @@
|
|||
IntPtr raw_ret = gdk_window_get_toplevels();
|
||||
if (raw_ret == IntPtr.Zero)
|
||||
return new Window [0];
|
||||
GLib.List list = new GLib.List(raw_ret);
|
||||
Window[] result = new Window [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Window;
|
||||
return result;
|
||||
return GLib.Marshaller.ListPtrToArray<Window> (raw_ret, typeof(GLib.List), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5559,4 +5559,4 @@
|
|||
</method>
|
||||
</struct>
|
||||
</namespace>
|
||||
</api>
|
||||
</api>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -80,12 +90,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = gdk/glue
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/depcomp
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -195,6 +204,7 @@ am__define_uniq_tagged_files = \
|
|||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AL = @AL@
|
||||
|
@ -262,6 +272,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -345,6 +356,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -390,7 +402,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gdk/glue/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign gdk/glue/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -694,6 +705,8 @@ uninstall-am: uninstall-libLTLIBRARIES
|
|||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
libgdksharpglue.dll: $(libgdksharpglue_2_la_OBJECTS) libgdksharpglue.rc libgdksharpglue.def
|
||||
./build-dll libgdksharpglue-2 $(VERSION)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <gdk/gdkproperty.h>
|
||||
|
||||
GList * gtksharp_get_gdk_net_supported (void);
|
||||
guint * gtksharp_get_gdk_net_client_list (int *count);
|
||||
gpointer * gtksharp_get_gdk_net_client_list (int *count);
|
||||
gint gtksharp_get_gdk_net_number_of_desktops (void);
|
||||
gint gtksharp_get_gdk_net_current_desktop (void);
|
||||
guint gtksharp_get_gdk_net_active_window (void);
|
||||
|
@ -75,14 +75,14 @@ gtksharp_get_gdk_net_supported (void)
|
|||
return list;
|
||||
}
|
||||
|
||||
guint *
|
||||
gpointer *
|
||||
gtksharp_get_gdk_net_client_list (int *count)
|
||||
{
|
||||
GdkAtom actual_property_type;
|
||||
int actual_format;
|
||||
int actual_length;
|
||||
long *data = NULL;
|
||||
guint * list = NULL;
|
||||
gpointer *list = NULL;
|
||||
int i;
|
||||
|
||||
if (!gdk_property_get (
|
||||
|
@ -107,7 +107,7 @@ gtksharp_get_gdk_net_client_list (int *count)
|
|||
}
|
||||
|
||||
*count = actual_length / sizeof (long);
|
||||
list = g_malloc (*count * sizeof (guint));
|
||||
list = g_malloc (*count * sizeof (gpointer));
|
||||
/* Put all of the windows into a GList to return */
|
||||
for (i = 0; i < *count; i ++) {
|
||||
list [i] = data [i];
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace GtkSharp.Generation
|
||||
{
|
||||
public static class AttributeHelper
|
||||
{
|
||||
public static void Gen (StreamWriter sw, string name, string libraryName, string pinvoke)
|
||||
{
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\tinternal class " + name + "Attribute : GLib.GTypeTypeAttribute {");
|
||||
sw.WriteLine ("\t\t[DllImport (\"" + libraryName + "\", CallingConvention = CallingConvention.Cdecl)]");
|
||||
sw.WriteLine ("\t\tstatic extern IntPtr {0} ();", pinvoke);
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\tprivate static GLib.GType _gtype = new GLib.GType ({0} ());", pinvoke);
|
||||
sw.WriteLine ("\t\tpublic static GLib.GType GType { get { return _gtype; } }");
|
||||
sw.WriteLine ("\t\tpublic override GLib.GType Type { get { return _gtype; } }");
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,7 +49,7 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\t{");
|
||||
|
||||
sw.WriteLine ("\t\t\tGLib.Value val = GLib.Value.Empty;");
|
||||
sw.WriteLine ("\t\t\tval.Init (" + QualifiedName + ".GType);");
|
||||
sw.WriteLine ("\t\t\tval.Init (" + Name + "Attribute.GType);");
|
||||
sw.WriteLine ("\t\t\tglibsharp_value_set_boxed (ref val, ref boxed);");
|
||||
sw.WriteLine ("\t\t\treturn val;");
|
||||
sw.WriteLine ("\t\t}");
|
||||
|
@ -72,7 +72,10 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("#endregion");
|
||||
AppendCustom(sw, gen_info.CustomDir);
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
var method = GetMethod ("GetType") ?? GetMethod ("GetGType");
|
||||
if (method != null)
|
||||
AttributeHelper.Gen (sw, Name, LibraryName, method.CName);
|
||||
sw.WriteLine ("}");
|
||||
sw.Close ();
|
||||
gen_info.Writer = null;
|
||||
Statistics.BoxedCount++;
|
||||
|
|
|
@ -24,39 +24,20 @@ namespace GtkSharp.Generation {
|
|||
|
||||
using System;
|
||||
|
||||
public class ByRefGen : SimpleBase, IManualMarshaler {
|
||||
public class ByRefGen : SimpleBase {
|
||||
|
||||
public ByRefGen (string ctype, string type) : base (ctype, type, type + ".Empty") {}
|
||||
|
||||
public override string MarshalType {
|
||||
get {
|
||||
return "IntPtr";
|
||||
return "ref " + QualifiedName;
|
||||
}
|
||||
}
|
||||
|
||||
public override string CallByName (string var_name)
|
||||
{
|
||||
return "native_" + var_name;
|
||||
}
|
||||
|
||||
public string AllocNative ()
|
||||
{
|
||||
return "Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + QualifiedName + ")))";
|
||||
}
|
||||
|
||||
public string AllocNative (string var_name)
|
||||
{
|
||||
return "GLib.Marshaller.StructureToPtrAlloc (" + var_name + ")";
|
||||
}
|
||||
|
||||
public override string FromNative (string var_name)
|
||||
{
|
||||
return String.Format ("({0}) Marshal.PtrToStructure ({1}, typeof ({0}))", QualifiedName, var_name);
|
||||
}
|
||||
|
||||
public string ReleaseNative (string var_name)
|
||||
{
|
||||
return "Marshal.FreeHGlobal (" + var_name + ")";
|
||||
public override string MarshalCallbackType {
|
||||
get {
|
||||
return "ref " + QualifiedName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
|
||||
p.CallName = p.Name;
|
||||
result [i] = p.CallString;
|
||||
result [i] = p.CallStringCallback;
|
||||
if (p.IsUserData)
|
||||
result [i] = "__data";
|
||||
}
|
||||
|
@ -168,12 +168,16 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\t" + retval.CSType + " InvokeNative (" + sig + ")");
|
||||
sw.WriteLine ("\t\t{");
|
||||
body.Initialize (gen_info);
|
||||
body.Initialize (gen_info, true);
|
||||
string call = "native_cb (" + InvokeString + ")";
|
||||
if (retval.IsVoid)
|
||||
sw.WriteLine ("\t\t\t" + call + ";");
|
||||
else
|
||||
else {
|
||||
sw.WriteLine ("\t\t\t" + retval.CSType + " result = " + retval.FromNative (call) + ";");
|
||||
var postRef = retval.PostFromNative (call);
|
||||
if (postRef != string.Empty)
|
||||
sw.WriteLine ("\t\t\t" + postRef);
|
||||
}
|
||||
body.Finish (sw, String.Empty);
|
||||
if (!retval.IsVoid)
|
||||
sw.WriteLine ("\t\t\treturn result;");
|
||||
|
@ -202,13 +206,13 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ();
|
||||
sw.WriteLine ("#region Autogenerated code");
|
||||
sw.WriteLine ("\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
|
||||
sw.WriteLine ("\tinternal delegate " + retval.MarshalType + " " + wrapper + "(" + parms.ImportSignature + ");");
|
||||
sw.WriteLine ("\tinternal delegate " + retval.MarshalType + " " + wrapper + "(" + parms.CallbackImportSignature + ");");
|
||||
sw.WriteLine ();
|
||||
GenInvoker (gen_info, sw);
|
||||
sw.WriteLine ("\tinternal class " + Name + "Wrapper {");
|
||||
sw.WriteLine ();
|
||||
ManagedCallString call = new ManagedCallString (parms, false);
|
||||
sw.WriteLine ("\t\tpublic " + retval.MarshalType + " NativeCallback (" + parms.ImportSignature + ")");
|
||||
sw.WriteLine ("\t\tpublic " + retval.MarshalType + " NativeCallback (" + parms.CallbackImportSignature + ")");
|
||||
sw.WriteLine ("\t\t{");
|
||||
string unconditional = call.Unconditional ("\t\t\t");
|
||||
if (unconditional.Length > 0)
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace GtkSharp.Generation {
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
||||
public class Ctor : MethodBase {
|
||||
|
@ -74,7 +75,7 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine("\t\t" + Protection + " static " + Safety + Modifiers + name + " " + StaticName + "(" + Signature + ")");
|
||||
sw.WriteLine("\t\t{");
|
||||
|
||||
Body.Initialize(gen_info, false, false, "");
|
||||
Body.Initialize(gen_info, false, false, "", false);
|
||||
|
||||
sw.Write("\t\t\t" + name + " result = ");
|
||||
if (container_type is StructBase)
|
||||
|
@ -87,6 +88,11 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\t\treturn result;");
|
||||
}
|
||||
|
||||
static bool IsNullable (IGeneratable gen)
|
||||
{
|
||||
return gen is ClassBase && !(gen is StructBase);
|
||||
}
|
||||
|
||||
public void Generate (GenerationInfo gen_info)
|
||||
{
|
||||
if (!Validate ())
|
||||
|
@ -105,9 +111,11 @@ namespace GtkSharp.Generation {
|
|||
|
||||
if (needs_chaining) {
|
||||
sw.WriteLine ("\t\t\tif (GetType () != typeof (" + name + ")) {");
|
||||
if (gen_info.AssemblyName == "gtk-sharp")
|
||||
sw.WriteLine ("\t\t\t\tGtk.Application.AssertMainThread();");
|
||||
|
||||
if (Parameters.Count == 0) {
|
||||
sw.WriteLine ("\t\t\t\tCreateNativeObject (new string [0], new GLib.Value[0]);");
|
||||
sw.WriteLine ("\t\t\t\tCreateNativeObject (Array.Empty<IntPtr> (), Array.Empty<GLib.Value> (), 0);");
|
||||
sw.WriteLine ("\t\t\t\treturn;");
|
||||
} else {
|
||||
ArrayList names = new ArrayList ();
|
||||
|
@ -124,23 +132,41 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
|
||||
if (names.Count == Parameters.Count) {
|
||||
sw.WriteLine ("\t\t\t\tArrayList vals = new ArrayList();");
|
||||
sw.WriteLine ("\t\t\t\tArrayList names = new ArrayList();");
|
||||
bool genFixedDimension = true;
|
||||
foreach (Parameter par in Parameters) {
|
||||
if (IsNullable (par.Generatable)) {
|
||||
genFixedDimension = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sw.WriteLine ("\t\t\t\tvar vals = new GLib.Value[{0}];", Parameters.Count);
|
||||
sw.WriteLine ("\t\t\t\tvar names = new IntPtr[{0}];", names.Count);
|
||||
if (!genFixedDimension)
|
||||
sw.WriteLine ("\t\t\t\tvar param_count = 0;");
|
||||
for (int i = 0; i < names.Count; i++) {
|
||||
Parameter p = Parameters [i];
|
||||
string indent = "\t\t\t\t";
|
||||
if (p.Generatable is ClassBase && !(p.Generatable is StructBase)) {
|
||||
if (IsNullable (p.Generatable)) {
|
||||
sw.WriteLine (indent + "if (" + p.Name + " != null) {");
|
||||
indent += "\t";
|
||||
}
|
||||
sw.WriteLine (indent + "names.Add (\"" + names [i] + "\");");
|
||||
sw.WriteLine (indent + "vals.Add (new GLib.Value (" + values[i] + "));");
|
||||
if (genFixedDimension) {
|
||||
sw.WriteLine (indent + "names[" + i + "] = GLib.Marshaller.StringToPtrGStrdup (\"" + names [i] + "\");");
|
||||
sw.WriteLine (indent + "vals[" + i + "] = new GLib.Value (" + values [i] + ");");
|
||||
} else {
|
||||
sw.WriteLine (indent + "names[param_count] = GLib.Marshaller.StringToPtrGStrdup (\"" + names [i] + "\");");
|
||||
sw.WriteLine (indent + "vals[param_count++] = new GLib.Value (" + values [i] + ");");
|
||||
}
|
||||
|
||||
if (p.Generatable is ClassBase && !(p.Generatable is StructBase))
|
||||
if (IsNullable (p.Generatable))
|
||||
sw.WriteLine ("\t\t\t\t}");
|
||||
}
|
||||
|
||||
sw.WriteLine ("\t\t\t\tCreateNativeObject ((string[])names.ToArray (typeof (string)), (GLib.Value[])vals.ToArray (typeof (GLib.Value)));");
|
||||
if (genFixedDimension)
|
||||
sw.WriteLine ("\t\t\t\tCreateNativeObject (names, vals, {0});", names.Count);
|
||||
else
|
||||
sw.WriteLine ("\t\t\t\tCreateNativeObject (names, vals, param_count);");
|
||||
|
||||
sw.WriteLine ("\t\t\t\treturn;");
|
||||
} else
|
||||
sw.WriteLine ("\t\t\t\tthrow new InvalidOperationException (\"Can't override this constructor.\");");
|
||||
|
@ -149,7 +175,10 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\t\t}");
|
||||
}
|
||||
|
||||
Body.Initialize(gen_info, false, false, "");
|
||||
Body.Initialize(gen_info, false, false, "", false);
|
||||
if (container_type is ObjectGen) {
|
||||
sw.WriteLine ("\t\t\towned = true;");
|
||||
}
|
||||
sw.WriteLine("\t\t\t{0} = {1}({2});", container_type.AssignToName, CName, Body.GetCallString (false));
|
||||
Body.Finish (sw, "");
|
||||
Body.HandleException (sw, "");
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace GtkSharp.Generation {
|
|||
if (Elem.GetAttribute("type") == "flags")
|
||||
sw.WriteLine ("\t[Flags]");
|
||||
if (Elem.HasAttribute("gtype"))
|
||||
sw.WriteLine ("\t[GLib.GType (typeof (" + NS + "." + Name + "GType))]");
|
||||
sw.WriteLine ("\t[{0}]", Name);
|
||||
|
||||
string access = IsInternal ? "internal" : "public";
|
||||
sw.WriteLine ("\t" + access + " enum " + Name + enum_type + " {");
|
||||
|
@ -104,17 +104,7 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t}");
|
||||
|
||||
if (Elem.HasAttribute ("gtype")) {
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\tinternal class " + Name + "GType {");
|
||||
sw.WriteLine ("\t\t[DllImport (\"" + LibraryName + "\", CallingConvention = CallingConvention.Cdecl)]");
|
||||
sw.WriteLine ("\t\tstatic extern IntPtr " + Elem.GetAttribute ("gtype") + " ();");
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\tpublic static GLib.GType GType {");
|
||||
sw.WriteLine ("\t\t\tget {");
|
||||
sw.WriteLine ("\t\t\t\treturn new GLib.GType (" + Elem.GetAttribute ("gtype") + " ());");
|
||||
sw.WriteLine ("\t\t\t}");
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ("\t}");
|
||||
AttributeHelper.Gen (sw, Name, LibraryName, Elem.GetAttribute ("gtype"));
|
||||
}
|
||||
|
||||
sw.WriteLine ("#endregion");
|
||||
|
|
|
@ -65,6 +65,12 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsNullTermArray {
|
||||
get {
|
||||
return elem.HasAttribute ("null_term_array");
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBitfield {
|
||||
get {
|
||||
return elem.HasAttribute("bits");
|
||||
|
|
|
@ -71,6 +71,12 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string MarshalCallbackType {
|
||||
get {
|
||||
return MarshalType;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract string MarshalType { get; }
|
||||
|
||||
public string Name {
|
||||
|
|
|
@ -41,6 +41,9 @@ namespace GtkSharp.Generation {
|
|||
// receiving this generatable back from unmanaged code
|
||||
string MarshalReturnType {get;}
|
||||
|
||||
// The type to use as the marshal type in a callback
|
||||
string MarshalCallbackType { get; }
|
||||
|
||||
// The type to use in a managed callback signature when returning this
|
||||
// generatable to unmanaged code
|
||||
string ToNativeReturnType {get;}
|
||||
|
|
|
@ -7,6 +7,7 @@ DISTCLEANFILES = gapi2-codegen
|
|||
references =
|
||||
|
||||
sources = \
|
||||
AttributeHelper.cs \
|
||||
AliasGen.cs \
|
||||
BoxedGen.cs \
|
||||
ByRefGen.cs \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -16,7 +16,17 @@
|
|||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -81,12 +91,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = generator
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(srcdir)/gapi2-codegen.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES = gapi2-codegen
|
||||
|
@ -141,6 +150,7 @@ am__can_run_installinfo = \
|
|||
esac
|
||||
DATA = $(assembly_DATA)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gapi2-codegen.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AL = @AL@
|
||||
|
@ -208,6 +218,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -291,6 +302,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -310,6 +322,7 @@ CLEANFILES = gapi_codegen.exe
|
|||
DISTCLEANFILES = gapi2-codegen
|
||||
references =
|
||||
sources = \
|
||||
AttributeHelper.cs \
|
||||
AliasGen.cs \
|
||||
BoxedGen.cs \
|
||||
ByRefGen.cs \
|
||||
|
@ -379,7 +392,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign generator/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign generator/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -618,6 +630,8 @@ uninstall-am: uninstall-assemblyDATA uninstall-binSCRIPTS
|
|||
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
|
||||
uninstall-am uninstall-assemblyDATA uninstall-binSCRIPTS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
gapi_codegen.exe: $(build_sources)
|
||||
$(CSC) -out:gapi_codegen.exe $(OFF_T_FLAGS) $(references) $(build_sources)
|
||||
|
|
|
@ -98,8 +98,9 @@ namespace GtkSharp.Generation {
|
|||
ret += indent + String.Format ("{0} {1}_invoker = new {0} ({1}, {2}, {3});\n", (igen as CallbackGen).InvokerName, p.Name, user_data_param, destroy_param);
|
||||
} else {
|
||||
ret += indent + igen.QualifiedName + " my" + p.Name;
|
||||
if (p.PassAs == "ref")
|
||||
if (p.PassAs == "ref") {
|
||||
ret += " = " + p.FromNative (p.Name);
|
||||
}
|
||||
ret += ";\n";
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +118,7 @@ namespace GtkSharp.Generation {
|
|||
for (int i = 0; i < parms.Count; i ++) {
|
||||
Parameter p = parms [i] as Parameter;
|
||||
result [i] = p.PassAs == "" ? "" : p.PassAs + " ";
|
||||
|
||||
if (p.Generatable is CallbackGen)
|
||||
result [i] += p.Name + "_invoker.Handler";
|
||||
else
|
||||
|
@ -139,9 +141,14 @@ namespace GtkSharp.Generation {
|
|||
|
||||
if (igen is CallbackGen)
|
||||
continue;
|
||||
else if (igen is StructBase || igen is ByRefGen)
|
||||
ret += indent + String.Format ("if ({0} != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (my{0}, {0}, false);\n", p.Name);
|
||||
else
|
||||
if (igen is StructBase) {
|
||||
if (SymbolTable.Table.IsBlittable (igen)) {
|
||||
ret += indent + string.Format ("unsafe {{ if ({1} != IntPtr.Zero) *({0}*){1} = my{1}; }}\n", p.CSType, p.Name);
|
||||
} else {
|
||||
ret += indent + String.Format ("if ({0} != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (my{0}, {0}, false);\n", p.Name);
|
||||
}
|
||||
}
|
||||
else if (!(igen is ByRefGen))
|
||||
ret += indent + p.Name + " = " + igen.ToNativeReturn ("my" + p.Name) + ";\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -28,14 +28,22 @@ namespace GtkSharp.Generation {
|
|||
string mtype;
|
||||
string call_fmt;
|
||||
string from_fmt;
|
||||
bool freeAfterUse;
|
||||
|
||||
public MarshalGen (string ctype, string type, string mtype, string call_fmt, string from_fmt) : base (ctype, type, "null")
|
||||
public MarshalGen (string ctype, string type, string mtype, string call_fmt, string from_fmt) : this (ctype, type, mtype, call_fmt, from_fmt, true)
|
||||
{
|
||||
}
|
||||
|
||||
public MarshalGen (string ctype, string type, string mtype, string call_fmt, string from_fmt, bool freeAfterUse) : base (ctype, type, "null")
|
||||
{
|
||||
this.mtype = mtype;
|
||||
this.call_fmt = call_fmt;
|
||||
this.from_fmt = from_fmt;
|
||||
FreeAfterUse = freeAfterUse;
|
||||
}
|
||||
|
||||
|
||||
public bool FreeAfterUse { get; private set; }
|
||||
|
||||
public override string MarshalType {
|
||||
get {
|
||||
return mtype;
|
||||
|
@ -52,5 +60,22 @@ namespace GtkSharp.Generation {
|
|||
return String.Format (from_fmt, var);
|
||||
}
|
||||
}
|
||||
|
||||
public class StringMarshalGen : MarshalGen, IManualMarshaler
|
||||
{
|
||||
public StringMarshalGen (string ctype, string type, string mtype, string call_fmt, string from_fmt) : base (ctype, type, mtype, call_fmt, from_fmt, true)
|
||||
{
|
||||
}
|
||||
|
||||
public string AllocNative (string managed_var)
|
||||
{
|
||||
return CallByName (managed_var);
|
||||
}
|
||||
|
||||
public string ReleaseNative (string native_var)
|
||||
{
|
||||
return string.Format ("GLib.Marshaller.Free ({0})", native_var);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace GtkSharp.Generation {
|
|||
private bool is_get, is_set;
|
||||
private bool deprecated = false;
|
||||
private bool win32_utf8_variant = false;
|
||||
private bool cacheValue = false;
|
||||
private string cacheName = string.Empty;
|
||||
|
||||
public Method (XmlElement elem, ClassBase container_type) : base (elem, container_type)
|
||||
{
|
||||
|
@ -50,8 +52,11 @@ namespace GtkSharp.Generation {
|
|||
win32_utf8_variant = attr == "1" || attr.ToLower () == "true";
|
||||
}
|
||||
|
||||
if (Name == "GetType")
|
||||
if (Name == "GetType") {
|
||||
Name = "GetGType";
|
||||
cacheValue = !(container_type is StructBase) && !retval.IsVoid;
|
||||
cacheName = "_gtype";
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasWin32Utf8Variant {
|
||||
|
@ -212,6 +217,13 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public void GenerateCacheValue (StreamWriter sw)
|
||||
{
|
||||
if (!cacheValue)
|
||||
return;
|
||||
sw.WriteLine ("\t\tstatic {0} {1} = new {0} ({2});", retval.CSType, cacheName, CName + call);
|
||||
}
|
||||
|
||||
public void Generate (GenerationInfo gen_info, ClassBase implementor)
|
||||
{
|
||||
if (!Validate ())
|
||||
|
@ -242,6 +254,7 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
|
||||
GenerateImport (gen_info.Writer);
|
||||
GenerateCacheValue (gen_info.Writer);
|
||||
if (comp != null && retval.CSType == comp.Parameters.AccessorReturnType)
|
||||
comp.GenerateImport (gen_info.Writer);
|
||||
|
||||
|
@ -288,7 +301,7 @@ namespace GtkSharp.Generation {
|
|||
implementor.Prepare (sw, indent + "\t\t\t");
|
||||
if (IsAccessor)
|
||||
Body.InitAccessor (sw, Signature, indent);
|
||||
Body.Initialize(gen_info, is_get, is_set, indent);
|
||||
Body.Initialize(gen_info, is_get, is_set, indent, false);
|
||||
|
||||
if (HasWin32Utf8Variant) {
|
||||
if (!retval.IsVoid)
|
||||
|
@ -306,14 +319,21 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine(indent + "\t\t\t" + "else");
|
||||
sw.WriteLine(indent + "\t\t\t\traw_ret = " + CName + call + ";");
|
||||
sw.WriteLine(indent + "\t\t\t" + retval.CSType + " ret = " + retval.FromNative ("raw_ret") + ";");
|
||||
var postRef = retval.PostFromNative ("raw_ret");
|
||||
if (postRef != string.Empty)
|
||||
sw.WriteLine (indent + "\t\t\t" + postRef);
|
||||
sw.WriteLine ();
|
||||
}
|
||||
} else {
|
||||
sw.Write(indent + "\t\t\t");
|
||||
if (retval.IsVoid)
|
||||
sw.WriteLine(CName + call + ";");
|
||||
else {
|
||||
else if (!cacheValue) {
|
||||
sw.WriteLine(retval.MarshalType + " raw_ret = " + CName + call + ";");
|
||||
sw.WriteLine(indent + "\t\t\t" + retval.CSType + " ret = " + retval.FromNative ("raw_ret") + ";");
|
||||
var postRef = retval.PostFromNative ("raw_ret");
|
||||
if (postRef != string.Empty)
|
||||
sw.WriteLine (indent + "\t\t\t" + postRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,9 +344,9 @@ namespace GtkSharp.Generation {
|
|||
|
||||
if (is_get && Parameters.Count > 0)
|
||||
sw.WriteLine (indent + "\t\t\treturn " + Parameters.AccessorName + ";");
|
||||
else if (!retval.IsVoid)
|
||||
sw.WriteLine (indent + "\t\t\treturn ret;");
|
||||
else if (IsAccessor)
|
||||
else if (!retval.IsVoid) {
|
||||
sw.WriteLine (indent + "\t\t\treturn " + (cacheValue ? cacheName : "ret") + ";");
|
||||
} else if (IsAccessor)
|
||||
Body.FinishAccessor (sw, Signature, indent);
|
||||
|
||||
sw.Write(indent + "\t\t}");
|
||||
|
|
|
@ -58,6 +58,12 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public bool Hidden {
|
||||
get {
|
||||
return elem.HasAttribute ("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
protected string BaseName {
|
||||
get {
|
||||
string name = Name;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace GtkSharp.Generation {
|
|||
public class MethodBody {
|
||||
|
||||
Parameters parameters;
|
||||
|
||||
bool is_callback;
|
||||
public MethodBody (Parameters parms)
|
||||
{
|
||||
parameters = parms;
|
||||
|
@ -62,7 +62,7 @@ namespace GtkSharp.Generation {
|
|||
p.CallName = "value";
|
||||
else
|
||||
p.CallName = p.Name;
|
||||
string call_parm = p.CallString;
|
||||
string call_parm = is_callback ? p.CallStringCallback : p.CallString;
|
||||
|
||||
if (p.IsUserData && parameters.IsHidden (p) && !parameters.HideData &&
|
||||
(i == 0 || parameters [i - 1].Scope != "notified")) {
|
||||
|
@ -75,17 +75,21 @@ namespace GtkSharp.Generation {
|
|||
return String.Join (", ", result);
|
||||
}
|
||||
|
||||
public void Initialize (GenerationInfo gen_info)
|
||||
public void Initialize (GenerationInfo gen_info, bool is_callback)
|
||||
{
|
||||
Initialize (gen_info, false, false, String.Empty);
|
||||
Initialize (gen_info, false, false, String.Empty, is_callback);
|
||||
}
|
||||
|
||||
public void Initialize (GenerationInfo gen_info, bool is_get, bool is_set, string indent)
|
||||
public void Initialize (GenerationInfo gen_info, bool is_get, bool is_set, string indent, bool is_callback)
|
||||
{
|
||||
if (parameters.Count == 0)
|
||||
return;
|
||||
|
||||
this.is_callback = is_callback;
|
||||
StreamWriter sw = gen_info.Writer;
|
||||
if (gen_info.AssemblyName == "gtk-sharp")
|
||||
sw.WriteLine (indent + "\t\t\tGtk.Application.AssertMainThread();");
|
||||
|
||||
for (int i = 0; i < parameters.Count; i++) {
|
||||
Parameter p = parameters [i];
|
||||
|
||||
|
@ -95,7 +99,8 @@ namespace GtkSharp.Generation {
|
|||
name = "value";
|
||||
|
||||
p.CallName = name;
|
||||
foreach (string prep in p.Prepare)
|
||||
var prepare = is_callback ? p.PrepareCallback : p.Prepare;
|
||||
foreach (string prep in prepare)
|
||||
sw.WriteLine (indent + "\t\t\t" + prep);
|
||||
|
||||
if (gen is CallbackGen) {
|
||||
|
@ -140,9 +145,11 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public void Finish (StreamWriter sw, string indent)
|
||||
{
|
||||
foreach (Parameter p in parameters)
|
||||
foreach (string s in p.Finish)
|
||||
sw.WriteLine(indent + "\t\t\t" + s);
|
||||
foreach (Parameter p in parameters) {
|
||||
var finish = is_callback ? p.FinishCallback : p.Finish;
|
||||
foreach (string s in finish)
|
||||
sw.WriteLine (indent + "\t\t\t" + s);
|
||||
}
|
||||
}
|
||||
|
||||
public void FinishAccessor (StreamWriter sw, Signature sig, string indent)
|
||||
|
|
|
@ -134,6 +134,28 @@ namespace GtkSharp.Generation {
|
|||
return result;
|
||||
}
|
||||
|
||||
ClassBase GetParentWithGType (ClassBase start)
|
||||
{
|
||||
ClassBase parent = start;
|
||||
while (parent != null && parent.CName != "GObject") {
|
||||
if (parent.GetMethod ("GetType") == null && parent.GetMethod ("GetGType") == null) {
|
||||
parent = Parent;
|
||||
} else {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void GenerateAttribute (StreamWriter writer)
|
||||
{
|
||||
var parent = GetParentWithGType (this);
|
||||
if (parent != null)
|
||||
writer.WriteLine ("\t[{0}]", parent.Name);
|
||||
else
|
||||
writer.WriteLine ("\t[GLib.GTypeObject]");
|
||||
}
|
||||
|
||||
public override void Generate (GenerationInfo gen_info)
|
||||
{
|
||||
gen_info.CurrentType = Name;
|
||||
|
@ -157,6 +179,7 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t[Obsolete]");
|
||||
foreach (string attr in custom_attrs)
|
||||
sw.WriteLine ("\t" + attr);
|
||||
GenerateAttribute (sw);
|
||||
sw.Write ("\t{0} {1}class " + Name, IsInternal ? "internal" : "public", IsAbstract ? "abstract " : "");
|
||||
string cs_parent = table.GetCSType(Elem.GetAttribute("parent"));
|
||||
if (cs_parent != "") {
|
||||
|
@ -250,6 +273,11 @@ namespace GtkSharp.Generation {
|
|||
AppendCustom (sw, gen_info.CustomDir);
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
var parentGType = GetParentWithGType (this);
|
||||
if (parentGType == this) {
|
||||
var method = parentGType.GetMethod ("GetType") ?? parentGType.GetMethod ("GetGType");
|
||||
AttributeHelper.Gen (sw, Name, LibraryName, method.CName);
|
||||
}
|
||||
sw.WriteLine ("}");
|
||||
|
||||
sw.Close ();
|
||||
|
@ -271,7 +299,7 @@ namespace GtkSharp.Generation {
|
|||
gen_info.Writer.WriteLine();
|
||||
gen_info.Writer.WriteLine("\t\tprotected " + Name + "() : base(IntPtr.Zero)");
|
||||
gen_info.Writer.WriteLine("\t\t{");
|
||||
gen_info.Writer.WriteLine("\t\t\tCreateNativeObject (new string [0], new GLib.Value [0]);");
|
||||
gen_info.Writer.WriteLine("\t\t\tCreateNativeObject (Array.Empty<IntPtr> (), Array.Empty<GLib.Value> (), 0);");
|
||||
gen_info.Writer.WriteLine("\t\t}");
|
||||
}
|
||||
gen_info.Writer.WriteLine();
|
||||
|
|
|
@ -41,6 +41,29 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
ClassBase GetParentWithGType (ClassBase start)
|
||||
{
|
||||
ClassBase parent = start;
|
||||
while (parent != null && parent.CName != "GObject") {
|
||||
if (parent.GetMethod ("GetType") == null && parent.GetMethod ("GetGType") == null) {
|
||||
parent = Parent;
|
||||
} else {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void GenerateAttribute (StreamWriter writer)
|
||||
{
|
||||
var parent = GetParentWithGType (this);
|
||||
if (parent == null) {
|
||||
writer.WriteLine ("\t[GLib.GTypeOpaque]");
|
||||
} else {
|
||||
writer.WriteLine ("\t[{0}]", Name);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Generate (GenerationInfo gen_info)
|
||||
{
|
||||
gen_info.CurrentType = Name;
|
||||
|
@ -63,6 +86,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
if (IsDeprecated)
|
||||
sw.WriteLine ("\t[Obsolete]");
|
||||
GenerateAttribute (sw);
|
||||
sw.Write ("\t{0} class " + Name, IsInternal ? "internal" : "public");
|
||||
string cs_parent = table.GetCSType(Elem.GetAttribute("parent"));
|
||||
if (cs_parent != "")
|
||||
|
@ -180,6 +204,11 @@ namespace GtkSharp.Generation {
|
|||
AppendCustom(sw, gen_info.CustomDir);
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
var parentGType = GetParentWithGType (this);
|
||||
if (parentGType == this) {
|
||||
var method = parentGType.GetMethod ("GetType") ?? parentGType.GetMethod ("GetGType");
|
||||
AttributeHelper.Gen (sw, Name, LibraryName, method.CName);
|
||||
}
|
||||
sw.WriteLine ("}");
|
||||
|
||||
sw.Close ();
|
||||
|
|
|
@ -168,6 +168,19 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string MarshalCallbackType {
|
||||
get {
|
||||
string type = SymbolTable.Table.GetMarshalCallbackType (elem.GetAttribute ("type"));
|
||||
if (type == "void" || Generatable is IManualMarshaler)
|
||||
type = "IntPtr";
|
||||
if (IsArray) {
|
||||
type += "[]";
|
||||
type = type.Replace ("ref ", "");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return SymbolTable.Table.MangleName (elem.GetAttribute("name"));
|
||||
|
@ -180,6 +193,15 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string NativeCallbackSignature {
|
||||
get {
|
||||
string sig = MarshalCallbackType + " " + Name;
|
||||
if (PassAs != String.Empty)
|
||||
sig = PassAs + " " + sig;
|
||||
return sig;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string NativeSignature {
|
||||
get {
|
||||
string sig = MarshalType + " " + Name;
|
||||
|
@ -245,6 +267,12 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string [] PrepareCallback {
|
||||
get {
|
||||
return Prepare;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string CallString {
|
||||
get {
|
||||
string call_parm;
|
||||
|
@ -266,6 +294,12 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string CallStringCallback {
|
||||
get {
|
||||
return CallString;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string[] Finish {
|
||||
get {
|
||||
IGeneratable gen = Generatable;
|
||||
|
@ -277,12 +311,23 @@ namespace GtkSharp.Generation {
|
|||
if (PassAs != "out")
|
||||
result [i] = (gen as IManualMarshaler).ReleaseNative ("native_" + CallName) + ";";
|
||||
return result;
|
||||
} else if (PassAs != String.Empty && MarshalType != CSType)
|
||||
} else if (PassAs != String.Empty && MarshalType != CSType) {
|
||||
var handle = gen as HandleBase;
|
||||
if (handle != null) {
|
||||
return new string [] { CallName + " = " + handle.FromNative ("native_" + CallName, Owned) + ";" };
|
||||
}
|
||||
return new string [] { CallName + " = " + gen.FromNative ("native_" + CallName) + ";" };
|
||||
}
|
||||
return new string [0];
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string [] FinishCallback {
|
||||
get {
|
||||
return Finish;
|
||||
}
|
||||
}
|
||||
|
||||
public string FromNative (string var)
|
||||
{
|
||||
if (Generatable == null)
|
||||
|
@ -340,16 +385,20 @@ namespace GtkSharp.Generation {
|
|||
|
||||
ArrayList result = new ArrayList ();
|
||||
result.Add (String.Format ("int cnt_{0} = {0} == null ? 0 : {0}.Length;", CallName));
|
||||
result.Add (String.Format ("{0}[] native_{1} = new {0} [cnt_{1}" + (NullTerminated ? " + 1" : "") + "];", MarshalType.TrimEnd('[', ']'), CallName));
|
||||
result.Add (String.Format ("for (int i = 0; i < cnt_{0}; i++)", CallName));
|
||||
result.Add (String.Format ("{0}[] native_{1} = new {0} [cnt_{1}" + (NullTerminated ? " + 1" : "") + "];", MarshalType.TrimEnd ('[', ']'), CallName));
|
||||
IGeneratable gen = Generatable;
|
||||
result.Add (String.Format ("for (int i = 0; i < cnt_{0}; i++) {{", CallName));
|
||||
string marshalRes;
|
||||
if (gen is IManualMarshaler)
|
||||
result.Add (String.Format ("\tnative_{0} [i] = {1};", CallName, (gen as IManualMarshaler).AllocNative (CallName + "[i]")));
|
||||
marshalRes = ((IManualMarshaler)gen).AllocNative (CallName + "[i]");
|
||||
else
|
||||
result.Add (String.Format ("\tnative_{0} [i] = {1};", CallName, gen.CallByName (CallName + "[i]")));
|
||||
marshalRes = gen.CallByName (CallName + "[i]");
|
||||
|
||||
result.Add (String.Format ("\tnative_{0} [i] = {1};", CallName, marshalRes));
|
||||
result.Add ("}");
|
||||
if (NullTerminated)
|
||||
result.Add (String.Format ("native_{0} [cnt_{0}] = IntPtr.Zero;", CallName));
|
||||
|
||||
return (string[]) result.ToArray (typeof (string));
|
||||
}
|
||||
}
|
||||
|
@ -368,17 +417,24 @@ namespace GtkSharp.Generation {
|
|||
if (CSType == MarshalType)
|
||||
return new string [0];
|
||||
|
||||
var result = new System.Collections.Generic.List<string> ();
|
||||
IGeneratable gen = Generatable;
|
||||
if (gen is IManualMarshaler) {
|
||||
string [] result = new string [4];
|
||||
result [0] = "for (int i = 0; i < native_" + CallName + ".Length" + (NullTerminated ? " - 1" : "") + "; i++) {";
|
||||
result [1] = "\t" + CallName + " [i] = " + Generatable.FromNative ("native_" + CallName + "[i]") + ";";
|
||||
result [2] = "\t" + (gen as IManualMarshaler).ReleaseNative ("native_" + CallName + "[i]") + ";";
|
||||
result [3] = "}";
|
||||
return result;
|
||||
if (gen is IManualMarshaler || (gen is MarshalGen && ((MarshalGen)gen).FreeAfterUse)) {
|
||||
result.Add ("for (int i = 0; i < cnt_" + CallName + "; i++) {");
|
||||
string nativeVariable = "native_" + CallName + "[i]";
|
||||
if (gen is IManualMarshaler) {
|
||||
// All of these are in setter methods, it's mostly fire and forget so there's no need to marshal back the return value.
|
||||
//result.Add ("\t" + CallName + "[i] = " + gen.FromNative (nativeVariable) + ";");
|
||||
result.Add ("\t" + (gen as IManualMarshaler).ReleaseNative (nativeVariable) + ";");
|
||||
} else {
|
||||
if (gen is MarshalGen && ((MarshalGen)gen).FreeAfterUse) {
|
||||
// Don't use the FromNative return as it'll try and reconstruct the value, which is useless overhead.
|
||||
result.Add ("\tGLib.Marshaller.Free (" + nativeVariable + ");");
|
||||
}
|
||||
}
|
||||
result.Add ("}");
|
||||
}
|
||||
|
||||
return new string [0];
|
||||
return result.ToArray ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,6 +493,12 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public override string NativeCallbackSignature {
|
||||
get {
|
||||
return NativeSignature;
|
||||
}
|
||||
}
|
||||
|
||||
public override string NativeSignature {
|
||||
get {
|
||||
if (invert)
|
||||
|
@ -466,6 +528,12 @@ namespace GtkSharp.Generation {
|
|||
public StructParameter (XmlElement elem) : base (elem) {}
|
||||
|
||||
public override string MarshalType {
|
||||
get {
|
||||
return "ref " + Generatable.QualifiedName;
|
||||
}
|
||||
}
|
||||
|
||||
public override string MarshalCallbackType {
|
||||
get {
|
||||
return "IntPtr";
|
||||
}
|
||||
|
@ -474,13 +542,27 @@ namespace GtkSharp.Generation {
|
|||
public override string[] Prepare {
|
||||
get {
|
||||
if (PassAs == "out")
|
||||
return new string [] { "IntPtr native_" + CallName + " = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + Generatable.QualifiedName + ")));"};
|
||||
return new string [] { CallName + " = new " + Generatable.QualifiedName + "();"};
|
||||
return new string [0];
|
||||
}
|
||||
}
|
||||
|
||||
public override string [] PrepareCallback {
|
||||
get {
|
||||
if (PassAs == "out")
|
||||
return new string [] { "IntPtr native_" + CallName + " = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + Generatable.QualifiedName + ")));" };
|
||||
else
|
||||
return new string [] { "IntPtr native_" + CallName + " = " + (Generatable as IManualMarshaler).AllocNative (CallName) + ";"};
|
||||
return new string [] { "IntPtr native_" + CallName + " = " + (Generatable as IManualMarshaler).AllocNative (CallName) + ";" };
|
||||
}
|
||||
}
|
||||
|
||||
public override string CallString {
|
||||
get {
|
||||
return "ref " + CallName;
|
||||
}
|
||||
}
|
||||
|
||||
public override string CallStringCallback {
|
||||
get {
|
||||
return "native_" + CallName;
|
||||
}
|
||||
|
@ -488,16 +570,73 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public override string[] Finish {
|
||||
get {
|
||||
string[] result = new string [2];
|
||||
result [0] = CallName + " = " + FromNative ("native_" + CallName) + ";";
|
||||
result [1] = (Generatable as IManualMarshaler).ReleaseNative ("native_" + CallName) + ";";
|
||||
return new string [0];
|
||||
}
|
||||
}
|
||||
|
||||
public override string [] FinishCallback {
|
||||
get {
|
||||
string [] result = new string [PassAs == string.Empty ? 1 : 2];
|
||||
int i = 0;
|
||||
if (PassAs != string.Empty) {
|
||||
result [i++] = CallName + " = " + FromNative ("native_" + CallName) + ";";
|
||||
}
|
||||
result [i++] = (Generatable as IManualMarshaler).ReleaseNative ("native_" + CallName) + ";";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public override string NativeCallbackSignature {
|
||||
get {
|
||||
return "IntPtr " + CallName;
|
||||
}
|
||||
}
|
||||
|
||||
public override string NativeSignature {
|
||||
get {
|
||||
return "IntPtr " + CallName;
|
||||
return "ref " + Generatable.QualifiedName + " " + CallName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ByRefParameter : Parameter
|
||||
{
|
||||
|
||||
public ByRefParameter (XmlElement elem) : base (elem) { }
|
||||
|
||||
public override string MarshalType {
|
||||
get {
|
||||
return "ref " + CallName;
|
||||
}
|
||||
}
|
||||
|
||||
public override string [] Prepare {
|
||||
get {
|
||||
return new string [0];
|
||||
}
|
||||
}
|
||||
|
||||
public override string CallString {
|
||||
get {
|
||||
return "ref " + CallName;
|
||||
}
|
||||
}
|
||||
|
||||
public override string [] Finish {
|
||||
get {
|
||||
return new string [0];
|
||||
}
|
||||
}
|
||||
|
||||
public override string NativeCallbackSignature {
|
||||
get {
|
||||
return NativeSignature;
|
||||
}
|
||||
}
|
||||
|
||||
public override string NativeSignature {
|
||||
get {
|
||||
return "ref " + CSType + " " + CallName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -660,8 +799,10 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
} else if (p.CType == "GError**")
|
||||
p = new ErrorParameter (parm);
|
||||
else if (gen is StructBase || gen is ByRefGen) {
|
||||
else if (gen is StructBase) {
|
||||
p = new StructParameter (parm);
|
||||
} else if (gen is ByRefGen) {
|
||||
p = new ByRefParameter (parm);
|
||||
} else if (gen is CallbackGen) {
|
||||
has_cb = true;
|
||||
}
|
||||
|
@ -711,6 +852,19 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public string CallbackImportSignature {
|
||||
get {
|
||||
if (Count == 0)
|
||||
return String.Empty;
|
||||
|
||||
string [] result = new string [Count];
|
||||
for (int i = 0; i < Count; i++)
|
||||
result [i] = this [i].NativeCallbackSignature;
|
||||
|
||||
return String.Join (", ", result);
|
||||
}
|
||||
}
|
||||
|
||||
public string ImportSignature {
|
||||
get {
|
||||
if (Count == 0)
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
if (Hidden || (!Readable && !Writable))
|
||||
return;
|
||||
|
||||
|
||||
string modifiers = "";
|
||||
|
||||
if (IsNew || (container_type.Parent != null && container_type.Parent.GetPropertyRecursively (Name) != null))
|
||||
|
@ -140,14 +140,14 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine();
|
||||
} else if (Readable) {
|
||||
sw.WriteLine(indent + "get {");
|
||||
sw.WriteLine(indent + "\tGLib.Value val = " + RawGetter (qpname) + ";");
|
||||
sw.WriteLine(indent + "\tusing (GLib.Value val = " + RawGetter (qpname) + ") {");
|
||||
if (table.IsOpaque (CType) || table.IsBoxed (CType)) {
|
||||
sw.WriteLine(indent + "\t" + CSType + " ret = (" + CSType + ") val;");
|
||||
sw.WriteLine(indent + "\t\t" + CSType + " ret = (" + CSType + ") val;");
|
||||
} else if (table.IsInterface (CType)) {
|
||||
// Do we have to dispose the GLib.Object from the GLib.Value?
|
||||
sw.WriteLine (indent + "\t{0} ret = {0}Adapter.GetObject ((GLib.Object) val);", CSType);
|
||||
sw.WriteLine (indent + "\t\t{0} ret = {0}Adapter.GetObject ((GLib.Object) val);", CSType);
|
||||
} else {
|
||||
sw.Write(indent + "\t" + CSType + " ret = ");
|
||||
sw.Write(indent + "\t\t" + CSType + " ret = ");
|
||||
sw.Write ("(" + CSType + ") ");
|
||||
if (v_type != "") {
|
||||
sw.Write(v_type + " ");
|
||||
|
@ -155,8 +155,8 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine("val;");
|
||||
}
|
||||
|
||||
sw.WriteLine(indent + "\tval.Dispose ();");
|
||||
sw.WriteLine(indent + "\treturn ret;");
|
||||
sw.WriteLine(indent + "\t\treturn ret;");
|
||||
sw.WriteLine(indent + "\t}");
|
||||
sw.WriteLine(indent + "}");
|
||||
}
|
||||
|
||||
|
@ -166,21 +166,22 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine();
|
||||
} else if (Writable) {
|
||||
sw.WriteLine(indent + "set {");
|
||||
sw.Write(indent + "\tGLib.Value val = ");
|
||||
sw.Write(indent + "\tusing (GLib.Value val = ");
|
||||
if (table.IsBoxed (CType)) {
|
||||
sw.WriteLine("(GLib.Value) value;");
|
||||
sw.Write("(GLib.Value) value");
|
||||
} else if (table.IsOpaque (CType)) {
|
||||
sw.WriteLine("new GLib.Value(value, \"{0}\");", CType);
|
||||
sw.Write("new GLib.Value(value, \"{0}\")", CType);
|
||||
} else {
|
||||
sw.Write("new GLib.Value(");
|
||||
if (v_type != "" && !(table.IsObject (CType) || table.IsInterface (CType) || table.IsOpaque (CType))) {
|
||||
sw.Write(v_type + " ");
|
||||
}
|
||||
sw.WriteLine("value);");
|
||||
sw.Write("value)");
|
||||
}
|
||||
sw.WriteLine(indent + "\t" + RawSetter (qpname) + ";");
|
||||
sw.WriteLine(indent + "\tval.Dispose ();");
|
||||
sw.WriteLine(indent + "}");
|
||||
sw.WriteLine (") {");
|
||||
sw.WriteLine(indent + "\t\t" + RawSetter (qpname) + ";");
|
||||
sw.WriteLine(indent + "\t}");
|
||||
sw.WriteLine (indent + "}");
|
||||
}
|
||||
|
||||
sw.WriteLine(indent.Substring (1) + "}");
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace GtkSharp.Generation {
|
|||
bool is_array;
|
||||
bool elements_owned;
|
||||
bool owned;
|
||||
bool needs_ref;
|
||||
string ctype = String.Empty;
|
||||
string element_ctype = String.Empty;
|
||||
|
||||
|
@ -43,6 +44,7 @@ namespace GtkSharp.Generation {
|
|||
owned = elem.GetAttribute ("owned") == "true";
|
||||
ctype = elem.GetAttribute("type");
|
||||
element_ctype = elem.GetAttribute ("element_type");
|
||||
needs_ref = elem.GetAttribute ("needs_ref") == "true";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,9 +126,9 @@ namespace GtkSharp.Generation {
|
|||
if (ElementType != String.Empty) {
|
||||
string args = (owned ? "true" : "false") + ", " + (elements_owned ? "true" : "false");
|
||||
if (IGen.QualifiedName == "GLib.PtrArray")
|
||||
return String.Format ("({0}[]) GLib.Marshaller.PtrArrayToArray ({1}, {2}, typeof({0}))", ElementType, var, args);
|
||||
return String.Format ("GLib.Marshaller.PtrArrayToArray<{0}> ({1}, {2})", ElementType, var, args);
|
||||
else
|
||||
return String.Format ("({0}[]) GLib.Marshaller.ListPtrToArray ({1}, typeof({2}), {3}, typeof({0}))", ElementType, var, IGen.QualifiedName, args);
|
||||
return String.Format ("GLib.Marshaller.ListPtrToArray<{0}> ({1}, typeof({2}), {3})", ElementType, var, IGen.QualifiedName, args);
|
||||
} else if (IGen is HandleBase)
|
||||
return ((HandleBase)IGen).FromNative (var, owned);
|
||||
else if (is_null_term)
|
||||
|
@ -134,6 +136,14 @@ namespace GtkSharp.Generation {
|
|||
else
|
||||
return IGen.FromNativeReturn (var);
|
||||
}
|
||||
|
||||
public string PostFromNative (string var)
|
||||
{
|
||||
if (!needs_ref)
|
||||
return string.Empty;
|
||||
|
||||
return "g_object_ref (" + var + ");";
|
||||
}
|
||||
|
||||
public string ToNative (string var)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace GtkSharp.Generation {
|
|||
Parameter p = parms [i];
|
||||
if (p.PassAs != "" && !(p.Generatable is StructBase))
|
||||
result += p.PassAs + " ";
|
||||
result += (p.MarshalType + " arg" + i);
|
||||
result += (p.MarshalCallbackType + " arg" + i);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -191,7 +191,7 @@ namespace GtkSharp.Generation {
|
|||
if (igen is BoxedGen)
|
||||
return retval.CSType + ".GType";
|
||||
if (igen is EnumGen)
|
||||
return retval.CSType + "GType.GType";
|
||||
return retval.CSType + "Attribute.GType";
|
||||
|
||||
switch (retval.CSType) {
|
||||
case "bool":
|
||||
|
@ -216,17 +216,22 @@ namespace GtkSharp.Generation {
|
|||
IGeneratable igen = p.Generatable;
|
||||
if (p.PassAs != "out") {
|
||||
if (igen is ManualGen) {
|
||||
sw.WriteLine("\t\t\t\tif (arg{0} == IntPtr.Zero)", idx);
|
||||
sw.WriteLine("\t\t\t\t\targs.Args[{0}] = null;", idx - 1);
|
||||
sw.WriteLine("\t\t\t\telse {");
|
||||
sw.WriteLine("\t\t\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
|
||||
sw.WriteLine("\t\t\t\t}");
|
||||
} else
|
||||
sw.WriteLine("\t\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
|
||||
sw.WriteLine ("\t\t\t\tif (arg{0} == IntPtr.Zero)", idx);
|
||||
sw.WriteLine ("\t\t\t\t\targs.Args[{0}] = null;", idx - 1);
|
||||
sw.WriteLine ("\t\t\t\telse {");
|
||||
sw.WriteLine ("\t\t\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
|
||||
sw.WriteLine ("\t\t\t\t}");
|
||||
} else {
|
||||
sw.WriteLine ("\t\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
|
||||
}
|
||||
}
|
||||
if (igen is StructBase && p.PassAs == "ref")
|
||||
finish += "\t\t\t\tif (arg" + idx + " != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (args.Args[" + (idx-1) + "], arg" + idx + ", false);\n";
|
||||
else if (p.PassAs != "")
|
||||
if (igen is StructBase && p.PassAs == "ref") {
|
||||
if (SymbolTable.Table.IsBlittable (SymbolTable.Table [igen.CName])) {
|
||||
finish += "\t\t\t\tunsafe { if (arg" + idx + " != IntPtr.Zero) " + string.Format ("*({0}*){1} = my{1}", p.CSType, p.Name) + "; }\n";
|
||||
} else {
|
||||
finish += "\t\t\t\tif (arg" + idx + " != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (args.Args[" + (idx - 1) + "], arg" + idx + ", false);\n";
|
||||
}
|
||||
} else if (p.PassAs != "")
|
||||
finish += "\t\t\t\targ" + idx + " = " + igen.ToNativeReturn ("((" + p.CSType + ")args.Args[" + (idx - 1) + "])") + ";\n";
|
||||
}
|
||||
return finish;
|
||||
|
@ -424,11 +429,16 @@ namespace GtkSharp.Generation {
|
|||
GenVMDeclaration (sw, null);
|
||||
sw.WriteLine ("\t\t{");
|
||||
MethodBody body = new MethodBody (parms);
|
||||
body.Initialize (gen_info, false, false, String.Empty);
|
||||
body.Initialize (gen_info, false, false, String.Empty, false);
|
||||
sw.WriteLine ("\t\t\t{0}{1} ({2});", IsVoid ? "" : retval.MarshalType + " __ret = ", glue_name, GlueCallString);
|
||||
body.Finish (sw, "");
|
||||
if (!IsVoid)
|
||||
if (!IsVoid) {
|
||||
sw.WriteLine ("\t\t\treturn {0};", retval.FromNative ("__ret"));
|
||||
var postRef = retval.PostFromNative ("__ret");
|
||||
if (postRef != string.Empty)
|
||||
sw.WriteLine ("\t\t\t" + postRef);
|
||||
|
||||
}
|
||||
sw.WriteLine ("\t\t}\n");
|
||||
}
|
||||
|
||||
|
@ -442,42 +452,46 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\t\tGLib.Value ret = new GLib.Value (" + ReturnGType + ");");
|
||||
|
||||
sw.WriteLine ("\t\t\tGLib.ValueArray inst_and_params = new GLib.ValueArray (" + parms.Count + ");");
|
||||
sw.WriteLine ("\t\t\tGLib.Value[] vals = new GLib.Value [" + parms.Count + "];");
|
||||
sw.WriteLine ("\t\t\tvals [0] = new GLib.Value (this);");
|
||||
sw.WriteLine ("\t\t\tinst_and_params.Append (vals [0]);");
|
||||
string cleanup = "";
|
||||
sw.WriteLine ("\t\t\tusing (var val0 = new GLib.Value (this)) {");
|
||||
sw.WriteLine ("\t\t\t\tinst_and_params.Append (val0);");
|
||||
string cleanup = "";
|
||||
string indent = new string ('\t', 4);
|
||||
for (int i = 1; i < parms.Count; i++) {
|
||||
Parameter p = parms [i];
|
||||
Parameter p = parms [i];
|
||||
indent = new string ('\t', 3 + i);
|
||||
if (p.PassAs != "") {
|
||||
if (SymbolTable.Table.IsBoxed (p.CType)) {
|
||||
if (p.PassAs == "ref")
|
||||
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + ");");
|
||||
sw.WriteLine (indent + "using (var val" + i + " = new GLib.Value (" + p.Name + ")) {");
|
||||
else
|
||||
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value ((GLib.GType)typeof (" + p.CSType + "));");
|
||||
cleanup += "\t\t\t" + p.Name + " = (" + p.CSType + ") vals [" + i + "];\n";
|
||||
sw.WriteLine (indent + "using (var val" + i + " = new GLib.Value ((GLib.GType)typeof (" + p.CSType + "))) {");
|
||||
cleanup += indent + p.Name + " = (" + p.CSType + ") vals [" + i + "];\n";
|
||||
} else {
|
||||
if (p.PassAs == "ref")
|
||||
sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = GLib.Marshaller.StructureToPtrAlloc (" + p.Generatable.CallByName (p.Name) + ");");
|
||||
sw.WriteLine (indent + "IntPtr " + p.Name + "_ptr = GLib.Marshaller.StructureToPtrAlloc (" + p.Generatable.CallByName (p.Name) + ");");
|
||||
else
|
||||
sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + p.MarshalType + ")));");
|
||||
sw.WriteLine (indent + "IntPtr " + p.Name + "_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + p.MarshalType + ")));");
|
||||
|
||||
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + "_ptr);");
|
||||
cleanup += "\t\t\t" + p.Name + " = " + p.FromNative ("(" + p.MarshalType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.MarshalType + "))") + ";\n";
|
||||
cleanup += "\t\t\tMarshal.FreeHGlobal (" + p.Name + "_ptr);\n";
|
||||
sw.WriteLine (indent + "using (var val" + i + " = new GLib.Value (" + p.Name + "_ptr)) {");
|
||||
cleanup += indent + p.Name + " = " + p.FromNative ("(" + p.MarshalType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.MarshalType + "))") + ";\n";
|
||||
cleanup += indent + "Marshal.FreeHGlobal (" + p.Name + "_ptr);\n";
|
||||
}
|
||||
} else if (p.IsLength && parms [i - 1].IsString)
|
||||
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (System.Text.Encoding.UTF8.GetByteCount (" + parms [i-1].Name + "));");
|
||||
sw.WriteLine (indent + "using (var val" + i + " = new GLib.Value (System.Text.Encoding.UTF8.GetByteCount (" + parms [i-1].Name + "))) {");
|
||||
else
|
||||
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + ");");
|
||||
sw.WriteLine (indent + "using (var val" + i + " = new GLib.Value (" + p.Name + ")) {");
|
||||
|
||||
sw.WriteLine ("\t\t\tinst_and_params.Append (vals [" + i + "]);");
|
||||
sw.WriteLine (indent + "inst_and_params.Append (val" + i + ");");
|
||||
}
|
||||
|
||||
sw.WriteLine ("\t\t\tg_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);");
|
||||
sw.WriteLine (indent + "g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);");
|
||||
if (cleanup != "")
|
||||
sw.WriteLine (cleanup);
|
||||
sw.WriteLine ("\t\t\tforeach (GLib.Value v in vals)");
|
||||
sw.WriteLine ("\t\t\t\tv.Dispose ();");
|
||||
for (int i = 1; i < parms.Count; ++i) {
|
||||
indent = new string ('\t', parms.Count - i + 3);
|
||||
sw.WriteLine (indent + "}");
|
||||
}
|
||||
sw.WriteLine ("\t\t\t}");
|
||||
if (!IsVoid) {
|
||||
IGeneratable igen = SymbolTable.Table [retval.CType];
|
||||
sw.WriteLine ("\t\t\t" + retval.CSType + " result = (" + (igen is EnumGen ? retval.CSType + ") (Enum" : retval.CSType) + ") ret;");
|
||||
|
@ -495,7 +509,7 @@ namespace GtkSharp.Generation {
|
|||
string glue_name = String.Empty;
|
||||
ManagedCallString call = new ManagedCallString (parms, true);
|
||||
sw.WriteLine ("\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
|
||||
sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + Name + "VMDelegate (" + parms.ImportSignature + ");\n");
|
||||
sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + Name + "VMDelegate (" + parms.CallbackImportSignature + ");\n");
|
||||
|
||||
if (use_glue) {
|
||||
glue = gen_info.GlueWriter;
|
||||
|
@ -513,7 +527,7 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
|
||||
sw.WriteLine ("\t\tstatic {0} {1};\n", Name + "VMDelegate", Name + "VMCallback");
|
||||
sw.WriteLine ("\t\tstatic " + retval.ToNativeType + " " + Name.ToLower() + "_cb (" + parms.ImportSignature + ")");
|
||||
sw.WriteLine ("\t\tstatic " + retval.ToNativeType + " " + Name.ToLower() + "_cb (" + parms.CallbackImportSignature + ")");
|
||||
sw.WriteLine ("\t\t{");
|
||||
string unconditional = call.Unconditional ("\t\t\t");
|
||||
if (unconditional.Length > 0)
|
||||
|
|
|
@ -72,6 +72,12 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string MarshalCallbackType {
|
||||
get {
|
||||
return MarshalType;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string DefaultValue {
|
||||
get {
|
||||
return default_value;
|
||||
|
|
|
@ -29,8 +29,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public abstract class StructBase : ClassBase, IManualMarshaler {
|
||||
|
||||
new ArrayList fields = new ArrayList ();
|
||||
bool need_read_native = false;
|
||||
internal new ArrayList fields = new ArrayList ();
|
||||
|
||||
protected StructBase (XmlElement ns, XmlElement elem) : base (ns, elem)
|
||||
{
|
||||
|
@ -62,24 +61,36 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public override string MarshalType {
|
||||
public override string MarshalReturnType {
|
||||
get {
|
||||
return "IntPtr";
|
||||
}
|
||||
}
|
||||
|
||||
public override string MarshalCallbackType {
|
||||
get {
|
||||
return "IntPtr";
|
||||
}
|
||||
}
|
||||
|
||||
public override string MarshalType {
|
||||
get {
|
||||
return "ref " + QualifiedName;
|
||||
}
|
||||
}
|
||||
|
||||
public override string AssignToName {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
|
||||
public override string CallByName ()
|
||||
{
|
||||
return "this_as_native";
|
||||
return "ref this";
|
||||
}
|
||||
|
||||
public override string CallByName (string var)
|
||||
{
|
||||
return var + "_as_native";
|
||||
return "ref " + var;
|
||||
}
|
||||
|
||||
public override string FromNative (string var)
|
||||
|
@ -159,17 +170,15 @@ namespace GtkSharp.Generation {
|
|||
if (IsDeprecated)
|
||||
sw.WriteLine ("\t[Obsolete]");
|
||||
sw.WriteLine ("\t[StructLayout(LayoutKind.Sequential)]");
|
||||
GenerateAttribute (sw);
|
||||
string access = IsInternal ? "internal" : "public";
|
||||
sw.WriteLine ("\t" + access + " struct " + Name + " {");
|
||||
sw.WriteLine ();
|
||||
|
||||
need_read_native = false;
|
||||
GenFields (gen_info);
|
||||
sw.WriteLine ();
|
||||
GenCtors (gen_info);
|
||||
GenMethods (gen_info, null, this);
|
||||
if (need_read_native)
|
||||
GenReadNative (sw);
|
||||
|
||||
if (!need_close)
|
||||
return;
|
||||
|
@ -179,10 +188,37 @@ namespace GtkSharp.Generation {
|
|||
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
|
||||
sw.Close ();
|
||||
gen_info.Writer = null;
|
||||
}
|
||||
|
||||
|
||||
protected virtual void GenerateAttribute (StreamWriter writer)
|
||||
{
|
||||
if (GetMethod ("GetType") != null || GetMethod ("GetGType") != null)
|
||||
writer.WriteLine ("\t[{0}]", Name);
|
||||
}
|
||||
|
||||
void GenNewWithMarshal (StreamWriter sw)
|
||||
{
|
||||
sw.WriteLine ("\t\tpublic static " + QualifiedName + " New (IntPtr raw) {");
|
||||
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero)");
|
||||
sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName);
|
||||
sw.WriteLine ("\t\t\treturn ({0}) Marshal.PtrToStructure (raw, typeof ({0}));", QualifiedName);
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
}
|
||||
|
||||
void GenNewWithMemCpy (StreamWriter sw)
|
||||
{
|
||||
sw.WriteLine ("\t\tpublic static " + QualifiedName + " New (IntPtr raw) {");
|
||||
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero)");
|
||||
sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName);
|
||||
sw.WriteLine ("\t\t\tunsafe {{ return *({0}*)raw; }}", QualifiedName);
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
}
|
||||
|
||||
protected override void GenCtors (GenerationInfo gen_info)
|
||||
{
|
||||
StreamWriter sw = gen_info.Writer;
|
||||
|
@ -190,12 +226,12 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\tpublic static {0} Zero = new {0} ();", QualifiedName);
|
||||
sw.WriteLine();
|
||||
if (!DisableNew) {
|
||||
sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {");
|
||||
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero)");
|
||||
sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName);
|
||||
sw.WriteLine ("\t\t\treturn ({0}) Marshal.PtrToStructure (raw, typeof ({0}));", QualifiedName);
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
bool viaMarshal = !SymbolTable.Table.IsBlittable(SymbolTable.Table[this.CName]);
|
||||
|
||||
if (viaMarshal)
|
||||
GenNewWithMarshal (sw);
|
||||
else
|
||||
GenNewWithMemCpy (sw);
|
||||
}
|
||||
|
||||
foreach (Ctor ctor in Ctors)
|
||||
|
@ -204,26 +240,12 @@ namespace GtkSharp.Generation {
|
|||
base.GenCtors (gen_info);
|
||||
}
|
||||
|
||||
void GenReadNative (StreamWriter sw)
|
||||
{
|
||||
sw.WriteLine ("\t\tstatic void ReadNative (IntPtr native, ref {0} target)", QualifiedName);
|
||||
sw.WriteLine ("\t\t{");
|
||||
sw.WriteLine ("\t\t\ttarget = New (native);");
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
}
|
||||
|
||||
public override void Prepare (StreamWriter sw, string indent)
|
||||
{
|
||||
sw.WriteLine (indent + "IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));");
|
||||
sw.WriteLine (indent + "System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);");
|
||||
}
|
||||
|
||||
public override void Finish (StreamWriter sw, string indent)
|
||||
{
|
||||
need_read_native = true;
|
||||
sw.WriteLine (indent + "ReadNative (this_as_native, ref this);");
|
||||
sw.WriteLine (indent + "System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace GtkSharp.Generation {
|
|||
public new string CSType {
|
||||
get {
|
||||
string type = base.CSType;
|
||||
if (IsArray)
|
||||
if (IsArray || IsNullTermArray)
|
||||
type += "[]";
|
||||
else if ((IsPointer || SymbolTable.Table.IsOpaque (CType)) && type != "string")
|
||||
type = "IntPtr";
|
||||
|
@ -115,7 +115,14 @@ namespace GtkSharp.Generation {
|
|||
string wrapped_name = SymbolTable.Table.MangleName (CName);
|
||||
IGeneratable gen = table [CType];
|
||||
|
||||
if (IsArray) {
|
||||
if (IsNullTermArray) {
|
||||
sw.WriteLine (indent + Access + " IntPtr Native" + StudlyName + ";");
|
||||
sw.WriteLine (indent + Access + " " + CSType + " " + StudlyName + " {");
|
||||
sw.WriteLine (indent + "\tget {");
|
||||
sw.WriteLine (indent + "\t\treturn GLib.Marshaller.NullTermPtrToStringArray (Native" + StudlyName + ", false);");
|
||||
sw.WriteLine (indent + "\t}");
|
||||
sw.WriteLine (indent + "}");
|
||||
} else if (IsArray) {
|
||||
sw.WriteLine (indent + "[MarshalAs (UnmanagedType.ByValArray, SizeConst=" + ArrayLength + ")]");
|
||||
sw.WriteLine (indent + "{0} {1} {2};", Access, CSType, StudlyName);
|
||||
} else if (IsBitfield) {
|
||||
|
|
|
@ -28,21 +28,28 @@ namespace GtkSharp.Generation {
|
|||
public class StructGen : StructBase {
|
||||
|
||||
public StructGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
||||
|
||||
|
||||
protected override void GenerateAttribute (StreamWriter writer)
|
||||
{
|
||||
if (GetMethod ("GetType") == null && GetMethod ("GetGType") == null) {
|
||||
writer.WriteLine ("\t[GLib.GTypeStruct]");
|
||||
} else {
|
||||
base.GenerateAttribute (writer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Generate (GenerationInfo gen_info)
|
||||
{
|
||||
gen_info.CurrentType = Name;
|
||||
|
||||
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
||||
base.Generate (gen_info);
|
||||
if (GetMethod ("GetType") == null && GetMethod ("GetGType") == null) {
|
||||
sw.WriteLine ("\t\tprivate static GLib.GType GType {");
|
||||
sw.WriteLine ("\t\t\tget { return GLib.GType.Pointer; }");
|
||||
sw.WriteLine ("\t\t}");
|
||||
}
|
||||
sw.WriteLine ("#endregion");
|
||||
AppendCustom (sw, gen_info.CustomDir);
|
||||
sw.WriteLine ("\t}");
|
||||
var method = GetMethod ("GetType") ?? GetMethod ("GetGType");
|
||||
if (method != null)
|
||||
AttributeHelper.Gen (sw, Name, LibraryName, method.CName);
|
||||
sw.WriteLine ("}");
|
||||
sw.Close ();
|
||||
gen_info.Writer = null;
|
||||
|
|
|
@ -107,9 +107,9 @@ namespace GtkSharp.Generation {
|
|||
AddType (new ConstStringGen ("const-xmlChar"));
|
||||
AddType (new ConstStringGen ("const-char"));
|
||||
AddType (new ConstFilenameGen ("const-gfilename"));
|
||||
AddType (new MarshalGen ("gfilename", "string", "IntPtr", "GLib.Marshaller.StringToFilenamePtr({0})", "GLib.Marshaller.FilenamePtrToStringGFree({0})"));
|
||||
AddType (new MarshalGen ("gchar", "string", "IntPtr", "GLib.Marshaller.StringToPtrGStrdup({0})", "GLib.Marshaller.PtrToStringGFree({0})"));
|
||||
AddType (new MarshalGen ("char", "string", "IntPtr", "GLib.Marshaller.StringToPtrGStrdup({0})", "GLib.Marshaller.PtrToStringGFree({0})"));
|
||||
AddType (new StringMarshalGen ("gfilename", "string", "IntPtr", "GLib.Marshaller.StringToFilenamePtr({0})", "GLib.Marshaller.FilenamePtrToStringGFree({0})"));
|
||||
AddType (new StringMarshalGen ("gchar", "string", "IntPtr", "GLib.Marshaller.StringToPtrGStrdup({0})", "GLib.Marshaller.PtrToStringGFree({0})"));
|
||||
AddType (new StringMarshalGen ("char", "string", "IntPtr", "GLib.Marshaller.StringToPtrGStrdup({0})", "GLib.Marshaller.PtrToStringGFree({0})"));
|
||||
AddType (new SimpleGen ("GStrv", "string[]", "null"));
|
||||
|
||||
// manually wrapped types requiring more complex marshaling
|
||||
|
@ -121,7 +121,7 @@ namespace GtkSharp.Generation {
|
|||
AddType (new MarshalGen ("gunichar", "char", "uint", "GLib.Marshaller.CharToGUnichar ({0})", "GLib.Marshaller.GUnicharToChar ({0})"));
|
||||
AddType (new MarshalGen ("time_t", "System.DateTime", "IntPtr", "GLib.Marshaller.DateTimeTotime_t ({0})", "GLib.Marshaller.time_tToDateTime ({0})"));
|
||||
AddType (new MarshalGen ("GString", "string", "IntPtr", "new GLib.GString ({0}).Handle", "GLib.GString.PtrToString ({0})"));
|
||||
AddType (new MarshalGen ("GType", "GLib.GType", "IntPtr", "{0}.Val", "new GLib.GType({0})"));
|
||||
AddType (new MarshalGen ("GType", "GLib.GType", "IntPtr", "{0}.Val", "new GLib.GType({0})", freeAfterUse: false));
|
||||
AddType (new ByRefGen ("GValue", "GLib.Value"));
|
||||
AddType (new SimpleGen ("GDestroyNotify", "GLib.DestroyNotify", "null"));
|
||||
|
||||
|
@ -267,6 +267,14 @@ namespace GtkSharp.Generation {
|
|||
return "";
|
||||
return gen.ToNativeReturnType;
|
||||
}
|
||||
|
||||
public string GetMarshalCallbackType (string c_type)
|
||||
{
|
||||
IGeneratable gen = this [c_type];
|
||||
if (gen == null)
|
||||
return "";
|
||||
return gen.MarshalCallbackType;
|
||||
}
|
||||
|
||||
public string GetMarshalType(string c_type)
|
||||
{
|
||||
|
@ -408,5 +416,37 @@ namespace GtkSharp.Generation {
|
|||
|
||||
return name;
|
||||
}
|
||||
|
||||
public bool IsBlittable (IGeneratable t)
|
||||
{
|
||||
if (t is SimpleGen)
|
||||
return true;
|
||||
if (t is EnumGen)
|
||||
return true;
|
||||
if (t is ByRefGen && t.CName == "GValue")
|
||||
return true;
|
||||
if (t is IAccessor && t.MarshalType == "IntPtr")
|
||||
return true;
|
||||
|
||||
if (t is StructBase) {
|
||||
foreach (StructField field in (t as StructBase).fields) {
|
||||
if (field.IsArray || field.IsNullTermArray)
|
||||
return false;
|
||||
|
||||
if (field.CSType == "string")
|
||||
return false;
|
||||
|
||||
// We don't care about pointers.
|
||||
if (field.IsPointer)
|
||||
continue;
|
||||
|
||||
var gen = SymbolTable.Table [field.CType];
|
||||
if (!IsBlittable (gen))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public string MarshalReturnType {
|
||||
get {
|
||||
return SymbolTable.Table.GetToNativeReturnType (elem["return-type"].GetAttribute("type"));
|
||||
return SymbolTable.Table.GetMarshalReturnType (elem["return-type"].GetAttribute("type"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,9 +80,9 @@ namespace GtkSharp.Generation {
|
|||
call_string = "__obj." + Name.Substring (3) + " = " + call;
|
||||
|
||||
sw.WriteLine ("\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
|
||||
sw.WriteLine ("\t\tdelegate " + MarshalReturnType + " " + Name + "Delegate (" + parms.ImportSignature + ");");
|
||||
sw.WriteLine ("\t\tdelegate " + MarshalReturnType + " " + Name + "Delegate (" + parms.CallbackImportSignature + ");");
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\tstatic " + MarshalReturnType + " " + Name + "Callback (" + parms.ImportSignature + ")");
|
||||
sw.WriteLine ("\t\tstatic " + MarshalReturnType + " " + Name + "Callback (" + parms.CallbackImportSignature + ")");
|
||||
sw.WriteLine ("\t\t{");
|
||||
string unconditional = call.Unconditional ("\t\t\t");
|
||||
if (unconditional.Length > 0)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -79,14 +89,12 @@ POST_UNINSTALL = :
|
|||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
DIST_COMMON = $(top_srcdir)/Makefile.include $(srcdir)/Makefile.in \
|
||||
$(srcdir)/Makefile.am $(srcdir)/glade-sharp.dll.config.in \
|
||||
$(srcdir)/glade-sharp-2.0.pc.in
|
||||
subdir = glade
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES = glade-sharp.dll.config glade-sharp-2.0.pc
|
||||
|
@ -175,6 +183,10 @@ am__define_uniq_tagged_files = \
|
|||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in \
|
||||
$(srcdir)/glade-sharp-2.0.pc.in \
|
||||
$(srcdir)/glade-sharp.dll.config.in \
|
||||
$(top_srcdir)/Makefile.include
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
|
@ -267,6 +279,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -350,6 +363,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -417,7 +431,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign glade/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign glade/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -426,7 +439,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
$(top_srcdir)/Makefile.include:
|
||||
$(top_srcdir)/Makefile.include $(am__empty):
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
@ -768,6 +781,8 @@ uninstall-am: uninstall-gapiDATA uninstall-local \
|
|||
ps ps-am tags tags-am uninstall uninstall-am \
|
||||
uninstall-gapiDATA uninstall-local uninstall-pkgconfigDATA
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
$(API): $(METADATA) $(RAW_API) $(SYMBOLS) $(top_builddir)/parser/gapi-fixup.exe
|
||||
cp $(srcdir)/$(RAW_API) $(API)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -80,12 +90,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = glade/glue
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/depcomp
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -195,6 +204,7 @@ am__define_uniq_tagged_files = \
|
|||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AL = @AL@
|
||||
|
@ -262,6 +272,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -345,6 +356,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -385,7 +397,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign glade/glue/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign glade/glue/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -685,6 +696,8 @@ uninstall-am: uninstall-libLTLIBRARIES
|
|||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
libgladesharpglue.dll: $(libgladesharpglue_2_la_OBJECTS) libgladesharpglue.rc libgladesharpglue.def
|
||||
./build-dll libgladesharpglue-2 $(VERSION)
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace GLib
|
||||
{
|
||||
static class FastActivator
|
||||
{
|
||||
const BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance;
|
||||
|
||||
delegate object FastCreateObjectPtr (IntPtr ptr);
|
||||
static FastCreateObjectPtr FastCtorPtr (Type t, Dictionary<Type, FastCreateObjectPtr> cache)
|
||||
{
|
||||
FastCreateObjectPtr method;
|
||||
lock (cache) {
|
||||
if (!cache.TryGetValue (t, out method)) {
|
||||
var param = Expression.Parameter (typeof (IntPtr));
|
||||
var ctor = t.GetConstructor (flags, null, new [] { typeof (IntPtr) }, new ParameterModifier [0]);
|
||||
if (ctor == null)
|
||||
throw new MissingMethodException ();
|
||||
|
||||
var newExpr = Expression.New (ctor, param);
|
||||
cache [t] = method = (FastCreateObjectPtr)Expression.Lambda (typeof (FastCreateObjectPtr), newExpr, param).Compile ();
|
||||
}
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
delegate object FastCreateObject ();
|
||||
static FastCreateObject FastCtor (Type t, Dictionary<Type, FastCreateObject> cache)
|
||||
{
|
||||
FastCreateObject method;
|
||||
lock (cache) {
|
||||
if (!cache.TryGetValue (t, out method)) {
|
||||
var newExpr = Expression.New (t);
|
||||
cache [t] = method = (FastCreateObject)Expression.Lambda (typeof (FastCreateObject), newExpr).Compile ();
|
||||
}
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
static readonly Dictionary<Type, FastCreateObjectPtr> cacheOpaque = new Dictionary<Type, FastCreateObjectPtr> (new TypeEqualityComparer ());
|
||||
public static Opaque CreateOpaque (IntPtr o, Type type)
|
||||
{
|
||||
return (Opaque)FastCtorPtr (type, cacheOpaque)(o);
|
||||
}
|
||||
|
||||
static readonly Dictionary<Type, FastCreateObjectPtr> cacheObject = new Dictionary<Type, FastCreateObjectPtr> (new TypeEqualityComparer ());
|
||||
public static Object CreateObject (IntPtr o, Type type)
|
||||
{
|
||||
return (Object)FastCtorPtr (type, cacheObject)(o);
|
||||
}
|
||||
|
||||
static readonly Dictionary<Type, FastCreateObject> cacheSignalArgs = new Dictionary<Type, FastCreateObject> (new TypeEqualityComparer ());
|
||||
public static SignalArgs CreateSignalArgs (Type type)
|
||||
{
|
||||
return (SignalArgs)FastCtor (type, cacheSignalArgs)();
|
||||
}
|
||||
|
||||
class TypeEqualityComparer : IEqualityComparer<Type>
|
||||
{
|
||||
public bool Equals (Type x, Type y)
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
public int GetHashCode (Type obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return 0;
|
||||
return obj.GetHashCode ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ namespace GLib {
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -65,8 +66,8 @@ namespace GLib {
|
|||
public static readonly GType Param = new GType ((IntPtr) TypeFundamentals.TypeParam);
|
||||
public static readonly GType Object = new GType ((IntPtr) TypeFundamentals.TypeObject);
|
||||
|
||||
static Hashtable types = new Hashtable ();
|
||||
static Hashtable gtypes = new Hashtable ();
|
||||
static Dictionary<IntPtr, Type> types = new Dictionary<IntPtr, Type> (IntPtrEqualityComparer.Instance);
|
||||
static Dictionary<Type, GType> gtypes = new Dictionary<Type, GType> ();
|
||||
|
||||
public static void Register (GType native_type, System.Type type)
|
||||
{
|
||||
|
@ -98,7 +99,6 @@ namespace GLib {
|
|||
Register (GType.String, typeof (string));
|
||||
Register (GType.Pointer, typeof (IntPtr));
|
||||
Register (GType.Object, typeof (GLib.Object));
|
||||
Register (GType.Pointer, typeof (IntPtr));
|
||||
|
||||
// One-way mapping
|
||||
gtypes[typeof (char)] = GType.UInt;
|
||||
|
@ -108,26 +108,39 @@ namespace GLib {
|
|||
{
|
||||
GType gtype;
|
||||
|
||||
if (gtypes.Contains (type))
|
||||
return (GType)gtypes[type];
|
||||
|
||||
if (gtypes.TryGetValue (type, out gtype))
|
||||
return gtype;
|
||||
|
||||
if (type.IsSubclassOf (typeof (GLib.Object))) {
|
||||
gtype = GLib.Object.LookupGType (type);
|
||||
Register (gtype, type);
|
||||
return gtype;
|
||||
}
|
||||
|
||||
PropertyInfo pi = type.GetProperty ("GType", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||||
if (pi != null)
|
||||
gtype = (GType) pi.GetValue (null, null);
|
||||
else if (type.IsDefined (typeof (GTypeAttribute), false)) {
|
||||
GTypeAttribute gattr = (GTypeAttribute)Attribute.GetCustomAttribute (type, typeof (GTypeAttribute), false);
|
||||
pi = gattr.WrapperType.GetProperty ("GType", BindingFlags.Public | BindingFlags.Static);
|
||||
gtype = (GType) pi.GetValue (null, null);
|
||||
} else if (type.IsSubclassOf (typeof (GLib.Opaque)))
|
||||
gtype = GType.Pointer;
|
||||
else
|
||||
gtype = ManagedValue.GType;
|
||||
if (type.IsEnum) {
|
||||
GTypeTypeAttribute geattr;
|
||||
GTypeAttribute gattr;
|
||||
if ((geattr = (GTypeTypeAttribute)Attribute.GetCustomAttribute (type, typeof (GTypeTypeAttribute), false)) != null) {
|
||||
gtype = geattr.Type;
|
||||
} else if ((gattr = (GTypeAttribute)Attribute.GetCustomAttribute (type, typeof (GTypeAttribute), false)) != null) {
|
||||
// This should never happen for generated code, keep it in place for other users of the API.
|
||||
var pi = gattr.WrapperType.GetProperty ("GType", BindingFlags.Public | BindingFlags.Static);
|
||||
gtype = (GType)pi.GetValue (null, null);
|
||||
} else
|
||||
gtype = ManagedValue.GType;
|
||||
} else {
|
||||
GTypeTypeAttribute geattr;
|
||||
PropertyInfo pi;
|
||||
if ((geattr = (GTypeTypeAttribute)Attribute.GetCustomAttribute (type, typeof (GTypeTypeAttribute), false)) != null) {
|
||||
gtype = geattr.Type;
|
||||
} else if ((pi = type.GetProperty ("GType", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy)) != null) {
|
||||
gtype = (GType)pi.GetValue (null, null);
|
||||
} else if (type.IsSubclassOf (typeof (GLib.Opaque)))
|
||||
gtype = GType.Pointer;
|
||||
else
|
||||
gtype = ManagedValue.GType;
|
||||
}
|
||||
|
||||
|
||||
Register (gtype, type);
|
||||
return gtype;
|
||||
|
@ -159,12 +172,12 @@ namespace GLib {
|
|||
|
||||
public static Type LookupType (IntPtr typeid)
|
||||
{
|
||||
if (types.Contains (typeid))
|
||||
return (Type)types[typeid];
|
||||
Type result;
|
||||
if (types.TryGetValue (typeid, out result))
|
||||
return result;
|
||||
|
||||
string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid));
|
||||
string type_name = GetQualifiedName (native_name);
|
||||
Type result = null;
|
||||
Assembly[] assemblies = (Assembly[]) AppDomain.CurrentDomain.GetAssemblies ().Clone ();
|
||||
foreach (Assembly asm in assemblies) {
|
||||
result = asm.GetType (type_name);
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace GLib {
|
|||
|
||||
using System;
|
||||
|
||||
[Obsolete ("Use GTypeTypeAttribute instead.")]
|
||||
[AttributeUsage (AttributeTargets.Enum)]
|
||||
public sealed class GTypeAttribute : Attribute {
|
||||
Type wrapper_type;
|
||||
|
@ -39,4 +40,39 @@ namespace GLib {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage (AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Class, Inherited = false)]
|
||||
public abstract class GTypeTypeAttribute : Attribute
|
||||
{
|
||||
public abstract GType Type {
|
||||
get;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GTypeOpaqueAttribute : GTypeTypeAttribute
|
||||
{
|
||||
public override GType Type {
|
||||
get {
|
||||
return GType.Pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GTypeObjectAttribute : GTypeTypeAttribute
|
||||
{
|
||||
public override GType Type {
|
||||
get {
|
||||
return GType.Object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GTypeStructAttribute : GTypeTypeAttribute
|
||||
{
|
||||
public override GType Type {
|
||||
get {
|
||||
return GType.Pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
23
glib/Idle.cs
23
glib/Idle.cs
|
@ -32,7 +32,7 @@ namespace GLib {
|
|||
public class Idle {
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
delegate bool IdleHandlerInternal ();
|
||||
delegate bool IdleHandlerInternal (IntPtr ptr);
|
||||
|
||||
|
||||
internal class IdleProxy : SourceProxy {
|
||||
|
@ -65,14 +65,17 @@ namespace GLib {
|
|||
Source.Remove (ID);
|
||||
}
|
||||
|
||||
public bool Handler ()
|
||||
static bool Handler (IntPtr data)
|
||||
{
|
||||
try {
|
||||
IdleHandler idle_handler = (IdleHandler) real_handler;
|
||||
SourceProxy obj;
|
||||
lock(proxies)
|
||||
obj = proxies [(int)data];
|
||||
IdleHandler idle_handler = (IdleHandler)obj.real_handler;
|
||||
|
||||
bool cont = idle_handler ();
|
||||
if (!cont)
|
||||
Remove ();
|
||||
obj.Remove ();
|
||||
return cont;
|
||||
} catch (Exception e) {
|
||||
ExceptionManager.RaiseUnhandledException (e, false);
|
||||
|
@ -91,7 +94,7 @@ namespace GLib {
|
|||
public static uint Add (IdleHandler hndlr)
|
||||
{
|
||||
IdleProxy p = new IdleProxy (hndlr);
|
||||
p.ID = g_idle_add ((IdleHandlerInternal) p.proxy_handler, IntPtr.Zero);
|
||||
p.ID = g_idle_add ((IdleHandlerInternal)p.proxy_handler, (IntPtr)p.proxyId);
|
||||
lock (Source.source_handlers)
|
||||
Source.source_handlers [p.ID] = p;
|
||||
|
||||
|
@ -104,19 +107,23 @@ namespace GLib {
|
|||
public static bool Remove (IdleHandler hndlr)
|
||||
{
|
||||
bool result = false;
|
||||
ArrayList keys = new ArrayList ();
|
||||
var keys = new System.Collections.Generic.List<uint> ();
|
||||
|
||||
lock (Source.source_handlers) {
|
||||
foreach (uint code in Source.source_handlers.Keys) {
|
||||
IdleProxy p = Source.source_handlers [code] as IdleProxy;
|
||||
|
||||
if (p != null && p.real_handler == hndlr) {
|
||||
if (p != null && p.real_handler == (System.Delegate) hndlr) {
|
||||
keys.Add (code);
|
||||
result = g_source_remove (code);
|
||||
p.proxy_handler = null;
|
||||
p.real_handler = null;
|
||||
lock(SourceProxy.proxies)
|
||||
SourceProxy.proxies.Remove (p.proxyId);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (object key in keys)
|
||||
foreach (var key in keys)
|
||||
Source.source_handlers.Remove (key);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GLib
|
||||
{
|
||||
class IntPtrEqualityComparer : IEqualityComparer<IntPtr>
|
||||
{
|
||||
public static readonly IEqualityComparer<IntPtr> Instance = new IntPtrEqualityComparer ();
|
||||
|
||||
public bool Equals (IntPtr x, IntPtr y)
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
|
||||
public int GetHashCode (IntPtr obj)
|
||||
{
|
||||
return obj.GetHashCode ();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -75,13 +75,18 @@ namespace GLib {
|
|||
return g_list_nth_data (Handle, n);
|
||||
}
|
||||
|
||||
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_free (IntPtr item);
|
||||
|
||||
public List (IntPtr raw) : this (raw, null) {}
|
||||
|
||||
public List (System.Type element_type) : this (IntPtr.Zero, element_type) {}
|
||||
|
||||
public List (IntPtr raw, System.Type element_type) : this (raw, element_type, false, false) {}
|
||||
|
||||
public List (IntPtr raw, System.Type element_type, bool owned, bool elements_owned) : base (raw, element_type, owned, elements_owned) {}
|
||||
public List (IntPtr raw, System.Type element_type, bool owned, bool elements_owned) : base (raw, element_type, owned, elements_owned, g_free) { }
|
||||
|
||||
public List (IntPtr raw, System.Type element_type, bool owned, bool elements_owned, ListElementFree free_func) : base (raw, element_type, owned, elements_owned, free_func) {}
|
||||
|
||||
public List (object[] elements, System.Type element_type, bool owned, bool elements_owned) : this (IntPtr.Zero, element_type, owned, elements_owned)
|
||||
{
|
||||
|
|
|
@ -26,13 +26,14 @@ namespace GLib {
|
|||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public delegate void ListElementFree (IntPtr ptr);
|
||||
public abstract class ListBase : IDisposable, ICollection, GLib.IWrapper, ICloneable {
|
||||
|
||||
private IntPtr list_ptr = IntPtr.Zero;
|
||||
private int length = -1;
|
||||
private bool managed = false;
|
||||
internal bool elements_owned = false;
|
||||
protected System.Type element_type = null;
|
||||
private ListElementFree free_func;
|
||||
|
||||
abstract internal IntPtr NthData (uint index);
|
||||
abstract internal int Length (IntPtr list);
|
||||
|
@ -40,12 +41,13 @@ namespace GLib {
|
|||
abstract internal IntPtr Append (IntPtr current, IntPtr raw);
|
||||
abstract internal IntPtr Prepend (IntPtr current, IntPtr raw);
|
||||
|
||||
internal ListBase (IntPtr list, System.Type element_type, bool owned, bool elements_owned)
|
||||
internal ListBase (IntPtr list, System.Type element_type, bool owned, bool elements_owned, ListElementFree free_func)
|
||||
{
|
||||
list_ptr = list;
|
||||
this.element_type = element_type;
|
||||
managed = owned;
|
||||
this.elements_owned = elements_owned;
|
||||
this.free_func = free_func;
|
||||
}
|
||||
|
||||
~ListBase ()
|
||||
|
@ -87,9 +89,7 @@ namespace GLib {
|
|||
// ICollection
|
||||
public int Count {
|
||||
get {
|
||||
if (length == -1)
|
||||
length = Length (list_ptr);
|
||||
return length;
|
||||
return Length (list_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,12 @@ namespace GLib {
|
|||
|
||||
public void CopyTo (Array array, int index)
|
||||
{
|
||||
object[] orig = new object[Count];
|
||||
CopyTo (array, index, Count);
|
||||
}
|
||||
|
||||
internal void CopyTo (Array array, int index, int count)
|
||||
{
|
||||
object[] orig = new object[count];
|
||||
int i = 0;
|
||||
foreach (object o in this)
|
||||
orig [i++] = o;
|
||||
|
@ -121,6 +126,13 @@ namespace GLib {
|
|||
orig.CopyTo (array, index);
|
||||
}
|
||||
|
||||
public void CopyTo<T> (T[] array, int index)
|
||||
{
|
||||
int i = index;
|
||||
foreach (T o in this)
|
||||
array [i++] = o;
|
||||
}
|
||||
|
||||
public class FilenameString {
|
||||
private FilenameString () {}
|
||||
}
|
||||
|
@ -180,22 +192,33 @@ namespace GLib {
|
|||
return ret;
|
||||
}
|
||||
|
||||
[DllImport ("libglib-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_free (IntPtr item);
|
||||
|
||||
[DllImport ("libgobject-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_unref (IntPtr item);
|
||||
|
||||
public void Empty ()
|
||||
{
|
||||
if (elements_owned)
|
||||
for (uint i = 0; i < Count; i++)
|
||||
if (typeof (GLib.Object).IsAssignableFrom (element_type))
|
||||
g_object_unref (NthData (i));
|
||||
else if (typeof (GLib.Opaque).IsAssignableFrom (element_type))
|
||||
GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
|
||||
else
|
||||
g_free (NthData (i));
|
||||
if (elements_owned) {
|
||||
var current = list_ptr;
|
||||
if (typeof (GLib.Object).IsAssignableFrom (element_type)) {
|
||||
while (current != IntPtr.Zero) {
|
||||
var temp = current;
|
||||
current = Next (temp);
|
||||
g_object_unref (GetData (temp));
|
||||
}
|
||||
} else if (typeof (GLib.Opaque).IsAssignableFrom (element_type)) {
|
||||
while (current != IntPtr.Zero) {
|
||||
var temp = current;
|
||||
current = Next (temp);
|
||||
GLib.Opaque.GetOpaque (GetData (temp), element_type, true).Dispose ();
|
||||
}
|
||||
} else {
|
||||
while (current != IntPtr.Zero) {
|
||||
var temp = current;
|
||||
current = Next (temp);
|
||||
free_func (GetData (temp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (managed)
|
||||
FreeList ();
|
||||
|
@ -270,7 +293,6 @@ namespace GLib {
|
|||
if (list_ptr != IntPtr.Zero)
|
||||
Free (list_ptr);
|
||||
list_ptr = IntPtr.Zero;
|
||||
length = -1;
|
||||
}
|
||||
|
||||
// ICloneable
|
||||
|
|
10
glib/Log.cs
10
glib/Log.cs
|
@ -73,6 +73,16 @@ namespace GLib {
|
|||
[DllImport("libglib-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_logv (IntPtr log_domain, LogLevelFlags flags, IntPtr message);
|
||||
|
||||
public static void Write (string logDomain, LogLevelFlags flags, string format, params object [] args)
|
||||
{
|
||||
IntPtr ndom = Marshaller.StringToPtrGStrdup (logDomain);
|
||||
IntPtr nmessage = Marshaller.StringToPtrGStrdup (String.Format (format, args));
|
||||
g_logv (ndom, flags, nmessage);
|
||||
Marshaller.Free (ndom);
|
||||
Marshaller.Free (nmessage);
|
||||
}
|
||||
|
||||
[Obsolete ("Use the static member Write")]
|
||||
public void WriteLog (string logDomain, LogLevelFlags flags, string format, params object [] args)
|
||||
{
|
||||
IntPtr ndom = Marshaller.StringToPtrGStrdup (logDomain);
|
||||
|
|
|
@ -28,6 +28,7 @@ sources = \
|
|||
DestroyNotify.cs \
|
||||
EnumWrapper.cs \
|
||||
ExceptionManager.cs \
|
||||
FastActivator.cs \
|
||||
FileUtils.cs \
|
||||
Format.cs \
|
||||
GException.cs \
|
||||
|
@ -40,6 +41,7 @@ sources = \
|
|||
Idle.cs \
|
||||
IgnoreClassInitializersAttribute.cs \
|
||||
InitiallyUnowned.cs \
|
||||
IntPtrEqualityComparer.cs \
|
||||
IOChannel.cs \
|
||||
IWrapper.cs \
|
||||
ListBase.cs \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -80,13 +90,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = glib
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(srcdir)/glib-sharp-2.0.pc.in \
|
||||
$(srcdir)/glib-sharp.dll.config.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES = glib-sharp-2.0.pc glib-sharp.dll.config
|
||||
|
@ -175,6 +183,8 @@ am__define_uniq_tagged_files = \
|
|||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/glib-sharp-2.0.pc.in \
|
||||
$(srcdir)/glib-sharp.dll.config.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
|
@ -267,6 +277,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -350,6 +361,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -387,6 +399,7 @@ sources = \
|
|||
DestroyNotify.cs \
|
||||
EnumWrapper.cs \
|
||||
ExceptionManager.cs \
|
||||
FastActivator.cs \
|
||||
FileUtils.cs \
|
||||
Format.cs \
|
||||
GException.cs \
|
||||
|
@ -399,6 +412,7 @@ sources = \
|
|||
Idle.cs \
|
||||
IgnoreClassInitializersAttribute.cs \
|
||||
InitiallyUnowned.cs \
|
||||
IntPtrEqualityComparer.cs \
|
||||
IOChannel.cs \
|
||||
IWrapper.cs \
|
||||
ListBase.cs \
|
||||
|
@ -457,7 +471,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign glib/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign glib/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -807,6 +820,8 @@ uninstall-am: uninstall-gapiDATA uninstall-local \
|
|||
ps ps-am tags tags-am uninstall uninstall-am \
|
||||
uninstall-gapiDATA uninstall-local uninstall-pkgconfigDATA
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
gtk-sharp.snk: $(top_srcdir)/gtk-sharp.snk
|
||||
cp $(top_srcdir)/gtk-sharp.snk .
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace GLib {
|
|||
public class Marshaller {
|
||||
|
||||
private Marshaller () {}
|
||||
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_free (IntPtr mem);
|
||||
|
||||
|
@ -76,16 +76,31 @@ namespace GLib {
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if HAVE_NET_4_6
|
||||
static bool hasFastGetStringOverload = typeof (System.Text.Encoding).GetMethod ("GetString", new [] { typeof (byte*), typeof (int) }) != null;
|
||||
static string Utf8PtrToStringFast (IntPtr ptr, int len)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
var p = (byte*)ptr;
|
||||
return System.Text.Encoding.UTF8.GetString (p, len);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[DllImport("glibsharpglue-2", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern UIntPtr glibsharp_strlen (IntPtr mem);
|
||||
|
||||
public static string Utf8PtrToString (IntPtr ptr)
|
||||
{
|
||||
if (ptr == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
int len = (int) (uint)glibsharp_strlen (ptr);
|
||||
byte[] bytes = new byte [len];
|
||||
#if HAVE_NET_4_6
|
||||
if (hasFastGetStringOverload)
|
||||
return Utf8PtrToStringFast (ptr, len);
|
||||
#endif
|
||||
byte [] bytes = new byte [len];
|
||||
Marshal.Copy (ptr, bytes, 0, len);
|
||||
return System.Text.Encoding.UTF8.GetString (bytes);
|
||||
}
|
||||
|
@ -146,10 +161,16 @@ namespace GLib {
|
|||
public static IntPtr StringToPtrGStrdup (string str) {
|
||||
if (str == null)
|
||||
return IntPtr.Zero;
|
||||
byte[] bytes = System.Text.Encoding.UTF8.GetBytes (str);
|
||||
IntPtr result = g_malloc (new UIntPtr ((ulong)bytes.Length + 1));
|
||||
Marshal.Copy (bytes, 0, result, bytes.Length);
|
||||
Marshal.WriteByte (result, bytes.Length, 0);
|
||||
int len = System.Text.Encoding.UTF8.GetByteCount (str);
|
||||
IntPtr result = g_malloc (new UIntPtr ((uint)len + 1));
|
||||
unsafe
|
||||
{
|
||||
fixed (char* p = str)
|
||||
{
|
||||
System.Text.Encoding.UTF8.GetBytes (p, str.Length, (byte*)result, len);
|
||||
}
|
||||
}
|
||||
Marshal.WriteByte (result, len, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -186,7 +207,7 @@ namespace GLib {
|
|||
return new string [0];
|
||||
|
||||
int count = 0;
|
||||
System.Collections.ArrayList result = new System.Collections.ArrayList ();
|
||||
var result = new System.Collections.Generic.List<string> ();
|
||||
IntPtr s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
|
||||
while (s != IntPtr.Zero) {
|
||||
result.Add (Utf8PtrToString (s));
|
||||
|
@ -196,7 +217,7 @@ namespace GLib {
|
|||
if (owned)
|
||||
g_strfreev (null_term_array);
|
||||
|
||||
return (string[]) result.ToArray (typeof(string));
|
||||
return result.ToArray ();
|
||||
}
|
||||
|
||||
public static string[] PtrToStringArrayGFree (IntPtr string_array)
|
||||
|
@ -235,8 +256,8 @@ namespace GLib {
|
|||
}
|
||||
|
||||
static bool check_sixtyfour () {
|
||||
int szint = Marshal.SizeOf (typeof (int));
|
||||
int szlong = Marshal.SizeOf (typeof (long));
|
||||
int szint = sizeof (int);
|
||||
int szlong = sizeof (long);
|
||||
int szptr = IntPtr.Size;
|
||||
|
||||
if (szptr == szint)
|
||||
|
@ -254,7 +275,7 @@ namespace GLib {
|
|||
for (int i = 0; i < args.Length; i++)
|
||||
ptrs[i] = (int) Marshal.StringToHGlobalAuto (args[i]);
|
||||
|
||||
IntPtr buf = g_malloc (new UIntPtr ((ulong) Marshal.SizeOf(typeof(int)) *
|
||||
IntPtr buf = g_malloc (new UIntPtr ((ulong) sizeof (int) *
|
||||
(ulong) args.Length));
|
||||
Marshal.Copy (ptrs, 0, buf, ptrs.Length);
|
||||
return buf;
|
||||
|
@ -267,7 +288,7 @@ namespace GLib {
|
|||
for (int i = 0; i < args.Length; i++)
|
||||
ptrs[i] = (long) Marshal.StringToHGlobalAuto (args[i]);
|
||||
|
||||
IntPtr buf = g_malloc (new UIntPtr ((ulong) Marshal.SizeOf(typeof(long)) *
|
||||
IntPtr buf = g_malloc (new UIntPtr ((ulong) sizeof (long) *
|
||||
(ulong) args.Length));
|
||||
Marshal.Copy (ptrs, 0, buf, ptrs.Length);
|
||||
return buf;
|
||||
|
@ -370,6 +391,7 @@ namespace GLib {
|
|||
return result;
|
||||
}
|
||||
|
||||
[Obsolete ("Use the ListPtrToArray<T> overload.")]
|
||||
public static Array ListPtrToArray (IntPtr list_ptr, Type list_type, bool owned, bool elements_owned, Type elem_type)
|
||||
{
|
||||
ListBase list;
|
||||
|
@ -382,6 +404,31 @@ namespace GLib {
|
|||
return ListToArray (list, elem_type);
|
||||
}
|
||||
|
||||
public static T [] ListPtrToArray<T> (IntPtr list_ptr, Type list_type, bool owned, bool elements_owned, ListElementFree free_func)
|
||||
{
|
||||
ListBase list;
|
||||
if (list_type == typeof (GLib.List))
|
||||
list = new GLib.List (list_ptr, typeof (T), owned, elements_owned, free_func);
|
||||
else
|
||||
list = new GLib.SList (list_ptr, typeof (T), owned, elements_owned, free_func);
|
||||
|
||||
using (list)
|
||||
return ListToArray<T> (list);
|
||||
}
|
||||
|
||||
public static T [] ListPtrToArray<T> (IntPtr list_ptr, Type list_type, bool owned, bool elements_owned)
|
||||
{
|
||||
ListBase list;
|
||||
if (list_type == typeof (GLib.List))
|
||||
list = new GLib.List (list_ptr, typeof(T), owned, elements_owned);
|
||||
else
|
||||
list = new GLib.SList (list_ptr, typeof (T), owned, elements_owned);
|
||||
|
||||
using (list)
|
||||
return ListToArray<T> (list);
|
||||
}
|
||||
|
||||
[Obsolete ("Use the PtrArrayToArray<T> overload.")]
|
||||
public static Array PtrArrayToArray (IntPtr list_ptr, bool owned, bool elements_owned, Type elem_type)
|
||||
{
|
||||
GLib.PtrArray array = new GLib.PtrArray (list_ptr, elem_type, owned, elements_owned);
|
||||
|
@ -391,17 +438,52 @@ namespace GLib {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static T [] PtrArrayToArray<T> (IntPtr list_ptr, bool owned, bool elements_owned)
|
||||
{
|
||||
var elem_type = typeof (T);
|
||||
GLib.PtrArray array = new GLib.PtrArray (list_ptr, elem_type, owned, elements_owned);
|
||||
T [] ret = new T [array.Count];
|
||||
array.CopyTo (ret, 0);
|
||||
array.Dispose ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static T [] PtrArrayToArray<T> (IntPtr list_ptr, bool owned, bool elements_owned, ListElementFree free_func)
|
||||
{
|
||||
var elem_type = typeof (T);
|
||||
GLib.PtrArray array = new GLib.PtrArray (list_ptr, elem_type, owned, elements_owned, free_func);
|
||||
T [] ret = new T [array.Count];
|
||||
array.CopyTo (ret, 0);
|
||||
array.Dispose ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
[Obsolete ("Use the ListToArray<T> overload")]
|
||||
public static Array ListToArray (ListBase list, System.Type type)
|
||||
{
|
||||
Array result = Array.CreateInstance (type, list.Count);
|
||||
if (list.Count > 0)
|
||||
list.CopyTo (result, 0);
|
||||
int count = list.Count;
|
||||
Array result = Array.CreateInstance (type, count);
|
||||
if (count > 0)
|
||||
list.CopyTo (result, 0, count);
|
||||
|
||||
if (type.IsSubclassOf (typeof (GLib.Opaque)))
|
||||
list.elements_owned = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static T [] ListToArray<T> (ListBase list)
|
||||
{
|
||||
int count = list.Count;
|
||||
var result = new T [count];
|
||||
if (count > 0)
|
||||
list.CopyTo (result, 0);
|
||||
|
||||
if (typeof(T).IsSubclassOf (typeof (GLib.Opaque)))
|
||||
list.elements_owned = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
107
glib/Object.cs
107
glib/Object.cs
|
@ -24,6 +24,7 @@ namespace GLib {
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -34,17 +35,20 @@ namespace GLib {
|
|||
IntPtr handle;
|
||||
ToggleRef tref;
|
||||
bool disposed = false;
|
||||
internal protected bool owned = false;
|
||||
Hashtable data;
|
||||
static Hashtable Objects = new Hashtable();
|
||||
static ArrayList PendingDestroys = new ArrayList ();
|
||||
static Dictionary<IntPtr, ToggleRef> Objects = new Dictionary<IntPtr, ToggleRef>(IntPtrEqualityComparer.Instance);
|
||||
static object lockObject = new object ();
|
||||
static List<ToggleRef> PendingDestroys = new List<ToggleRef> ();
|
||||
static bool idle_queued;
|
||||
|
||||
~Object ()
|
||||
{
|
||||
lock (PendingDestroys) {
|
||||
lock (lockObject) {
|
||||
lock (Objects) {
|
||||
if (Objects[Handle] is ToggleRef)
|
||||
PendingDestroys.Add (Objects [Handle]);
|
||||
ToggleRef res;
|
||||
if (Objects.TryGetValue (handle, out res))
|
||||
PendingDestroys.Add (res);
|
||||
Objects.Remove (Handle);
|
||||
}
|
||||
if (!idle_queued){
|
||||
|
@ -59,12 +63,11 @@ namespace GLib {
|
|||
|
||||
static bool PerformQueuedUnrefs ()
|
||||
{
|
||||
object [] references;
|
||||
List<ToggleRef> references;
|
||||
|
||||
lock (PendingDestroys){
|
||||
references = new object [PendingDestroys.Count];
|
||||
PendingDestroys.CopyTo (references, 0);
|
||||
PendingDestroys.Clear ();
|
||||
lock (lockObject) {
|
||||
references = PendingDestroys;
|
||||
PendingDestroys = new List<ToggleRef> ();
|
||||
idle_queued = false;
|
||||
}
|
||||
|
||||
|
@ -82,7 +85,7 @@ namespace GLib {
|
|||
disposed = true;
|
||||
ToggleRef toggle_ref;
|
||||
lock(Objects) {
|
||||
toggle_ref = Objects [Handle] as ToggleRef;
|
||||
Objects.TryGetValue (Handle, out toggle_ref);
|
||||
Objects.Remove (Handle);
|
||||
}
|
||||
try {
|
||||
|
@ -106,8 +109,8 @@ namespace GLib {
|
|||
|
||||
ToggleRef tr;
|
||||
lock(Objects)
|
||||
tr = (ToggleRef) Objects[o];
|
||||
if (tr != null && tr.IsAlive) {
|
||||
Objects.TryGetValue (o, out tr);
|
||||
if (tr != null) {
|
||||
return tr.Target;
|
||||
}
|
||||
|
||||
|
@ -120,30 +123,24 @@ namespace GLib {
|
|||
return null;
|
||||
|
||||
Object obj = null;
|
||||
ToggleRef toggle_ref = null;
|
||||
lock(Objects)
|
||||
Objects.TryGetValue (o, out toggle_ref);
|
||||
|
||||
lock(Objects) {
|
||||
if (Objects.Contains (o)) {
|
||||
ToggleRef toggle_ref = Objects [o] as ToggleRef;
|
||||
if (toggle_ref != null && toggle_ref.IsAlive)
|
||||
obj = toggle_ref.Target;
|
||||
}
|
||||
if (toggle_ref != null)
|
||||
obj = toggle_ref.Target;
|
||||
|
||||
if (obj != null && obj.Handle == o) {
|
||||
if (owned_ref)
|
||||
g_object_unref (obj.Handle);
|
||||
return obj;
|
||||
}
|
||||
if (obj != null && obj.Handle == o)
|
||||
return obj;
|
||||
|
||||
if (!owned_ref)
|
||||
g_object_ref (o);
|
||||
|
||||
obj = GLib.ObjectManager.CreateObject(o);
|
||||
}
|
||||
obj = GLib.ObjectManager.CreateObject (o);
|
||||
if (obj == null) {
|
||||
g_object_unref (o);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (owned_ref)
|
||||
g_object_unref (o);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -196,11 +193,11 @@ namespace GLib {
|
|||
|
||||
// Key: The pointer to the ParamSpec of the property
|
||||
// Value: The corresponding PropertyInfo object
|
||||
static Hashtable properties;
|
||||
static Hashtable Properties {
|
||||
static Dictionary<IntPtr, PropertyInfo> properties;
|
||||
static Dictionary<IntPtr, PropertyInfo> Properties {
|
||||
get {
|
||||
if (properties == null)
|
||||
properties = new Hashtable ();
|
||||
properties = new Dictionary<IntPtr, PropertyInfo> (IntPtrEqualityComparer.Instance);
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +342,7 @@ namespace GLib {
|
|||
}
|
||||
|
||||
|
||||
static Hashtable g_types = new Hashtable ();
|
||||
static Dictionary<Type, GType> g_types = new Dictionary<Type, GType> ();
|
||||
|
||||
protected GType LookupGType ()
|
||||
{
|
||||
|
@ -354,12 +351,23 @@ namespace GLib {
|
|||
|
||||
protected internal static GType LookupGType (System.Type t)
|
||||
{
|
||||
if (g_types.Contains (t))
|
||||
return (GType) g_types [t];
|
||||
GType res;
|
||||
if (g_types.TryGetValue (t, out res))
|
||||
return res;
|
||||
|
||||
GTypeTypeAttribute geattr;
|
||||
if ((geattr = (GTypeTypeAttribute)Attribute.GetCustomAttribute (t, typeof (GTypeTypeAttribute), false)) != null) {
|
||||
var val = geattr.Type;
|
||||
g_types [t] = val;
|
||||
return val;
|
||||
}
|
||||
|
||||
PropertyInfo pi = t.GetProperty ("GType", BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public);
|
||||
if (pi != null)
|
||||
return (GType) pi.GetValue (null, null);
|
||||
if (pi != null) {
|
||||
var val = (GType)pi.GetValue (null, null);
|
||||
g_types [t] = val;
|
||||
return val;
|
||||
}
|
||||
|
||||
return RegisterGType (t);
|
||||
}
|
||||
|
@ -388,12 +396,25 @@ namespace GLib {
|
|||
|
||||
protected virtual void CreateNativeObject (string[] names, GLib.Value[] vals)
|
||||
{
|
||||
IntPtr[] native_names = new IntPtr [names.Length];
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
CreateNativeObject (names, vals, names.Length);
|
||||
}
|
||||
|
||||
protected void CreateNativeObject (string [] names, GLib.Value [] vals, int count)
|
||||
{
|
||||
IntPtr[] native_names = new IntPtr [count];
|
||||
for (int i = 0; i < count; i++)
|
||||
native_names [i] = GLib.Marshaller.StringToPtrGStrdup (names [i]);
|
||||
Raw = gtksharp_object_newv (LookupGType ().Val, names.Length, native_names, vals);
|
||||
foreach (IntPtr p in native_names)
|
||||
GLib.Marshaller.Free (p);
|
||||
CreateNativeObject (native_names, vals, count);
|
||||
}
|
||||
|
||||
protected void CreateNativeObject (IntPtr [] native_names, GLib.Value [] vals, int count)
|
||||
{
|
||||
owned = true;
|
||||
Raw = gtksharp_object_newv (LookupGType ().Val, count, native_names, vals);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
GLib.Marshaller.Free (native_names [i]);
|
||||
vals [i].Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual IntPtr Raw {
|
||||
|
@ -581,8 +602,8 @@ namespace GLib {
|
|||
|
||||
protected GLib.Value GetProperty (string name)
|
||||
{
|
||||
Value val = new Value (this, name);
|
||||
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
|
||||
Value val = new Value (this, native_name);
|
||||
g_object_get_property (Raw, native_name, ref val);
|
||||
GLib.Marshaller.Free (native_name);
|
||||
return val;
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace GLib {
|
|||
|
||||
GLib.Object obj;
|
||||
try {
|
||||
obj = Activator.CreateInstance (type, flags, null, new object[] {raw}, null) as GLib.Object;
|
||||
obj = FastActivator.CreateObject (raw, type);
|
||||
} catch (MissingMethodException) {
|
||||
throw new GLib.MissingIntPtrCtorException ("GLib.Object subclass " + type + " must provide a protected or public IntPtr ctor to support wrapping of native object handles.");
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace GLib {
|
|||
|
||||
public static Opaque GetOpaque (IntPtr o, Type type, bool owned)
|
||||
{
|
||||
Opaque opaque = (Opaque)Activator.CreateInstance (type, new object[] { o });
|
||||
Opaque opaque = FastActivator.CreateOpaque (o, type);
|
||||
if (owned) {
|
||||
if (opaque.owned) {
|
||||
// The constructor took a Ref it shouldn't have, so undo it
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace GLib {
|
|||
private bool managed = false;
|
||||
internal bool elements_owned = false;
|
||||
protected System.Type element_type = null;
|
||||
private ListElementFree free_func;
|
||||
|
||||
[DllImport("libgobject-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_ptr_array_sized_new (uint n_preallocs);
|
||||
|
@ -54,12 +55,16 @@ namespace GLib {
|
|||
this.elements_owned = elements_owned;
|
||||
}
|
||||
|
||||
internal PtrArray (IntPtr raw, System.Type element_type, bool owned, bool elements_owned)
|
||||
internal PtrArray (IntPtr raw, System.Type element_type, bool owned, bool elements_owned, ListElementFree free_func)
|
||||
{
|
||||
handle = raw;
|
||||
this.element_type = element_type;
|
||||
managed = owned;
|
||||
this.elements_owned = elements_owned;
|
||||
this.free_func = free_func;
|
||||
}
|
||||
internal PtrArray (IntPtr raw, System.Type element_type, bool owned, bool elements_owned) : this(raw, element_type, owned, elements_owned, g_free)
|
||||
{
|
||||
}
|
||||
public PtrArray (IntPtr raw, System.Type element_type) : this (raw, element_type, false, false) {}
|
||||
|
||||
|
@ -99,7 +104,7 @@ namespace GLib {
|
|||
else if (typeof (GLib.Opaque).IsAssignableFrom (element_type))
|
||||
GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
|
||||
else
|
||||
g_free (NthData (i));
|
||||
free_func (NthData (i));
|
||||
}
|
||||
|
||||
if (managed)
|
||||
|
|
|
@ -76,13 +76,20 @@ namespace GLib {
|
|||
return g_slist_nth_data (Handle, n);
|
||||
}
|
||||
|
||||
|
||||
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void g_free (IntPtr item);
|
||||
|
||||
public SList (IntPtr raw) : this (raw, null) {}
|
||||
|
||||
public SList (System.Type element_type) : this (IntPtr.Zero, element_type) {}
|
||||
|
||||
public SList (IntPtr raw, System.Type element_type) : this (raw, element_type, false, false) {}
|
||||
|
||||
public SList (IntPtr raw, System.Type element_type, bool owned, bool elements_owned) : base (raw, element_type, false, false) {}
|
||||
public SList (IntPtr raw, System.Type element_type, bool owned, bool elements_owned) : base (raw, element_type, owned, elements_owned, g_free) { }
|
||||
|
||||
public SList (IntPtr raw, System.Type element_type, bool owned, bool elements_owned, ListElementFree free_func) : base (raw, element_type, owned, elements_owned, free_func) { }
|
||||
|
||||
|
||||
public SList (object[] members, System.Type element_type, bool owned, bool elements_owned) : this (IntPtr.Zero, element_type, owned, elements_owned)
|
||||
{
|
||||
|
|
|
@ -81,8 +81,9 @@ namespace GLib {
|
|||
bool NativeCallback (ref InvocationHint hint, uint n_pvals, IntPtr pvals_ptr, IntPtr data)
|
||||
{
|
||||
object[] pvals = new object [n_pvals];
|
||||
int valueSize = Marshal.SizeOf (typeof (Value));
|
||||
for (int i = 0; i < n_pvals; i++) {
|
||||
IntPtr p = new IntPtr ((long) pvals_ptr + i * Marshal.SizeOf (typeof (Value)));
|
||||
IntPtr p = new IntPtr ((long) pvals_ptr + i * valueSize);
|
||||
Value v = (Value) Marshal.PtrToStructure (p, typeof (Value));
|
||||
pvals [i] = v.Val;
|
||||
}
|
||||
|
@ -157,14 +158,14 @@ namespace GLib {
|
|||
void ClosureDisposedCB (object o, EventArgs args)
|
||||
{
|
||||
if (o == before_closure) {
|
||||
before_closure.Disposed -= new EventHandler (ClosureDisposedHandler);
|
||||
before_closure.Invoked -= new ClosureInvokedHandler (ClosureInvokedCB);
|
||||
before_closure.Disposed -= ClosureDisposedHandler;
|
||||
before_closure.Invoked -= ClosureInvokedHandler;
|
||||
if (tref.Target != null)
|
||||
tref.Target.BeforeSignals.Remove (name);
|
||||
before_closure = null;
|
||||
} else if (o == after_closure) {
|
||||
after_closure.Disposed -= new EventHandler (ClosureDisposedHandler);
|
||||
after_closure.Invoked -= new ClosureInvokedHandler (ClosureInvokedCB);
|
||||
after_closure.Disposed -= ClosureDisposedHandler;
|
||||
after_closure.Invoked -= ClosureInvokedHandler;
|
||||
if (tref.Target != null)
|
||||
tref.Target.AfterSignals.Remove (name);
|
||||
after_closure = null;
|
||||
|
@ -183,20 +184,21 @@ namespace GLib {
|
|||
}
|
||||
}
|
||||
|
||||
void ClosureInvokedCB (object o, ClosureInvokedArgs args)
|
||||
static void ClosureInvokedCB (object o, ClosureInvokedArgs args)
|
||||
{
|
||||
var closure = (SignalClosure)o;
|
||||
Delegate handler;
|
||||
if (o == before_closure)
|
||||
handler = args.Target.BeforeSignals [name] as Delegate;
|
||||
if (closure.before_closure)
|
||||
handler = args.Target.BeforeSignals [closure.name] as Delegate;
|
||||
else
|
||||
handler = args.Target.AfterSignals [name] as Delegate;
|
||||
handler = args.Target.AfterSignals [closure.name] as Delegate;
|
||||
|
||||
if (handler != null)
|
||||
handler.DynamicInvoke (new object[] {args.Target, args.Args});
|
||||
}
|
||||
|
||||
ClosureInvokedHandler closure_invoked_cb;
|
||||
ClosureInvokedHandler ClosureInvokedHandler {
|
||||
static ClosureInvokedHandler closure_invoked_cb;
|
||||
static ClosureInvokedHandler ClosureInvokedHandler {
|
||||
get {
|
||||
if (closure_invoked_cb == null)
|
||||
closure_invoked_cb = new ClosureInvokedHandler (ClosureInvokedCB);
|
||||
|
@ -228,11 +230,14 @@ namespace GLib {
|
|||
|
||||
public Delegate Handler {
|
||||
get {
|
||||
InvocationHint hint = (InvocationHint) Marshal.PtrToStructure (g_signal_get_invocation_hint (tref.Handle), typeof (InvocationHint));
|
||||
if (hint.run_type == Flags.RunFirst)
|
||||
return tref.Target.BeforeSignals [name] as Delegate;
|
||||
else
|
||||
return tref.Target.AfterSignals [name] as Delegate;
|
||||
unsafe
|
||||
{
|
||||
InvocationHint *hint = (InvocationHint*)g_signal_get_invocation_hint (tref.Handle);
|
||||
if (hint->run_type == Flags.RunFirst)
|
||||
return tref.Target.BeforeSignals [name] as Delegate;
|
||||
else
|
||||
return tref.Target.AfterSignals [name] as Delegate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,9 +250,9 @@ namespace GLib {
|
|||
tref.Target.BeforeSignals [name] = Delegate.Combine (tref.Target.BeforeSignals [name] as Delegate, d);
|
||||
if (before_closure == null) {
|
||||
if (marshaler == null)
|
||||
before_closure = new SignalClosure (tref.Handle, name, args_type);
|
||||
before_closure = new SignalClosure (tref.Handle, name, args_type, before_closure: true);
|
||||
else
|
||||
before_closure = new SignalClosure (tref.Handle, name, marshaler, this);
|
||||
before_closure = new SignalClosure (tref.Handle, name, marshaler, this, before_closure: true);
|
||||
before_closure.Disposed += ClosureDisposedHandler;
|
||||
before_closure.Invoked += ClosureInvokedHandler;
|
||||
before_closure.Connect (false);
|
||||
|
@ -256,9 +261,9 @@ namespace GLib {
|
|||
tref.Target.AfterSignals [name] = Delegate.Combine (tref.Target.AfterSignals [name] as Delegate, d);
|
||||
if (after_closure == null) {
|
||||
if (marshaler == null)
|
||||
after_closure = new SignalClosure (tref.Handle, name, args_type);
|
||||
after_closure = new SignalClosure (tref.Handle, name, args_type, before_closure: false);
|
||||
else
|
||||
after_closure = new SignalClosure (tref.Handle, name, marshaler, this);
|
||||
after_closure = new SignalClosure (tref.Handle, name, marshaler, this, before_closure: false);
|
||||
after_closure.Disposed += ClosureDisposedHandler;
|
||||
after_closure.Invoked += ClosureInvokedHandler;
|
||||
after_closure.Connect (true);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
namespace GLib {
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[Obsolete ("Replaced by GLib.Signal.")]
|
||||
|
@ -32,7 +33,7 @@ namespace GLib {
|
|||
protected static int _NextKey = 0;
|
||||
|
||||
// Hashtable containing refs to all current instances.
|
||||
protected static Hashtable _Instances = new Hashtable ();
|
||||
protected static Dictionary<int, SignalCallback> _Instances = new Dictionary<int, SignalCallback> ();
|
||||
|
||||
// protected instance members
|
||||
protected GLib.Object _obj;
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace GLib {
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal class ClosureInvokedArgs : EventArgs {
|
||||
|
@ -56,31 +57,32 @@ namespace GLib {
|
|||
|
||||
IntPtr handle;
|
||||
IntPtr raw_closure;
|
||||
string name;
|
||||
internal string name;
|
||||
uint id = UInt32.MaxValue;
|
||||
System.Type args_type;
|
||||
Delegate custom_marshaler;
|
||||
GCHandle gch;
|
||||
GCHandle? gch;
|
||||
internal bool before_closure;
|
||||
|
||||
static Hashtable closures = new Hashtable ();
|
||||
static Dictionary<IntPtr, SignalClosure> closures = new Dictionary<IntPtr, SignalClosure> (IntPtrEqualityComparer.Instance);
|
||||
|
||||
public SignalClosure (IntPtr obj, string signal_name, System.Type args_type)
|
||||
public SignalClosure (IntPtr obj, string signal_name, System.Type args_type, bool before_closure)
|
||||
{
|
||||
raw_closure = glibsharp_closure_new (Marshaler, Notify, IntPtr.Zero);
|
||||
closures [raw_closure] = this;
|
||||
handle = obj;
|
||||
name = signal_name;
|
||||
this.args_type = args_type;
|
||||
this.before_closure = before_closure;
|
||||
}
|
||||
|
||||
public SignalClosure (IntPtr obj, string signal_name, Delegate custom_marshaler, Signal signal)
|
||||
public SignalClosure (IntPtr obj, string signal_name, Delegate custom_marshaler, Signal signal, bool before_closure)
|
||||
{
|
||||
gch = GCHandle.Alloc (signal);
|
||||
raw_closure = g_cclosure_new (custom_marshaler, (IntPtr) gch, Notify);
|
||||
closures [raw_closure] = this;
|
||||
handle = obj;
|
||||
name = signal_name;
|
||||
this.custom_marshaler = custom_marshaler;
|
||||
this.before_closure = before_closure;
|
||||
}
|
||||
|
||||
public event EventHandler Disposed;
|
||||
|
@ -103,9 +105,10 @@ namespace GLib {
|
|||
{
|
||||
Disconnect ();
|
||||
closures.Remove (raw_closure);
|
||||
if (custom_marshaler != null)
|
||||
gch.Free ();
|
||||
custom_marshaler = null;
|
||||
if (gch != null) {
|
||||
gch.Value.Free ();
|
||||
gch = null;
|
||||
}
|
||||
if (Disposed != null)
|
||||
Disposed (this, EventArgs.Empty);
|
||||
GC.SuppressFinalize (this);
|
||||
|
@ -121,24 +124,24 @@ namespace GLib {
|
|||
static ClosureMarshal marshaler;
|
||||
static ClosureMarshal Marshaler {
|
||||
get {
|
||||
if (marshaler == null)
|
||||
marshaler = new ClosureMarshal (MarshalCallback);
|
||||
if (marshaler == null) {
|
||||
unsafe {
|
||||
marshaler = new ClosureMarshal (MarshalCallback);
|
||||
}
|
||||
}
|
||||
return marshaler;
|
||||
}
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
delegate void ClosureMarshal (IntPtr closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data);
|
||||
unsafe delegate void ClosureMarshal (IntPtr closure, Value *return_val, uint n_param_vals, Value *param_values, IntPtr invocation_hint, IntPtr marshal_data);
|
||||
|
||||
static void MarshalCallback (IntPtr raw_closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
|
||||
unsafe static void MarshalCallback (IntPtr raw_closure, Value *return_val, uint n_param_vals, Value *param_values, IntPtr invocation_hint, IntPtr marshal_data)
|
||||
{
|
||||
string message = String.Empty;
|
||||
|
||||
SignalClosure closure = null;
|
||||
try {
|
||||
SignalClosure closure = closures [raw_closure] as SignalClosure;
|
||||
message = "Marshaling " + closure.name + " signal";
|
||||
Value objval = (Value) Marshal.PtrToStructure (param_values, typeof (Value));
|
||||
GLib.Object __obj = objval.Val as GLib.Object;
|
||||
closure = closures [raw_closure] as SignalClosure;
|
||||
GLib.Object __obj = param_values[0].Val as GLib.Object;
|
||||
if (__obj == null)
|
||||
return;
|
||||
|
||||
|
@ -147,29 +150,23 @@ namespace GLib {
|
|||
return;
|
||||
}
|
||||
|
||||
SignalArgs args = Activator.CreateInstance (closure.args_type, new object [0]) as SignalArgs;
|
||||
SignalArgs args = FastActivator.CreateSignalArgs (closure.args_type);
|
||||
args.Args = new object [n_param_vals - 1];
|
||||
GLib.Value[] vals = new GLib.Value [n_param_vals - 1];
|
||||
for (int i = 1; i < n_param_vals; i++) {
|
||||
IntPtr ptr = new IntPtr (param_values.ToInt64 () + i * Marshal.SizeOf (typeof (Value)));
|
||||
vals [i - 1] = (Value) Marshal.PtrToStructure (ptr, typeof (Value));
|
||||
args.Args [i - 1] = vals [i - 1].Val;
|
||||
args.Args [i - 1] = param_values [i].Val;
|
||||
}
|
||||
ClosureInvokedArgs ci_args = new ClosureInvokedArgs (__obj, args);
|
||||
closure.Invoke (ci_args);
|
||||
for (int i = 1; i < n_param_vals; i++) {
|
||||
vals [i - 1].Update (args.Args [i - 1]);
|
||||
IntPtr ptr = new IntPtr (param_values.ToInt64 () + i * Marshal.SizeOf (typeof (Value)));
|
||||
Marshal.StructureToPtr (vals [i - 1], ptr, false);
|
||||
param_values [i].Update (args.Args [i - 1]);
|
||||
}
|
||||
if (return_val == IntPtr.Zero || args.RetVal == null)
|
||||
if (return_val == null || args.RetVal == null)
|
||||
return;
|
||||
|
||||
Value ret = (Value) Marshal.PtrToStructure (return_val, typeof (Value));
|
||||
ret.Val = args.RetVal;
|
||||
Marshal.StructureToPtr (ret, return_val, false);
|
||||
return_val->Val = args.RetVal;
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine (message);
|
||||
if (closure != null)
|
||||
Console.WriteLine ("Marshaling {0} signal", closure.name);
|
||||
ExceptionManager.RaiseUnhandledException (e, false);
|
||||
}
|
||||
}
|
||||
|
@ -179,9 +176,9 @@ namespace GLib {
|
|||
|
||||
static void NotifyCallback (IntPtr data, IntPtr raw_closure)
|
||||
{
|
||||
SignalClosure closure = closures [raw_closure] as SignalClosure;
|
||||
if (closure != null)
|
||||
closure.Dispose ();
|
||||
SignalClosure closure;
|
||||
if (closures.TryGetValue (raw_closure, out closure))
|
||||
closure.Dispose();
|
||||
}
|
||||
|
||||
static ClosureNotify notify_handler;
|
||||
|
|
|
@ -23,7 +23,9 @@ namespace GLib {
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
public delegate bool GSourceFunc ();
|
||||
|
||||
|
@ -35,19 +37,35 @@ namespace GLib {
|
|||
internal Delegate proxy_handler;
|
||||
internal uint ID;
|
||||
|
||||
internal int proxyId;
|
||||
static int idCounter;
|
||||
internal static Dictionary<int, SourceProxy> proxies = new Dictionary<int, SourceProxy> ();
|
||||
|
||||
protected SourceProxy ()
|
||||
{
|
||||
lock(proxies) {
|
||||
do {
|
||||
proxyId = idCounter++;
|
||||
} while (proxies.ContainsKey (proxyId));
|
||||
proxies [proxyId] = this;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Remove ()
|
||||
{
|
||||
lock (Source.source_handlers)
|
||||
Source.source_handlers.Remove (ID);
|
||||
real_handler = null;
|
||||
proxy_handler = null;
|
||||
lock(proxies)
|
||||
proxies.Remove (proxyId);
|
||||
}
|
||||
}
|
||||
|
||||
public class Source {
|
||||
private Source () {}
|
||||
|
||||
internal static Hashtable source_handlers = new Hashtable ();
|
||||
internal static Dictionary<uint, SourceProxy> source_handlers = new Dictionary<uint, SourceProxy>();
|
||||
|
||||
[DllImport("libglib-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern bool g_source_remove (uint tag);
|
||||
|
@ -58,8 +76,9 @@ namespace GLib {
|
|||
bool ret = true;
|
||||
|
||||
lock (Source.source_handlers) {
|
||||
if (source_handlers.Contains (tag)) {
|
||||
source_handlers.Remove (tag);
|
||||
SourceProxy handler;
|
||||
if (source_handlers.TryGetValue (tag, out handler)) {
|
||||
handler.Remove ();
|
||||
ret = g_source_remove (tag);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace GLib {
|
|||
public class Timeout {
|
||||
|
||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||
delegate bool TimeoutHandlerInternal ();
|
||||
delegate bool TimeoutHandlerInternal (IntPtr ptr);
|
||||
|
||||
internal class TimeoutProxy : SourceProxy {
|
||||
public TimeoutProxy (TimeoutHandler real)
|
||||
|
@ -62,14 +62,17 @@ namespace GLib {
|
|||
Source.Remove (ID);
|
||||
}
|
||||
|
||||
public bool Handler ()
|
||||
static bool Handler (IntPtr data)
|
||||
{
|
||||
try {
|
||||
TimeoutHandler timeout_handler = (TimeoutHandler) real_handler;
|
||||
SourceProxy obj;
|
||||
lock (proxies)
|
||||
obj = proxies [(int)data];
|
||||
TimeoutHandler timeout_handler = (TimeoutHandler)obj.real_handler;
|
||||
|
||||
bool cont = timeout_handler ();
|
||||
if (!cont)
|
||||
Remove ();
|
||||
obj.Remove ();
|
||||
return cont;
|
||||
} catch (Exception e) {
|
||||
ExceptionManager.RaiseUnhandledException (e, false);
|
||||
|
@ -87,7 +90,7 @@ namespace GLib {
|
|||
{
|
||||
TimeoutProxy p = new TimeoutProxy (hndlr);
|
||||
|
||||
p.ID = g_timeout_add (interval, (TimeoutHandlerInternal) p.proxy_handler, IntPtr.Zero);
|
||||
p.ID = g_timeout_add (interval, (TimeoutHandlerInternal) p.proxy_handler, (IntPtr)p.proxyId);
|
||||
lock (Source.source_handlers)
|
||||
Source.source_handlers [p.ID] = p;
|
||||
|
||||
|
|
|
@ -39,18 +39,8 @@ namespace GLib {
|
|||
gch = GCHandle.Alloc (this);
|
||||
reference = target;
|
||||
g_object_add_toggle_ref (target.Handle, ToggleNotifyCallback, (IntPtr) gch);
|
||||
g_object_unref (target.Handle);
|
||||
}
|
||||
|
||||
public bool IsAlive {
|
||||
get {
|
||||
if (reference is WeakReference) {
|
||||
WeakReference weak = reference as WeakReference;
|
||||
return weak.IsAlive;
|
||||
} else if (reference == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (target.owned && !(target is InitiallyUnowned))
|
||||
g_object_unref (target.Handle);
|
||||
}
|
||||
|
||||
public IntPtr Handle {
|
||||
|
|
|
@ -158,6 +158,13 @@ namespace GLib {
|
|||
GLib.Marshaller.Free (prop);
|
||||
}
|
||||
|
||||
internal Value (GLib.Object obj, IntPtr prop)
|
||||
{
|
||||
type = IntPtr.Zero;
|
||||
pad_1 = pad_2 = 0;
|
||||
gtksharp_value_create_from_property (ref this, obj.Handle, prop);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public Value (GLib.Object obj, string prop_name, EnumWrapper wrap)
|
||||
{
|
||||
|
@ -413,16 +420,18 @@ namespace GLib {
|
|||
g_value_set_string (ref this, native);
|
||||
GLib.Marshaller.Free (native);
|
||||
} else if (type == GType.Pointer.Val) {
|
||||
if (value.GetType () == typeof (IntPtr)) {
|
||||
if (value is IntPtr) {
|
||||
g_value_set_pointer (ref this, (IntPtr) value);
|
||||
return;
|
||||
} else if (value is IWrapper) {
|
||||
g_value_set_pointer (ref this, ((IWrapper)value).Handle);
|
||||
return;
|
||||
}
|
||||
IntPtr buf = Marshal.AllocHGlobal (Marshal.SizeOf (value.GetType()));
|
||||
Marshal.StructureToPtr (value, buf, false);
|
||||
g_value_set_pointer (ref this, buf);
|
||||
IntPtr wrapper = ManagedValue.WrapObject (value);
|
||||
g_value_unset (ref this);
|
||||
g_value_init (ref this, ManagedValue.GType.Val);
|
||||
g_value_set_boxed (ref this, wrapper);
|
||||
ManagedValue.ReleaseWrapper (wrapper);
|
||||
} else if (type == GType.Param.Val) {
|
||||
g_value_set_param (ref this, (IntPtr) value);
|
||||
} else if (type == ManagedValue.GType.Val) {
|
||||
|
|
|
@ -23,13 +23,15 @@ namespace GLib {
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class ValueArray : IDisposable, ICollection, ICloneable, IWrapper {
|
||||
|
||||
private IntPtr handle = IntPtr.Zero;
|
||||
|
||||
static private ArrayList PendingFrees = new ArrayList ();
|
||||
static private object lockObject = new object ();
|
||||
static private List<IntPtr> PendingFrees = new List<IntPtr> (8);
|
||||
static private bool idle_queued = false;
|
||||
|
||||
[DllImport("libgobject-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
|
@ -65,7 +67,7 @@ namespace GLib {
|
|||
if (Handle == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
lock (PendingFrees) {
|
||||
lock (lockObject) {
|
||||
PendingFrees.Add (handle);
|
||||
|
||||
if (! idle_queued) {
|
||||
|
@ -79,18 +81,17 @@ namespace GLib {
|
|||
|
||||
static bool PerformFrees ()
|
||||
{
|
||||
IntPtr[] handles;
|
||||
List<IntPtr> handles;
|
||||
|
||||
lock (PendingFrees) {
|
||||
lock (lockObject) {
|
||||
idle_queued = false;
|
||||
|
||||
handles = new IntPtr [PendingFrees.Count];
|
||||
PendingFrees.CopyTo (handles, 0);
|
||||
PendingFrees.Clear ();
|
||||
handles = PendingFrees;
|
||||
PendingFrees = new List<IntPtr> (8);
|
||||
}
|
||||
|
||||
foreach (IntPtr h in handles)
|
||||
g_value_array_free (h);
|
||||
for (int i = 0; i < handles.Count; ++i)
|
||||
g_value_array_free (handles [i]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -15,7 +15,17 @@
|
|||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
|
@ -80,12 +90,11 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = glib/glue
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/depcomp
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -193,6 +202,7 @@ am__define_uniq_tagged_files = \
|
|||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AL = @AL@
|
||||
|
@ -260,6 +270,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
|
|||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
|
@ -343,6 +354,7 @@ pdfdir = @pdfdir@
|
|||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -391,7 +403,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign glib/glue/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign glib/glue/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
|
@ -699,6 +710,8 @@ uninstall-am: uninstall-libLTLIBRARIES
|
|||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
libgtksharpglue.dll: $(libgtksharpglue_2_la_OBJECTS) libgtksharpglue.rc libgtksharpglue.def
|
||||
./build-dll libgtksharpglue-2 $(VERSION)
|
||||
|
|
|
@ -123,9 +123,6 @@
|
|||
if (raw_ret == IntPtr.Zero)
|
||||
return new AccelGroup [0];
|
||||
GLib.SList list = new GLib.SList(raw_ret);
|
||||
AccelGroup[] result = new AccelGroup [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as AccelGroup;
|
||||
return result;
|
||||
return GLib.Marshaller.ListToArray<AccelGroup> (list);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
get {
|
||||
IntPtr raw_ret = gtk_action_get_proxies (Handle);
|
||||
GLib.SList list = new GLib.SList (raw_ret);
|
||||
Widget[] result = new Widget [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Widget;
|
||||
return result;
|
||||
return GLib.Marshaller.ListToArray<Widget> (list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,9 +78,5 @@
|
|||
|
||||
public Gtk.Action[] ListActions() {
|
||||
IntPtr raw_ret = gtk_action_group_list_actions (Handle);
|
||||
GLib.List list = new GLib.List (raw_ret);
|
||||
Gtk.Action[] result = new Gtk.Action [list.Count];
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
result [i] = list [i] as Gtk.Action;
|
||||
return result;
|
||||
return GLib.Marshaller.ListPtrToArray<Gtk.Action> (raw_ret, typeof (GLib.List), true, false);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ static extern IntPtr gtk_adjustment_new(double value, double lower, double upper
|
|||
public Adjustment (double value, double lower, double upper, double step_increment, double page_increment, double page_size) : base (IntPtr.Zero)
|
||||
{
|
||||
if (GetType () != typeof (Adjustment)) {
|
||||
CreateNativeObject (new string [0], new GLib.Value [0]);
|
||||
CreateNativeObject (new IntPtr [0], new GLib.Value [0], 0);
|
||||
Value = value;
|
||||
Lower = lower;
|
||||
Upper = upper;
|
||||
|
@ -34,6 +34,7 @@ public Adjustment (double value, double lower, double upper, double step_increme
|
|||
return;
|
||||
}
|
||||
|
||||
owned = true;
|
||||
Raw = gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace Gtk {
|
|||
using Gdk;
|
||||
|
||||
public class Application {
|
||||
static System.Threading.Thread MainThread;
|
||||
|
||||
//
|
||||
// Disables creation of instances.
|
||||
|
@ -117,13 +118,22 @@ namespace Gtk {
|
|||
return res;
|
||||
}
|
||||
|
||||
internal static void AssertMainThread ()
|
||||
{
|
||||
if (MainThread != null && System.Threading.Thread.CurrentThread != MainThread) {
|
||||
GLib.Log.Write (null, GLib.LogLevelFlags.Warning, "Gtk operations should be done on the main Thread\n" + Environment.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Init (string progname, ref string[] args)
|
||||
{
|
||||
MainThread = System.Threading.Thread.CurrentThread;
|
||||
do_init (progname, ref args, false);
|
||||
}
|
||||
|
||||
public static bool InitCheck (string progname, ref string[] args)
|
||||
{
|
||||
MainThread = System.Threading.Thread.CurrentThread;
|
||||
return do_init (progname, ref args, true);
|
||||
}
|
||||
|
||||
|
@ -138,7 +148,6 @@ namespace Gtk {
|
|||
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern bool gtk_events_pending ();
|
||||
|
||||
|
||||
public static bool EventsPending ()
|
||||
{
|
||||
return gtk_events_pending ();
|
||||
|
@ -172,9 +181,16 @@ namespace Gtk {
|
|||
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern IntPtr gtk_get_current_event ();
|
||||
|
||||
[DllImport ("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern void gdk_event_free (IntPtr raw);
|
||||
|
||||
public static Gdk.Event CurrentEvent {
|
||||
get {
|
||||
return Gdk.Event.GetEvent (gtk_get_current_event ());
|
||||
var raw_ret = gtk_get_current_event ();
|
||||
var ret = Gdk.Event.GetEvent (raw_ret);
|
||||
if (raw_ret != IntPtr.Zero)
|
||||
gdk_event_free (raw_ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
#if GTK_SHARP_2_14
|
||||
|
||||
[System.Serializable]
|
||||
public class HandlerNotFoundException : SystemException
|
||||
|
@ -412,4 +411,3 @@ void BindFields (object target, Type type)
|
|||
while (type != typeof(object) && type != null);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,14 +28,15 @@ public Button (string stock_id) : base (IntPtr.Zero)
|
|||
{
|
||||
if (GetType () != typeof (Button)) {
|
||||
GLib.Value[] vals = new GLib.Value [2];
|
||||
string[] names = new string [2];
|
||||
names [0] = "label";
|
||||
var names = new IntPtr [2];
|
||||
names [0] = GLib.Marshaller.StringToPtrGStrdup ("label");
|
||||
vals [0] = new GLib.Value (stock_id);
|
||||
names [1] = "use_stock";
|
||||
names [1] = GLib.Marshaller.StringToPtrGStrdup ("use_stock");
|
||||
vals [1] = new GLib.Value (true);
|
||||
CreateNativeObject (names, vals);
|
||||
CreateNativeObject (names, vals, 2);
|
||||
return;
|
||||
}
|
||||
owned = true;
|
||||
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (stock_id);
|
||||
Raw = gtk_button_new_from_stock (native);
|
||||
GLib.Marshaller.Free (native);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
public CheckMenuItem (string label) : base (IntPtr.Zero)
|
||||
{
|
||||
if (GetType() != typeof (CheckMenuItem)) {
|
||||
CreateNativeObject (new string [0], new GLib.Value [0]);
|
||||
CreateNativeObject (new IntPtr [0], new GLib.Value [0], 0);
|
||||
AccelLabel al = new AccelLabel ("");
|
||||
al.TextWithMnemonic = label;
|
||||
al.SetAlignment (0.0f, 0.5f);
|
||||
|
@ -36,6 +36,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
owned = true;
|
||||
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (label);
|
||||
Raw = gtk_check_menu_item_new_with_mnemonic (native);
|
||||
GLib.Marshaller.Free (native);
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
int sz = (int) (uint) length;
|
||||
byte[] ret = new byte [sz];
|
||||
Marshal.Copy (ret, 0, raw_ret, sz);
|
||||
GLib.Marshaller.Free (raw_ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,13 +43,17 @@
|
|||
{
|
||||
return null;
|
||||
}
|
||||
System.Console.WriteLine("Raw call finished, making " + n_colors + " actual colors");
|
||||
Gdk.Color[] colors = new Gdk.Color[n_colors];
|
||||
int colorSize = 0;
|
||||
unsafe {
|
||||
colorSize = sizeof(Gdk.Color);
|
||||
}
|
||||
for (int i=0; i < n_colors; i++)
|
||||
{
|
||||
colors[i] = Gdk.Color.New(parsedColors);
|
||||
parsedColors = (IntPtr) ((int)parsedColors + Marshal.SizeOf(colors[i]));
|
||||
parsedColors = (IntPtr) ((int)parsedColors + colorSize);
|
||||
}
|
||||
GLib.Marshaller.Free (parsedColors);
|
||||
return colors;
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче