Update internal glib-sharp copy and code generator to latest SVN trunk

This commit is contained in:
Sebastian Dröge 2009-09-03 11:07:43 +02:00
parent af356f46c6
commit 6affc35486
72 changed files with 1229 additions and 957 deletions

View file

@ -201,7 +201,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\tusing System.Runtime.InteropServices;");
sw.WriteLine ();
sw.WriteLine ("#region Autogenerated code");
sw.WriteLine ("\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
sw.WriteLine ("\t[UnmanagedFunctionPointer (Gst.GLib.Global.CallingConvention)]");
sw.WriteLine ("\tinternal delegate " + retval.MarshalType + " " + wrapper + "(" + parms.ImportSignature + ");");
sw.WriteLine ();
GenInvoker (gen_info, sw);

View file

@ -73,7 +73,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("#region Autogenerated code");
if (IsDeprecated)
sw.WriteLine ("\t[Obsolete]");
sw.Write ("\t{0} class " + Name, IsInternal ? "internal" : "public");
sw.Write ("\t{0} partial class " + Name, IsInternal ? "internal" : "public");
sw.WriteLine (" {");
sw.WriteLine ();

View file

@ -40,11 +40,6 @@ namespace GtkSharp.Generation {
return "Gst.GLib.Marshaller.Utf8PtrToString (" + var + ")";
}
public override string ToNativeReturn (string var)
{
return "Gst.GLib.Marshaller.StringToPtrGStrdup (" + var + ")";
}
public string AllocNative (string managed_var)
{
return "Gst.GLib.Marshaller.StringToPtrGStrdup (" + managed_var + ")";

View file

@ -53,9 +53,9 @@ namespace GtkSharp.Generation {
get {
if (!IsStatic)
return String.Empty;
if (Name != null && Name != String.Empty)
return Name;
if (Name != null && Name != String.Empty)
return Name;
string[] toks = CName.Substring(CName.IndexOf("new")).Split ('_');
string result = String.Empty;
@ -68,7 +68,7 @@ namespace GtkSharp.Generation {
void GenerateImport (StreamWriter sw)
{
sw.WriteLine("\t\t[DllImport(\"" + LibraryName + "\")]");
sw.WriteLine("\t\t[DllImport(\"" + LibraryName + "\", CallingConvention = GLib.Global.CallingConvention)]");
sw.WriteLine("\t\tstatic extern " + Safety + "IntPtr " + CName + "(" + Parameters.ImportSignature + ");");
sw.WriteLine();
}

View file

@ -24,7 +24,7 @@ namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml;
using System.Text.RegularExpressions;
public class EnumGen : GenBase {
@ -39,15 +39,15 @@ namespace GtkSharp.Generation {
continue;
string result = "\t\t" + member.GetAttribute("name");
if (member.HasAttribute ("value")) {
if (member.HasAttribute ("value")) {
string value = member.GetAttribute ("value").Trim ();
foreach (Match match in Regex.Matches (value, "[0-9]+([UL]{1,2})", RegexOptions.IgnoreCase)) {
switch (match.Groups[1].Value.ToUpper ()) {
case "U": enum_type = " : uint"; break;
case "L": enum_type = " : long"; break;
case "UL": enum_type = " : ulong"; break;
}
}
foreach (Match match in Regex.Matches (value, "[0-9]+([UL]{1,2})", RegexOptions.IgnoreCase)) {
switch (match.Groups[1].Value.ToUpper ()) {
case "U": enum_type = " : uint"; break;
case "L": enum_type = " : long"; break;
case "UL": enum_type = " : ulong"; break;
}
}
result += " = " + value;
}
members.Add (result + ",");
@ -112,7 +112,7 @@ namespace GtkSharp.Generation {
if (Elem.HasAttribute ("gtype")) {
sw.WriteLine ();
sw.WriteLine ("\tinternal class " + Name + "GType {");
sw.WriteLine ("\t\t[DllImport (\"" + LibraryName + "\")]");
sw.WriteLine ("\t\t[DllImport (\"" + LibraryName + "\", CallingConvention = GLib.Global.CallingConvention)]");
sw.WriteLine ("\t\tstatic extern IntPtr " + Elem.GetAttribute ("gtype") + " ();");
sw.WriteLine ();
sw.WriteLine ("\t\tpublic static Gst.GLib.GType GType {");

View file

@ -115,7 +115,7 @@ namespace GtkSharp.Generation {
if (getterName != null) {
sw.WriteLine (indent + "[DllImport (\"{0}\")]", gen_info.GluelibName);
sw.WriteLine (indent + "extern static {0} {1} ({2} raw);",
table.GetMarshalReturnType (CType), getterName,
table.GetMarshalType (CType), getterName,
container_type.MarshalType);
}
@ -165,7 +165,7 @@ namespace GtkSharp.Generation {
} else if (getterName != null) {
sw.WriteLine (indent + "\tget {");
container_type.Prepare (sw, indent + "\t\t");
sw.WriteLine (indent + "\t\t" + CSType + " result = " + table.FromNativeReturn (ctype, getterName + " (" + container_type.CallByName () + ")") + ";");
sw.WriteLine (indent + "\t\t" + CSType + " result = " + table.FromNative (ctype, getterName + " (" + container_type.CallByName () + ")") + ";");
container_type.Finish (sw, indent + "\t\t");
sw.WriteLine (indent + "\t\treturn result;");
sw.WriteLine (indent + "\t}");
@ -176,13 +176,16 @@ namespace GtkSharp.Generation {
sw.WriteLine (indent + "\t\t\t" + CSType + "* raw_ptr = (" + CSType + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
sw.WriteLine (indent + "\t\t\treturn *raw_ptr;");
} else {
sw.WriteLine (indent + "\t\t\t" + table.GetMarshalReturnType (CType) + "* raw_ptr = (" + table.GetMarshalReturnType (CType) + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
sw.WriteLine (indent + "\t\t\treturn " + table.FromNativeReturn (ctype, "(*raw_ptr)") + ";");
sw.WriteLine (indent + "\t\t\t" + table.GetMarshalType (CType) + "* raw_ptr = (" + table.GetMarshalType (CType) + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
sw.WriteLine (indent + "\t\t\treturn " + table.FromNative (ctype, "(*raw_ptr)") + ";");
}
sw.WriteLine (indent + "\t\t}");
sw.WriteLine (indent + "\t}");
}
IGeneratable gen = table [CType];
string to_native = (gen is IManualMarshaler) ? (gen as IManualMarshaler).AllocNative ("value") : gen.CallByName ("value");
if (Setter != null) {
sw.Write (indent + "\tset ");
Setter.GenerateBody (gen_info, container_type, "\t");
@ -190,7 +193,7 @@ namespace GtkSharp.Generation {
} else if (setterName != null) {
sw.WriteLine (indent + "\tset {");
container_type.Prepare (sw, indent + "\t\t");
sw.WriteLine (indent + "\t\t" + setterName + " (" + container_type.CallByName () + ", " + table.CallByName (ctype, "value") + ");");
sw.WriteLine (indent + "\t\t" + setterName + " (" + container_type.CallByName () + ", " + to_native + ");");
container_type.Finish (sw, indent + "\t\t");
sw.WriteLine (indent + "\t}");
} else if (Writable && offsetName != null) {
@ -200,8 +203,8 @@ namespace GtkSharp.Generation {
sw.WriteLine (indent + "\t\t\t" + CSType + "* raw_ptr = (" + CSType + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
sw.WriteLine (indent + "\t\t\t*raw_ptr = value;");
} else {
sw.WriteLine (indent + "\t\t\t" + table.GetMarshalReturnType (CType) + "* raw_ptr = (" + table.GetMarshalReturnType (CType) + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
sw.WriteLine (indent + "\t\t\t*raw_ptr = " + table.ToNativeReturn (ctype, "value") + ";");
sw.WriteLine (indent + "\t\t\t" + table.GetMarshalType (CType) + "* raw_ptr = (" + table.GetMarshalType (CType) + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
sw.WriteLine (indent + "\t\t\t*raw_ptr = " + to_native + ";");
}
sw.WriteLine (indent + "\t\t}");
sw.WriteLine (indent + "\t}");

View file

@ -204,7 +204,7 @@ namespace GtkSharp.Generation {
this.GenerateMethodBody (sw, null);
// Find the first unmanaged ancestor
sw.WriteLine ("\t\t\t{0}NativeDelegate unmanaged = GetClassStruct (this.LookupGType ().ThresholdType, true).{0};", this.Name);
sw.WriteLine ("\t\t\t{0}NativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).{0};", this.Name);
sw.Write ("\t\t\tif (unmanaged == null) ");
if (parms.HasOutParam)
sw.WriteLine ("throw new InvalidOperationException (\"No base method to invoke\");");
@ -286,7 +286,7 @@ namespace GtkSharp.Generation {
glue.WriteLine ();
GenerateOverrideBody (sw);
sw.WriteLine ("\t\t\t{0} (gtype.ClassPtr, callback);", glue_name);
sw.WriteLine ("\t\t\t{0} (gtype.GetClassPtr (), callback);", glue_name);
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
@ -325,7 +325,7 @@ namespace GtkSharp.Generation {
GenerateMethodBody (sw, null);
Body.Initialize (gen_info, false, false, String.Empty);
string glue_call_string = "this.LookupGType ().ThresholdType.ClassPtr";
string glue_call_string = "this.LookupGType ().GetThresholdType ().GetClassPtr ()";
if (!IsStatic)
glue_call_string += ", Handle";
if (parms.Count > 0)

View file

@ -72,12 +72,6 @@ namespace GtkSharp.Generation {
}
}
public virtual string MarshalReturnType {
get {
return MarshalType;
}
}
public abstract string MarshalType { get; }
public string Name {
@ -100,16 +94,10 @@ namespace GtkSharp.Generation {
}
}
public virtual string ToNativeReturnType {
get {
return MarshalType;
}
}
protected void AppendCustom (StreamWriter sw, string custom_dir)
{
AppendCustom (sw, custom_dir, Name);
}
{
AppendCustom (sw, custom_dir, Name);
}
protected void AppendCustom (StreamWriter sw, string custom_dir, string type_name)
{
@ -130,16 +118,6 @@ namespace GtkSharp.Generation {
public abstract string FromNative (string var);
public virtual string FromNativeReturn (string var)
{
return FromNative (var);
}
public virtual string ToNativeReturn (string var)
{
return CallByName (var);
}
public abstract bool Validate ();
public void Generate ()

View file

@ -58,16 +58,6 @@ namespace GtkSharp.Generation {
return FromNative (var, false);
}
public string FromNativeReturn (string var, bool owned)
{
return FromNative (var, owned);
}
public override string FromNativeReturn (string var)
{
return FromNativeReturn (var, false);
}
public void WriteAccessors (StreamWriter sw, string indent, string var)
{
sw.WriteLine (indent + "get {");

View file

@ -37,14 +37,6 @@ namespace GtkSharp.Generation {
// signature when passing this generatable to unmanaged code
string MarshalType {get;}
// The type to use as the return type in an import signature when
// receiving this generatable back from unmanaged code
string MarshalReturnType {get;}
// The type to use in a managed callback signature when returning this
// generatable to unmanaged code
string ToNativeReturnType {get;}
// The value returned by callbacks that are interrupted prematurely
// by managed exceptions or other conditions where an appropriate
// value can't be otherwise obtained.
@ -56,12 +48,6 @@ namespace GtkSharp.Generation {
// Generates an expression to convert var from MarshalType
string FromNative (string var);
// Generates an expression to convert var from MarshalReturnType
string FromNativeReturn (string var);
// Generates an expression to convert var to ToNativeReturnType
string ToNativeReturn (string var);
bool Validate ();
void Generate ();

View file

@ -230,7 +230,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\tusing System.Runtime.InteropServices;");
sw.WriteLine ();
sw.WriteLine ("#region Autogenerated code");
sw.WriteLine ("\tpublic class " + Name + "Adapter : Gst.GLib.GInterfaceAdapter, " + QualifiedName + " {");
sw.WriteLine ("\tpublic partial class " + Name + "Adapter : Gst.GLib.GInterfaceAdapter, " + QualifiedName + " {");
sw.WriteLine ();
if (!IsConsumeOnly) {
@ -277,7 +277,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ();
sw.WriteLine ("\t[Gst.GLib.GInterface (typeof (" + Name + "Adapter))]");
string access = IsInternal ? "internal" : "public";
sw.WriteLine ("\t" + access + " interface " + Name + "Implementor : Gst.GLib.IWrapper {");
sw.WriteLine ("\t" + access + " partial interface " + Name + "Implementor : Gst.GLib.IWrapper {");
sw.WriteLine ();
Hashtable vm_table = new Hashtable ();
foreach (InterfaceVM vm in interface_vms) {
@ -323,7 +323,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ();
sw.WriteLine ("#region Autogenerated code");
string access = IsInternal ? "internal" : "public";
sw.WriteLine ("\t" + access + " interface " + Name + " : Gst.GLib.IWrapper {");
sw.WriteLine ("\t" + access + " partial interface " + Name + " : Gst.GLib.IWrapper {");
sw.WriteLine ();
foreach (Signal sig in sigs.Values) {

View file

@ -141,8 +141,10 @@ namespace GtkSharp.Generation {
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 IManualMarshaler)
ret += String.Format ("{0}{1} = {2};", indent, p.Name, (igen as IManualMarshaler).AllocNative ("my" + p.Name));
else
ret += indent + p.Name + " = " + igen.ToNativeReturn ("my" + p.Name) + ";\n";
ret += indent + p.Name + " = " + igen.CallByName ("my" + p.Name) + ";\n";
}
return ret;

View file

@ -185,7 +185,7 @@ namespace GtkSharp.Generation {
string import_sig = IsStatic ? "" : container_type.MarshalType + " raw";
import_sig += !IsStatic && Parameters.Count > 0 ? ", " : "";
import_sig += Parameters.ImportSignature.ToString();
sw.WriteLine("\t\t[DllImport(\"" + LibraryName + "\")]");
sw.WriteLine("\t\t[DllImport(\"" + LibraryName + "\", CallingConvention = GLib.Global.CallingConvention)]");
if (retval.MarshalType.StartsWith ("[return:"))
sw.WriteLine("\t\t" + retval.MarshalType + " static extern " + Safety + retval.CSType + " " + CName + "(" + import_sig + ");");
else

View file

@ -212,7 +212,7 @@ namespace GtkSharp.Generation {
if (cs_parent == "")
sw.WriteLine ("\t\tstatic uint class_offset = 0;");
else
sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).ClassSize;", cs_parent);
sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).GetClassSize ();", cs_parent);
sw.WriteLine ("\t\tstatic Hashtable class_structs;");
sw.WriteLine ();
sw.WriteLine ("\t\tstatic {0} GetClassStruct (Gst.GLib.GType gtype, bool use_cache)", class_struct_name);
@ -223,7 +223,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\t\tif (use_cache && class_structs.Contains (gtype))");
sw.WriteLine ("\t\t\t\treturn ({0}) class_structs [gtype];", class_struct_name);
sw.WriteLine ("\t\t\telse {");
sw.WriteLine ("\t\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\t\tIntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\t\t{0} class_struct = ({0}) Marshal.PtrToStructure (class_ptr, typeof ({0}));", class_struct_name);
sw.WriteLine ("\t\t\t\tif (use_cache)");
sw.WriteLine ("\t\t\t\t\tclass_structs.Add (gtype, class_struct);");
@ -233,7 +233,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ();
sw.WriteLine ("\t\tstatic void OverrideClassStruct (Gst.GLib.GType gtype, {0} class_struct)", class_struct_name);
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\tMarshal.StructureToPtr (class_struct, class_ptr, false);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();

View file

@ -97,12 +97,6 @@ namespace GtkSharp.Generation {
}
}
private bool DisableGTypeCtor {
get {
return Elem.HasAttribute ("disable_gtype_ctor");
}
}
private class DirectoryInfo {
public string assembly_name;
public Hashtable objects;
@ -156,7 +150,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t[Obsolete]");
foreach (string attr in custom_attrs)
sw.WriteLine ("\t" + attr);
sw.Write ("\t{0} {1}class " + Name, IsInternal ? "internal" : "public", IsAbstract ? "abstract " : "");
sw.Write ("\t{0} partial {1}class " + Name, IsInternal ? "internal" : "public", IsAbstract ? "abstract " : "");
string cs_parent = table.GetCSType(Elem.GetAttribute("parent"));
if (cs_parent != "") {
di.objects.Add (CName, QualifiedName);
@ -254,10 +248,6 @@ namespace GtkSharp.Generation {
if (!Elem.HasAttribute("parent"))
return;
if (!DisableGTypeCtor) {
gen_info.Writer.WriteLine("\t\t[Obsolete]");
gen_info.Writer.WriteLine("\t\tprotected " + Name + "(Gst.GLib.GType gtype) : base(gtype) {}");
}
gen_info.Writer.WriteLine("\t\tpublic " + Name + "(IntPtr raw) : base(raw) {}");
if (ctors.Count == 0 && !DisableVoidCtor) {
gen_info.Writer.WriteLine();
@ -312,7 +302,7 @@ namespace GtkSharp.Generation {
if (cs_parent == "")
sw.WriteLine ("\t\tstatic uint class_offset = 0;");
else
sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).ClassSize;", cs_parent);
sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).GetClassSize ();", cs_parent);
sw.WriteLine ("\t\tstatic Hashtable class_structs;");
sw.WriteLine ();
sw.WriteLine ("\t\tstatic {0} GetClassStruct (Gst.GLib.GType gtype, bool use_cache)", class_struct_name);
@ -323,7 +313,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\t\tif (use_cache && class_structs.Contains (gtype))");
sw.WriteLine ("\t\t\t\treturn ({0}) class_structs [gtype];", class_struct_name);
sw.WriteLine ("\t\t\telse {");
sw.WriteLine ("\t\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\t\tIntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\t\t{0} class_struct = ({0}) Marshal.PtrToStructure (class_ptr, typeof ({0}));", class_struct_name);
sw.WriteLine ("\t\t\t\tif (use_cache)");
sw.WriteLine ("\t\t\t\t\tclass_structs.Add (gtype, class_struct);");
@ -333,7 +323,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ();
sw.WriteLine ("\t\tstatic void OverrideClassStruct (Gst.GLib.GType gtype, {0} class_struct)", class_struct_name);
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\tMarshal.StructureToPtr (class_struct, class_ptr, false);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();

View file

@ -63,7 +63,7 @@ namespace GtkSharp.Generation {
if (IsDeprecated)
sw.WriteLine ("\t[Obsolete]");
sw.Write ("\t{0}{1}class " + Name, IsInternal ? "internal " : "public ", IsAbstract ? "abstract " : String.Empty);
sw.Write ("\t{0} partial {1}class " + Name, IsInternal ? "internal" : "public", IsAbstract ? "abstract " : String.Empty);
string cs_parent = table.GetCSType(Elem.GetAttribute("parent"));
if (cs_parent != "")
sw.Write (" : " + cs_parent);

View file

@ -102,7 +102,7 @@ namespace GtkSharp.Generation {
return String.Empty;
else if (is_null_term)
return "IntPtr";
return IGen.MarshalReturnType + (is_array ? "[]" : String.Empty);
return IGen.MarshalType + (is_array ? "[]" : String.Empty);
}
}
@ -112,7 +112,7 @@ namespace GtkSharp.Generation {
return String.Empty;
else if (is_null_term)
return "IntPtr";
return IGen.ToNativeReturnType + (is_array ? "[]" : String.Empty);
return IGen.MarshalType + (is_array ? "[]" : String.Empty);
}
}
@ -132,7 +132,7 @@ namespace GtkSharp.Generation {
else if (is_null_term)
return String.Format ("Gst.Marshaller.NullTermPtrToStringArray ({0}, {1})", var, owned ? "true" : "false");
else
return IGen.FromNativeReturn (var);
return IGen.FromNative (var);
}
public string ToNative (string var)
@ -153,7 +153,7 @@ namespace GtkSharp.Generation {
else if (IGen is OpaqueGen && owned)
return var + " == null ? IntPtr.Zero : " + var + ".OwnedCopy";
else
return IGen.ToNativeReturn (var);
return IGen.CallByName (var);
}
public bool Validate ()

View file

@ -178,10 +178,12 @@ namespace GtkSharp.Generation {
} else
sw.WriteLine("\t\t\t\targs.Args[" + idx + "] = " + p.FromNative ("arg" + idx) + ";");
}
if (igen is StructBase && p.PassAs == "ref")
if ((igen is StructBase || igen is ByRefGen) && p.PassAs != "")
finish += "\t\t\t\tif (arg" + idx + " != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (args.Args[" + idx + "], arg" + idx + ", false);\n";
else if (igen is IManualMarshaler && p.PassAs != "")
finish += String.Format ("\t\t\t\targ{0} = {1};\n", idx, (igen as IManualMarshaler).AllocNative ("args.Args[" + idx + "]"));
else if (p.PassAs != "")
finish += "\t\t\t\targ" + idx + " = " + igen.ToNativeReturn ("((" + p.CSType + ")args.Args[" + idx + "])") + ";\n";
finish += "\t\t\t\targ" + idx + " = " + igen.CallByName ("((" + p.CSType + ")args.Args[" + idx + "])") + ";\n";
}
return finish;
}
@ -198,7 +200,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\t\t\tif (args.RetVal == null)");
sw.WriteLine ("\t\t\t\t\treturn false;");
}
sw.WriteLine("\t\t\t\treturn " + SymbolTable.Table.ToNativeReturn (retval.CType, "((" + retval.CSType + ")args.RetVal)") + ";");
sw.WriteLine ("\t\t\t\treturn {0};", retval.ToNative (String.Format ("(({0}) args.RetVal)", retval.CSType)));
}
sw.WriteLine("\t\t\t} catch (Exception) {");
sw.WriteLine ("\t\t\t\tException ex = new Exception (\"args.RetVal or 'out' property unset or set to incorrect type in " + EventHandlerQualifiedName + " callback\");");
@ -219,7 +221,7 @@ namespace GtkSharp.Generation {
native_signature += ", " + CallbackSig;
native_signature += ", IntPtr gch";
sw.WriteLine ("\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
sw.WriteLine ("\t\t[UnmanagedFunctionPointer (GLib.Global.CallingConvention)]");
sw.WriteLine ("\t\tdelegate {0} {1} ({2});", retval.ToNativeType, DelegateName, native_signature);
sw.WriteLine ();
sw.WriteLine ("\t\tstatic {0} {1} ({2})", retval.ToNativeType, CallbackName, native_signature);

View file

@ -66,24 +66,12 @@ namespace GtkSharp.Generation {
}
}
public virtual string MarshalReturnType {
get {
return MarshalType;
}
}
public virtual string DefaultValue {
get {
return default_value;
}
}
public virtual string ToNativeReturnType {
get {
return MarshalType;
}
}
public virtual string CallByName (string var)
{
return var;
@ -93,16 +81,6 @@ namespace GtkSharp.Generation {
{
return var;
}
public virtual string FromNativeReturn(string var)
{
return FromNative (var);
}
public virtual string ToNativeReturn(string var)
{
return CallByName (var);
}
public bool Validate ()
{

View file

@ -160,7 +160,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t[Obsolete]");
sw.WriteLine ("\t[StructLayout(LayoutKind.Sequential)]");
string access = IsInternal ? "internal" : "public";
sw.WriteLine ("\t" + access + " struct " + Name + " {");
sw.WriteLine ("\t" + access + " partial struct " + Name + " {");
sw.WriteLine ();
need_read_native = false;

View file

@ -134,7 +134,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ();
if (Access != "private") {
sw.WriteLine (indent + Access + " " + wrapped + " " + wrapped_name + " {");
sw.WriteLine (indent + "\tget { return " + table.FromNativeReturn (CType, Name) + "; }");
sw.WriteLine (indent + "\tget { return " + table.FromNative (CType, Name) + "; }");
sw.WriteLine (indent + "}");
}
} else if (IsPointer && CSType != "string") {

View file

@ -214,22 +214,6 @@ namespace GtkSharp.Generation {
return types [type];
}
public string FromNativeReturn(string c_type, string val)
{
IGeneratable gen = this[c_type];
if (gen == null)
return "";
return gen.FromNativeReturn (val);
}
public string ToNativeReturn(string c_type, string val)
{
IGeneratable gen = this[c_type];
if (gen == null)
return "";
return gen.ToNativeReturn (val);
}
public string FromNative(string c_type, string val)
{
IGeneratable gen = this[c_type];
@ -254,22 +238,6 @@ namespace GtkSharp.Generation {
return gen.Name;
}
public string GetMarshalReturnType(string c_type)
{
IGeneratable gen = this[c_type];
if (gen == null)
return "";
return gen.MarshalReturnType;
}
public string GetToNativeReturnType(string c_type)
{
IGeneratable gen = this[c_type];
if (gen == null)
return "";
return gen.ToNativeReturnType;
}
public string GetMarshalType(string c_type)
{
IGeneratable gen = this[c_type];

View file

@ -73,7 +73,7 @@ namespace GtkSharp.Generation {
if (parms.Count > 0)
native_signature += parms.ImportSignature;
sw.WriteLine ("\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
sw.WriteLine ("\t\t[UnmanagedFunctionPointer (GLib.Global.CallingConvention)]");
sw.WriteLine ("\t\tdelegate {0} {1}NativeDelegate ({2});", retval.ToNativeType, this.Name, native_signature);
sw.WriteLine ();
sw.WriteLine ("\t\tstatic {0} {1}_cb ({2})", retval.ToNativeType, this.Name, native_signature);

View file

@ -1,6 +1,5 @@
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/BoxedGen.cs generator/BoxedGen.cs
--- gtk-sharp/generator/BoxedGen.cs 2009-01-04 23:29:56.000000000 +0100
+++ generator/BoxedGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/BoxedGen.cs 2009-01-04 23:29:56.000000000 +0100
+++ generator/BoxedGen.cs 2009-09-03 10:46:47.000000000 +0200
@@ -40,16 +40,16 @@
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
@ -21,9 +20,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\treturn (" + QualifiedName + ") val.Val;");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/ByRefGen.cs generator/ByRefGen.cs
--- gtk-sharp/generator/ByRefGen.cs 2008-02-26 17:29:14.000000000 +0100
+++ generator/ByRefGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/ByRefGen.cs 2008-02-26 17:29:14.000000000 +0100
+++ generator/ByRefGen.cs 2009-09-03 10:46:47.000000000 +0200
@@ -46,7 +46,7 @@
public string AllocNative (string var_name)
@ -33,9 +31,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
}
public override string FromNative (string var_name)
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/CallbackGen.cs generator/CallbackGen.cs
--- gtk-sharp/generator/CallbackGen.cs 2009-07-02 22:18:10.000000000 +0200
+++ generator/CallbackGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/CallbackGen.cs 2009-09-02 22:17:37.000000000 +0200
+++ generator/CallbackGen.cs 2009-09-03 11:05:22.000000000 +0200
@@ -140,7 +140,7 @@
sw.WriteLine ();
sw.WriteLine ("\t\t" + Name + "Native native_cb;");
@ -54,6 +51,15 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tthis.native_cb = native_cb;");
sw.WriteLine ("\t\t\t__data = data;");
@@ -201,7 +201,7 @@
sw.WriteLine ("\tusing System.Runtime.InteropServices;");
sw.WriteLine ();
sw.WriteLine ("#region Autogenerated code");
- sw.WriteLine ("\t[UnmanagedFunctionPointer (GLib.Global.CallingConvention)]");
+ sw.WriteLine ("\t[UnmanagedFunctionPointer (Gst.GLib.Global.CallingConvention)]");
sw.WriteLine ("\tinternal delegate " + retval.MarshalType + " " + wrapper + "(" + parms.ImportSignature + ");");
sw.WriteLine ();
GenInvoker (gen_info, sw);
@@ -233,7 +233,7 @@
*/
bool fatal = (retval.MarshalType != "void" && retval.MarshalType != "bool") || call.HasOutParam;
@ -63,9 +69,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
if (fatal) {
sw.WriteLine ("\t\t\t\t// NOTREACHED: Above call does not return.");
sw.WriteLine ("\t\t\t\tthrow e;");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/ConstFilenameGen.cs generator/ConstFilenameGen.cs
--- gtk-sharp/generator/ConstFilenameGen.cs 2007-09-21 18:37:04.000000000 +0200
+++ generator/ConstFilenameGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/ConstFilenameGen.cs 2007-09-21 18:37:04.000000000 +0200
+++ generator/ConstFilenameGen.cs 2009-09-03 10:46:47.000000000 +0200
@@ -35,17 +35,17 @@
public override string FromNative (string var)
@ -87,10 +92,9 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
}
}
}
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/ConstStringGen.cs generator/ConstStringGen.cs
--- gtk-sharp/generator/ConstStringGen.cs 2007-09-21 18:37:04.000000000 +0200
+++ generator/ConstStringGen.cs 2009-08-05 16:49:19.000000000 +0200
@@ -37,22 +37,22 @@
--- tmp/generator/ConstStringGen.cs 2009-08-13 16:46:33.000000000 +0200
+++ generator/ConstStringGen.cs 2009-09-03 10:47:50.000000000 +0200
@@ -37,17 +37,17 @@
public override string FromNative (string var)
{
@ -98,12 +102,6 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
+ return "Gst.GLib.Marshaller.Utf8PtrToString (" + var + ")";
}
public override string ToNativeReturn (string var)
{
- return "GLib.Marshaller.StringToPtrGStrdup (" + var + ")";
+ return "Gst.GLib.Marshaller.StringToPtrGStrdup (" + var + ")";
}
public string AllocNative (string managed_var)
{
- return "GLib.Marshaller.StringToPtrGStrdup (" + managed_var + ")";
@ -117,9 +115,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
}
}
}
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/Ctor.cs generator/Ctor.cs
--- gtk-sharp/generator/Ctor.cs 2009-04-24 10:08:17.000000000 +0200
+++ generator/Ctor.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/Ctor.cs 2009-09-02 22:17:37.000000000 +0200
+++ generator/Ctor.cs 2009-09-03 10:46:47.000000000 +0200
@@ -32,14 +32,16 @@
private bool preferred;
private string name;
@ -170,9 +167,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t\t\treturn;");
} else
sw.WriteLine ("\t\t\t\tthrow new InvalidOperationException (\"Can't override this constructor.\");");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/DefaultSignalHandler.cs generator/DefaultSignalHandler.cs
--- gtk-sharp/generator/DefaultSignalHandler.cs 2009-04-13 19:44:48.000000000 +0200
+++ generator/DefaultSignalHandler.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/DefaultSignalHandler.cs 2009-04-13 19:44:48.000000000 +0200
+++ generator/DefaultSignalHandler.cs 2009-09-03 10:46:47.000000000 +0200
@@ -68,13 +68,13 @@
{
GenerateMethodBody (sw, implementor);
@ -258,9 +254,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
default:
throw new Exception (retval.CSType);
}
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/EnumGen.cs generator/EnumGen.cs
--- gtk-sharp/generator/EnumGen.cs 2009-05-28 20:49:11.000000000 +0200
+++ generator/EnumGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/EnumGen.cs 2009-09-02 22:17:37.000000000 +0200
+++ generator/EnumGen.cs 2009-09-03 10:46:47.000000000 +0200
@@ -98,7 +98,7 @@
if (Elem.GetAttribute("type") == "flags")
sw.WriteLine ("\t[Flags]");
@ -271,7 +266,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
string access = IsInternal ? "internal" : "public";
sw.WriteLine ("\t" + access + " enum " + Name + enum_type + " {");
@@ -115,9 +115,9 @@
sw.WriteLine ("\t\t[DllImport (\"" + LibraryName + "\")]");
sw.WriteLine ("\t\t[DllImport (\"" + LibraryName + "\", CallingConvention = GLib.Global.CallingConvention)]");
sw.WriteLine ("\t\tstatic extern IntPtr " + Elem.GetAttribute ("gtype") + " ();");
sw.WriteLine ();
- sw.WriteLine ("\t\tpublic static GLib.GType GType {");
@ -282,9 +277,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t}");
sw.WriteLine ("\t}");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/FieldBase.cs generator/FieldBase.cs
--- gtk-sharp/generator/FieldBase.cs 2009-05-06 16:58:39.000000000 +0200
+++ generator/FieldBase.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/FieldBase.cs 2009-08-13 16:46:33.000000000 +0200
+++ generator/FieldBase.cs 2009-09-03 10:46:47.000000000 +0200
@@ -89,7 +89,7 @@
void CheckGlue ()
{
@ -305,9 +299,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
if (Getter != null) {
sw.Write (indent + "\tget ");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/GObjectVM.cs generator/GObjectVM.cs
--- gtk-sharp/generator/GObjectVM.cs 2009-05-04 19:39:45.000000000 +0200
+++ generator/GObjectVM.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/GObjectVM.cs 2009-08-09 01:42:15.000000000 +0200
+++ generator/GObjectVM.cs 2009-09-03 10:46:47.000000000 +0200
@@ -154,17 +154,17 @@
sw.WriteLine ("\t\tpublic static " + Name + "Delegate " + Name + "Handler {");
sw.WriteLine ("\t\t\tset {");
@ -347,9 +340,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
return "G_TYPE_NONE";
default:
return val;
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/InterfaceGen.cs generator/InterfaceGen.cs
--- gtk-sharp/generator/InterfaceGen.cs 2009-08-05 08:24:27.000000000 +0200
+++ generator/InterfaceGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/InterfaceGen.cs 2009-08-19 18:13:17.000000000 +0200
+++ generator/InterfaceGen.cs 2009-09-03 10:49:21.000000000 +0200
@@ -60,7 +60,7 @@
public override string CallByName (string var, bool owned)
@ -435,8 +427,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\tusing System.Runtime.InteropServices;");
sw.WriteLine ();
sw.WriteLine ("#region Autogenerated code");
- sw.WriteLine ("\tpublic class " + Name + "Adapter : GLib.GInterfaceAdapter, " + QualifiedName + " {");
+ sw.WriteLine ("\tpublic class " + Name + "Adapter : Gst.GLib.GInterfaceAdapter, " + QualifiedName + " {");
- sw.WriteLine ("\tpublic partial class " + Name + "Adapter : GLib.GInterfaceAdapter, " + QualifiedName + " {");
+ sw.WriteLine ("\tpublic partial class " + Name + "Adapter : Gst.GLib.GInterfaceAdapter, " + QualifiedName + " {");
sw.WriteLine ();
if (!IsConsumeOnly) {
@ -456,8 +448,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
- sw.WriteLine ("\t[GLib.GInterface (typeof (" + Name + "Adapter))]");
+ sw.WriteLine ("\t[Gst.GLib.GInterface (typeof (" + Name + "Adapter))]");
string access = IsInternal ? "internal" : "public";
- sw.WriteLine ("\t" + access + " interface " + Name + "Implementor : GLib.IWrapper {");
+ sw.WriteLine ("\t" + access + " interface " + Name + "Implementor : Gst.GLib.IWrapper {");
- sw.WriteLine ("\t" + access + " partial interface " + Name + "Implementor : GLib.IWrapper {");
+ sw.WriteLine ("\t" + access + " partial interface " + Name + "Implementor : Gst.GLib.IWrapper {");
sw.WriteLine ();
Hashtable vm_table = new Hashtable ();
foreach (InterfaceVM vm in interface_vms) {
@ -465,14 +457,13 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ();
sw.WriteLine ("#region Autogenerated code");
string access = IsInternal ? "internal" : "public";
- sw.WriteLine ("\t" + access + " interface " + Name + " : GLib.IWrapper {");
+ sw.WriteLine ("\t" + access + " interface " + Name + " : Gst.GLib.IWrapper {");
- sw.WriteLine ("\t" + access + " partial interface " + Name + " : GLib.IWrapper {");
+ sw.WriteLine ("\t" + access + " partial interface " + Name + " : Gst.GLib.IWrapper {");
sw.WriteLine ();
foreach (Signal sig in sigs.Values) {
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/MethodBody.cs generator/MethodBody.cs
--- gtk-sharp/generator/MethodBody.cs 2009-01-07 18:10:08.000000000 +0100
+++ generator/MethodBody.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/MethodBody.cs 2009-01-07 18:10:08.000000000 +0100
+++ generator/MethodBody.cs 2009-09-03 10:46:47.000000000 +0200
@@ -111,7 +111,7 @@
sw.WriteLine (indent + "\t\t\t\t{0} = null;", parameters [i + 2].Name);
sw.WriteLine (indent + "\t\t\t} else {");
@ -491,9 +482,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
}
public bool ThrowsException {
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/Method.cs generator/Method.cs
--- gtk-sharp/generator/Method.cs 2009-01-08 19:00:47.000000000 +0100
+++ generator/Method.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/Method.cs 2009-09-02 22:17:37.000000000 +0200
+++ generator/Method.cs 2009-09-03 10:46:47.000000000 +0200
@@ -118,7 +118,7 @@
if (Name == "ToString" && Parameters.Count == 0)
@ -503,9 +493,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.Write("new ");
else if (Modifiers == "new " || (dup != null && ((dup.Signature != null && Signature != null && dup.Signature.ToString() == Signature.ToString()) || (dup.Signature == null && Signature == null))))
sw.Write("new ");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/MiniObjectGen.cs generator/MiniObjectGen.cs
--- gtk-sharp/generator/MiniObjectGen.cs 1970-01-01 01:00:00.000000000 +0100
+++ generator/MiniObjectGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/MiniObjectGen.cs 1970-01-01 01:00:00.000000000 +0100
+++ generator/MiniObjectGen.cs 2009-09-03 11:03:48.000000000 +0200
@@ -0,0 +1,326 @@
+// GtkSharp.Generation.MiniObjectGen.cs - The Mini Object Generatable.
+//
@ -721,7 +710,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
+ if (cs_parent == "")
+ sw.WriteLine ("\t\tstatic uint class_offset = 0;");
+ else
+ sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).ClassSize;", cs_parent);
+ sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).GetClassSize ();", cs_parent);
+ sw.WriteLine ("\t\tstatic Hashtable class_structs;");
+ sw.WriteLine ();
+ sw.WriteLine ("\t\tstatic {0} GetClassStruct (Gst.GLib.GType gtype, bool use_cache)", class_struct_name);
@ -732,7 +721,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
+ sw.WriteLine ("\t\t\tif (use_cache && class_structs.Contains (gtype))");
+ sw.WriteLine ("\t\t\t\treturn ({0}) class_structs [gtype];", class_struct_name);
+ sw.WriteLine ("\t\t\telse {");
+ sw.WriteLine ("\t\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
+ sw.WriteLine ("\t\t\t\tIntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);");
+ sw.WriteLine ("\t\t\t\t{0} class_struct = ({0}) Marshal.PtrToStructure (class_ptr, typeof ({0}));", class_struct_name);
+ sw.WriteLine ("\t\t\t\tif (use_cache)");
+ sw.WriteLine ("\t\t\t\t\tclass_structs.Add (gtype, class_struct);");
@ -742,7 +731,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
+ sw.WriteLine ();
+ sw.WriteLine ("\t\tstatic void OverrideClassStruct (Gst.GLib.GType gtype, {0} class_struct)", class_struct_name);
+ sw.WriteLine ("\t\t{");
+ sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
+ sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);");
+ sw.WriteLine ("\t\t\tMarshal.StructureToPtr (class_struct, class_ptr, false);");
+ sw.WriteLine ("\t\t}");
+ sw.WriteLine ();
@ -833,9 +822,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
+ }
+}
+
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/ObjectBase.cs generator/ObjectBase.cs
--- gtk-sharp/generator/ObjectBase.cs 2009-08-05 08:24:27.000000000 +0200
+++ generator/ObjectBase.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/ObjectBase.cs 2009-08-05 08:24:27.000000000 +0200
+++ generator/ObjectBase.cs 2009-09-03 10:46:50.000000000 +0200
@@ -164,7 +164,7 @@
public override string FromNative (string var, bool owned)
@ -845,18 +833,9 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
}
public string ClassStructName {
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/ObjectGen.cs generator/ObjectGen.cs
--- gtk-sharp/generator/ObjectGen.cs 2009-08-05 08:24:27.000000000 +0200
+++ generator/ObjectGen.cs 2009-08-05 16:49:19.000000000 +0200
@@ -256,14 +256,14 @@
if (!DisableGTypeCtor) {
gen_info.Writer.WriteLine("\t\t[Obsolete]");
- gen_info.Writer.WriteLine("\t\tprotected " + Name + "(GLib.GType gtype) : base(gtype) {}");
+ gen_info.Writer.WriteLine("\t\tprotected " + Name + "(Gst.GLib.GType gtype) : base(gtype) {}");
}
gen_info.Writer.WriteLine("\t\tpublic " + Name + "(IntPtr raw) : base(raw) {}");
if (ctors.Count == 0 && !DisableVoidCtor) {
--- tmp/generator/ObjectGen.cs 2009-08-19 18:13:17.000000000 +0200
+++ generator/ObjectGen.cs 2009-09-03 10:51:24.000000000 +0200
@@ -253,7 +253,7 @@
gen_info.Writer.WriteLine();
gen_info.Writer.WriteLine("\t\tprotected " + Name + "() : base(IntPtr.Zero)");
gen_info.Writer.WriteLine("\t\t{");
@ -865,12 +844,12 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
gen_info.Writer.WriteLine("\t\t}");
}
gen_info.Writer.WriteLine();
@@ -312,10 +312,10 @@
@@ -302,10 +302,10 @@
if (cs_parent == "")
sw.WriteLine ("\t\tstatic uint class_offset = 0;");
else
- sw.WriteLine ("\t\tstatic uint class_offset = ((GLib.GType) typeof ({0})).ClassSize;", cs_parent);
+ sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).ClassSize;", cs_parent);
- sw.WriteLine ("\t\tstatic uint class_offset = ((GLib.GType) typeof ({0})).GetClassSize ();", cs_parent);
+ sw.WriteLine ("\t\tstatic uint class_offset = ((Gst.GLib.GType) typeof ({0})).GetClassSize ();", cs_parent);
sw.WriteLine ("\t\tstatic Hashtable class_structs;");
sw.WriteLine ();
- sw.WriteLine ("\t\tstatic {0} GetClassStruct (GLib.GType gtype, bool use_cache)", class_struct_name);
@ -878,16 +857,16 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tif (class_structs == null)");
sw.WriteLine ("\t\t\t\tclass_structs = new Hashtable ();");
@@ -331,7 +331,7 @@
@@ -321,7 +321,7 @@
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
- sw.WriteLine ("\t\tstatic void OverrideClassStruct (GLib.GType gtype, {0} class_struct)", class_struct_name);
+ sw.WriteLine ("\t\tstatic void OverrideClassStruct (Gst.GLib.GType gtype, {0} class_struct)", class_struct_name);
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\tMarshal.StructureToPtr (class_struct, class_ptr, false);");
@@ -345,7 +345,7 @@
@@ -335,7 +335,7 @@
for (int i = 1; i < cname.Length; i++) {
if (Char.IsUpper (cname[i])) {
if (i == 1 && cname[0] == 'G')
@ -896,7 +875,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
else
return cname.Substring (0, i) + "." + cname.Substring (i);
}
@@ -408,7 +408,7 @@
@@ -398,7 +398,7 @@
foreach (string key in dir_info.objects.Keys) {
if (GetExpected(key) != ((string) dir_info.objects[key]))
@ -905,9 +884,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
}
sw.WriteLine ("\t\t}");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/OpaqueGen.cs generator/OpaqueGen.cs
--- gtk-sharp/generator/OpaqueGen.cs 2009-04-26 05:21:47.000000000 +0200
+++ generator/OpaqueGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/OpaqueGen.cs 2009-08-19 18:13:17.000000000 +0200
+++ generator/OpaqueGen.cs 2009-09-03 10:46:50.000000000 +0200
@@ -32,7 +32,7 @@
public override string FromNative(string var, bool owned)
@ -947,9 +925,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t\tresult.Owned = true;");
sw.WriteLine ("\t\t\treturn result;");
sw.WriteLine ("\t\t}");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/Parameters.cs generator/Parameters.cs
--- gtk-sharp/generator/Parameters.cs 2009-07-13 00:01:52.000000000 +0200
+++ generator/Parameters.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/Parameters.cs 2009-07-13 00:01:52.000000000 +0200
+++ generator/Parameters.cs 2009-09-03 10:46:50.000000000 +0200
@@ -263,9 +263,9 @@
} else if (gen is IManualMarshaler)
call_parm = "native_" + CallName;
@ -962,9 +939,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
return call_parm;
}
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/Parser.cs generator/Parser.cs
--- gtk-sharp/generator/Parser.cs 2009-04-13 19:44:48.000000000 +0200
+++ generator/Parser.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/Parser.cs 2009-04-13 19:44:48.000000000 +0200
+++ generator/Parser.cs 2009-09-03 10:46:50.000000000 +0200
@@ -138,6 +138,9 @@
case "object":
result.Add (new ObjectGen (ns, elem));
@ -975,9 +951,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
case "class":
result.Add (new ClassGen (ns, elem));
break;
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/Property.cs generator/Property.cs
--- gtk-sharp/generator/Property.cs 2008-09-17 01:21:50.000000000 +0200
+++ generator/Property.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/Property.cs 2008-09-17 01:21:50.000000000 +0200
+++ generator/Property.cs 2009-09-03 10:46:50.000000000 +0200
@@ -64,7 +64,7 @@
}
@ -1033,17 +1008,16 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
if (v_type != "" && !(table.IsObject (CType) || table.IsInterface (CType) || table.IsOpaque (CType))) {
sw.Write(v_type + " ");
}
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/ReturnValue.cs generator/ReturnValue.cs
--- gtk-sharp/generator/ReturnValue.cs 2009-05-06 18:20:35.000000000 +0200
+++ generator/ReturnValue.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/ReturnValue.cs 2009-08-13 16:46:33.000000000 +0200
+++ generator/ReturnValue.cs 2009-09-03 10:50:20.000000000 +0200
@@ -110,7 +110,9 @@
get {
if (IGen == null)
return String.Empty;
- return IGen.ToNativeReturnType + (is_array || is_null_term ? "[]" : String.Empty);
- return IGen.MarshalType + (is_array || is_null_term ? "[]" : String.Empty);
+ else if (is_null_term)
+ return "IntPtr";
+ return IGen.ToNativeReturnType + (is_array ? "[]" : String.Empty);
+ return IGen.MarshalType + (is_array ? "[]" : String.Empty);
}
}
@ -1064,7 +1038,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
- return String.Format ("GLib.Marshaller.NullTermPtrToStringArray ({0}, {1})", var, owned ? "true" : "false");
+ return String.Format ("Gst.Marshaller.NullTermPtrToStringArray ({0}, {1})", var, owned ? "true" : "false");
else
return IGen.FromNativeReturn (var);
return IGen.FromNative (var);
}
@@ -142,11 +144,11 @@
string args = ", typeof (" + ElementType + "), " + (owned ? "true" : "false") + ", " + (elements_owned ? "true" : "false");
@ -1080,10 +1054,9 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
return var + " == null ? IntPtr.Zero : " + var + ".OwnedHandle";
else if (IGen is OpaqueGen && owned)
return var + " == null ? IntPtr.Zero : " + var + ".OwnedCopy";
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/Signal.cs generator/Signal.cs
--- gtk-sharp/generator/Signal.cs 2009-07-02 22:18:10.000000000 +0200
+++ generator/Signal.cs 2009-08-05 16:49:19.000000000 +0200
@@ -202,7 +202,7 @@
--- tmp/generator/Signal.cs 2009-09-02 22:17:37.000000000 +0200
+++ generator/Signal.cs 2009-09-03 10:46:50.000000000 +0200
@@ -204,7 +204,7 @@
}
sw.WriteLine("\t\t\t} catch (Exception) {");
sw.WriteLine ("\t\t\t\tException ex = new Exception (\"args.RetVal or 'out' property unset or set to incorrect type in " + EventHandlerQualifiedName + " callback\");");
@ -1092,7 +1065,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t\t\t// NOTREACHED: above call doesn't return.");
sw.WriteLine ("\t\t\t\tthrow ex;");
@@ -226,15 +226,15 @@
@@ -228,15 +228,15 @@
sw.WriteLine("\t\t{");
sw.WriteLine("\t\t\t{0} args = new {0} ();", EventArgsQualifiedName);
sw.WriteLine("\t\t\ttry {");
@ -1111,7 +1084,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine("\t\t\t}");
GenArgsCleanup (sw, finish);
sw.WriteLine("\t\t}");
@@ -264,7 +264,7 @@
@@ -266,7 +266,7 @@
sw.WriteLine ();
sw.WriteLine ("\tpublic delegate void " + EventHandlerName + "(object o, " + EventArgsName + " args);");
sw.WriteLine ();
@ -1120,7 +1093,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
for (int i = 0; i < parms.Count; i++) {
sw.WriteLine ("\t\tpublic " + parms[i].CSType + " " + parms[i].StudlyName + "{");
if (parms[i].PassAs != "out") {
@@ -294,17 +294,17 @@
@@ -296,17 +296,17 @@
args_type = ", new " + DelegateName + "(" + CallbackName + ")";
}
@ -1141,9 +1114,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine("\t\t\t\tsig.RemoveDelegate (value);");
sw.WriteLine("\t\t\t}");
sw.WriteLine("\t\t}");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/StructBase.cs generator/StructBase.cs
--- gtk-sharp/generator/StructBase.cs 2008-09-30 23:21:53.000000000 +0200
+++ generator/StructBase.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/StructBase.cs 2009-08-19 18:13:17.000000000 +0200
+++ generator/StructBase.cs 2009-09-03 10:46:50.000000000 +0200
@@ -92,7 +92,7 @@
public string AllocNative (string var)
@ -1153,9 +1125,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
}
public string ReleaseNative (string var)
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/StructGen.cs generator/StructGen.cs
--- gtk-sharp/generator/StructGen.cs 2005-08-05 22:34:45.000000000 +0200
+++ generator/StructGen.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/StructGen.cs 2005-08-05 22:34:45.000000000 +0200
+++ generator/StructGen.cs 2009-09-03 10:46:50.000000000 +0200
@@ -36,8 +36,8 @@
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
base.Generate (gen_info);
@ -1167,9 +1138,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
sw.WriteLine ("\t\t}");
}
sw.WriteLine ("#endregion");
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/SymbolTable.cs generator/SymbolTable.cs
--- gtk-sharp/generator/SymbolTable.cs 2009-04-13 19:44:48.000000000 +0200
+++ generator/SymbolTable.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/SymbolTable.cs 2009-08-13 16:46:33.000000000 +0200
+++ generator/SymbolTable.cs 2009-09-03 10:46:50.000000000 +0200
@@ -108,23 +108,24 @@
AddType (new ConstStringGen ("const-xmlChar"));
AddType (new ConstStringGen ("const-char"));
@ -1218,7 +1188,7 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
AddType (new SimpleGen ("GHashTable", "System.IntPtr", "IntPtr.Zero"));
AddType (new SimpleGen ("va_list", "IntPtr", "IntPtr.Zero"));
AddType (new SimpleGen ("GParamSpec", "IntPtr", "IntPtr.Zero"));
@@ -338,7 +339,8 @@
@@ -306,7 +307,8 @@
public bool IsObject(string c_type)
{
@ -1228,9 +1198,8 @@ diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur
return true;
return false;
diff -x'*Makefile' -x'*exe*' -x'*in' -x'*Makefile.am' -x'*orig' -x'*diff' -Naur gtk-sharp/generator/VirtualMethod.cs generator/VirtualMethod.cs
--- gtk-sharp/generator/VirtualMethod.cs 2009-07-02 22:18:10.000000000 +0200
+++ generator/VirtualMethod.cs 2009-08-05 16:49:19.000000000 +0200
--- tmp/generator/VirtualMethod.cs 2009-09-02 22:17:37.000000000 +0200
+++ generator/VirtualMethod.cs 2009-09-03 10:46:50.000000000 +0200
@@ -92,7 +92,7 @@
else
type = this.container_type.Name;

View file

@ -74,7 +74,7 @@ public Gst.QueryType[] GetQueryTypes () {
static extern void gst_element_class_add_pad_template (IntPtr klass, IntPtr templ);
protected static void AddPadTemplate (Gst.GLib.GType gtype, Gst.PadTemplate templ) {
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 ());
gst_element_class_add_pad_template (class_ptr, templ.Handle);
}
@ -83,7 +83,7 @@ static extern IntPtr gst_element_class_get_pad_template (IntPtr klass, IntPtr na
public Gst.PadTemplate GetPadTemplate (string name) {
Gst.GLib.GType gtype = this.LookupGType ();
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 ());
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr raw_ret = gst_element_class_get_pad_template (class_ptr, native_name);
Gst.GLib.Marshaller.Free (native_name);
@ -97,7 +97,7 @@ static extern IntPtr gst_element_class_get_pad_template_list (IntPtr klass);
public Gst.PadTemplate[] PadTemplates {
get {
Gst.GLib.GType gtype = this.LookupGType ();
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 ());
IntPtr raw_ret = gst_element_class_get_pad_template_list (class_ptr);
return (Gst.PadTemplate[]) Gst.GLib.Marshaller.ListPtrToArray (raw_ret, typeof (Gst.GLib.List), false, false, typeof (Gst.PadTemplate));
@ -108,7 +108,7 @@ public Gst.PadTemplate[] PadTemplates {
static extern void gst_element_class_set_details_simple (IntPtr klass, IntPtr longname, IntPtr classification, IntPtr desc, IntPtr author);
protected static void SetDetails (Gst.GLib.GType gtype, string longname, string klass, string description, string author) {
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 ());
IntPtr native_longname = Gst.GLib.Marshaller.StringToPtrGStrdup (longname);
IntPtr native_klass = Gst.GLib.Marshaller.StringToPtrGStrdup (klass);
IntPtr native_desc = Gst.GLib.Marshaller.StringToPtrGStrdup (description);

View file

@ -215,7 +215,7 @@ namespace Gst {
if (use_cache && class_structs.Contains (gtype))
return (GstMiniObjectClass) class_structs [gtype];
else {
IntPtr class_ptr = gtype.ClassPtr;
IntPtr class_ptr = gtype.GetClassPtr ();
GstMiniObjectClass class_struct = (GstMiniObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GstMiniObjectClass));
if (use_cache)
class_structs.Add (gtype, class_struct);
@ -224,7 +224,7 @@ namespace Gst {
}
static void OverrideClassStruct (Gst.GLib.GType gtype, GstMiniObjectClass class_struct) {
IntPtr class_ptr = gtype.ClassPtr;
IntPtr class_ptr = gtype.GetClassPtr ();
Marshal.StructureToPtr (class_struct, class_ptr, false);
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.Argv.cs : Argv marshaling class
// GLib.Argv.cs : Argv marshaling class
//
// Author: Mike Kestner <mkestner@novell.com>
//
@ -30,10 +30,10 @@ namespace Gst.GLib {
IntPtr handle;
bool add_progname = false;
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_malloc(IntPtr size);
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_free (IntPtr mem);
~Argv ()

View file

@ -56,8 +56,8 @@ namespace Gst.GLib {
// currently only GObjects store
// callbacks over the long-term
if (o is Gst.GLib.Object) {
AddDestroyNotify ((Gst.GLib.Object) o);
if (o is GLib.Object) {
AddDestroyNotify ((GLib.Object) o);
}
} else {
// If o is null, we cannot ask for a destroy
@ -69,13 +69,13 @@ namespace Gst.GLib {
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
private delegate void DestroyNotify (IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
private static extern void g_object_set_data_full (IntPtr obj, IntPtr name, IntPtr data, DestroyNotify destroy);
private void AddDestroyNotify (Gst.GLib.Object o) {
private void AddDestroyNotify (GLib.Object o) {
// This is a bit of an ugly hack. There is no
// way of getting a destroy notification
// explicitly, so we set some data and ask

View file

@ -1,4 +1,4 @@
// Gst.GLib.DestroyNotify.cs - internal DestroyNotify helper
// GLib.DestroyNotify.cs - internal DestroyNotify helper
//
// Author: Mike Kestner <mkestner@novell.com>
//
@ -23,7 +23,7 @@ namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
public delegate void DestroyNotify (IntPtr data);
public class DestroyHelper {

View file

@ -24,7 +24,7 @@ namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
[Obsolete ("Replaced by direct enum type casts to/from Gst.GLib.Value")]
[Obsolete ("Replaced by direct enum type casts to/from GLib.Value")]
public class EnumWrapper {
int val;
public bool flags;

View file

@ -1,4 +1,4 @@
// Gst.GLib.Application.cs - static Application class
// GLib.Application.cs - static Application class
//
// Authors: Mike Kestner <mkestner@novell.com>
//
@ -53,7 +53,7 @@ namespace Gst.GLib {
{
if (UnhandledException == null) {
Console.Error.WriteLine ("Exception in Gtk# callback delegate");
Console.Error.WriteLine (" Note: Applications can use Gst.GLib.ExceptionManager.UnhandledException to handle the exception.");
Console.Error.WriteLine (" Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.");
Console.Error.WriteLine (e);
Console.Error.WriteLine (new System.Diagnostics.StackTrace (true));
Environment.Exit (1);

View file

@ -1,4 +1,4 @@
// Gst.GLib.FileUtils.cs - GFileUtils class implementation
// GLib.FileUtils.cs - GFileUtils class implementation
//
// Author: Martin Baulig <martin@gnome.org>
//
@ -27,7 +27,7 @@ namespace Gst.GLib {
public class FileUtils
{
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
extern static bool g_file_get_contents (IntPtr filename, out IntPtr contents, out int length, out IntPtr error);
public static string GetFileContents (string filename)

View file

@ -26,7 +26,7 @@ using System.Runtime.InteropServices;
namespace Gst.GLib {
#if GTK_SHARP_2_14
public class Format {
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_format_size_for_display (long size);
static public string SizeForDisplay (long size)

View file

@ -46,7 +46,7 @@ namespace Gst.GLib {
}
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_clear_error (ref IntPtr errptr);
~GException ()
{

View file

@ -1,4 +1,4 @@
// Gst.GLib.GString.cs : Marshaler for GStrings
// GLib.GString.cs : Marshaler for GStrings
//
// Author: Mike Kestner <mkestner@ximian.com>
//
@ -23,11 +23,11 @@ namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
public class GString : Gst.GLib.IWrapper {
public class GString : GLib.IWrapper {
IntPtr handle;
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_string_free (IntPtr mem, bool free_segments);
~GString ()
@ -35,7 +35,7 @@ namespace Gst.GLib {
g_string_free (handle, true);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_string_new (IntPtr text);
public GString (string text)

View file

@ -1,4 +1,4 @@
// Gst.GLib.Type.cs - GLib GType class implementation
// GLib.Type.cs - GLib GType class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
@ -29,7 +29,7 @@ namespace Gst.GLib {
using System.Runtime.InteropServices;
using System.Text;
public delegate System.Type TypeResolutionHandler (Gst.GLib.GType gtype, string gtype_name);
public delegate System.Type TypeResolutionHandler (GLib.GType gtype, string gtype_name);
[StructLayout(LayoutKind.Sequential)]
public struct GType {
@ -103,8 +103,8 @@ namespace Gst.GLib {
static GType ()
{
if (!Gst.GLib.Thread.Supported)
Gst.GLib.Thread.Init ();
if (!GLib.Thread.Supported)
GLib.Thread.Init ();
g_type_init ();
@ -119,7 +119,7 @@ namespace Gst.GLib {
Register (GType.Double, typeof (double));
Register (GType.String, typeof (string));
Register (GType.Pointer, typeof (IntPtr));
Register (GType.Object, typeof (Gst.GLib.Object));
Register (GType.Object, typeof (GLib.Object));
Register (GType.Pointer, typeof (IntPtr));
// One-way mapping
@ -135,8 +135,8 @@ namespace Gst.GLib {
return (GType)gtypes[type];
}
if (type.IsSubclassOf (typeof (Gst.GLib.Object))) {
gtype = Gst.GLib.Object.LookupGType (type);
if (type.IsSubclassOf (typeof (GLib.Object))) {
gtype = GLib.Object.LookupGType (type);
Register (gtype, type);
return gtype;
}
@ -148,7 +148,7 @@ namespace Gst.GLib {
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 (Gst.GLib.Opaque)))
} else if (type.IsSubclassOf (typeof (GLib.Opaque)))
gtype = GType.Pointer;
else
gtype = ManagedValue.GType;
@ -162,7 +162,7 @@ namespace Gst.GLib {
for (int i = 1; i < cname.Length; i++) {
if (System.Char.IsUpper (cname[i])) {
if (i == 1 && cname [0] == 'G')
return "Gst.GLib." + cname.Substring (1);
return "GLib." + cname.Substring (1);
else
return cname.Substring (0, i) + "." + cname.Substring (i);
}
@ -193,7 +193,7 @@ namespace Gst.GLib {
string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid));
if (ResolveType != null) {
Gst.GLib.GType gt = new Gst.GLib.GType (typeid);
GLib.GType gt = new GLib.GType (typeid);
Delegate[] invocation_list = ResolveType.GetInvocationList ();
foreach (Delegate d in invocation_list) {
@ -285,41 +285,33 @@ namespace Gst.GLib {
return Marshaller.Utf8PtrToString (g_type_name (val));
}
public IntPtr ClassPtr {
get {
IntPtr klass = g_type_class_peek (val);
if (klass == IntPtr.Zero)
klass = g_type_class_ref (val);
return klass;
}
public IntPtr GetClassPtr ()
{
IntPtr klass = g_type_class_peek (val);
if (klass == IntPtr.Zero)
klass = g_type_class_ref (val);
return klass;
}
public GType BaseType {
get {
IntPtr parent = g_type_parent (this.Val);
if (parent == IntPtr.Zero)
return GType.None;
else
return new GType (parent);
}
public GType GetBaseType ()
{
IntPtr parent = g_type_parent (this.Val);
return parent == IntPtr.Zero ? GType.None : new GType (parent);
}
public GType ThresholdType {
get {
Gst.GLib.GType curr_type = this;
while (curr_type.ToString ().StartsWith ("__gtksharp_")) {
curr_type = curr_type.BaseType;
}
return curr_type;
}
public GType GetThresholdType ()
{
GType curr_type = this;
while (curr_type.ToString ().StartsWith ("__gtksharp_"))
curr_type = curr_type.GetBaseType ();
return curr_type;
}
public uint ClassSize {
get {
GTypeQuery query;
g_type_query (this.Val, out query);
return query.class_size;
}
public uint GetClassSize ()
{
GTypeQuery query;
g_type_query (this.Val, out query);
return query.class_size;
}
internal void EnsureClass ()
@ -357,14 +349,14 @@ namespace Gst.GLib {
{
GType parent_gtype = LookupGObjectType (t.BaseType);
string name = BuildEscapedName (t);
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
GTypeQuery query;
g_type_query (parent_gtype.Val, out query);
GTypeInfo info = new GTypeInfo ();
info.class_size = (ushort) query.class_size;
info.instance_size = (ushort) query.instance_size;
GType gtype = new GType (g_type_register_static (parent_gtype.Val, native_name, ref info, 0));
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
Register (gtype, t);
return gtype;
}
@ -380,7 +372,7 @@ namespace Gst.GLib {
if (pi != null)
return (GType) pi.GetValue (null, null);
return Gst.GLib.Object.RegisterGType (t);
return GLib.Object.RegisterGType (t);
}
internal static IntPtr ValFromInstancePtr (IntPtr handle)
@ -404,31 +396,31 @@ namespace Gst.GLib {
return GType.Is (ValFromInstancePtr (raw), this);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_type_class_peek (IntPtr gtype);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_type_class_ref (IntPtr gtype);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_type_from_name (string name);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_type_init ();
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_type_name (IntPtr raw);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_type_parent (IntPtr type);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_type_query (IntPtr type, out GTypeQuery query);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_type_register_static (IntPtr parent, IntPtr name, ref GTypeInfo info, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_type_is_a (IntPtr type, IntPtr is_a_type);
}
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.Global.cs - Global glib properties and methods.
// GLib.Global.cs - Global glib properties and methods.
//
// Author: Andres G. Aragoneses <aaragoneses@novell.com>
//
@ -31,38 +31,40 @@ namespace Gst.GLib {
//this is a static class
private Global () {}
public const System.Runtime.InteropServices.CallingConvention CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;
public static string ProgramName {
get {
return Gst.GLib.Marshaller.PtrToStringGFree(g_get_prgname());
return GLib.Marshaller.PtrToStringGFree(g_get_prgname());
}
set {
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (value);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (value);
g_set_prgname (native_name);
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
}
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_set_prgname (IntPtr name);
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_get_prgname ();
public static string ApplicationName {
get {
return Gst.GLib.Marshaller.PtrToStringGFree(g_get_application_name());
return GLib.Marshaller.PtrToStringGFree(g_get_application_name());
}
set {
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (value);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (value);
g_set_application_name (native_name);
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
}
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_set_application_name (IntPtr name);
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_get_application_name ();
}
}

View file

@ -25,7 +25,7 @@ namespace Gst.GLibSharp {
using System.Runtime.InteropServices;
using GLib;
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
internal delegate bool IOFuncNative(IntPtr source, int condition, IntPtr data);
internal class IOFuncWrapper {
@ -319,102 +319,100 @@ namespace Gst.GLib {
return (IOChannelError) g_io_channel_error_from_errno (en);
}
const string libname = "libglib-2.0-0.dll";
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_io_channel_unix_new (int fd);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_io_channel_new_file (IntPtr filename, IntPtr mode, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_error_quark ();
[DllImport(libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_error_from_errno (int en);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_flush (IntPtr raw, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_io_channel_init (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_read_chars (IntPtr raw, byte[] buf, UIntPtr count, out UIntPtr bytes_read, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_read_line (IntPtr raw, out IntPtr str_return, IntPtr length, out UIntPtr terminator_pos, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_read_to_end (IntPtr raw, out IntPtr str_return, out UIntPtr length, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_read_unichar (IntPtr raw, out uint thechar, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_seek_position (IntPtr raw, long offset, int type, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_shutdown (IntPtr raw, bool flush, out IntPtr err);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_write_chars (IntPtr raw, byte[] buf, IntPtr count, out UIntPtr bytes_written, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_write_unichar (IntPtr raw, uint thechar, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_get_buffer_condition (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_io_channel_get_buffered (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_io_channel_set_buffered (IntPtr raw, bool buffered);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern UIntPtr g_io_channel_get_buffer_size (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_io_channel_set_buffer_size (IntPtr raw, UIntPtr size);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_io_channel_get_close_on_unref (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_io_channel_set_close_on_unref (IntPtr raw, bool do_close);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_io_channel_get_encoding (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_set_encoding (IntPtr raw, IntPtr encoding, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_get_flags (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_set_flags (IntPtr raw, int flags, out IntPtr error);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_io_channel_get_line_term (IntPtr raw, out int length);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_io_channel_set_line_term (IntPtr raw, byte[] term, int length);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_io_channel_unix_get_fd (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_io_channel_ref (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_io_channel_unref (IntPtr raw);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_io_add_watch_full (IntPtr raw, int priority, int condition, IOFuncNative func, IntPtr user_data, DestroyNotify notify);
[DllImport (libname)]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_io_create_watch (IntPtr raw, int condition);
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.Idle.cs - Idle class implementation
// GLib.Idle.cs - Idle class implementation
//
// Author(s):
// Mike Kestner <mkestner@speakeasy.net>
@ -34,7 +34,7 @@ namespace Gst.GLib {
public class Idle {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate bool IdleHandlerInternal ();
@ -65,7 +65,7 @@ namespace Gst.GLib {
{
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_idle_add (IdleHandlerInternal d, IntPtr data);
public static uint Add (IdleHandler hndlr)
@ -78,7 +78,7 @@ namespace Gst.GLib {
return p.ID;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_idle_add_full (int priority, IdleHandlerInternal d, IntPtr data, DestroyNotify notify);
public static uint Add (IdleHandler hndlr, Priority priority)
@ -91,7 +91,7 @@ namespace Gst.GLib {
return p.ID;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_source_remove_by_funcs_user_data (Delegate d, IntPtr data);
public static void Remove (uint id)

View file

@ -31,10 +31,7 @@ namespace Gst.GLib {
protected InitiallyUnowned (IntPtr raw) : base (raw) {}
[Obsolete]
protected InitiallyUnowned (GType gtype) : base (gtype) {}
public new static Gst.GLib.GType GType {
public new static GLib.GType GType {
get {
return GType.Object;
}

View file

@ -26,7 +26,7 @@ namespace Gst.GLib {
public class List : ListBase {
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_list_copy (IntPtr l);
public override object Clone ()
@ -34,7 +34,7 @@ namespace Gst.GLib {
return new List (g_list_copy (Handle));
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_list_length (IntPtr l);
internal override int Length (IntPtr list)
@ -42,7 +42,7 @@ namespace Gst.GLib {
return g_list_length (list);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_list_free(IntPtr l);
internal override void Free (IntPtr list)
@ -51,7 +51,7 @@ namespace Gst.GLib {
g_list_free (list);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_list_append (IntPtr l, IntPtr raw);
internal override IntPtr Append (IntPtr list, IntPtr raw)
@ -59,7 +59,7 @@ namespace Gst.GLib {
return g_list_append (list, raw);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_list_prepend (IntPtr l, IntPtr raw);
internal override IntPtr Prepend (IntPtr list, IntPtr raw)
@ -67,7 +67,7 @@ namespace Gst.GLib {
return g_list_prepend (list, raw);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_list_nth_data (IntPtr l, uint n);
internal override IntPtr NthData (uint n)

View file

@ -26,7 +26,7 @@ namespace Gst.GLib {
using System.Collections;
using System.Runtime.InteropServices;
public abstract class ListBase : IDisposable, ICollection, Gst.GLib.IWrapper, ICloneable {
public abstract class ListBase : IDisposable, ICollection, GLib.IWrapper, ICloneable {
private IntPtr list_ptr = IntPtr.Zero;
private int length = -1;
@ -159,10 +159,10 @@ namespace Gst.GLib {
ret = Marshaller.FilenamePtrToString (data);
else if (element_type == typeof (IntPtr))
ret = data;
else if (element_type.IsSubclassOf (typeof (Gst.GLib.Object)))
ret = Gst.GLib.Object.GetObject (data, false);
else if (element_type.IsSubclassOf (typeof (Gst.GLib.Opaque)))
ret = Gst.GLib.Opaque.GetOpaque (data, element_type, elements_owned);
else if (element_type.IsSubclassOf (typeof (GLib.Object)))
ret = GLib.Object.GetObject (data, false);
else if (element_type.IsSubclassOf (typeof (GLib.Opaque)))
ret = GLib.Opaque.GetOpaque (data, element_type, elements_owned);
else if (element_type == typeof (int))
ret = (int) data;
else if (element_type.IsValueType)
@ -175,25 +175,25 @@ namespace Gst.GLib {
ret = Activator.CreateInstance (element_type, new object[] {data});
} else if (Object.IsObject (data))
ret = Gst.GLib.Object.GetObject (data, false);
ret = GLib.Object.GetObject (data, false);
return ret;
}
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_free (IntPtr item);
[DllImport ("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_unref (IntPtr item);
public void Empty ()
{
if (elements_owned)
for (uint i = 0; i < Count; i++)
if (typeof (Gst.GLib.Object).IsAssignableFrom (element_type))
if (typeof (GLib.Object).IsAssignableFrom (element_type))
g_object_unref (NthData (i));
else if (typeof (Gst.GLib.Opaque).IsAssignableFrom (element_type))
Gst.GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
else if (typeof (GLib.Opaque).IsAssignableFrom (element_type))
GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
else
g_free (NthData (i));

View file

@ -58,15 +58,73 @@ namespace Gst.GLib {
public class Log {
static Hashtable handlers;
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void LogFuncNative (IntPtr log_domain, LogLevelFlags flags, IntPtr message, IntPtr user_data);
static LogFuncNative native_handler;
static void NativeCallback (IntPtr log_domain_native, LogLevelFlags flags, IntPtr message_native, IntPtr user_data)
{
if (user_data == IntPtr.Zero)
return;
string log_domain = Marshaller.Utf8PtrToString (log_domain_native);
string message = Marshaller.Utf8PtrToString (message_native);
GCHandle gch = (GCHandle) user_data;
LogFunc func = gch.Target as LogFunc;
if (func != null)
func (log_domain, flags, message);
}
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void PrintFuncNative (IntPtr message);
class PrintHelper {
PrintFuncNative native;
PrintFunc managed;
public PrintHelper (PrintFuncNative native)
{
this.native = native;
}
public PrintHelper (PrintFunc managed)
{
this.managed = managed;
GCHandle.Alloc (this);
}
void Callback (IntPtr nmessage)
{
string message = Marshaller.Utf8PtrToString (nmessage);
managed (message);
}
void Invoke (string message)
{
IntPtr nmessage = Marshaller.StringToPtrGStrdup (message);
native (nmessage);
Marshaller.Free (nmessage);
}
public PrintFuncNative Handler {
get { return new PrintFuncNative (Callback); }
}
public PrintFunc Invoker {
get { return new PrintFunc (Invoke); }
}
}
static System.Collections.Generic.Dictionary<uint, GCHandle> handlers;
static void EnsureHash ()
{
if (handlers == null)
handlers = new Hashtable ();
handlers = new System.Collections.Generic.Dictionary<uint, GCHandle> ();
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_logv (IntPtr log_domain, LogLevelFlags flags, IntPtr message);
public void WriteLog (string logDomain, LogLevelFlags flags, string format, params object [] args)
@ -78,57 +136,61 @@ namespace Gst.GLib {
Marshaller.Free (nmessage);
}
[DllImport("libglib-2.0-0.dll")]
static extern uint g_log_set_handler (IntPtr log_domain, LogLevelFlags flags, LogFunc log_func, IntPtr user_data);
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_log_set_handler (IntPtr log_domain, LogLevelFlags flags, LogFuncNative log_func, IntPtr user_data);
public static uint SetLogHandler (string logDomain, LogLevelFlags flags, LogFunc logFunc)
{
if (native_handler == null)
native_handler = new LogFuncNative (NativeCallback);
IntPtr ndom = Marshaller.StringToPtrGStrdup (logDomain);
uint result = g_log_set_handler (ndom, flags, logFunc, IntPtr.Zero);
GCHandle gch = GCHandle.Alloc (logFunc);
uint result = g_log_set_handler (ndom, flags, native_handler, (IntPtr) gch);
Marshaller.Free (ndom);
EnsureHash ();
handlers [result] = logFunc;
handlers [result] = gch;
return result;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_log_remove_handler (IntPtr log_domain, uint handler_id);
public static void RemoveLogHandler (string logDomain, uint handlerID)
{
if (handlers != null && handlers.ContainsKey (handlerID))
if (handlers != null && handlers.ContainsKey (handlerID)) {
handlers [handlerID].Free ();
handlers.Remove (handlerID);
}
IntPtr ndom = Marshaller.StringToPtrGStrdup (logDomain);
g_log_remove_handler (ndom, handlerID);
Marshaller.Free (ndom);
}
[DllImport("libglib-2.0-0.dll")]
static extern PrintFunc g_set_print_handler (PrintFunc handler);
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern PrintFuncNative g_set_print_handler (PrintFuncNative handler);
public static PrintFunc SetPrintHandler (PrintFunc handler)
{
EnsureHash ();
handlers ["PrintHandler"] = handler;
return g_set_print_handler (handler);
PrintHelper helper = new PrintHelper (handler);
PrintFuncNative prev = g_set_print_handler (helper.Handler);
helper = new PrintHelper (prev);
return helper.Invoker;
}
[DllImport("libglib-2.0-0.dll")]
static extern PrintFunc g_set_printerr_handler (PrintFunc handler);
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern PrintFuncNative g_set_printerr_handler (PrintFuncNative handler);
public static PrintFunc SetPrintErrorHandler (PrintFunc handler)
{
EnsureHash ();
handlers ["PrintErrorHandler"] = handler;
return g_set_printerr_handler (handler);
PrintHelper helper = new PrintHelper (handler);
PrintFuncNative prev = g_set_printerr_handler (helper.Handler);
helper = new PrintHelper (prev);
return helper.Invoker;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_log_default_handler (IntPtr log_domain, LogLevelFlags log_level, IntPtr message, IntPtr unused_data);
public static void DefaultHandler (string logDomain, LogLevelFlags logLevel, string message)
@ -141,7 +203,7 @@ namespace Gst.GLib {
Marshaller.Free (nmess);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
extern static LogLevelFlags g_log_set_always_fatal (LogLevelFlags fatal_mask);
public static LogLevelFlags SetAlwaysFatal (LogLevelFlags fatalMask)
@ -149,7 +211,7 @@ namespace Gst.GLib {
return g_log_set_always_fatal (fatalMask);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
extern static LogLevelFlags g_log_set_fatal_mask (IntPtr log_domain, LogLevelFlags fatal_mask);
public static LogLevelFlags SetAlwaysFatal (string logDomain, LogLevelFlags fatalMask)
@ -160,6 +222,44 @@ namespace Gst.GLib {
return result;
}
class Invoker {
LogFuncNative native;
public Invoker (LogFuncNative native)
{
this.native = native;
}
void Invoke (string log_domain, LogLevelFlags flags, string message)
{
IntPtr ndom = Marshaller.StringToPtrGStrdup (log_domain);
IntPtr nmess = Marshaller.StringToPtrGStrdup (message);
native (ndom, flags, nmess, IntPtr.Zero);
Marshaller.Free (ndom);
Marshaller.Free (nmess);
}
public LogFunc Handler {
get { return new LogFunc (Invoke); }
}
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
extern static LogFuncNative g_log_set_default_handler (LogFuncNative log_func, IntPtr user_data);
public static LogFunc SetDefaultHandler (LogFunc log_func)
{
if (native_handler == null)
native_handler = new LogFuncNative (NativeCallback);
LogFuncNative prev = g_log_set_default_handler (native_handler, (IntPtr) GCHandle.Alloc (log_func));
if (prev == null)
return null;
Invoker invoker = new Invoker (prev);
return invoker.Handler;
}
/*
* Some common logging methods.
*

View file

@ -1,4 +1,4 @@
// Gst.GLib.MainContext.cs - mainContext class implementation
// GLib.MainContext.cs - mainContext class implementation
//
// Author: Radek Doulik <rodo@matfyz.cz>
//
@ -25,32 +25,143 @@ namespace Gst.GLib {
using System.Runtime.InteropServices;
public class MainContext {
[DllImport("libglib-2.0-0.dll")]
IntPtr handle;
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_main_context_new ();
public MainContext ()
{
handle = g_main_context_new ();
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_context_ref (IntPtr raw);
internal MainContext (IntPtr raw)
{
handle = raw;
g_main_context_ref (handle);
}
internal IntPtr Handle {
get {
return handle;
}
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_context_unref (IntPtr raw);
~MainContext ()
{
g_main_context_unref (handle);
handle = IntPtr.Zero;
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_main_context_default ();
public static MainContext Default {
get {
return new MainContext (g_main_context_default ());
}
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_main_context_thread_default ();
public MainContext ThreadDefault {
get {
IntPtr raw = g_main_context_thread_default ();
// NULL is returned if the thread-default main context is the default context. We'd rather not adopt this strange bahaviour.
return raw == IntPtr.Zero ? Default : new MainContext (raw);
}
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_context_push_thread_default (IntPtr raw);
public void PushThreadDefault ()
{
g_main_context_push_thread_default (handle);
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_context_pop_thread_default (IntPtr raw);
public void PopThreadDefault ()
{
g_main_context_pop_thread_default (handle);
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_main_context_iteration (IntPtr raw, bool may_block);
public bool RunIteration (bool may_block)
{
return g_main_context_iteration (handle, may_block);
}
public bool RunIteration ()
{
return RunIteration (false);
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_main_context_pending (IntPtr raw);
public bool HasPendingEvents
{
get {
return g_main_context_pending (handle);
}
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_context_wakeup (IntPtr raw);
public void Wakeup ()
{
g_main_context_wakeup (handle);
}
public override bool Equals (object o)
{
if (!(o is MainContext))
return false;
return Handle == (o as MainContext).Handle;
}
public override int GetHashCode ()
{
return Handle.GetHashCode ();
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_main_depth ();
public static int Depth {
get { return g_main_depth (); }
}
[DllImport("libglib-2.0-0.dll")]
static extern bool g_main_context_iteration (IntPtr Raw, bool MayBlock);
public static bool Iteration ()
{
return g_main_context_iteration (IntPtr.Zero, false);
return Iteration (false);
}
public static bool Iteration (bool MayBlock)
public static bool Iteration (bool may_block)
{
return g_main_context_iteration (IntPtr.Zero, MayBlock);
return Default.RunIteration (may_block);
}
[DllImport("libglib-2.0-0.dll")]
static extern bool g_main_context_pending (IntPtr Raw);
public static bool Pending ()
{
return g_main_context_pending (IntPtr.Zero);
return Default.HasPendingEvents;
}
}
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.MainLoop.cs - g_main_loop class implementation
// GLib.MainLoop.cs - g_main_loop class implementation
//
// Author: Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
@ -25,15 +25,19 @@ namespace Gst.GLib {
public class MainLoop {
private IntPtr handle;
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_main_loop_new (IntPtr context, bool isRunning);
public MainLoop ()
public MainLoop () : this (MainContext.Default) { }
public MainLoop (MainContext context) : this (context, false) { }
public MainLoop (MainContext context, bool is_running)
{
handle = g_main_loop_new (IntPtr.Zero, false);
handle = g_main_loop_new (context.Handle, is_running);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_loop_unref (IntPtr loop);
~MainLoop ()
@ -42,7 +46,7 @@ namespace Gst.GLib {
handle = IntPtr.Zero;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_main_loop_is_running (IntPtr loop);
public bool IsRunning {
@ -51,7 +55,7 @@ namespace Gst.GLib {
}
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_loop_run (IntPtr loop);
public void Run ()
@ -59,13 +63,36 @@ namespace Gst.GLib {
g_main_loop_run (handle);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_main_loop_quit (IntPtr loop);
public void Quit ()
{
g_main_loop_quit (handle);
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_main_loop_get_context (IntPtr loop);
public MainContext Context {
get {
return new MainContext (g_main_loop_get_context (handle));
}
}
public override bool Equals (object o)
{
if (!(o is MainLoop))
return false;
return handle == (o as MainLoop).handle;
}
public override int GetHashCode ()
{
return handle.GetHashCode ();
}
}
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.ManagedValue.cs : Managed types boxer
// GLib.ManagedValue.cs : Managed types boxer
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//
@ -58,16 +58,16 @@ namespace Gst.GLib {
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate IntPtr CopyFunc (IntPtr gch);
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void FreeFunc (IntPtr gch);
static CopyFunc copy;
static FreeFunc free;
static GType boxed_type = GType.Invalid;
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_boxed_type_register_static (IntPtr typename, CopyFunc copy_func, FreeFunc free_func);
public static GType GType {
@ -77,7 +77,7 @@ namespace Gst.GLib {
free = new FreeFunc (Free);
IntPtr name = Marshaller.StringToPtrGStrdup ("GstGLibSharpValue");
boxed_type = new Gst.GLib.GType (g_boxed_type_register_static (name, copy, free));
boxed_type = new GLib.GType (g_boxed_type_register_static (name, copy, free));
Marshaller.Free (name);
}

View file

@ -29,7 +29,7 @@ namespace Gst.GLib {
public class Markup {
private Markup () {}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_markup_escape_text (IntPtr text, int len);
static public string EscapeText (string s)

View file

@ -29,7 +29,7 @@ namespace Gst.GLib {
private Marshaller () {}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_free (IntPtr mem);
public static void Free (IntPtr ptr)
@ -46,7 +46,7 @@ namespace Gst.GLib {
g_free (ptrs [i]);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_filename_to_utf8 (IntPtr mem, int len, IntPtr read, out IntPtr written, out IntPtr error);
public static string FilenamePtrToString (IntPtr ptr)
@ -56,7 +56,7 @@ namespace Gst.GLib {
IntPtr dummy, error;
IntPtr utf8 = g_filename_to_utf8 (ptr, -1, IntPtr.Zero, out dummy, out error);
if (error != IntPtr.Zero)
throw new Gst.GLib.GException (error);
throw new GLib.GException (error);
return Utf8PtrToString (utf8);
}
@ -114,7 +114,7 @@ namespace Gst.GLib {
return ret;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_filename_from_utf8 (IntPtr mem, int len, IntPtr read, out IntPtr written, out IntPtr error);
public static IntPtr StringToFilenamePtr (string str)
@ -161,7 +161,7 @@ namespace Gst.GLib {
return result;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_strfreev (IntPtr mem);
public static void StrFreeV (IntPtr null_term_array)
@ -200,9 +200,9 @@ namespace Gst.GLib {
string[] members = new string[count];
for (int i = 0; i < count; ++i) {
IntPtr s = Marshal.ReadIntPtr (string_array, i * IntPtr.Size);
members[i] = Gst.GLib.Marshaller.PtrToStringGFree (s);
members[i] = GLib.Marshaller.PtrToStringGFree (s);
}
Gst.GLib.Marshaller.Free (string_array);
GLib.Marshaller.Free (string_array);
return members;
}
@ -215,7 +215,7 @@ namespace Gst.GLib {
// transparently, since we need to alloc buffers of
// [native pointer size] * [count] bytes.
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_malloc(UIntPtr size);
public static IntPtr Malloc (ulong size)
@ -262,7 +262,7 @@ namespace Gst.GLib {
return buf;
}
[Obsolete ("Use Gst.GLib.Argv instead to avoid leaks.")]
[Obsolete ("Use GLib.Argv instead to avoid leaks.")]
public static IntPtr ArgvToArrayPtr (string[] args)
{
if (args.Length == 0)
@ -303,7 +303,7 @@ namespace Gst.GLib {
return args;
}
[Obsolete ("Use Gst.GLib.Argv instead to avoid leaks.")]
[Obsolete ("Use GLib.Argv instead to avoid leaks.")]
public static string[] ArrayPtrToArgv (IntPtr array, int argc)
{
if (argc == 0)
@ -328,10 +328,10 @@ namespace Gst.GLib {
return local_epoch.AddSeconds (time_t.ToInt64 () + utc_offset);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_malloc0 (UIntPtr size);
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_unichar_to_utf8 (uint c, IntPtr buf);
public static char GUnicharToChar (uint ucs4_char)
@ -356,7 +356,7 @@ namespace Gst.GLib {
return PtrToStringGFree (buf);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_utf16_to_ucs4 (ref ushort c, IntPtr len, IntPtr d1, IntPtr d2, IntPtr d3);
public static uint CharToGUnichar (char c)
@ -379,10 +379,10 @@ namespace Gst.GLib {
{
Type array_type = elem_type == typeof (ListBase.FilenameString) ? typeof (string) : elem_type;
ListBase list;
if (list_type == typeof(Gst.GLib.List))
list = new Gst.GLib.List (list_ptr, elem_type, owned, elements_owned);
if (list_type == typeof(GLib.List))
list = new GLib.List (list_ptr, elem_type, owned, elements_owned);
else
list = new Gst.GLib.SList (list_ptr, elem_type, owned, elements_owned);
list = new GLib.SList (list_ptr, elem_type, owned, elements_owned);
using (list)
return ListToArray (list, array_type);
@ -390,7 +390,7 @@ namespace Gst.GLib {
public static Array PtrArrayToArray (IntPtr list_ptr, bool owned, bool elements_owned, Type elem_type)
{
Gst.GLib.PtrArray array = new Gst.GLib.PtrArray (list_ptr, elem_type, owned, elements_owned);
GLib.PtrArray array = new GLib.PtrArray (list_ptr, elem_type, owned, elements_owned);
Array ret = Array.CreateInstance (elem_type, array.Count);
array.CopyTo (ret, 0);
array.Dispose ();
@ -403,7 +403,7 @@ namespace Gst.GLib {
if (list.Count > 0)
list.CopyTo (result, 0);
if (type.IsSubclassOf (typeof (Gst.GLib.Opaque)))
if (type.IsSubclassOf (typeof (GLib.Opaque)))
list.elements_owned = false;
return result;

View file

@ -21,8 +21,8 @@ namespace Gst.GLib {
public delegate void NotifyHandler (object o, NotifyArgs args);
public class NotifyArgs : Gst.GLib.SignalArgs {
[DllImport("libgobject-2.0-0.dll")]
public class NotifyArgs : GLib.SignalArgs {
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_get_name (IntPtr pspec);
public string Property {

View file

@ -54,7 +54,7 @@ namespace Gst.GLib {
}
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_unref (IntPtr raw);
static bool PerformQueuedUnrefs ()
@ -93,7 +93,7 @@ namespace Gst.GLib {
GC.SuppressFinalize (this);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_object_ref (IntPtr raw);
public static Object GetObject(IntPtr o, bool owned_ref)
@ -118,7 +118,7 @@ namespace Gst.GLib {
if (!owned_ref)
g_object_ref (o);
obj = Gst.GLib.ObjectManager.CreateObject(o);
obj = GLib.ObjectManager.CreateObject(o);
if (obj == null) {
g_object_unref (o);
return null;
@ -163,7 +163,7 @@ namespace Gst.GLib {
m.Invoke (null, parms);
}
for (Type curr = t; curr != typeof(Gst.GLib.Object); curr = curr.BaseType) {
for (Type curr = t; curr != typeof(GLib.Object); curr = curr.BaseType) {
if (curr.Assembly.IsDefined (typeof (IgnoreClassInitializersAttribute), false))
continue;
@ -213,7 +213,7 @@ namespace Gst.GLib {
static Hashtable class_structs;
static GObjectClass GetClassStruct (Gst.GLib.GType gtype, bool use_cache)
static GObjectClass GetClassStruct (GLib.GType gtype, bool use_cache)
{
if (class_structs == null)
class_structs = new Hashtable ();
@ -221,7 +221,7 @@ namespace Gst.GLib {
if (use_cache && class_structs.Contains (gtype))
return (GObjectClass) class_structs [gtype];
else {
IntPtr class_ptr = gtype.ClassPtr;
IntPtr class_ptr = gtype.GetClassPtr ();
GObjectClass class_struct = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass));
if (use_cache)
class_structs.Add (gtype, class_struct);
@ -229,12 +229,13 @@ namespace Gst.GLib {
}
}
static void OverrideClassStruct (Gst.GLib.GType gtype, GObjectClass class_struct)
static void OverrideClassStruct (GLib.GType gtype, GObjectClass class_struct)
{
IntPtr class_ptr = gtype.ClassPtr;
IntPtr class_ptr = gtype.GetClassPtr ();
Marshal.StructureToPtr (class_struct, class_ptr, false);
}
static void OverridePropertyHandlers (GType gtype, GetPropertyDelegate get_cb, SetPropertyDelegate set_cb)
{
GObjectClass klass = GetClassStruct (gtype, false);
@ -243,12 +244,12 @@ namespace Gst.GLib {
OverrideClassStruct (gtype, klass);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_class_install_property (IntPtr klass, uint prop_id, IntPtr param_spec);
static IntPtr RegisterProperty (GType type, string name, string nick, string blurb, uint property_id, GType property_type, bool can_read, bool can_write)
{
IntPtr declaring_class = type.ClassPtr;
IntPtr declaring_class = type.GetClassPtr ();
ParamSpec pspec = new ParamSpec (name, nick, blurb, property_type, can_read, can_write);
g_object_class_install_property (declaring_class, property_id, pspec.Handle);
@ -266,19 +267,19 @@ namespace Gst.GLib {
static IntPtr constructor_cb (IntPtr gtype, uint n_construct_properties, IntPtr construct_properties)
{
GType type = new Gst.GLib.GType (gtype);
IntPtr instance = GetClassStruct (type.ThresholdType, false).constructor_cb (gtype, n_construct_properties, construct_properties);
GType type = new GLib.GType (gtype);
IntPtr instance = GetClassStruct (type.GetThresholdType (), false).constructor_cb (gtype, n_construct_properties, construct_properties);
for (int i = 0; i < n_construct_properties; i++) {
IntPtr p = new IntPtr ((long) construct_properties + i * Marshal.SizeOf (typeof (GObjectConstructParam)));
GObjectConstructParam cparam = (GObjectConstructParam) Marshal.PtrToStructure (p, typeof (GObjectConstructParam));
ParamSpec pspec = new ParamSpec (cparam.pspec);
Gst.GLib.Value val = (Value) Marshal.PtrToStructure (cparam.value, typeof (Value));
GLib.Value val = (Value) Marshal.PtrToStructure (cparam.value, typeof (Value));
if (pspec.Name == "gtk-sharp-managed-instance" && (IntPtr) val.Val != IntPtr.Zero) {
GCHandle gch = (GCHandle) (IntPtr) val.Val;
Object o = (Gst.GLib.Object) gch.Target;
Object o = (GLib.Object) gch.Target;
o.Raw = instance;
}
}
@ -287,32 +288,32 @@ namespace Gst.GLib {
}
static ConstructedDelegate Constructed_cb = new ConstructedDelegate (constructed_cb);
[Gst.GLib.CDeclCallback]
[GLib.CDeclCallback]
delegate void ConstructedDelegate (IntPtr o);
static void constructed_cb (IntPtr o)
{
Gst.GLib.Object __obj = Gst.GLib.Object.GetObject (o, false) as Gst.GLib.Object;
ConstructedDelegate unmanaged = GetClassStruct (__obj.LookupGType ().ThresholdType, true).constructed_cb;
GLib.Object __obj = GLib.Object.GetObject (o, false) as GLib.Object;
ConstructedDelegate unmanaged = GetClassStruct (__obj.LookupGType ().GetThresholdType (), true).constructed_cb;
if (unmanaged != null)
unmanaged (__obj.Handle);
}
static SetPropertyDelegate Set_prop_dummy_cb = new SetPropertyDelegate (set_prop_dummy_cb);
static void set_prop_dummy_cb (IntPtr GObject, uint property_id, ref Gst.GLib.Value value, IntPtr pspec) {}
static void set_prop_dummy_cb (IntPtr GObject, uint property_id, ref GLib.Value value, IntPtr pspec) {}
static void AddProperties (GType gtype, System.Type t)
{
uint idx = 1;
if (gtype.BaseType == gtype.ThresholdType) {
if (gtype.GetBaseType () == gtype.GetThresholdType ()) {
GObjectClass gobject_class = GetClassStruct (gtype, false);
gobject_class.constructor_cb = Constructor_cb;
gobject_class.constructed_cb = Constructed_cb;
gobject_class.set_prop_cb = Set_prop_dummy_cb;
OverrideClassStruct (gtype, gobject_class);
IntPtr declaring_class = gtype.ClassPtr;
IntPtr declaring_class = gtype.GetClassPtr ();
ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly);
g_object_class_install_property (declaring_class, idx, pspec.Handle);
idx++;
@ -322,7 +323,7 @@ namespace Gst.GLib {
foreach (PropertyInfo pinfo in t.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) {
foreach (object attr in pinfo.GetCustomAttributes (typeof (PropertyAttribute), false)) {
if(pinfo.GetIndexParameters().Length > 0)
throw(new InvalidOperationException(String.Format("Gst.GLib.RegisterPropertyAttribute cannot be applied to property {0} of type {1} because the property expects one or more indexed parameters", pinfo.Name, t.FullName)));
throw(new InvalidOperationException(String.Format("GLib.RegisterPropertyAttribute cannot be applied to property {0} of type {1} because the property expects one or more indexed parameters", pinfo.Name, t.FullName)));
PropertyAttribute property_attr = attr as PropertyAttribute;
if (!handlers_overridden) {
@ -335,21 +336,21 @@ namespace Gst.GLib {
Properties.Add (param_spec, pinfo);
idx++;
} catch (ArgumentException) {
throw new InvalidOperationException (String.Format ("Gst.GLib.PropertyAttribute cannot be applied to property {0} of type {1} because the return type of the property is not supported", pinfo.Name, t.FullName));
throw new InvalidOperationException (String.Format ("GLib.PropertyAttribute cannot be applied to property {0} of type {1} because the return type of the property is not supported", pinfo.Name, t.FullName));
}
}
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void GetPropertyDelegate (IntPtr GObject, uint property_id, ref Gst.GLib.Value value, IntPtr pspec);
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void GetPropertyDelegate (IntPtr GObject, uint property_id, ref GLib.Value value, IntPtr pspec);
static void GetPropertyCallback (IntPtr handle, uint property_id, ref Gst.GLib.Value value, IntPtr param_spec)
static void GetPropertyCallback (IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec)
{
if (!Properties.Contains (param_spec))
return;
Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, false);
GLib.Object obj = GLib.Object.GetObject (handle, false);
value.Val = (Properties [param_spec] as PropertyInfo).GetValue (obj, new object [0]);
}
@ -362,15 +363,15 @@ namespace Gst.GLib {
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void SetPropertyDelegate (IntPtr GObject, uint property_id, ref Gst.GLib.Value value, IntPtr pspec);
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void SetPropertyDelegate (IntPtr GObject, uint property_id, ref GLib.Value value, IntPtr pspec);
static void SetPropertyCallback(IntPtr handle, uint property_id, ref Gst.GLib.Value value, IntPtr param_spec)
static void SetPropertyCallback(IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec)
{
if (!Properties.Contains (param_spec))
return;
Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, false);
GLib.Object obj = GLib.Object.GetObject (handle, false);
(Properties [param_spec] as PropertyInfo).SetValue (obj, value.Val, new object [0]);
}
@ -383,7 +384,7 @@ namespace Gst.GLib {
}
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_type_add_interface_static (IntPtr gtype, IntPtr iface_type, ref GInterfaceInfo info);
static void AddInterfaces (GType gtype, Type t)
@ -416,7 +417,7 @@ namespace Gst.GLib {
if (Handle != IntPtr.Zero) {
GTypeInstance obj = (GTypeInstance) Marshal.PtrToStructure (Handle, typeof (GTypeInstance));
GTypeClass klass = (GTypeClass) Marshal.PtrToStructure (obj.g_class, typeof (GTypeClass));
return new Gst.GLib.GType (klass.gtype);
return new GLib.GType (klass.gtype);
} else {
return LookupGType (GetType ());
}
@ -434,42 +435,36 @@ namespace Gst.GLib {
protected Object ()
{
CreateNativeObject (new string [0], new Gst.GLib.Value [0]);
CreateNativeObject (new string [0], new GLib.Value [0]);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_object_new (IntPtr gtype, IntPtr dummy);
[Obsolete]
protected Object (GType gtype)
{
Raw = g_object_new (gtype.Val, IntPtr.Zero);
}
struct GParameter {
public IntPtr name;
public Gst.GLib.Value val;
public GLib.Value val;
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_object_newv (IntPtr gtype, int n_params, GParameter[] parms);
protected virtual void CreateNativeObject (string[] names, Gst.GLib.Value[] vals)
protected virtual void CreateNativeObject (string[] names, GLib.Value[] vals)
{
Gst.GLib.GType gtype = LookupGType ();
GLib.GType gtype = LookupGType ();
bool managed_type = gtype.ToString().StartsWith ("__gtksharp_");
GParameter[] parms = new GParameter [names.Length + ((managed_type) ? 1 : 0)];
for (int i = 0; i < names.Length; i++) {
parms [i].name = Gst.GLib.Marshaller.StringToPtrGStrdup (names [i]);
parms [i].name = GLib.Marshaller.StringToPtrGStrdup (names [i]);
parms [i].val = vals [i];
}
if (managed_type) {
GCHandle gch = GCHandle.Alloc (this);
parms[names.Length].name = Gst.GLib.Marshaller.StringToPtrGStrdup ("gtk-sharp-managed-instance");
parms[names.Length].val = new Gst.GLib.Value ((IntPtr) gch);
parms[names.Length].name = GLib.Marshaller.StringToPtrGStrdup ("gtk-sharp-managed-instance");
parms[names.Length].val = new GLib.Value ((IntPtr) gch);
Raw = g_object_newv (gtype.Val, parms.Length, parms);
@ -479,7 +474,7 @@ namespace Gst.GLib {
}
foreach (GParameter p in parms)
Gst.GLib.Marshaller.Free (p.name);
GLib.Marshaller.Free (p.name);
}
protected virtual IntPtr Raw {
@ -505,7 +500,7 @@ namespace Gst.GLib {
}
}
public static Gst.GLib.GType GType {
public static GLib.GType GType {
get {
return GType.Object;
}
@ -517,7 +512,7 @@ namespace Gst.GLib {
}
}
internal Gst.GLib.GType NativeType {
internal GLib.GType NativeType {
get {
return LookupGType ();
}
@ -542,7 +537,7 @@ namespace Gst.GLib {
}
Hashtable before_signals;
[Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")]
protected internal Hashtable BeforeSignals {
get {
if (before_signals == null)
@ -552,7 +547,7 @@ namespace Gst.GLib {
}
Hashtable after_signals;
[Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")]
protected internal Hashtable AfterSignals {
get {
if (after_signals == null)
@ -562,7 +557,7 @@ namespace Gst.GLib {
}
EventHandlerList before_handlers;
[Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")]
protected EventHandlerList BeforeHandlers {
get {
if (before_handlers == null)
@ -572,7 +567,7 @@ namespace Gst.GLib {
}
EventHandlerList after_handlers;
[Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")]
protected EventHandlerList AfterHandlers {
get {
if (after_handlers == null)
@ -581,13 +576,13 @@ namespace Gst.GLib {
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void NotifyDelegate (IntPtr handle, IntPtr pspec, IntPtr gch);
void NotifyCallback (IntPtr handle, IntPtr pspec, IntPtr gch)
{
try {
Gst.GLib.Signal sig = ((GCHandle) gch).Target as Gst.GLib.Signal;
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
if (sig == null)
throw new Exception("Unknown signal GC handle received " + gch);
@ -595,7 +590,7 @@ namespace Gst.GLib {
args.Args = new object[1];
args.Args[0] = pspec;
NotifyHandler handler = (NotifyHandler) sig.Handler;
handler (Gst.GLib.Object.GetObject (handle), args);
handler (GLib.Object.GetObject (handle), args);
} catch (Exception e) {
ExceptionManager.RaiseUnhandledException (e, false);
}
@ -657,36 +652,36 @@ namespace Gst.GLib {
}
}
[DllImport("libgobject-2.0-0.dll")]
static extern void g_object_get_property (IntPtr obj, IntPtr name, ref Gst.GLib.Value val);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_get_property (IntPtr obj, IntPtr name, ref GLib.Value val);
protected Gst.GLib.Value GetProperty (string name)
protected GLib.Value GetProperty (string name)
{
Value val = new Value (this, name);
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
g_object_get_property (Raw, native_name, ref val);
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
return val;
}
[DllImport("libgobject-2.0-0.dll")]
static extern void g_object_set_property (IntPtr obj, IntPtr name, ref Gst.GLib.Value val);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_set_property (IntPtr obj, IntPtr name, ref GLib.Value val);
protected void SetProperty (string name, Gst.GLib.Value val)
protected void SetProperty (string name, GLib.Value val)
{
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
g_object_set_property (Raw, native_name, ref val);
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_notify (IntPtr obj, IntPtr property_name);
protected void Notify (string property_name)
{
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (property_name);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
g_object_notify (Handle, native_name);
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
}
protected static void OverrideVirtualMethod (GType gtype, string name, Delegate cb)
@ -694,10 +689,10 @@ namespace Gst.GLib {
Signal.OverrideDefaultHandler (gtype, name, cb);
}
[DllImport("libgobject-2.0-0.dll")]
protected static extern void g_signal_chain_from_overridden (IntPtr args, ref Gst.GLib.Value retval);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
protected static extern void g_signal_chain_from_overridden (IntPtr args, ref GLib.Value retval);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_type_check_instance_is_a (IntPtr obj, IntPtr gtype);
internal static bool IsObject (IntPtr obj)
@ -732,7 +727,7 @@ namespace Gst.GLib {
static Object ()
{
if (Environment.GetEnvironmentVariable ("GTK_SHARP_DEBUG") != null)
Gst.GLib.Log.SetLogHandler ("GLib-GObject", Gst.GLib.LogLevelFlags.All, new Gst.GLib.LogFunc (Gst.GLib.Log.PrintTraceLogFunction));
GLib.Log.SetLogHandler ("GLib-GObject", GLib.LogLevelFlags.All, new GLib.LogFunc (GLib.Log.PrintTraceLogFunction));
}
}
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.ObjectManager.cs - GLib ObjectManager class implementation
// GLib.ObjectManager.cs - GLib ObjectManager class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
@ -30,7 +30,7 @@ namespace Gst.GLib {
static BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance;
public static Gst.GLib.Object CreateObject (IntPtr raw)
public static GLib.Object CreateObject (IntPtr raw)
{
if (raw == IntPtr.Zero)
return null;
@ -40,11 +40,11 @@ namespace Gst.GLib {
if (type == null)
return null;
Gst.GLib.Object obj;
GLib.Object obj;
try {
obj = Activator.CreateInstance (type, flags, null, new object[] {raw}, null) as Gst.GLib.Object;
obj = Activator.CreateInstance (type, flags, null, new object[] {raw}, null) as GLib.Object;
} catch (MissingMethodException) {
throw new Gst.GLib.MissingIntPtrCtorException ("Gst.GLib.Object subclass " + type + " must provide a protected or public IntPtr ctor to support wrapping of native object handles.");
throw new GLib.MissingIntPtrCtorException ("GLib.Object subclass " + type + " must provide a protected or public IntPtr ctor to support wrapping of native object handles.");
}
return obj;
}
@ -83,7 +83,7 @@ namespace Gst.GLib {
return result;
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_type_parent (IntPtr typ);
}
}

View file

@ -40,9 +40,9 @@ namespace Gst.GLib {
int flags = (int) pflags;
IntPtr ret;
IntPtr p_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr p_nick = Gst.GLib.Marshaller.StringToPtrGStrdup (nick);
IntPtr p_blurb = Gst.GLib.Marshaller.StringToPtrGStrdup (blurb);
IntPtr p_name = GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr p_nick = GLib.Marshaller.StringToPtrGStrdup (nick);
IntPtr p_blurb = GLib.Marshaller.StringToPtrGStrdup (blurb);
if (type == GType.Char)
ret = g_param_spec_char (p_name, p_nick, p_blurb, SByte.MinValue, SByte.MaxValue, 0, flags);
@ -85,9 +85,9 @@ namespace Gst.GLib {
else
throw new ArgumentException ("type");
Gst.GLib.Marshaller.Free (p_name);
Gst.GLib.Marshaller.Free (p_nick);
Gst.GLib.Marshaller.Free (p_blurb);
GLib.Marshaller.Free (p_name);
GLib.Marshaller.Free (p_nick);
GLib.Marshaller.Free (p_blurb);
return ret;
}
@ -124,7 +124,7 @@ namespace Gst.GLib {
public string Name {
get {
GParamSpec spec = (GParamSpec) Marshal.PtrToStructure (Handle, typeof (GParamSpec));
return Gst.GLib.Marshaller.Utf8PtrToString (spec.name);
return GLib.Marshaller.Utf8PtrToString (spec.name);
}
}
@ -147,58 +147,58 @@ namespace Gst.GLib {
uint param_id;
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_char (IntPtr name, IntPtr nick, IntPtr blurb, sbyte min, sbyte max, sbyte dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_uchar (IntPtr name, IntPtr nick, IntPtr blurb, byte min, byte max, byte dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_boolean (IntPtr name, IntPtr nick, IntPtr blurb, bool dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_int (IntPtr name, IntPtr nick, IntPtr blurb, int min, int max, int dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_uint (IntPtr name, IntPtr nick, IntPtr blurb, uint min, uint max, uint dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_long (IntPtr name, IntPtr nick, IntPtr blurb, IntPtr min, IntPtr max, IntPtr dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_ulong (IntPtr name, IntPtr nick, IntPtr blurb, UIntPtr min, UIntPtr max, UIntPtr dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_int64 (IntPtr name, IntPtr nick, IntPtr blurb, long min, long max, long dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_uint64 (IntPtr name, IntPtr nick, IntPtr blurb, ulong min, ulong max, ulong dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_float (IntPtr name, IntPtr nick, IntPtr blurb, float min, float max, float dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_double (IntPtr name, IntPtr nick, IntPtr blurb, double min, double max, double dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_string (IntPtr name, IntPtr nick, IntPtr blurb, IntPtr dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_pointer (IntPtr name, IntPtr nick, IntPtr blurb, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_gtype (IntPtr name, IntPtr nick, IntPtr blurb, IntPtr dval, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_boxed (IntPtr name, IntPtr nick, IntPtr blurb, IntPtr return_type, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_param_spec_object (IntPtr name, IntPtr nick, IntPtr blurb, IntPtr return_type, int flags);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_gtype_get_type ();
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_type_is_a (IntPtr a, IntPtr b);
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.Priority.cs
// GLib.Priority.cs
//
// Author(s):
// Stephane Delcroix <stephane@delcroix.org>

View file

@ -32,7 +32,7 @@ namespace Gst.GLib {
internal bool elements_owned = false;
protected System.Type element_type = null;
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_ptr_array_sized_new (uint n_preallocs);
public PtrArray (uint n_preallocs, System.Type element_type, bool owned, bool elements_owned)
@ -43,7 +43,7 @@ namespace Gst.GLib {
this.elements_owned = elements_owned;
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_ptr_array_new ();
public PtrArray (System.Type element_type, bool owned, bool elements_owned)
@ -77,13 +77,13 @@ namespace Gst.GLib {
GC.SuppressFinalize (this);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_ptr_array_free (IntPtr raw, bool free_seg);
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_unref (IntPtr item);
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_free (IntPtr item);
void Dispose (bool disposing)
@ -94,10 +94,10 @@ namespace Gst.GLib {
if (elements_owned) {
int count = Count;
for (uint i = 0; i < count; i++)
if (typeof (Gst.GLib.Object).IsAssignableFrom (element_type))
if (typeof (GLib.Object).IsAssignableFrom (element_type))
g_object_unref (NthData (i));
else if (typeof (Gst.GLib.Opaque).IsAssignableFrom (element_type))
Gst.GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
else if (typeof (GLib.Opaque).IsAssignableFrom (element_type))
GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
else
g_free (NthData (i));
}
@ -120,7 +120,7 @@ namespace Gst.GLib {
}
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_ptr_array_add (IntPtr raw, IntPtr val);
public void Add (IntPtr val)
@ -128,7 +128,7 @@ namespace Gst.GLib {
g_ptr_array_add (Handle, val);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_ptr_array_remove (IntPtr raw, IntPtr data);
public void Remove (IntPtr data)
@ -136,7 +136,7 @@ namespace Gst.GLib {
g_ptr_array_remove (Handle, data);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_ptr_array_remove_range (IntPtr raw, uint index, uint length);
public void RemoveRange (IntPtr data, uint index, uint length)
@ -174,10 +174,10 @@ namespace Gst.GLib {
ret = Marshaller.Utf8PtrToString (data);
else if (element_type == typeof (IntPtr))
ret = data;
else if (element_type.IsSubclassOf (typeof (Gst.GLib.Object)))
ret = Gst.GLib.Object.GetObject (data, false);
else if (element_type.IsSubclassOf (typeof (Gst.GLib.Opaque)))
ret = Gst.GLib.Opaque.GetOpaque (data, element_type, elements_owned);
else if (element_type.IsSubclassOf (typeof (GLib.Object)))
ret = GLib.Object.GetObject (data, false);
else if (element_type.IsSubclassOf (typeof (GLib.Opaque)))
ret = GLib.Opaque.GetOpaque (data, element_type, elements_owned);
else if (element_type == typeof (int))
ret = (int) data;
else if (element_type.IsValueType)
@ -186,7 +186,7 @@ namespace Gst.GLib {
ret = Activator.CreateInstance (element_type, new object[] {data});
} else if (Object.IsObject (data))
ret = Gst.GLib.Object.GetObject (data, false);
ret = GLib.Object.GetObject (data, false);
return ret;
}
@ -260,7 +260,7 @@ namespace Gst.GLib {
return new ListEnumerator (this);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_ptr_array_copy (IntPtr raw);
// ICloneable

View file

@ -26,7 +26,7 @@ namespace Gst.GLib {
public class SList : ListBase {
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_slist_copy (IntPtr l);
public override object Clone ()
@ -34,7 +34,7 @@ namespace Gst.GLib {
return new SList (g_slist_copy (Handle));
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_slist_length (IntPtr l);
internal override int Length (IntPtr list)
@ -42,7 +42,7 @@ namespace Gst.GLib {
return g_slist_length (list);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_slist_free(IntPtr l);
internal override void Free (IntPtr list)
@ -51,7 +51,7 @@ namespace Gst.GLib {
g_slist_free (list);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_slist_append (IntPtr l, IntPtr raw);
internal override IntPtr Append (IntPtr list, IntPtr raw)
@ -59,7 +59,7 @@ namespace Gst.GLib {
return g_slist_append (list, raw);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_slist_prepend (IntPtr l, IntPtr raw);
internal override IntPtr Prepend (IntPtr list, IntPtr raw)
@ -68,7 +68,7 @@ namespace Gst.GLib {
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_slist_nth_data (IntPtr l, uint n);
internal override IntPtr NthData (uint n)

View file

@ -1,4 +1,4 @@
// Gst.GLib.Signal.cs - signal marshaling class
// GLib.Signal.cs - signal marshaling class
//
// Authors: Mike Kestner <mkestner@novell.com>
// Andrés G. Aragoneses <aaragoneses@novell.com>
@ -63,7 +63,7 @@ namespace Gst.GLib {
public IntPtr param_types;
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
public delegate bool EmissionHookNative (ref InvocationHint hint, uint n_pvals, IntPtr pvals, IntPtr data);
public delegate bool EmissionHook (InvocationHint ihint, object[] inst_and_param_values);
@ -140,7 +140,7 @@ namespace Gst.GLib {
SignalClosure after_closure;
Delegate marshaler;
private Signal (Gst.GLib.Object obj, string signal_name, Delegate marshaler)
private Signal (GLib.Object obj, string signal_name, Delegate marshaler)
{
tref = obj.ToggleRef;
name = signal_name;
@ -148,7 +148,7 @@ namespace Gst.GLib {
this.marshaler = marshaler;
}
private Signal (Gst.GLib.Object obj, string signal_name, Type args_type)
private Signal (GLib.Object obj, string signal_name, Type args_type)
{
tref = obj.ToggleRef;
name = signal_name;
@ -215,12 +215,12 @@ namespace Gst.GLib {
}
}
public static Signal Lookup (Gst.GLib.Object obj, string name)
public static Signal Lookup (GLib.Object obj, string name)
{
return Lookup (obj, name, typeof (EventArgs));
}
public static Signal Lookup (Gst.GLib.Object obj, string name, Delegate marshaler)
public static Signal Lookup (GLib.Object obj, string name, Delegate marshaler)
{
Signal result = obj.ToggleRef.Signals [name] as Signal;
if (result == null)
@ -228,7 +228,7 @@ namespace Gst.GLib {
return result;
}
public static Signal Lookup (Gst.GLib.Object obj, string name, Type args_type)
public static Signal Lookup (GLib.Object obj, string name, Type args_type)
{
Signal result = obj.ToggleRef.Signals [name] as Signal;
if (result == null)
@ -313,7 +313,7 @@ namespace Gst.GLib {
}
}
public static object Emit (Gst.GLib.Object instance, string detailed_signal, params object[] args)
public static object Emit (GLib.Object instance, string detailed_signal, params object[] args)
{
uint gquark, signal_id;
string signal_name;
@ -321,13 +321,13 @@ namespace Gst.GLib {
signal_id = GetSignalId (signal_name, instance);
if (signal_id <= 0)
throw new ArgumentException ("Invalid signal name: " + signal_name);
Gst.GLib.Value[] vals = new Gst.GLib.Value [args.Length + 1];
Gst.GLib.ValueArray inst_and_params = new Gst.GLib.ValueArray ((uint) args.Length + 1);
GLib.Value[] vals = new GLib.Value [args.Length + 1];
GLib.ValueArray inst_and_params = new GLib.ValueArray ((uint) args.Length + 1);
vals [0] = new Gst.GLib.Value (instance);
vals [0] = new GLib.Value (instance);
inst_and_params.Append (vals [0]);
for (int i = 1; i < vals.Length; i++) {
vals [i] = new Gst.GLib.Value (args [i - 1]);
vals [i] = new GLib.Value (args [i - 1]);
inst_and_params.Append (vals [i]);
}
@ -335,27 +335,27 @@ namespace Gst.GLib {
Query query;
g_signal_query (signal_id, out query);
if (query.return_type != GType.None.Val) {
Gst.GLib.Value ret = Gst.GLib.Value.Empty;
GLib.Value ret = GLib.Value.Empty;
g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, ref ret);
ret_obj = ret.Val;
ret.Dispose ();
} else
g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, IntPtr.Zero);
foreach (Gst.GLib.Value val in vals)
foreach (GLib.Value val in vals)
val.Dispose ();
return ret_obj;
}
private static uint GetGQuarkFromString (string str) {
IntPtr native_string = Gst.GLib.Marshaller.StringToPtrGStrdup (str);
IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup (str);
uint ret = g_quark_from_string (native_string);
Gst.GLib.Marshaller.Free (native_string);
GLib.Marshaller.Free (native_string);
return ret;
}
private static uint GetSignalId (string signal_name, Gst.GLib.Object obj)
private static uint GetSignalId (string signal_name, GLib.Object obj)
{
IntPtr typeid = GType.ValFromInstancePtr (obj.Handle);
return GetSignalId (signal_name, typeid);
@ -363,13 +363,13 @@ namespace Gst.GLib {
private static uint GetSignalId (string signal_name, IntPtr typeid)
{
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (signal_name);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (signal_name);
uint signal_id = g_signal_lookup (native_name, typeid);
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
return signal_id;
}
public static ulong AddEmissionHook (string detailed_signal, Gst.GLib.GType type, EmissionHook handler_func)
public static ulong AddEmissionHook (string detailed_signal, GLib.GType type, EmissionHook handler_func)
{
uint gquark;
string signal_name;
@ -388,32 +388,32 @@ namespace Gst.GLib {
g_signal_override_class_closure (id, gtype.Val, closure);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_cclosure_new (Delegate cb, IntPtr data, IntPtr notify);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_signal_get_invocation_hint (IntPtr instance);
[DllImport("libgobject-2.0-0.dll")]
static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, ref Gst.GLib.Value return_value);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, ref GLib.Value return_value);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, IntPtr return_value);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_signal_lookup (IntPtr name, IntPtr itype);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_signal_override_class_closure (uint id, IntPtr gtype, IntPtr closure);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_signal_query (uint signal_id, out Query query);
//better not to expose g_quark_from_static_string () due to memory allocation issues
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_quark_from_string (IntPtr str);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern ulong g_signal_add_emission_hook (uint signal_id, uint gquark_detail, EmissionHookNative hook_func, IntPtr hook_data, IntPtr data_destroy);
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.SignalArgs.cs - Signal argument class implementation
// GLib.SignalArgs.cs - Signal argument class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//

View file

@ -1,4 +1,4 @@
// Gst.GLib.SignalCallback.cs - Signal callback base class implementation
// GLib.SignalCallback.cs - Signal callback base class implementation
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
@ -25,7 +25,7 @@ namespace Gst.GLib {
using System.Collections;
using System.Runtime.InteropServices;
[Obsolete ("Replaced by Gst.GLib.Signal.")]
[Obsolete ("Replaced by GLib.Signal.")]
public abstract class SignalCallback : IDisposable {
// A counter used to produce unique keys for instances.
@ -35,13 +35,13 @@ namespace Gst.GLib {
protected static Hashtable _Instances = new Hashtable ();
// protected instance members
protected Gst.GLib.Object _obj;
protected GLib.Object _obj;
protected Delegate _handler;
protected int _key;
protected System.Type _argstype;
protected uint _HandlerID;
protected SignalCallback (Gst.GLib.Object obj, Delegate eh, System.Type argstype)
protected SignalCallback (GLib.Object obj, Delegate eh, System.Type argstype)
{
_key = _NextKey++;
_obj = obj;
@ -60,7 +60,7 @@ namespace Gst.GLib {
_handler = Delegate.Remove (_handler, d);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_signal_connect_data(IntPtr obj, IntPtr name, Delegate cb, int key, IntPtr p, int flags);
protected void Connect (string name, Delegate cb, int flags)
@ -70,10 +70,10 @@ namespace Gst.GLib {
Marshaller.Free (native_name);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_signal_handler_disconnect (IntPtr instance, uint handler);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_signal_handler_is_connected (IntPtr instance, uint handler);
protected void Disconnect ()

View file

@ -28,10 +28,10 @@ namespace Gst.GLib {
internal class ClosureInvokedArgs : EventArgs {
EventArgs args;
Gst.GLib.Object obj;
GLib.Object obj;
object result;
public ClosureInvokedArgs (Gst.GLib.Object obj, EventArgs args)
public ClosureInvokedArgs (GLib.Object obj, EventArgs args)
{
this.obj = obj;
this.args = args;
@ -43,7 +43,7 @@ namespace Gst.GLib {
}
}
public Gst.GLib.Object Target {
public GLib.Object Target {
get {
return obj;
}
@ -97,9 +97,9 @@ namespace Gst.GLib {
public void Connect (bool is_after)
{
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
id = g_signal_connect_closure (handle, native_name, raw_closure, is_after);
Gst.GLib.Marshaller.Free (native_name);
GLib.Marshaller.Free (native_name);
}
public void Disconnect ()
@ -136,7 +136,7 @@ namespace Gst.GLib {
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void ClosureMarshal (IntPtr closure, IntPtr return_val, uint n_param_vals, IntPtr 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)
@ -147,7 +147,7 @@ namespace Gst.GLib {
SignalClosure closure = closures [raw_closure] as SignalClosure;
message = "Marshaling " + closure.name + " signal";
Value objval = (Value) Marshal.PtrToStructure (param_values, typeof (Value));
Gst.GLib.Object __obj = objval.Val as Gst.GLib.Object;
GLib.Object __obj = objval.Val as GLib.Object;
if (__obj == null)
return;
@ -158,7 +158,7 @@ namespace Gst.GLib {
SignalArgs args = Activator.CreateInstance (closure.args_type, new object [0]) as SignalArgs;
args.Args = new object [n_param_vals - 1];
Gst.GLib.Value[] vals = new Gst.GLib.Value [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));
@ -183,7 +183,7 @@ namespace Gst.GLib {
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void ClosureNotify (IntPtr data, IntPtr closure);
static void NotifyCallback (IntPtr data, IntPtr raw_closure)
@ -202,25 +202,25 @@ namespace Gst.GLib {
}
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_cclosure_new (Delegate cb, IntPtr user_data, ClosureNotify notify);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_closure_new_simple (int closure_size, IntPtr dummy);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_closure_set_marshal (IntPtr closure, ClosureMarshal marshaler);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_closure_add_finalize_notifier (IntPtr closure, IntPtr dummy, ClosureNotify notify);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_signal_connect_closure (IntPtr obj, IntPtr name, IntPtr closure, bool is_after);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_signal_handler_disconnect (IntPtr instance, uint handler);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_signal_handler_is_connected (IntPtr instance, uint handler);
}
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.Source.cs - Source class implementation
// GLib.Source.cs - Source class implementation
//
// Author: Duncan Mak <duncan@ximian.com>
//
@ -49,7 +49,7 @@ namespace Gst.GLib {
internal static Hashtable source_handlers = new Hashtable ();
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_source_remove (uint tag);
public static bool Remove (uint tag)

View file

@ -60,7 +60,7 @@ namespace Gst.GLib {
public delegate void SpawnChildSetupFunc ();
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
internal delegate void SpawnChildSetupFuncNative (IntPtr gch);
internal class SpawnChildSetupWrapper {
@ -102,7 +102,7 @@ namespace Gst.GLib {
this.pid = pid;
}
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_spawn_close_pid (int pid);
public void Close ()
@ -110,7 +110,7 @@ namespace Gst.GLib {
g_spawn_close_pid ((int) pid);
}
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_spawn_async (IntPtr dir, IntPtr[] argv, IntPtr[] envp, int flags, SpawnChildSetupFuncNative func, IntPtr data, out int pid, out IntPtr error);
public static bool SpawnAsync (string working_directory, string[] argv, string[] envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, out Process child_process)
@ -126,11 +126,11 @@ namespace Gst.GLib {
Marshaller.Free (native_dir);
Marshaller.Free (native_argv);
Marshaller.Free (native_envp);
if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return result;
}
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_spawn_async_with_pipes (IntPtr dir, IntPtr[] argv, IntPtr[] envp, int flags, SpawnChildSetupFuncNative func, IntPtr data, out int pid, IntPtr stdin, IntPtr stdout, IntPtr stderr, out IntPtr error);
public static bool SpawnAsyncWithPipes (string working_directory, string[] argv, string[] envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, out Process child_process, ref int stdin, ref int stdout, ref int stderr)
@ -161,11 +161,11 @@ namespace Gst.GLib {
Marshaller.Free (native_dir);
Marshaller.Free (native_argv);
Marshaller.Free (native_envp);
if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return result;
}
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_spawn_sync (IntPtr dir, IntPtr[] argv, IntPtr[] envp, int flags, SpawnChildSetupFuncNative func, IntPtr data, out IntPtr stdout, out IntPtr stderr, out int exit_status, out IntPtr error);
public static bool SpawnSync (string working_directory, string[] argv, string[] envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, out string stdout, out string stderr, out int exit_status)
@ -181,11 +181,11 @@ namespace Gst.GLib {
Marshaller.Free (native_envp);
stdout = Marshaller.PtrToStringGFree (native_stdout);
stderr = Marshaller.PtrToStringGFree (native_stderr);
if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return result;
}
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_spawn_command_line_async (IntPtr cmdline, out IntPtr error);
public static bool SpawnCommandLineAsync (string command_line)
@ -194,11 +194,11 @@ namespace Gst.GLib {
IntPtr native_cmd = Marshaller.StringToPtrGStrdup (command_line);
bool result = g_spawn_command_line_async (native_cmd, out error);
Marshaller.Free (native_cmd);
if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return result;
}
[DllImport ("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_spawn_command_line_sync (IntPtr cmdline, out IntPtr stdout, out IntPtr stderr, out int exit_status, out IntPtr error);
public static bool SpawnCommandLineSync (string command_line, out string stdout, out string stderr, out int exit_status)
@ -209,7 +209,7 @@ namespace Gst.GLib {
Marshaller.Free (native_cmd);
stdout = Marshaller.PtrToStringGFree (native_stdout);
stderr = Marshaller.PtrToStringGFree (native_stderr);
if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return result;
}
}

View file

@ -28,7 +28,7 @@ namespace Gst.GLib
{
private Thread () {}
[DllImport("libgthread-2.0-0.dll")]
[DllImport ("libgthread-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_thread_init (IntPtr i);
public static void Init ()
@ -36,13 +36,13 @@ namespace Gst.GLib
g_thread_init (IntPtr.Zero);
}
[DllImport("glibsharpglue-2")]
static extern bool glibsharp_g_thread_supported ();
[DllImport("gstreamersharpglue-0.10")]
static extern bool gstglibsharp_g_thread_supported ();
public static bool Supported
{
get {
return glibsharp_g_thread_supported ();
return gstglibsharp_g_thread_supported ();
}
}
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.Timeout.cs - Timeout class implementation
// GLib.Timeout.cs - Timeout class implementation
//
// Author(s):
// Mike Kestner <mkestner@speakeasy.net>
@ -32,7 +32,7 @@ namespace Gst.GLib {
public class Timeout {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate bool TimeoutHandlerInternal ();
internal class TimeoutProxy : SourceProxy {
@ -59,7 +59,7 @@ namespace Gst.GLib {
}
private Timeout () {}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_timeout_add (uint interval, TimeoutHandlerInternal d, IntPtr data);
public static uint Add (uint interval, TimeoutHandler hndlr)
@ -73,7 +73,7 @@ namespace Gst.GLib {
return p.ID;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_timeout_add_full (int priority, uint interval, TimeoutHandlerInternal d, IntPtr data, DestroyNotify notify);
public static uint Add (uint interval, TimeoutHandler hndlr, Priority priority)
@ -87,7 +87,7 @@ namespace Gst.GLib {
return p.ID;
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_timeout_add_seconds (uint interval, TimeoutHandlerInternal d, IntPtr data);
public static uint AddSeconds (uint interval, TimeoutHandler hndlr)
@ -106,7 +106,7 @@ namespace Gst.GLib {
Source.Remove (id);
}
[DllImport("libglib-2.0-0.dll")]
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_source_remove_by_funcs_user_data (Delegate d, IntPtr data);
public static bool Remove (TimeoutHandler hndlr)

View file

@ -1,4 +1,4 @@
// Gst.GLib.ToggleRef.cs - GLib ToggleRef class implementation
// GLib.ToggleRef.cs - GLib ToggleRef class implementation
//
// Author: Mike Kestner <mkestner@novell.com>
//
@ -33,7 +33,7 @@ namespace Gst.GLib {
GCHandle gch;
Hashtable signals;
public ToggleRef (Gst.GLib.Object target)
public ToggleRef (GLib.Object target)
{
handle = target.Handle;
gch = GCHandle.Alloc (this);
@ -67,15 +67,15 @@ namespace Gst.GLib {
}
}
public Gst.GLib.Object Target {
public GLib.Object Target {
get {
if (reference == null)
return null;
else if (reference is Gst.GLib.Object)
return reference as Gst.GLib.Object;
else if (reference is GLib.Object)
return reference as GLib.Object;
WeakReference weak = reference as WeakReference;
return weak.Target as Gst.GLib.Object;
return weak.Target as GLib.Object;
}
}
@ -111,7 +111,7 @@ namespace Gst.GLib {
void Toggle (bool is_last_ref)
{
if (is_last_ref && reference is Gst.GLib.Object)
if (is_last_ref && reference is GLib.Object)
reference = new WeakReference (reference);
else if (!is_last_ref && reference is WeakReference) {
WeakReference weak = reference as WeakReference;
@ -120,7 +120,7 @@ namespace Gst.GLib {
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[UnmanagedFunctionPointer (Global.CallingConvention)]
delegate void ToggleNotifyHandler (IntPtr data, IntPtr handle, bool is_last_ref);
static void RefToggled (IntPtr data, IntPtr handle, bool is_last_ref)
@ -143,16 +143,16 @@ namespace Gst.GLib {
}
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_add_toggle_ref (IntPtr raw, ToggleNotifyHandler notify_cb, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_remove_toggle_ref (IntPtr raw, ToggleNotifyHandler notify_cb, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_object_ref (IntPtr raw);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_object_unref (IntPtr raw);
}

View file

@ -1,4 +1,4 @@
// Gst.GLib.TypeConverter.cs : Convert between fundamental and .NET types
// GLib.TypeConverter.cs : Convert between fundamental and .NET types
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//

View file

@ -1,4 +1,4 @@
// Gst.GLib.TypeFundamentals.cs : Standard Types enumeration
// GLib.TypeFundamentals.cs : Standard Types enumeration
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//

View file

@ -24,7 +24,7 @@ namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
[Obsolete ("Replaced by direct object-type casts to/from Gst.GLib.Value")]
[Obsolete ("Replaced by direct object-type casts to/from GLib.Value")]
public class UnwrappedObject {
IntPtr obj;

View file

@ -1,4 +1,4 @@
// Gst.GLib.Value.cs - GLib Value class implementation
// GLib.Value.cs - GLib Value class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
@ -49,7 +49,7 @@ namespace Gst.GLib {
public static Value Empty;
public Value (Gst.GLib.GType gtype)
public Value (GLib.GType gtype)
{
type = IntPtr.Zero;
pad1 = new Padding ();
@ -133,9 +133,9 @@ namespace Gst.GLib {
public Value (string val) : this (GType.String)
{
IntPtr native_val = Gst.GLib.Marshaller.StringToPtrGStrdup (val);
IntPtr native_val = GLib.Marshaller.StringToPtrGStrdup (val);
g_value_set_string (ref this, native_val);
Gst.GLib.Marshaller.Free (native_val);
GLib.Marshaller.Free (native_val);
}
public Value (ValueArray val) : this (ValueArray.GType)
@ -157,17 +157,17 @@ namespace Gst.GLib {
g_value_set_boxed (ref this, val.Handle);
}
public Value (Gst.GLib.Object val) : this (val == null ? GType.Object : val.NativeType)
public Value (GLib.Object val) : this (val == null ? GType.Object : val.NativeType)
{
g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle);
}
public Value (Gst.GLib.GInterfaceAdapter val) : this (val == null ? GType.Object : val.GType)
public Value (GLib.GInterfaceAdapter val) : this (val == null ? GType.Object : val.GType)
{
g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle);
}
public Value (Gst.GLib.Object obj, string prop_name)
public Value (GLib.Object obj, string prop_name)
{
type = IntPtr.Zero;
pad1 = new Padding ();
@ -176,7 +176,7 @@ namespace Gst.GLib {
}
[Obsolete]
public Value (Gst.GLib.Object obj, string prop_name, EnumWrapper wrap)
public Value (GLib.Object obj, string prop_name, EnumWrapper wrap)
{
type = IntPtr.Zero;
pad1 = new Padding ();
@ -194,11 +194,11 @@ namespace Gst.GLib {
type = IntPtr.Zero;
pad1 = new Padding ();
pad2 = new Padding ();
InitForProperty (Gst.GLib.Object.GetObject (obj), prop_name);
InitForProperty (GLib.Object.GetObject (obj), prop_name);
g_value_set_boxed (ref this, val.Handle);
}
public Value (string[] val) : this (new Gst.GLib.GType (g_strv_get_type ()))
public Value (string[] val) : this (new GLib.GType (g_strv_get_type ()))
{
if (val == null) {
g_value_set_boxed (ref this, IntPtr.Zero);
@ -207,13 +207,13 @@ namespace Gst.GLib {
IntPtr native_array = Marshal.AllocHGlobal ((val.Length + 1) * IntPtr.Size);
for (int i = 0; i < val.Length; i++)
Marshal.WriteIntPtr (native_array, i * IntPtr.Size, Gst.GLib.Marshaller.StringToPtrGStrdup (val[i]));
Marshal.WriteIntPtr (native_array, i * IntPtr.Size, GLib.Marshaller.StringToPtrGStrdup (val[i]));
Marshal.WriteIntPtr (native_array, val.Length * IntPtr.Size, IntPtr.Zero);
g_value_set_boxed (ref this, native_array);
for (int i = 0; i < val.Length; i++)
Gst.GLib.Marshaller.Free (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
GLib.Marshaller.Free (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
Marshal.FreeHGlobal (native_array);
}
@ -223,7 +223,7 @@ namespace Gst.GLib {
g_value_unset (ref this);
}
public void Init (Gst.GLib.GType gtype)
public void Init (GLib.GType gtype)
{
g_value_init (ref this, gtype.Val);
}
@ -299,7 +299,7 @@ namespace Gst.GLib {
public static explicit operator string (Value val)
{
IntPtr str = g_value_get_string (ref val);
return str == IntPtr.Zero ? null : Gst.GLib.Marshaller.Utf8PtrToString (str);
return str == IntPtr.Zero ? null : GLib.Marshaller.Utf8PtrToString (str);
}
public static explicit operator ValueArray (Value val)
@ -312,23 +312,23 @@ namespace Gst.GLib {
return g_value_get_pointer (ref val);
}
public static explicit operator Gst.GLib.Opaque (Value val)
public static explicit operator GLib.Opaque (Value val)
{
return Gst.GLib.Opaque.GetOpaque (g_value_get_boxed (ref val), (Type) new GType (val.type), false);
return GLib.Opaque.GetOpaque (g_value_get_boxed (ref val), (Type) new GType (val.type), false);
}
public static explicit operator Gst.GLib.Boxed (Value val)
public static explicit operator GLib.Boxed (Value val)
{
return new Gst.GLib.Boxed (g_value_get_boxed (ref val));
return new GLib.Boxed (g_value_get_boxed (ref val));
}
public static explicit operator Gst.GLib.Object (Value val)
public static explicit operator GLib.Object (Value val)
{
return Gst.GLib.Object.GetObject (g_value_get_object (ref val), false);
return GLib.Object.GetObject (g_value_get_object (ref val), false);
}
[Obsolete ("Replaced by Gst.GLib.Object cast")]
public static explicit operator Gst.GLib.UnwrappedObject (Value val)
[Obsolete ("Replaced by GLib.Object cast")]
public static explicit operator GLib.UnwrappedObject (Value val)
{
return new UnwrappedObject (g_value_get_object (ref val));
}
@ -344,18 +344,18 @@ namespace Gst.GLib {
count++;
string[] strings = new string[count];
for (int i = 0; i < count; i++)
strings[i] = Gst.GLib.Marshaller.Utf8PtrToString (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
strings[i] = GLib.Marshaller.Utf8PtrToString (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
return strings;
}
object ToRegisteredType () {
Type t = Gst.GLib.GType.LookupType (type);
Type t = GLib.GType.LookupType (type);
ConstructorInfo ci = null;
try {
while (ci == null && t != null) {
if (!t.IsAbstract)
ci = t.GetConstructor (new Type[] { typeof (Gst.GLib.Value) });
ci = t.GetConstructor (new Type[] { typeof (GLib.Value) });
if (ci == null)
t = t.BaseType;
}
@ -370,12 +370,12 @@ namespace Gst.GLib {
}
void FromRegisteredType (object val) {
Type t = Gst.GLib.GType.LookupType (type);
Type t = GLib.GType.LookupType (type);
MethodInfo mi = null;
try {
while (mi == null && t != null) {
mi = t.GetMethod ("SetGValue", new Type[] { Type.GetType ("Gst.GLib.Value&") });
mi = t.GetMethod ("SetGValue", new Type[] { Type.GetType ("GLib.Value&") });
if (mi != null && (mi.IsAbstract || mi.ReturnType != typeof (void)))
mi = null;
if (mi == null)
@ -390,7 +390,7 @@ namespace Gst.GLib {
object[] parameters = new object[] { this };
mi.Invoke (val, parameters);
this = (Gst.GLib.Value) parameters[0];
this = (GLib.Value) parameters[0];
}
object ToEnum ()
@ -413,8 +413,8 @@ namespace Gst.GLib {
Type t = GType.LookupType (type);
if (t == null)
throw new Exception ("Unknown type " + new GType (type).ToString ());
else if (t.IsSubclassOf (typeof (Gst.GLib.Opaque)))
return (Gst.GLib.Opaque) this;
else if (t.IsSubclassOf (typeof (GLib.Opaque)))
return (GLib.Opaque) this;
MethodInfo mi = t.GetMethod ("New", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
if (mi == null)
@ -458,7 +458,7 @@ namespace Gst.GLib {
else if (type == ManagedValue.GType.Val)
return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this));
else if (GType.Is (type, GType.Object))
return (Gst.GLib.Object) this;
return (GLib.Object) this;
else if (GType.Is (type, GType.Boxed))
return ToBoxed ();
else if (GType.LookupType (type) != null)
@ -492,9 +492,9 @@ namespace Gst.GLib {
else if (type == GType.Double.Val)
g_value_set_double (ref this, (double) value);
else if (type == GType.String.Val) {
IntPtr native = Gst.GLib.Marshaller.StringToPtrGStrdup ((string)value);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup ((string)value);
g_value_set_string (ref this, native);
Gst.GLib.Marshaller.Free (native);
GLib.Marshaller.Free (native);
} else if (type == GType.Pointer.Val) {
if (value.GetType () == typeof (IntPtr)) {
g_value_set_pointer (ref this, (IntPtr) value);
@ -515,10 +515,10 @@ namespace Gst.GLib {
g_value_set_boxed (ref this, wrapper);
ManagedValue.ReleaseWrapper (wrapper);
} else if (GType.Is (type, GType.Object))
if(value is Gst.GLib.Object)
g_value_set_object (ref this, (value as Gst.GLib.Object).Handle);
if(value is GLib.Object)
g_value_set_object (ref this, (value as GLib.Object).Handle);
else
g_value_set_object (ref this, (value as Gst.GLib.GInterfaceAdapter).Handle);
g_value_set_object (ref this, (value as GLib.GInterfaceAdapter).Handle);
else if (GType.Is (type, GType.Boxed)) {
if (value is IWrapper) {
g_value_set_boxed (ref this, ((IWrapper)value).Handle);
@ -527,7 +527,7 @@ namespace Gst.GLib {
IntPtr buf = Marshaller.StructureToPtrAlloc (value);
g_value_set_boxed (ref this, buf);
Marshal.FreeHGlobal (buf);
} else if (Gst.GLib.GType.LookupType (type) != null) {
} else if (GLib.GType.LookupType (type) != null) {
FromRegisteredType (value);
} else
throw new Exception ("Unknown type " + new GType (type).ToString ());
@ -553,7 +553,7 @@ namespace Gst.GLib {
void InitForProperty (GType gtype, string name)
{
IntPtr p_name = Marshaller.StringToPtrGStrdup (name);
IntPtr spec_ptr = g_object_class_find_property (gtype.ClassPtr, p_name);
IntPtr spec_ptr = g_object_class_find_property (gtype.GetClassPtr (), p_name);
Marshaller.Free (p_name);
if (spec_ptr == IntPtr.Zero)
@ -563,113 +563,113 @@ namespace Gst.GLib {
g_value_init (ref this, spec.ValueType.Val);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_object_class_find_property (IntPtr klass, IntPtr name);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_type_check_value_holds (ref Value val, IntPtr gtype);
[DllImport("libgobject-2.0-0.dll")]
static extern void g_value_init (ref Gst.GLib.Value val, IntPtr gtype);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_init (ref GLib.Value val, IntPtr gtype);
[DllImport("libgobject-2.0-0.dll")]
static extern void g_value_unset (ref Gst.GLib.Value val);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_unset (ref GLib.Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_boolean (ref Value val, bool data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_uchar (ref Value val, byte data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_char (ref Value val, sbyte data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_boxed (ref Value val, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_double (ref Value val, double data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_float (ref Value val, float data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_int (ref Value val, int data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_int64 (ref Value val, long data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_uint64 (ref Value val, ulong data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_object (ref Value val, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_param (ref Value val, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_pointer (ref Value val, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_string (ref Value val, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_uint (ref Value val, uint data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_enum (ref Value val, int data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_set_flags (ref Value val, uint data);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern bool g_value_get_boolean (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern byte g_value_get_uchar (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern sbyte g_value_get_char (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_get_boxed (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern double g_value_get_double (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern float g_value_get_float (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_value_get_int (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern long g_value_get_int64 (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern ulong g_value_get_uint64 (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_get_object (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_get_param (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_get_pointer (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_get_string (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_value_get_uint (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern int g_value_get_enum (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern uint g_value_get_flags (ref Value val);
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_strv_get_type ();
}
}

View file

@ -32,7 +32,7 @@ namespace Gst.GLib {
static private ArrayList PendingFrees = new ArrayList ();
static private bool idle_queued = false;
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_array_new (uint n_preallocs);
public ValueArray (uint n_preallocs)
@ -57,7 +57,7 @@ namespace Gst.GLib {
GC.SuppressFinalize (this);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_array_free (IntPtr raw);
void Dispose (bool disposing)
@ -115,31 +115,31 @@ namespace Gst.GLib {
get { return Native.values; }
}
[DllImport("libgobject-2.0-0.dll")]
static extern void g_value_array_append (IntPtr raw, ref Gst.GLib.Value val);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_array_append (IntPtr raw, ref GLib.Value val);
public void Append (Gst.GLib.Value val)
public void Append (GLib.Value val)
{
g_value_array_append (Handle, ref val);
}
[DllImport("libgobject-2.0-0.dll")]
static extern void g_value_array_insert (IntPtr raw, uint idx, ref Gst.GLib.Value val);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_array_insert (IntPtr raw, uint idx, ref GLib.Value val);
public void Insert (uint idx, Gst.GLib.Value val)
public void Insert (uint idx, GLib.Value val)
{
g_value_array_insert (Handle, idx, ref val);
}
[DllImport("libgobject-2.0-0.dll")]
static extern void g_value_array_prepend (IntPtr raw, ref Gst.GLib.Value val);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_array_prepend (IntPtr raw, ref GLib.Value val);
public void Prepend (Gst.GLib.Value val)
public void Prepend (GLib.Value val)
{
g_value_array_prepend (Handle, ref val);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern void g_value_array_remove (IntPtr raw, uint idx);
public void Remove (uint idx)
@ -152,13 +152,13 @@ namespace Gst.GLib {
get { return (int) Native.n_values; }
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_array_get_nth (IntPtr raw, uint idx);
public object this [int index] {
get {
IntPtr raw_val = g_value_array_get_nth (Handle, (uint) index);
return Marshal.PtrToStructure (raw_val, typeof (Gst.GLib.Value));
return Marshal.PtrToStructure (raw_val, typeof (GLib.Value));
}
}
@ -226,7 +226,7 @@ namespace Gst.GLib {
return new ListEnumerator (this);
}
[DllImport("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_array_copy (IntPtr raw);
// ICloneable
@ -235,12 +235,12 @@ namespace Gst.GLib {
return new ValueArray (g_value_array_copy (Handle));
}
[DllImport ("libgobject-2.0-0.dll")]
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
static extern IntPtr g_value_array_get_type ();
public static Gst.GLib.GType GType {
public static GLib.GType GType {
get {
return new Gst.GLib.GType (g_value_array_get_type ());
return new GLib.GType (g_value_array_get_type ());
}
}
}

View file

@ -1,5 +1,6 @@
--- ../gtk-sharp/glib/Argv.cs 2005-03-08 22:28:08.000000000 +0100
+++ glib-sharp/Argv.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/Argv.cs glib-sharp/Argv.cs
--- glib/Argv.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Argv.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -9,8 +10,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/Boxed.cs 2004-10-21 03:08:10.000000000 +0200
+++ glib-sharp/Boxed.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/Boxed.cs glib-sharp/Boxed.cs
--- glib/Boxed.cs 2004-10-21 03:08:10.000000000 +0200
+++ glib-sharp/Boxed.cs 2009-09-03 10:41:01.000000000 +0200
@@ -18,7 +18,7 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
@ -20,8 +22,9 @@
using System;
--- ../gtk-sharp/glib/CDeclCallbackAttribute.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/CDeclCallbackAttribute.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/CDeclCallbackAttribute.cs glib-sharp/CDeclCallbackAttribute.cs
--- glib/CDeclCallbackAttribute.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/CDeclCallbackAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -31,8 +34,9 @@
using System;
--- ../gtk-sharp/glib/ClassInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/ClassInitializerAttribute.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/ClassInitializerAttribute.cs glib-sharp/ClassInitializerAttribute.cs
--- glib/ClassInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/ClassInitializerAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -42,8 +46,9 @@
using System;
--- ../gtk-sharp/glib/ConnectBeforeAttribute.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/ConnectBeforeAttribute.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/ConnectBeforeAttribute.cs glib-sharp/ConnectBeforeAttribute.cs
--- glib/ConnectBeforeAttribute.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/ConnectBeforeAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -53,8 +58,9 @@
using System;
--- ../gtk-sharp/glib/DefaultSignalHandlerAttribute.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/DefaultSignalHandlerAttribute.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/DefaultSignalHandlerAttribute.cs glib-sharp/DefaultSignalHandlerAttribute.cs
--- glib/DefaultSignalHandlerAttribute.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/DefaultSignalHandlerAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -64,8 +70,9 @@
using System;
--- ../gtk-sharp/glib/DelegateWrapper.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/DelegateWrapper.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/DelegateWrapper.cs glib-sharp/DelegateWrapper.cs
--- glib/DelegateWrapper.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/DelegateWrapper.cs 2009-09-03 10:41:01.000000000 +0200
@@ -22,7 +22,7 @@
// Boston, MA 02111-1307, USA.
@ -75,8 +82,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/DestroyNotify.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/DestroyNotify.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/DestroyNotify.cs glib-sharp/DestroyNotify.cs
--- glib/DestroyNotify.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/DestroyNotify.cs 2009-09-03 10:41:01.000000000 +0200
@@ -18,7 +18,7 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
@ -86,8 +94,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/EnumWrapper.cs 2005-07-22 20:36:50.000000000 +0200
+++ glib-sharp/EnumWrapper.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/EnumWrapper.cs glib-sharp/EnumWrapper.cs
--- glib/EnumWrapper.cs 2005-07-22 20:36:50.000000000 +0200
+++ glib-sharp/EnumWrapper.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -97,8 +106,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/ExceptionManager.cs 2007-03-08 21:28:24.000000000 +0100
+++ glib-sharp/ExceptionManager.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/ExceptionManager.cs glib-sharp/ExceptionManager.cs
--- glib/ExceptionManager.cs 2007-03-08 21:28:24.000000000 +0100
+++ glib-sharp/ExceptionManager.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -108,8 +118,9 @@
using System;
--- ../gtk-sharp/glib/FileUtils.cs 2005-03-08 22:28:08.000000000 +0100
+++ glib-sharp/FileUtils.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/FileUtils.cs glib-sharp/FileUtils.cs
--- glib/FileUtils.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/FileUtils.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -119,8 +130,9 @@
using System;
using System.Text;
--- ../gtk-sharp/glib/Format.cs 2008-11-21 17:42:46.000000000 +0100
+++ glib-sharp/Format.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/Format.cs glib-sharp/Format.cs
--- glib/Format.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Format.cs 2009-09-03 10:41:01.000000000 +0200
@@ -23,7 +23,7 @@
using System;
using System.Runtime.InteropServices;
@ -129,9 +141,10 @@
+namespace Gst.GLib {
#if GTK_SHARP_2_14
public class Format {
[DllImport("libglib-2.0-0.dll")]
--- ../gtk-sharp/glib/GException.cs 2008-12-19 19:57:42.000000000 +0100
+++ glib-sharp/GException.cs 2009-08-05 16:48:02.000000000 +0200
[DllImport ("libglib-2.0-0.dll", CallingConvention = Global.CallingConvention)]
diff -Naur glib/GException.cs glib-sharp/GException.cs
--- glib/GException.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/GException.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -141,8 +154,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/GInterfaceAdapter.cs 2009-07-21 08:51:10.000000000 +0200
+++ glib-sharp/GInterfaceAdapter.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/GInterfaceAdapter.cs glib-sharp/GInterfaceAdapter.cs
--- glib/GInterfaceAdapter.cs 2009-07-21 08:51:10.000000000 +0200
+++ glib-sharp/GInterfaceAdapter.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -152,8 +166,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/GInterfaceAttribute.cs 2007-09-11 22:34:24.000000000 +0200
+++ glib-sharp/GInterfaceAttribute.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/GInterfaceAttribute.cs glib-sharp/GInterfaceAttribute.cs
--- glib/GInterfaceAttribute.cs 2007-09-11 22:34:24.000000000 +0200
+++ glib-sharp/GInterfaceAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -17,7 +17,7 @@
// Boston, MA 02111-1307, USA.
@ -163,8 +178,9 @@
using System;
--- ../gtk-sharp/glib/Global.cs 2008-11-21 17:54:10.000000000 +0100
+++ glib-sharp/Global.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/Global.cs glib-sharp/Global.cs
--- glib/Global.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Global.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -174,8 +190,12 @@
using System;
using System.Text;
--- ../gtk-sharp/glib/GString.cs 2005-03-08 22:28:08.000000000 +0100
+++ glib-sharp/GString.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/glue/Makefile.am glib-sharp/glue/Makefile.am
diff -Naur glib/glue/thread.c glib-sharp/glue/thread.c
diff -Naur glib/glue/win32dll.c glib-sharp/glue/win32dll.c
diff -Naur glib/GString.cs glib-sharp/GString.cs
--- glib/GString.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/GString.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -185,8 +205,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/GTypeAttribute.cs 2005-05-04 18:54:24.000000000 +0200
+++ glib-sharp/GTypeAttribute.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/GTypeAttribute.cs glib-sharp/GTypeAttribute.cs
--- glib/GTypeAttribute.cs 2005-05-04 18:54:24.000000000 +0200
+++ glib-sharp/GTypeAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -17,7 +17,7 @@
// Boston, MA 02111-1307, USA.
@ -196,8 +217,9 @@
using System;
--- ../gtk-sharp/glib/GType.cs 2009-08-01 19:20:35.000000000 +0200
+++ glib-sharp/GType.cs 2009-08-05 16:48:02.000000000 +0200
diff -Naur glib/GType.cs glib-sharp/GType.cs
--- glib/GType.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/GType.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -207,8 +229,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/Idle.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/Idle.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Idle.cs glib-sharp/Idle.cs
--- glib/Idle.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Idle.cs 2009-09-03 10:41:01.000000000 +0200
@@ -24,7 +24,7 @@
// Boston, MA 02111-1307, USA.
@ -218,8 +241,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/IgnoreClassInitializersAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/IgnoreClassInitializersAttribute.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/IgnoreClassInitializersAttribute.cs glib-sharp/IgnoreClassInitializersAttribute.cs
--- glib/IgnoreClassInitializersAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/IgnoreClassInitializersAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -229,8 +253,9 @@
using System;
--- ../gtk-sharp/glib/InitiallyUnowned.cs 2006-05-10 19:13:30.000000000 +0200
+++ glib-sharp/InitiallyUnowned.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/InitiallyUnowned.cs glib-sharp/InitiallyUnowned.cs
--- glib/InitiallyUnowned.cs 2009-08-08 05:06:53.000000000 +0200
+++ glib-sharp/InitiallyUnowned.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
#if GTK_SHARP_2_10
@ -240,8 +265,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/IOChannel.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/IOChannel.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/IOChannel.cs glib-sharp/IOChannel.cs
--- glib/IOChannel.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/IOChannel.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -260,8 +286,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/IWrapper.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/IWrapper.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/IWrapper.cs glib-sharp/IWrapper.cs
--- glib/IWrapper.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/IWrapper.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -271,8 +298,9 @@
{
using System;
--- ../gtk-sharp/glib/ListBase.cs 2009-04-09 16:38:16.000000000 +0200
+++ glib-sharp/ListBase.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/ListBase.cs glib-sharp/ListBase.cs
--- glib/ListBase.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/ListBase.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -282,8 +310,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/List.cs 2008-12-19 19:57:42.000000000 +0100
+++ glib-sharp/List.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/List.cs glib-sharp/List.cs
--- glib/List.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/List.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -293,8 +322,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/Log.cs 2005-03-08 22:28:08.000000000 +0100
+++ glib-sharp/Log.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Log.cs glib-sharp/Log.cs
--- glib/Log.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Log.cs 2009-09-03 10:41:01.000000000 +0200
@@ -22,7 +22,7 @@
//
@ -304,8 +334,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/MainContext.cs 2005-10-07 23:33:30.000000000 +0200
+++ glib-sharp/MainContext.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/MainContext.cs glib-sharp/MainContext.cs
--- glib/MainContext.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/MainContext.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -315,8 +346,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/MainLoop.cs 2004-08-25 20:11:41.000000000 +0200
+++ glib-sharp/MainLoop.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/MainLoop.cs glib-sharp/MainLoop.cs
--- glib/MainLoop.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/MainLoop.cs 2009-09-03 10:41:01.000000000 +0200
@@ -21,7 +21,7 @@
using System;
using System.Runtime.InteropServices;
@ -326,8 +358,10 @@
public class MainLoop {
private IntPtr handle;
--- ../gtk-sharp/glib/ManagedValue.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/ManagedValue.cs 2009-08-05 16:54:43.000000000 +0200
diff -Naur glib/Makefile.am glib-sharp/Makefile.am
diff -Naur glib/ManagedValue.cs glib-sharp/ManagedValue.cs
--- glib/ManagedValue.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/ManagedValue.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -346,8 +380,9 @@
boxed_type = new GLib.GType (g_boxed_type_register_static (name, copy, free));
Marshaller.Free (name);
}
--- ../gtk-sharp/glib/Markup.cs 2005-03-08 22:28:08.000000000 +0100
+++ glib-sharp/Markup.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Markup.cs glib-sharp/Markup.cs
--- glib/Markup.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Markup.cs 2009-09-03 10:41:01.000000000 +0200
@@ -23,7 +23,7 @@
using System;
using System.Runtime.InteropServices;
@ -357,8 +392,9 @@
public class Markup {
--- ../gtk-sharp/glib/Marshaller.cs 2009-01-08 19:43:00.000000000 +0100
+++ glib-sharp/Marshaller.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Marshaller.cs glib-sharp/Marshaller.cs
--- glib/Marshaller.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Marshaller.cs 2009-09-03 10:41:01.000000000 +0200
@@ -21,7 +21,7 @@
// Boston, MA 02111-1307, USA.
@ -368,8 +404,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/MissingIntPtrCtorException.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/MissingIntPtrCtorException.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/MissingIntPtrCtorException.cs glib-sharp/MissingIntPtrCtorException.cs
--- glib/MissingIntPtrCtorException.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/MissingIntPtrCtorException.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -379,8 +416,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/NotifyHandler.cs 2005-03-08 22:28:08.000000000 +0100
+++ glib-sharp/NotifyHandler.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/NotifyHandler.cs glib-sharp/NotifyHandler.cs
--- glib/NotifyHandler.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/NotifyHandler.cs 2009-09-03 10:41:01.000000000 +0200
@@ -14,7 +14,7 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
@ -390,8 +428,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/Object.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/Object.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Object.cs glib-sharp/Object.cs
--- glib/Object.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Object.cs 2009-09-03 10:45:33.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -427,7 +466,7 @@
IntPtr dummy1;
IntPtr dummy2;
IntPtr dummy3;
@@ -209,13 +211,36 @@
@@ -209,13 +211,37 @@
IntPtr dummy7;
}
@ -441,7 +480,7 @@
+ if (use_cache && class_structs.Contains (gtype))
+ return (GObjectClass) class_structs [gtype];
+ else {
+ IntPtr class_ptr = gtype.ClassPtr;
+ IntPtr class_ptr = gtype.GetClassPtr ();
+ GObjectClass class_struct = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass));
+ if (use_cache)
+ class_structs.Add (gtype, class_struct);
@ -451,13 +490,14 @@
+
+ static void OverrideClassStruct (GLib.GType gtype, GObjectClass class_struct)
+ {
+ IntPtr class_ptr = gtype.ClassPtr;
+ IntPtr class_ptr = gtype.GetClassPtr ();
+ Marshal.StructureToPtr (class_struct, class_ptr, false);
+ }
+
+
static void OverridePropertyHandlers (GType gtype, GetPropertyDelegate get_cb, SetPropertyDelegate set_cb)
{
- IntPtr class_ptr = gtype.ClassPtr;
- IntPtr class_ptr = gtype.GetClassPtr ();
- GObjectClass klass = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass));
+ GObjectClass klass = GetClassStruct (gtype, false);
klass.get_prop_cb = get_cb;
@ -466,8 +506,8 @@
+ OverrideClassStruct (gtype, klass);
}
[DllImport("libgobject-2.0-0.dll")]
@@ -230,9 +255,68 @@
[DllImport ("libgobject-2.0-0.dll", CallingConvention = Global.CallingConvention)]
@@ -230,9 +256,68 @@
return pspec.Handle;
}
@ -483,7 +523,7 @@
+ static IntPtr constructor_cb (IntPtr gtype, uint n_construct_properties, IntPtr construct_properties)
+ {
+ GType type = new GLib.GType (gtype);
+ IntPtr instance = GetClassStruct (type.ThresholdType, false).constructor_cb (gtype, n_construct_properties, construct_properties);
+ IntPtr instance = GetClassStruct (type.GetThresholdType (), false).constructor_cb (gtype, n_construct_properties, construct_properties);
+ for (int i = 0; i < n_construct_properties; i++) {
+ IntPtr p = new IntPtr ((long) construct_properties + i * Marshal.SizeOf (typeof (GObjectConstructParam)));
+
@ -509,7 +549,7 @@
+ static void constructed_cb (IntPtr o)
+ {
+ GLib.Object __obj = GLib.Object.GetObject (o, false) as GLib.Object;
+ ConstructedDelegate unmanaged = GetClassStruct (__obj.LookupGType ().ThresholdType, true).constructed_cb;
+ ConstructedDelegate unmanaged = GetClassStruct (__obj.LookupGType ().GetThresholdType (), true).constructed_cb;
+ if (unmanaged != null)
+ unmanaged (__obj.Handle);
+ }
@ -521,14 +561,14 @@
{
uint idx = 1;
+
+ if (gtype.BaseType == gtype.ThresholdType) {
+ if (gtype.GetBaseType () == gtype.GetThresholdType ()) {
+ GObjectClass gobject_class = GetClassStruct (gtype, false);
+ gobject_class.constructor_cb = Constructor_cb;
+ gobject_class.constructed_cb = Constructed_cb;
+ gobject_class.set_prop_cb = Set_prop_dummy_cb;
+ OverrideClassStruct (gtype, gobject_class);
+
+ IntPtr declaring_class = gtype.ClassPtr;
+ IntPtr declaring_class = gtype.GetClassPtr ();
+ ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly);
+ g_object_class_install_property (declaring_class, idx, pspec.Handle);
+ idx++;
@ -536,7 +576,7 @@
bool handlers_overridden = false;
foreach (PropertyInfo pinfo in t.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) {
@@ -262,6 +346,9 @@
@@ -262,6 +347,9 @@
static void GetPropertyCallback (IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec)
{
@ -546,7 +586,7 @@
GLib.Object obj = GLib.Object.GetObject (handle, false);
value.Val = (Properties [param_spec] as PropertyInfo).GetValue (obj, new object [0]);
}
@@ -280,6 +367,9 @@
@@ -280,6 +368,9 @@
static void SetPropertyCallback(IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec)
{
@ -556,7 +596,7 @@
GLib.Object obj = GLib.Object.GetObject (handle, false);
(Properties [param_spec] as PropertyInfo).SetValue (obj, value.Val, new object [0]);
}
@@ -366,12 +456,28 @@
@@ -360,12 +451,28 @@
protected virtual void CreateNativeObject (string[] names, GLib.Value[] vals)
{
@ -587,7 +627,7 @@
foreach (GParameter p in parms)
GLib.Marshaller.Free (p.name);
}
@@ -599,10 +705,12 @@
@@ -593,10 +700,12 @@
return g_type_check_instance_is_a (obj, GType.Object.Val);
}
@ -600,8 +640,9 @@
struct GObject {
public GTypeInstance type_instance;
public uint ref_count;
--- ../gtk-sharp/glib/ObjectManager.cs 2008-12-19 19:57:42.000000000 +0100
+++ glib-sharp/ObjectManager.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/ObjectManager.cs glib-sharp/ObjectManager.cs
--- glib/ObjectManager.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/ObjectManager.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -611,8 +652,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/Opaque.cs 2009-01-29 17:26:09.000000000 +0100
+++ glib-sharp/Opaque.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Opaque.cs glib-sharp/Opaque.cs
--- glib/Opaque.cs 2009-01-29 17:26:09.000000000 +0100
+++ glib-sharp/Opaque.cs 2009-09-03 10:41:01.000000000 +0200
@@ -24,7 +24,7 @@
// Boston, MA 02111-1307, USA.
@ -622,8 +664,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/ParamSpec.cs 2009-04-21 10:11:35.000000000 +0200
+++ glib-sharp/ParamSpec.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/ParamSpec.cs glib-sharp/ParamSpec.cs
--- glib/ParamSpec.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/ParamSpec.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,50 +19,49 @@
// Boston, MA 02111-1307, USA.
@ -763,8 +806,9 @@
ParamFlags flags;
public IntPtr value_type;
IntPtr owner_type;
--- ../gtk-sharp/glib/Priority.cs 2009-05-03 21:34:22.000000000 +0200
+++ glib-sharp/Priority.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Priority.cs glib-sharp/Priority.cs
--- glib/Priority.cs 2009-05-03 21:34:22.000000000 +0200
+++ glib-sharp/Priority.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
@ -774,8 +818,9 @@
public enum Priority
{
High = -100,
--- ../gtk-sharp/glib/PropertyAttribute.cs 2008-06-06 18:55:00.000000000 +0200
+++ glib-sharp/PropertyAttribute.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/PropertyAttribute.cs glib-sharp/PropertyAttribute.cs
--- glib/PropertyAttribute.cs 2008-06-06 18:55:00.000000000 +0200
+++ glib-sharp/PropertyAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -17,7 +17,7 @@
// Boston, MA 02111-1307, USA.
@ -785,8 +830,9 @@
using System;
--- ../gtk-sharp/glib/PtrArray.cs 2008-12-19 19:57:42.000000000 +0100
+++ glib-sharp/PtrArray.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/PtrArray.cs glib-sharp/PtrArray.cs
--- glib/PtrArray.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/PtrArray.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -796,8 +842,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/SignalArgs.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/SignalArgs.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/SignalArgs.cs glib-sharp/SignalArgs.cs
--- glib/SignalArgs.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/SignalArgs.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -807,8 +854,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/SignalAttribute.cs 2005-10-08 23:08:04.000000000 +0200
+++ glib-sharp/SignalAttribute.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/SignalAttribute.cs glib-sharp/SignalAttribute.cs
--- glib/SignalAttribute.cs 2005-10-08 23:08:04.000000000 +0200
+++ glib-sharp/SignalAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -818,8 +866,9 @@
using System;
--- ../gtk-sharp/glib/SignalCallback.cs 2005-03-08 22:28:08.000000000 +0100
+++ glib-sharp/SignalCallback.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/SignalCallback.cs glib-sharp/SignalCallback.cs
--- glib/SignalCallback.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/SignalCallback.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -829,8 +878,9 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/SignalClosure.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/SignalClosure.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/SignalClosure.cs glib-sharp/SignalClosure.cs
--- glib/SignalClosure.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/SignalClosure.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -840,8 +890,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/Signal.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/Signal.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Signal.cs glib-sharp/Signal.cs
--- glib/Signal.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Signal.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
@ -851,8 +902,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/SList.cs 2008-12-19 19:57:42.000000000 +0100
+++ glib-sharp/SList.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/SList.cs glib-sharp/SList.cs
--- glib/SList.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/SList.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -862,8 +914,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/Source.cs 2008-02-21 17:32:03.000000000 +0100
+++ glib-sharp/Source.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Source.cs glib-sharp/Source.cs
--- glib/Source.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Source.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -873,8 +926,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/Spawn.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/Spawn.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Spawn.cs glib-sharp/Spawn.cs
--- glib/Spawn.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Spawn.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -884,8 +938,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/Thread.cs 2005-12-30 13:14:59.000000000 +0100
+++ glib-sharp/Thread.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Thread.cs glib-sharp/Thread.cs
--- glib/Thread.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Thread.cs 2009-09-03 10:59:53.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -895,8 +950,26 @@
{
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/Timeout.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/Timeout.cs 2009-08-05 16:48:03.000000000 +0200
@@ -36,13 +36,13 @@
g_thread_init (IntPtr.Zero);
}
- [DllImport("glibsharpglue-3")]
- static extern bool glibsharp_g_thread_supported ();
+ [DllImport("gstreamersharpglue-0.10")]
+ static extern bool gstglibsharp_g_thread_supported ();
public static bool Supported
{
get {
- return glibsharp_g_thread_supported ();
+ return gstglibsharp_g_thread_supported ();
}
}
}
diff -Naur glib/Timeout.cs glib-sharp/Timeout.cs
--- glib/Timeout.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Timeout.cs 2009-09-03 10:41:01.000000000 +0200
@@ -22,7 +22,7 @@
// Boston, MA 02111-1307, USA.
@ -906,8 +979,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/ToggleRef.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/ToggleRef.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/ToggleRef.cs glib-sharp/ToggleRef.cs
--- glib/ToggleRef.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/ToggleRef.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -917,8 +991,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/TypeConverter.cs 2005-05-04 18:54:24.000000000 +0200
+++ glib-sharp/TypeConverter.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/TypeConverter.cs glib-sharp/TypeConverter.cs
--- glib/TypeConverter.cs 2005-05-04 18:54:24.000000000 +0200
+++ glib-sharp/TypeConverter.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -928,8 +1003,9 @@
using System;
public class TypeConverter {
--- ../gtk-sharp/glib/TypeFundamentals.cs 2004-07-09 17:25:39.000000000 +0200
+++ glib-sharp/TypeFundamentals.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/TypeFundamentals.cs glib-sharp/TypeFundamentals.cs
--- glib/TypeFundamentals.cs 2004-07-09 17:25:39.000000000 +0200
+++ glib-sharp/TypeFundamentals.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -939,8 +1015,9 @@
public enum TypeFundamentals {
TypeInvalid = 0 << 2,
--- ../gtk-sharp/glib/TypeInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/TypeInitializerAttribute.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/TypeInitializerAttribute.cs glib-sharp/TypeInitializerAttribute.cs
--- glib/TypeInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/TypeInitializerAttribute.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -950,8 +1027,9 @@
using System;
--- ../gtk-sharp/glib/UnwrappedObject.cs 2005-07-22 20:36:50.000000000 +0200
+++ glib-sharp/UnwrappedObject.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/UnwrappedObject.cs glib-sharp/UnwrappedObject.cs
--- glib/UnwrappedObject.cs 2005-07-22 20:36:50.000000000 +0200
+++ glib-sharp/UnwrappedObject.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -961,8 +1039,9 @@
using System;
using System.Runtime.InteropServices;
--- ../gtk-sharp/glib/ValueArray.cs 2009-05-13 21:04:40.000000000 +0200
+++ glib-sharp/ValueArray.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/ValueArray.cs glib-sharp/ValueArray.cs
--- glib/ValueArray.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/ValueArray.cs 2009-09-03 10:41:01.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
@ -972,8 +1051,9 @@
using System;
using System.Collections;
--- ../gtk-sharp/glib/Value.cs 2009-05-13 21:27:39.000000000 +0200
+++ glib-sharp/Value.cs 2009-08-05 16:48:03.000000000 +0200
diff -Naur glib/Value.cs glib-sharp/Value.cs
--- glib/Value.cs 2009-09-02 22:17:37.000000000 +0200
+++ glib-sharp/Value.cs 2009-09-03 10:41:01.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.

View file

@ -1,6 +1,7 @@
lib_LTLIBRARIES = libgstreamersharpglue-0.10.la
libgstreamersharpglue_0_10_la_SOURCES = \
glib.c \
buffer.c \
caps.c \
clock.c \

108
parser/gst-gapi2xml.pl.diff Normal file
View file

@ -0,0 +1,108 @@
--- tmp/parser/gapi2xml.pl 2009-04-13 19:44:48.000000000 +0200
+++ gapi2xml.pl 2009-06-05 21:03:21.000000000 +0200
@@ -32,6 +32,9 @@
}
$ns = $ARGV[0];
+$ns_main = $ns;
+$ns_main =~ s/\..*//g;
+
$libname = $ARGV[2];
# Used by name mangling sub
@@ -231,7 +234,7 @@
$def = $edefs{$cname};
$cname = $etypes{$cname} if (exists($etypes{$cname}));
$enums{lc($cname)} = $cname;
- $enum_elem = addNameElem($ns_elem, 'enum', $cname, $ns);
+ $enum_elem = addNameElem($ns_elem, 'enum', $cname, $ns_main);
if ($def =~ /^deprecated/) {
$enum_elem->setAttribute("deprecated", "1");
$def =~ s/deprecated//g;
@@ -296,7 +299,7 @@
next if ($cbname =~ /^_/);
$cbcnt++;
$fdef = $cb = $fpdefs{$cbname};
- $cb_elem = addNameElem($ns_elem, 'callback', $cbname, $ns);
+ $cb_elem = addNameElem($ns_elem, 'callback', $cbname, $ns_main);
$cb =~ /typedef\s+(.*)\(.*\).*\((.*)\);/;
$ret = $1; $params = $2;
addReturnElem($cb_elem, $ret);
@@ -318,7 +321,7 @@
delete $types{$inst};
$ifacecnt++;
- $iface_el = addNameElem($ns_elem, 'interface', $inst, $ns);
+ $iface_el = addNameElem($ns_elem, 'interface', $inst, $ns_main);
$elem_table{lc($inst)} = $iface_el;
@@ -355,7 +358,7 @@
warn "Strange Class $inst\n" if (!$instdef && $debug);
$classcnt++;
- $obj_el = addNameElem($ns_elem, 'object', $inst, $ns);
+ $obj_el = addNameElem($ns_elem, 'object', $inst, $ns_main);
$elem_table{lc($inst)} = $obj_el;
@@ -424,7 +427,7 @@
} elsif ($types{$type} =~ /struct/ && $type =~ /^$ns/) {
$def = $types{$type};
} else {
- $elem = addNameElem($ns_elem, 'alias', $key, $ns);
+ $elem = addNameElem($ns_elem, 'alias', $key, $ns_main);
$elem->setAttribute('type', $lasttype);
warn "alias $key to $lasttype\n" if $debug;
next;
@@ -432,11 +435,11 @@
# fixme: hack
if ($key eq "GdkBitmap") {
- $struct_el = addNameElem($ns_elem, 'object', $key, $ns);
+ $struct_el = addNameElem($ns_elem, 'object', $key, $ns_main);
} elsif (exists($boxdefs{$key})) {
- $struct_el = addNameElem($ns_elem, 'boxed', $key, $ns);
+ $struct_el = addNameElem($ns_elem, 'boxed', $key, $ns_main);
} else {
- $struct_el = addNameElem($ns_elem, 'struct', $key, $ns);
+ $struct_el = addNameElem($ns_elem, 'struct', $key, $ns_main);
}
if ($def =~ /^deprecated/) {
@@ -459,7 +462,7 @@
foreach $key (sort (keys (%ptrs))) {
next if $ptrs{$key} !~ /struct\s+(\w+)/;
$type = $1;
- $struct_el = addNameElem ($ns_elem, 'struct', $key, $ns);
+ $struct_el = addNameElem ($ns_elem, 'struct', $key, $ns_main);
$struct_el->setAttribute('opaque', 'true');
$elem_table{lc($key)} = $struct_el;
}
@@ -761,6 +764,8 @@
$ns_prefix = "";
$global_el = "";
+ $ns_clean = lc($ns);
+ $ns_clean =~ s/\.//g;
for ($i = 0; $i < $mcount; $i++) {
$mname = $mnames[$i];
@@ -770,7 +775,7 @@
if ($ns_prefix eq "") {
my (@toks) = split(/_/, $prefix);
for ($j = 0; $j < @toks; $j++) {
- if (join ("", @toks[0 .. $j]) eq lc($ns)) {
+ if (join ("", @toks[0 .. $j]) eq $ns_clean) {
$ns_prefix = join ("_", @toks[0 .. $j]);
last;
}
@@ -885,7 +890,7 @@
if ($parm =~ /(.*)\(\s*\**\s*(\w+)\)\s+\((.*)\)/) {
my $ret = $1; my $cbn = $2; my $params = $3;
my $type = $parent->getAttribute('name') . StudlyCaps($cbn);
- $cb_elem = addNameElem($ns_elem, 'callback', $type, $ns);
+ $cb_elem = addNameElem($ns_elem, 'callback', $type, $ns_main);
addReturnElem($cb_elem, $ret);
if ($params && ($params ne "void")) {
addParamsElem($cb_elem, split(/,/, $params));