Commit Graph

49 Commits

Author SHA1 Message Date
Bertrand Lorentz
ced6f5e677 glib: Avoid unnecessary qualifier in Marshaller.PtrToStringArrayGFree 2013-11-17 16:26:02 +01:00
Bertrand Lorentz
f067f5112d glib: Remove obsolete Argv-related methods in Marshaller
The ArgvToArrayPtr and ArrayPtrToArgv have been marked obsolete since
2004, and removing them allows us to remove some more code.
2013-11-17 15:05:36 +01:00
Andrés G. Aragoneses
f1005da47c glib: Make all DllImports in custom code use a common const
This way there's less redundancy, and if the library name changes in the
future, it will be changed only in one place.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-11-17 13:05:12 +01:00
Stephan Sundermann
53312d5fc0 generator: fixed optional array parameters 2013-10-09 20:35:02 +02:00
Stephan Sundermann
9abde602ec glib: add GDate, GDateTime
Add GDate and GDateTime classes to glib, and map
them in the generator's SymbolTable.

(The types TimeZone and TimeVal are also added because
the Date* types depend on them, but there is no need
to map them in the generator.)

Also move the TODOs of other auto-generated classes
to a single TODO in the Makefile
2013-10-09 18:30:10 +02:00
Stephan Sundermann
b5806d2a1b generator: fixed string[] return types 2013-10-08 17:54:29 +02:00
Bertrand Lorentz
df751f87ce glib: Switch to generic collections in Marshaller and ValueArray 2012-11-04 16:58:49 +01:00
Mike Kestner
c6a3bf4b73 Fix TextBufferSerializeFunc signature
* generator/CallbackGen.cs: connect return value count parameters
* generator/ManagedCallString.cs: out count params aren't special
* generator/MethodBody.cs: don't finish hidden params
* generator/Parameters.cs: explicit IsCount setting support, with
    Parameters.GetCountParameter(name) interface. Clear IsCount
    values during validation if they have no associated array. Any
    remaining count params must be associated with a retval, so
    hide them.
* generator/ReturnValue.cs: support array_length_param attribute to
    associate a return value with a "count" param.  Use new helper
    methods to marshal these array retvals to IntPtr and back.
* glib/Marshaller.cs: support for byte[] marshaling to and from
    IntPtr using a count and type in the from native direction.
* gtk/Gtk.metadata: mark TextBufferSerializeFunc return type as
    an array with the length specific in the length param.
