From 0fa85fccbdd845e3c16fc8c8fda0e00b17d60021 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 27 Jul 2005 13:21:15 +0000 Subject: [PATCH] * parser/gapi2xml.pl (addParamsElem): deal with G_CONST_RETURN in params... some functions use that to mark const "out" params. In fact, let's use it as a hint to mark them pass_as="out" too... * pango/pango-api-2.4.raw: * pango/pango-api-2.6.raw: * gtk/gtk-api-2.6.raw: Regen, fixing pango_script_iter_get_range and gtk_image_get_icon_name. * pango/Pango.metadata: * pango/ScriptIter.cs: Alas, exposing GetRange makes it clear that PangoScriptIter is really weird and we weren't wrapping it correctly before anyway, so mark the whole thing hidden and wrap it by hand. svn path=/trunk/gtk-sharp/; revision=47748 --- ChangeLog | 17 ++++++++ doc/en/Gtk/Image.xml | 17 ++++++++ doc/en/Pango/ScriptIter.xml | 24 +++++++++++- gtk/gtk-api-2.6.raw | 2 +- pango/Makefile.am | 1 + pango/Pango.metadata | 1 + pango/ScriptIter.cs | 78 +++++++++++++++++++++++++++++++++++++ pango/pango-api-2.4.raw | 4 +- pango/pango-api-2.6.raw | 4 +- parser/gapi2xml.pl | 4 ++ 10 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 pango/ScriptIter.cs diff --git a/ChangeLog b/ChangeLog index 285b6b44e..1ebbac825 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2005-07-27 Dan Winship + + * parser/gapi2xml.pl (addParamsElem): deal with G_CONST_RETURN in + params... some functions use that to mark const "out" params. In + fact, let's use it as a hint to mark them pass_as="out" too... + + * pango/pango-api-2.4.raw: + * pango/pango-api-2.6.raw: + * gtk/gtk-api-2.6.raw: Regen, fixing pango_script_iter_get_range + and gtk_image_get_icon_name. + + * pango/Pango.metadata: + * pango/ScriptIter.cs: Alas, exposing GetRange makes it clear that + PangoScriptIter is really weird and we weren't wrapping it + correctly before anyway, so mark the whole thing hidden and wrap + it by hand. + 2005-07-25 Mike Kestner * gnome/Gnome.metadata : mark IconList.GetIconFilename retval const. diff --git a/doc/en/Gtk/Image.xml b/doc/en/Gtk/Image.xml index 177079ef0..a8878b729 100644 --- a/doc/en/Gtk/Image.xml +++ b/doc/en/Gtk/Image.xml @@ -829,5 +829,22 @@ If the value is , the image will be looked up on the call + + + Method + + System.Void + + + + + + + To be added. + To be added. + To be added. + To be added. + + diff --git a/doc/en/Pango/ScriptIter.xml b/doc/en/Pango/ScriptIter.xml index a98974d3d..746f8bf39 100644 --- a/doc/en/Pango/ScriptIter.xml +++ b/doc/en/Pango/ScriptIter.xml @@ -26,9 +26,10 @@ - Releases the objects resources. + Obsolete. Do not use - + is properly garbage-collected now. You do not need to manually free it. + @@ -72,5 +73,24 @@ + + + Method + + System.Void + + + + + + + + On return, contains the index of the start of the current range. + On return, contains the length of the current range. + On return, contains the script type of the current range. + Gets the bounds and script type of the current range. + + + diff --git a/gtk/gtk-api-2.6.raw b/gtk/gtk-api-2.6.raw index 662664423..38658f71d 100644 --- a/gtk/gtk-api-2.6.raw +++ b/gtk/gtk-api-2.6.raw @@ -6568,7 +6568,7 @@ - + diff --git a/pango/Makefile.am b/pango/Makefile.am index 4c45179c2..2e7537a52 100644 --- a/pango/Makefile.am +++ b/pango/Makefile.am @@ -28,6 +28,7 @@ sources = \ AttrVariant.cs \ AttrWeight.cs \ Scale.cs \ + ScriptIter.cs \ Units.cs customs = \ diff --git a/pango/Pango.metadata b/pango/Pango.metadata index 731973f41..1df68fbd4 100644 --- a/pango/Pango.metadata +++ b/pango/Pango.metadata @@ -51,5 +51,6 @@ ref ref 1 + 1 1 diff --git a/pango/ScriptIter.cs b/pango/ScriptIter.cs new file mode 100644 index 000000000..316c2c482 --- /dev/null +++ b/pango/ScriptIter.cs @@ -0,0 +1,78 @@ +// Pango.ScriptIter +// +// Copyright (c) 2005 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +namespace Pango { + + using System; + using System.Runtime.InteropServices; + + public class ScriptIter : GLib.Opaque { + + IntPtr native_text; + + public ScriptIter(IntPtr raw) : base(raw) {} + + [DllImport("libpango-1.0-0.dll")] + static extern IntPtr pango_script_iter_new(IntPtr text, int length); + + public ScriptIter (string text) + { + native_text = GLib.Marshaller.StringToPtrGStrdup (text); + Raw = pango_script_iter_new (native_text, -1); + } + + [DllImport("libpango-1.0-0.dll")] + static extern void pango_script_iter_free (IntPtr raw); + + ~ScriptIter () + { + GLib.Marshaller.Free (native_text); + pango_script_iter_free (Raw); + Raw = IntPtr.Zero; + } + + [DllImport("libpango-1.0-0.dll")] + static extern void pango_script_iter_get_range (IntPtr raw, out IntPtr start, out IntPtr end, out Pango.Script script); + + [DllImport("libglib-2.0-0.dll")] + static extern IntPtr g_utf8_pointer_to_offset (IntPtr str, IntPtr pos); + + public void GetRange (out int start, out int len, out Pango.Script script) + { + IntPtr start_ptr; + IntPtr end_ptr; + + pango_script_iter_get_range (Handle, out start_ptr, out end_ptr, out script); + start = (int)g_utf8_pointer_to_offset (native_text, start_ptr); + len = (int)g_utf8_pointer_to_offset (start_ptr, end_ptr); + } + + [DllImport("libpango-1.0-0.dll")] + static extern bool pango_script_iter_next (IntPtr raw); + + public bool Next () + { + return pango_script_iter_next (Handle); + } + + [Obsolete ("Replaced by garbage collection")] + public void Free () + { + } + } +} diff --git a/pango/pango-api-2.4.raw b/pango/pango-api-2.4.raw index 5a1e65a60..681b91040 100644 --- a/pango/pango-api-2.4.raw +++ b/pango/pango-api-2.4.raw @@ -1316,8 +1316,8 @@ - - + + diff --git a/pango/pango-api-2.6.raw b/pango/pango-api-2.6.raw index 3600f36bb..d36fba112 100644 --- a/pango/pango-api-2.6.raw +++ b/pango/pango-api-2.6.raw @@ -1665,8 +1665,8 @@ - - + + diff --git a/parser/gapi2xml.pl b/parser/gapi2xml.pl index d63167c7c..d359c309f 100755 --- a/parser/gapi2xml.pl +++ b/parser/gapi2xml.pl @@ -774,6 +774,7 @@ sub addParamsElem foreach $parm (@params) { $parm_num++; $parm =~ s/\s+(\*+)/\1 /g; + my $out = $parm =~ s/G_CONST_RETURN/const/g; $parm =~ s/(const\s+)?(\w+)\*\s+const\*/const \2\*/g; $parm =~ s/(\*+)\s*const\s+/\1 /g; $parm =~ s/const\s+/const-/g; @@ -818,6 +819,9 @@ sub addParamsElem $name = $1; $parm_elem->setAttribute('array', "true"); } + if ($out) { + $parm_elem->setAttribute('pass_as', "out"); + } $parm_elem->setAttribute('name', $name); } }