java-gobject-introspection r14 - in trunk/src/org/gnome/gir: compiler gobject
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r14 - in trunk/src/org/gnome/gir: compiler gobject
- Date: Tue, 2 Sep 2008 00:24:03 +0000 (UTC)
Author: walters
Date: Tue Sep 2 00:24:03 2008
New Revision: 14
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=14&view=rev
Log:
Expand coverage of random GLib/GObject structs; Pointer everything else
Modified:
trunk/src/org/gnome/gir/compiler/CodeFactory.java
trunk/src/org/gnome/gir/gobject/GObjectAPI.java
trunk/src/org/gnome/gir/gobject/GSignalAPI.java
trunk/src/org/gnome/gir/gobject/GlibAPI.java
Modified: trunk/src/org/gnome/gir/compiler/CodeFactory.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/CodeFactory.java (original)
+++ trunk/src/org/gnome/gir/compiler/CodeFactory.java Tue Sep 2 00:24:03 2008
@@ -120,20 +120,53 @@
put("GLib.OptionEntry", "org/gnome/gir/gobject/GOptionEntry");
put("GLib.String", "org/gnome/gir/gobject/GString");
put("GLib.Callback", "com/sun/jna/Callback");
+ put("GLib.Mutex", "org/gnome/gir/gobject/GLibAPI$GMutex");
+ put("GLib.StaticRecMutex", "org/gnome/gir/gobject/GLibAPI$GStaticRecMutex");
- String[] glibUnmapped = new String[] { "Mutex", "Cond" };
- for (String unmapped : glibUnmapped)
- put("GLib." + unmapped, "com/sun/jna/Pointer");
+ String[] glibPointerUnmapped = new String[] { "Mutex", "Cond", "FreeFunc", "DestroyNotify", "MarkupParser",
+ "SpawnChildSetupFunc", "SourceFunc", "Node", "CompareFunc", "KeyFile", "PtrArray", "Func",
+ "ThreadPool", "Source", "CompareDataFunc", };
+ for (String unmapped : glibPointerUnmapped)
+ put("GLib." + unmapped, "com/sun/jna/Pointer");
+ String[] glibIntegerUnmapped = new String[] { "SpawnFlags", "SeekType", };
+ for (String unmapped : glibIntegerUnmapped)
+ put("GLib." + unmapped, "java/lang/integer");
put("GObject.ParamSpec", "org/gnome/gir/gobject/GObjectAPI$GParamSpec");
put("GObject.Object", "org/gnome/gir/gobject/GObject");
put("GObject.InitiallyUnowned", "org/gnome/gir/gobject/GInitiallyUnowned");
put("GObject.Type", "org/gnome/gir/gobject/GType");
+ put("GObject.Value", "org/gnome/gir/gobject/GValue");
put("GObject.TypePlugin", "org/gnome/gir/gobject/GTypePlugin");
- put("GObject.TypeModule", "org/gnome/gir/gobject/GTypeModule");
- put("GObject.ObjectClass", "org/gnome/gir/gobject/GObjectAPI$GObjectClass");
+ put("GObject.TypeModule", "org/gnome/gir/gobject/GTypeModule");
+ put("GObject.TypeClass", "org/gnome/gir/gobject/GObjectAPI$GTypeClass");
+ put("GObject.TypeQuery", "org/gnome/gir/gobject/GObjectAPI$GTypeQuery");
+ put("GObject.TypeInfo", "org/gnome/gir/gobject/GObjectAPI$GTypeInfo");
+ put("GObject.InterfaceInfo", "org/gnome/gir/gobject/GObjectAPI$GInterfaceInfo");
+ put("GObject.TypeValueTable", "org/gnome/gir/gobject/GObjectAPI$GTypeValueTable");
+ put("GObject.TypeFundamentalInfo", "org/gnome/gir/gobject/GObjectAPI$GTypeFundamentalInfo");
+ put("GObject.Class", "org/gnome/gir/gobject/GObjectAPI$GObjectClass");
+ put("GObject.InitiallyUnownedClass", "org/gnome/gir/gobject/GObjectAPI$GInitiallyUnownedClass");
put("GObject.TypeDebugFlags", "org/gnome/gir/gobject/GObjectAPI$GTypeDebugFlags");
put("GObject.TypeInstance", "org/gnome/gir/gobject/GObjectAPI$GTypeInstance");
+ put("GObject.TypeInterface", "org/gnome/gir/gobject/GObjectAPI$GTypeInterface");
+ put("GObject.String", "org/gnome/gir/gobject/GString");
+ put("GObject.Closure", "org/gnome/gir/gobject/GClosure");
+ put("GObject.SignalInvocationHint", "org/gnome/gir/gobject/GSignalAPI$GSignalInvocationHint");
+ put("GObject.EnumValue", "org/gnome/gir/gobject/GObjectAPI$GEnumValue");
+ put("GObject.EnumClass", "org/gnome/gir/gobject/GObjectAPI$GEnumClass");
+ put("GObject.FlagsValue", "org/gnome/gir/gobject/GObjectAPI$GFlagsValue");
+ put("GObject.FlagsClass", "org/gnome/gir/gobject/GObjectAPI$GFlagsClass");
+
+ String[] gobjectUnmapped = new String[] { "Callback", "BaseInitFunc", "InstanceInitFunc",
+ "SignalAccumulator", "ClosureMarshal", "ClassInitFunc", "SignalEmissionHook",
+ "IOChannel", "Date", "BaseFinalizeFunc", "ClassFinalizeFunc" };
+ for (String unmapped : gobjectUnmapped)
+ put("GObject." + unmapped, "com/sun/jna/Pointer");
+ String[] gobjectIntegerUnmapped = new String[] { "SignalFlags", "ConnectFlags", "SignalMatchType",
+ "TypeFlags", "ParamFlags" };
+ for (String unmapped : gobjectIntegerUnmapped)
+ put("GObject." + unmapped, "java/lang/integer");
for (String name : new String[] { "Context" }) {
put("Cairo." + name, "com/sun/jna/Pointer");
@@ -166,7 +199,10 @@
/* Unfortunately, flags are best mapped as plain Integer for now */
if (info instanceof FlagsInfo)
return Type.getObjectType("java/lang/Integer");
- return Type.getObjectType(getInternalNameMapped(info.getNamespace(), info.getName()));
+ String internalName = getInternalNameMapped(info.getNamespace(), info.getName());
+ if (internalName != null)
+ return Type.getObjectType(internalName);
+ return null;
}
public Type toJava(TypeInfo type) {
@@ -327,6 +363,8 @@
String val = overrides.get(key);
if (val != null)
return val;
+ if (namespace.equals("GLib") || namespace.equals("GObject"))
+ throw new RuntimeException(String.format("Unmapped internal ns=%s name=%s", namespace, name));
return getInternalName(namespace, name);
}
Modified: trunk/src/org/gnome/gir/gobject/GObjectAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GObjectAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GObjectAPI.java Tue Sep 2 00:24:03 2008
@@ -51,6 +51,7 @@
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
/**
*
@@ -191,6 +192,9 @@
}
}
+ public static final class GInitiallyUnownedClass extends Structure {
+ private GInitiallyUnownedClass() {}
+ }
public static interface GBaseInitFunc extends Callback {
public void callback(Pointer g_class);
@@ -236,6 +240,38 @@
public volatile /* GTypeValueTable */ Pointer value_table;
}
+ public static final class GTypeFundamentalInfo extends Structure
+ {
+ public int type_flags;
+ };
+
+ public static final class GInterfaceInfo extends Structure
+ {
+ public Pointer interface_init;
+ public Pointer interface_finalize;
+ public Pointer interface_data;
+ };
+
+ public static final class GTypeInterface extends Structure {
+ /*< private >*/
+ public GType g_type; /* iface type */
+ public GType g_instance_type;
+ };
+
+ public static final class GTypeValueTable
+ {
+ public Pointer value_init;
+ public Pointer value_free;
+ public Pointer value_copy;
+ /* varargs functionality (optional) */
+ public Pointer value_peek_pointer;
+ public String collect_format;
+ public Pointer collect_value;
+ public String lcopy_format;
+ public Pointer lcopy_value;
+ };
+
+
static class GParamSpec extends com.sun.jna.Structure {
public volatile GTypeInstance g_type_instance;
public volatile String g_name;
@@ -258,4 +294,97 @@
public static final int SIGNALS = 1 << 1;
public static final int MASK = 0x03;
}
+
+ /**
+ * GEnumClass:
+ * @g_type_class: the parent class
+ * @minimum: the smallest possible value.
+ * @maximum: the largest possible value.
+ * @n_values: the number of possible values.
+ * @values: an array of #GEnumValue structs describing the
+ * individual values.
+ *
+ * The class of an enumeration type holds information about its
+ * possible values.
+ */
+ public static final class GEnumClass extends Structure
+ {
+ public GTypeClass g_type_class;
+
+ /*< public >*/
+ public int minimum;
+ public int maximum;
+ public int n_values;
+ public GEnumValue[] values;
+ };
+ /**
+ * GFlagsClass:
+ * @g_type_class: the parent class
+ * @mask: a mask covering all possible values.
+ * @n_values: the number of possible values.
+ * @values: an array of #GFlagsValue structs describing the
+ * individual values.
+ *
+ * The class of a flags type holds information about its
+ * possible values.
+ */
+ public static final class GFlagsClass extends Structure
+ {
+ public GTypeClass g_type_class;
+
+ /*< public >*/
+ public int mask;
+ public int n_values;
+ public GFlagsValue[] values;
+ };
+ /**
+ * GEnumValue:
+ * @value: the enum value
+ * @value_name: the name of the value
+ * @value_nick: the nickname of the value
+ *
+ * A structure which contains a single enum value, it's name, and it's
+ * nickname.
+ */
+ public static final class GEnumValue extends Structure
+ {
+ public int value;
+ public String value_name;
+ public String value_nick;
+ };
+ /**
+ * GFlagsValue:
+ * @value: the flags value
+ * @value_name: the name of the value
+ * @value_nick: the nickname of the value
+ *
+ * A structure which contains a single flags value, it's name, and it's
+ * nickname.
+ */
+ public static final class GFlagsValue extends Structure
+ {
+ public int value;
+ public String value_name;
+ public String value_nick;
+ };
+
+ /**
+ * GTypeQuery:
+ * @type: the #GType value of the type.
+ * @type_name: the name of the type.
+ * @class_size: the size of the class structure.
+ * @instance_size: the size of the instance structure.
+ *
+ * A structure holding information for a specific type. It is
+ * filled in by the g_type_query() function.
+ */
+ public static final class GTypeQuery extends Structure
+ {
+ public GType type;
+ public String type_name;
+ public int class_size;
+ public int instance_size;
+ };
+
+
}
Modified: trunk/src/org/gnome/gir/gobject/GSignalAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GSignalAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GSignalAPI.java Tue Sep 2 00:24:03 2008
@@ -45,13 +45,15 @@
package org.gnome.gir.gobject;
+import java.util.HashMap;
+
+import org.gnome.gir.gobject.GObjectAPI.GClosureNotify;
+
import com.sun.jna.Callback;
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
-import java.util.HashMap;
-
-import org.gnome.gir.gobject.GObjectAPI.GClosureNotify;
+import com.sun.jna.Structure;
/**
*
@@ -89,4 +91,12 @@
// Do nothing, but provide a base Callback class that gets automatic type conversion
public static interface GSignalCallbackProxy extends com.sun.jna.CallbackProxy {}
+
+ public static final class GSignalInvocationHint extends Structure
+ {
+ public int signal_id;
+ public GQuark detail;
+ public int run_type;
+ };
+
}
Modified: trunk/src/org/gnome/gir/gobject/GlibAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GlibAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GlibAPI.java Tue Sep 2 00:24:03 2008
@@ -52,6 +52,8 @@
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import com.sun.jna.Union;
import com.sun.jna.ptr.PointerByReference;
/**
@@ -177,4 +179,37 @@
return valueOf(_prev);
}
}
+
+ public static final class GMutex extends Structure {
+
+ }
+
+ /* FIXME - this only works on POSIX */
+ public static final class GStaticMutex extends Structure
+ {
+ GMutex runtime_mutex;
+ public static final class StaticMutex extends Union {
+ public byte pad[] = new byte[40];
+ public double dummy_double;
+ Pointer dummy_pointer;
+ long dummy_long;
+ };
+ StaticMutex static_mutex;
+ };
+
+ public static final class GSystemThread extends Union
+ {
+ public char data[] = new char[8];
+ public double dummy_double;
+ public Pointer dummy_pointer;
+ public long dummy_long;
+ };
+
+ public static final class GStaticRecMutex extends Structure
+ {
+ /*< private >*/
+ public GStaticMutex mutex;
+ public int depth;
+ public GSystemThread owner;
+ };
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]