2011-04-28 18:38:07 -05:00
Mike Kestner
d3d32c8ff0 GKeyFile binding
* glib/KeyFile.cs: new pseudo-hand-binding for GKeyFile
* glib/Makefile.am: add file
* glib/Marshaller.cs: add string[] to strv marshaler
* glib/glib-api.xml: expose GKeyFile mapping
2011-04-14 14:35:47 -05:00
Mike Kestner
536c3aca54 2009-11-30 Mike Kestner <mkestner@novell.com>
* generator/Method.cs: support win32_utf8_variant attribute on methods.
	* glib/*.cs: support win32 utf8 variant methods.
	* gtk/*.custom: support win32 utf8 variant methods.
	* gtk/Gtk.metadata: mark some win32_utf8_variant methods.
	  [Fixes #550961] Adapted from a patch by Tor Lillqvist.

svn path=/trunk/gtk-sharp/; revision=147113
2009-11-30 17:39:11 +00:00
Christian Hoff
7b752d233c 2009-09-03 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Kill the calling convention field again.
	It breaks GLib 2.x compatibility in the generator and there is
	probably no need to make the calling convention configurable.
	* .cs, *.custom: Hardcode Cdecl calling convention instead of
	using GLib's field.

svn path=/trunk/gtk-sharp/; revision=141283
2009-09-03 19:50:53 +00:00
Christian Hoff
58e97c087a 2009-09-02 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Add a public constant field specifying the
	calling convention used by GLib and depending libraries.
	By now it's hardcoded to Cdecl as every non-Win32 runtime
	should ignore this attribute.
	* *.cs, *.custom: Use GLib.Global.CallingConvention for both
	pinvokes and callbacks. Plugs a stack leak on Win32. All
	pinvokes defaulted to StdCall and thus the stack was never
	cleaned up.

svn path=/trunk/gtk-sharp/; revision=141175
2009-09-02 20:17:37 +00:00
Mike Kestner
1a16f66803 2009-01-08 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs: map gfilename* list elements to type
	ListBase.FilenameString so they are marshaled correctly.
	* glib/Marshaller.cs: handle FilenameStrings in ListPtrToArray.
	* gtk/Gtk.metadata: FileChooser.GetFilenames and ListShortcutFolders
	return type mangling to avoid custom implementations.
	* gtk/FileChooser*.custom: kill manual Filenames and ShortcutFolders.

svn path=/trunk/gtk-sharp/; revision=122802
2009-01-08 18:43:00 +00:00
Mike Kestner
89afb3f49f 2008-12-19 Mike Kestner <mkestner@novell.com>
* generator/BoxedGen.cs: don't generate glue dependencies.
	* glib/*.cs: remove glibsharpglue usage except thread.c.
	* glib/glue/*.c: kill all but thread.c. need glib 2.20 to kill
	it eventually.
	* pango/Attr*.cs: kill glue usage.
	* pango/glue/*.c: kill all but generated.c. it's next.
	* gtk/TreeIter.custom: kill a dumb glibsharpglue usage.

svn path=/trunk/gtk-sharp/; revision=121880
2008-12-19 18:57:42 +00:00
Mike Gorse
c9d658f381 2008-11-04 Mike Gorse <mgorse@novell.com>
* glib/PtrArray.cs, glib/glue/ptrarray.c, glib/Makefile.am,
	  glib/glue/Makefile.am, glib/gtype.cs, generator/SymbolTable.cs,
	  generator/ReturnValue.cs: Add PtrArray.
	* glib/Marshaller.cs: Add PtrArrayToArray.

	* atk/Atk.metadata: Specify GetTarget return type.

	* atk/Object.custom, atk/glue/object.c: Support overriding
	  RefRelationSet.

svn path=/trunk/gtk-sharp/; revision=117919
2008-11-04 20:17:00 +00:00
Mike Kestner
cab2f46db5 2008-08-20 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs: use new ListPtrToArray marshaler for
	lists with known element types.
	* glib/Marshaller.cs: new ListPtrToArray marshaller with more
	aggressive list disposal.
	* gtk/Container.custom: remove manual Children impl.  Use Children
	in GetEnumerator instead of pinvoking directly.
	* gtk/Gtk.metadata: remove hidden attr and add element type and owned 
	for Container.GetChildren to generate it properly.

svn path=/trunk/gtk-sharp/; revision=111173
2008-08-20 19:48:26 +00:00
Mike Kestner
51454acbb7 2008-06-28 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs: some 64 bit fixes for time_t marshaling
	issue found by Federico.

svn path=/trunk/gtk-sharp/; revision=106828
2008-06-28 17:15:31 +00:00
Mike Kestner
772790dcb0 2008-04-15 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs: marshal null string arrays as a null IntPtr[].
	[Fixes #378514]

svn path=/trunk/gtk-sharp/; revision=100744
2008-04-15 17:43:55 +00:00
Mike Kestner
be28ed3597 2008-02-29 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs: null-term array handling.
	* glib/Marshaller.cs: marshaling methods for null-term arrays.

svn path=/trunk/gtk-sharp/; revision=97032
2008-02-29 23:42:27 +00:00
Mike Kestner
097537310e 2007-11-12 Mike Kestner <mkestner@novell.com>
* glib/IOChannel.cs: IOChannel wrapper implementation.
	* glib/Makefile.am: build new files.
	* glib/Marshaller.cs: new string array marshaling methods.
	* glib/Spawn.cs: g_spawn* wrapper implementation.
	* sample/SpawnTests.cs: tests for the new GLib.Process class
	and a cursory exercise of IOChannel for SpawnAsyncWithPipes.

svn path=/trunk/gtk-sharp/; revision=89477
2007-11-12 17:27:35 +00:00
Mike Kestner
de78d57176 2007-11-08 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs: new null-terminated string[] marshaler from
	Mono.Unix with adaptations by Michael Hutchinson.

svn path=/trunk/gtk-sharp/; revision=89218
2007-11-08 17:27:13 +00:00
Mike Kestner
16fef6601b 2006-03-27 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs : deal with ownership of Opaque elements.
	* glib/Marshaller.cs : add a hack to deal with Opaque ownership in
	ListToArray marshaling.

svn path=/trunk/gtk-sharp/; revision=58609
2006-03-27 18:35:08 +00:00
Mike Kestner
e1d8403f5d 2005-01-13 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs : subtract utc_offset when marshaling to time_t.
	[Fixes #77244]

svn path=/trunk/gtk-sharp/; revision=55575
2006-01-14 14:07:27 +00:00
Dan Winship
635ed16db4 * generator/Parameters.cs (AllowComplexRefs): new property for
whether or not to allow "complex" ref/out args.
	(Validate): update for that

	* generator/Signal.cs: set AllowComplexRefs false on the params.
	(Validate): fix the messages
	(GenCallback, GenEventHandler): properly handle ref/out args, by
	manually pointerifying them (except for boxed args, which are
	already pointers).

	* glib/Marshaller.cs (StructureToPtrAlloc): Rename from
	PtrToStructureAlloc, since it wraps Marshal.StructureToPtr.

svn path=/trunk/gtk-sharp/; revision=46773
2005-06-30 17:09:39 +00:00
Lluis Sanchez
c5585dfd78 2005-06-09 Lluis Sanchez <lluis@novell.com>
* glib/Marshaller.cs: Added null check in FilenamePtrToString.


svn path=/trunk/gtk-sharp/; revision=45706
2005-06-09 14:52:24 +00:00
Mike Kestner
e24d72317a 2005-06-08 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs : don't write a sem in FromNative.
	* glib/ListBase.cs : handle GLib.Object explicit element types.
	* glib/Marshaler.cs : only copy lists if Count > 0.
	* gtk/Gtk.metadata : unhide Window.ListToplevels with a proper element
	type for automatic list to array marshaling.
	* gtk/Window.custom : kill manual ListToplevels impl.

svn path=/trunk/gtk-sharp/; revision=45654
2005-06-08 17:29:48 +00:00
Mike Kestner
a307c78232 2005-06-08 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs : improved list to array marshaling.
	* glib/Marshaller.cs : added ListToArray ().
	* gnomevfs/Gnomevfs.metadata : mark element_type on
	Mime.GetAllApplications. [Fixes #71888]

svn path=/trunk/gtk-sharp/; revision=45649
2005-06-08 16:53:12 +00:00
Mike Kestner
fee353d525 2005-06-02 Mike Kestner <mkestner@novell.com>
* generator/ConstFilenameGen.cs : new generatable for filename encoded
	const string marshaling
	* generator/Makefile.am : add new file
	* generator/SymbolTable.cs : add new gfilename types.
	* glib/Marshaller.cs : add new filename-encoded string marshalers.
	* gtk/FileSelection.custom : use FilenamePtrToString to marshal.
	* gtk/Gtk.metadata : map the FileSelector filename types to my new
	imaginary gfilename type.  [Fixes #74963]

svn path=/trunk/gtk-sharp/; revision=45328
2005-06-02 14:16:52 +00:00
Dan Winship
faa783fba7 * gnome/Gnome.metadata: mark GnomeTriggerActionFunction's char**
param const

        * glib/Marshaller.cs (Utf8PtrToString): Add an IntPtr[]->string[]
        overload, since that's what we actually need in the case where
        it's used (above). Leave the IntPtr[]->string[] overload of
        PtrToStringGFree in case anyone is using it manually.

        * gtk/Gtk.metadata: hide GtkModuleInitFunc and
        GtkModuleDisplayInitFunc; they are the signatures of user-defined
        methods that gtk only ever resolves via g_module_symbol(), so
        they're not useful from C#. (And the marshalling was all wrong
        anyway...)

svn path=/trunk/gtk-sharp/; revision=43461
2005-04-22 19:43:46 +00:00
Mike Kestner
9001c6fa25 2005-03-29 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs : special case ucs4 "0" conversion.
	[Fixes #74175]

svn path=/trunk/gtk-sharp/; revision=42337
2005-03-29 15:28:02 +00:00
Mike Kestner
ac91f1c8b1 2005-03-10 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs : don't use g_utf8_strlen to determine the byte
	count to be copied, it returns chars, not bytes.
	* glib/glue/unichar.c : implement a quick and dirty strlen glue func.

svn path=/trunk/gtk-sharp/; revision=41661
2005-03-10 20:33:57 +00:00
Mike Kestner
ae7d9dfbf9 2005-03-09 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs : add IntPtr.Zero guarding.

svn path=/trunk/gtk-sharp/; revision=41607
2005-03-09 17:01:35 +00:00
Mike Kestner
90a870e2de 2005-03-08 Mike Kestner <mkestner@novell.com>
* */*.cs : scrub for StringToPtrAnsi and string usage in DllImports.
	* */*.custom : begin the scrub here too.
	* generator/ConstStringGen.cs : implement IManualMarshaler and move to
	100% IntPtr marshaling.
	* generator/Ctor.cs : call Body.Finish too.
	* generator/IManualMarshaler.cs : new interface for generatables that
	marshal manually and need cleanup.
	* generator/Makefile.am : new file.
	* generator/MethodBody.cs : use IManualMarshaler if applicable.

svn path=/trunk/gtk-sharp/; revision=41579
2005-03-08 21:28:08 +00:00
Mike Kestner
0b0700bae6 2005-03-04 Mike Kestner <mkestner@novell.com>
* generator/ImportSignature.cs : out param handling fix.
	* generator/Makefile.am : kill StringGen.cs.
	* generator/MethodBody.cs : simplify out param handling.
	* generator/StringGen.cs : kill it, now using MarshalGen.
	* generator/SymbolTable.cs : make non-const strings use an appropriate
	MarshalGen.  Non-const strings are now correctly marshaled as Utf8.
	* glib/Marshaller.cs : add some utf8-fu for strdup/free marshaling.
	Add a method to alloc/copy structs to native memory, unused yet.
	* gtk/Gtk.metadata : partially fix a broken delegate.

svn path=/trunk/gtk-sharp/; revision=41459
2005-03-04 18:59:09 +00:00
Mike Kestner
a8f16beaa7 2005-02-01 Fredrik Nilsson <jymdman@home.se>
* glib/Marshaller.cs : DateTime marshaling fix.

svn path=/trunk/gtk-sharp/; revision=39952
2005-02-01 22:35:48 +00:00
Dan Winship
67e7fc486b * glib/Marshaller.cs (StringFormat): Calls String.Format and makes
sure the output has no unescaped "%"s. (For wrapping printf-style
	unmanaged methods with String.Format-style managed ones.)

	* gtk/MessageDialog.custom (MessageDialog): use it. #71405. Also,
	use gtk_message_dialog_new_with_markup by default, and add an
	overloaded ctor that lets you use the non-markup version.

	* gtk/Gtk.metadata: hide the GtkMessageDialog ctors so we don't
	get ellipsis warnings about them.

	* sample/GtkDemo/DemoApplicationWindow.cs:
	* sample/GtkDemo/DemoDialog.cs: simplify the MessageDialog usage;
	don't need to call String.Format separately now.

svn path=/trunk/gtk-sharp/; revision=39256
2005-01-20 15:45:13 +00:00
Mike Kestner
e38ece1fdb 2004-12-21 Mike Kestner <mkestner@novell.com>
* glib/Argv.cs : argv marshaling class.
	* glib/Makefile.am : add file.
	* glib/Marshaller.cs : mark the argv methods obsolete.
	* gtk/Application.cs : use GLib.Argv. [Fixes #68812]

svn path=/trunk/gtk-sharp/; revision=38046
2004-12-21 19:47:55 +00:00
Dan Winship
a610fb9a79 * generator/GUnicharGen.cs: generatable for gunichar, using
GLib.Marshaller.CharToGUnichar and .GUnicharToChar [#70704]

        * generator/SymbolTable.cs (SymbolTable): add a GUnicharGen.

        * generator/Makefile.am (sources): add GUnicharGen.cs

        * parser/gapi2xml.pl (addPropElem): g_param_spec_unichar() has
        type "gunichar" not "unichar".

        * gtk/gtk-api.raw: Regen

        * glib/Marshaller.cs: Import CharToGUnichar's glue method by the
        right name

svn path=/trunk/gtk-sharp/; revision=37998
2004-12-20 22:05:21 +00:00
Mike Kestner
993d91fa31 2004-12-07 Mike Kestner <mkestner@novell.com>
* */*.cs : s/glue-2.0/glue-2 so that dllimport works on win32.
	* */*.custom : s/glue-2.0/glue-2
	* */glue/makefile.win32 : s/glue-2.0/glue-2
	* */glue/Makefile.am : s/glue-2.0/glue-2

svn path=/trunk/gtk-sharp/; revision=37324
2004-12-07 19:03:55 +00:00
Mike Kestner
7f3171c814 merge to HEAD of jeroen and friends' work on the 2-4 branch. HEAD
is now tracking Gnome 2.6.

svn path=/trunk/gtk-sharp/; revision=35479
2004-10-29 20:33:07 +00:00
Mike Kestner
0d9c6b74e2 kill a C.WL
svn path=/trunk/gtk-sharp/; revision=33124
2004-08-31 19:18:28 +00:00
Mike Kestner
da322c565f 2004-08-31 Mike Kestner <mkestner@ximian.com>
* glib/Marshaller.cs : fix utc offseting for time_tToDateTime.
	[Fixes #60960]

svn path=/trunk/gtk-sharp/; revision=33107
2004-08-31 16:36:32 +00:00
Mike Kestner
fdcc41a70b 2004-08-17 Mike Kestner <mkestner@ximian.com>
* pango/Pango.metadata : metadata for the pango audit.
	* pango/*.custom : customizations to fix audited API.
	* doc/en/* : docs for some api changes and additions.
	* glib/Marshaller.cs : some gunichar marshal-fu.
	* glib/glue/unichar.c : a new glue method.

svn path=/trunk/gtk-sharp/; revision=32462
2004-08-17 20:43:49 +00:00
Mike Kestner
7a6d6b2128 2004-06-25 Mike Kestner <mkestner@ximian.com>
* */*.cs : add lgpl license blurb and clean up (c)'s.
	* */*.custom : add lgpl license blurb and clean up (c)'s.
	* */glue/*.c : add lgpl license blurb and clean up (c)'s.
	file adds without license from now on are punishable by wedgie.

svn path=/trunk/gtk-sharp/; revision=30401
2004-06-25 18:42:19 +00:00
Mike Kestner
9f54a63375 2004-05-19 Mike Kestner <mkestner@ximian.com>
* gtk/Container.custom : add CallbackInvoke and use it in OnForall.

2004-05-19  Mike Kestner  <mkestner@ximian.com>

	* generator/Makefile.am : add TimeTGen.cs
	* generator/SymbolTable.cs : use new TimeTGen.
	* generator/StringGen.cs : s/GLibSharp/GLib
	* generator/TimeTGen.cs : generatable to marshal time_t.
	* glib/time_t_CustomMarshaler.cs : kill
	* glib/Makefile.am : remove time_t_CustomMarshaler.cs
	* glib/Markup.cs : s/GLibSharp/GLib
	* glib/Marshaller.cs : move to GLib namespace. Add methods to
	marshal time_t to and from DateTime.
	* glib/glue/time_t.c : kill
	* glib/glue/Makefile.am : remove time_t.c
	* glib/glue/makefile.win32 : remove time_t.o
	* gnome/*.custom : use GLib.Marshaller instead of the time_t custom
	marshaler.
	* gtk/*.custom : s/GLibSharp/GLib

svn path=/trunk/gtk-sharp/; revision=27704
2004-05-19 18:57:28 +00:00
Owen Fraser-Green
ce55d821aa Minor fixed to get gstreamer working.
svn path=/trunk/gtk-sharp/; revision=26341
2004-04-29 21:21:57 +00:00
Peter Williams
4feed7bb77 2004-01-18 Peter Williams <peter@newton.cx>
* glib/Marshaller.cs (ArrayPtrToArgv, ArgvToArrayPtr): new
	functions for marshalling and unmarshalling string arrays
	to/from char **. Not pretty, but lets us call gtk_init()
	in Gtk.

	* gtk/Application.cs (do_init): New helper function to handle
	passing args to Gtk. Uses above functions.
	(Init): Use do_init, take a new progname parameter.
	(InitCheck): Same.

doc/:

2003-01-13  Peter Williams  <peter@newton.cx>

	* en/Gtk/Application.xml: Update Init, InitCheck functions
	for new progname argument. Fix a paste-o in the docs for InitCheck.

svn path=/trunk/gtk-sharp/; revision=22237
2004-01-19 03:24:25 +00:00
Miguel de Icaza
f1e095a87b 2003-11-27 Miguel de Icaza <miguel@ximian.com>
* glib/Log.cs: Make LogLevelFlags CLS compliant.

	* glib/SignalCallback.cs: Set the constructor protection level to
	protected, since it can not be instantiate.d

	* glib/Marshaller.cs: Do not allow instances of this class as it
	only exposes static methods.

	* glib/Source.cs, glib/FileUtils.cs, glib/Timeout.cs,
	glib/Thread.cs, glib/Markup.cs, glib/TypeConverter.cs: Ditto.

svn path=/trunk/gtk-sharp/; revision=20573
2003-11-28 05:29:34 +00:00
Rachel Hestilow
fe699e9fbb 2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.

	* generator/StringGen.cs, ConstStringGen.cs: Added.
	* generator/IGeneratable.cs: Add new method ToNativeReturn.
	* generator/CallbackGen.cs: Implement ToNativeReturn. Call
	ToNativeReturn for the return statement. Fix a couple of
	places where s_ret was being used incorrectly for m_ret.
	* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
	SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
	* generator/SignalHandler.cs: Call ToNativeReturn for the
	return statement, instead of CallByName.
	* generator/SymbolTable.cs: Use StringGen for gchar, char,
	and gunichar, and ConstStringGen for their const variants.
	Add a new method wrapper for ToNativeReturn.
	(Trim): Add a special-case for const strings so that the
	const is not stripped. Otherwise there is no way of
	resolving the const case.

	* glade/XML.custom: Update to use new string marshalling.

	* glib/Marshaller.cs: Added.
	* glib/GException.cs, Markup.cs, ObjectManager.cs,
	Value.cs: Update to use new string marshalling.
	* glib/Object.cs: Remove old g_type_name DllImport
	as it is no longer used.

	* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
	Mark this as const return.

	* gtk/ColorSelection.custom, FileSelection.custom,
	SelectionData.custom: Update to use new string marshalling.

svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00