summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--gee/hashmap.vala1
-rw-r--r--gee/hashset.vala1
-rw-r--r--gobject-introspection/gidl.vapi43
-rw-r--r--gobject/valaccodeclassbinding.vala10
-rw-r--r--gobject/valaccodegenerator.vala18
-rw-r--r--gobject/valaccodememberaccessbinding.vala3
-rw-r--r--gobject/valaccodemethodbinding.vala6
-rw-r--r--gobject/valatyperegisterfunction.vala2
-rw-r--r--tests/classes.exp10
-rw-r--r--tests/classes.vala40
-rw-r--r--vala/valaclass.vala34
-rw-r--r--vala/valainterfacewriter.vala8
-rw-r--r--vapi/glib-2.0.vapi85
14 files changed, 194 insertions, 89 deletions
diff --git a/ChangeLog b/ChangeLog
index d511c252c..0282662f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2008-05-25 Jürg Billeter <j@bitron.ch>
+ * vala/valaclass.vala:
+ * vala/valainterfacewriter.vala:
+ * gobject/valaccodeclassbinding.vala:
+ * gobject/valaccodegenerator.vala:
+ * gobject/valaccodememberaccessbinding.vala:
+ * gobject/valaccodemethodbinding.vala:
+ * gobject/valatyperegisterfunction.vala:
+
+ Add support for [Compact] class attribute, register non-compact
+ classes with GType, fixes bug 532518
+
+ * gee/hashmap.vala:
+ * gee/hashset.vala:
+ * gobject-introspection/gidl.vapi:
+ * tests/classes.exp:
+ * tests/classes.vala:
+ * vapi/glib-2.0.vapi:
+
+ Update to use compact classes where appropriate
+
+2008-05-25 Jürg Billeter <j@bitron.ch>
+
* vala/valaparser.vala:
* vala/valascanner.vala:
* vala/valasymbolresolver.vala:
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 9269c75bb..3802468b6 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -168,6 +168,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
clear ();
}
+ [Compact]
private class Node<K,V> {
public K key;
public V value;
diff --git a/gee/hashset.vala b/gee/hashset.vala
index 96e85f47d..d614701bf 100644
--- a/gee/hashset.vala
+++ b/gee/hashset.vala
@@ -152,6 +152,7 @@ public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
clear ();
}
+ [Compact]
private class Node<G> {
public G key;
public Node<G> next;
diff --git a/gobject-introspection/gidl.vapi b/gobject-introspection/gidl.vapi
index e2bae696b..539a8a100 100644
--- a/gobject-introspection/gidl.vapi
+++ b/gobject-introspection/gidl.vapi
@@ -26,7 +26,8 @@ namespace GLib {
namespace Idl {
public List<IdlModule> parse_file (string filename) throws MarkupError;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_module_free", cheader_filename = "gidlmodule.h")]
public class IdlModule {
public string name;
@@ -56,13 +57,15 @@ namespace GLib {
FIELD,
XREF
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNode {
public IdlNodeTypeId type;
public string name;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeFunction {
public bool deprecated;
@@ -79,6 +82,7 @@ namespace GLib {
public List<IdlNodeParam> parameters;
}
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeVFunc
{
@@ -91,7 +95,8 @@ namespace GLib {
public IdlNodeParam result;
public int offset;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeSignal {
public bool deprecated;
@@ -112,7 +117,8 @@ namespace GLib {
public List<IdlNodeParam> parameters;
public IdlNodeParam result;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeBoxed {
public bool deprecated;
@@ -122,7 +128,8 @@ namespace GLib {
public List<IdlNode> members;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeEnum {
public bool deprecated;
@@ -132,7 +139,8 @@ namespace GLib {
public List<IdlNode> values;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeField {
public bool readable;
@@ -142,7 +150,8 @@ namespace GLib {
public IdlNodeType type;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeConstant {
public bool deprecated;
@@ -151,7 +160,8 @@ namespace GLib {
public string value;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeInterface {
public bool deprecated;
@@ -166,7 +176,8 @@ namespace GLib {
public List<IdlNode> members;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeParam {
public bool @in;
@@ -180,7 +191,8 @@ namespace GLib {
public IdlNodeType type;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeProperty {
public bool deprecated;
@@ -194,21 +206,24 @@ namespace GLib {
public IdlNodeType type;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeStruct {
public bool deprecated;
public List<IdlNode> members;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeUnion {
public bool deprecated;
public List<IdlNode> members;
}
-
+
+ [Compact]
[CCode (free_function = "g_idl_node_free", cheader_filename = "gidlnode.h")]
public class IdlNodeType {
public bool is_pointer;
diff --git a/gobject/valaccodeclassbinding.vala b/gobject/valaccodeclassbinding.vala
index 051c2541e..88fecd7b4 100644
--- a/gobject/valaccodeclassbinding.vala
+++ b/gobject/valaccodeclassbinding.vala
@@ -46,9 +46,9 @@ public class Vala.CCodeClassBinding : CCodeTypesymbolBinding {
codegen.current_type_symbol = cl;
codegen.current_class = cl;
- bool is_gtypeinstance = cl.is_subtype_of (codegen.gtypeinstance_type);
+ bool is_gtypeinstance = !cl.is_compact;
bool is_gobject = cl.is_subtype_of (codegen.gobject_type);
- bool is_fundamental = (cl.base_class == codegen.gtypeinstance_type);
+ bool is_fundamental = is_gtypeinstance && cl.base_class == null;
if (cl.get_cname().len () < 3) {
cl.error = true;
@@ -106,9 +106,9 @@ public class Vala.CCodeClassBinding : CCodeTypesymbolBinding {
if (cl.base_class != null) {
codegen.instance_struct.add_field (cl.base_class.get_cname (), "parent_instance");
- if (is_fundamental) {
- codegen.instance_struct.add_field ("volatile int", "ref_count");
- }
+ } else if (is_fundamental) {
+ codegen.instance_struct.add_field ("GTypeInstance", "parent_instance");
+ codegen.instance_struct.add_field ("volatile int", "ref_count");
}
if (is_gtypeinstance) {
diff --git a/gobject/valaccodegenerator.vala b/gobject/valaccodegenerator.vala
index 366cd34d1..920350b35 100644
--- a/gobject/valaccodegenerator.vala
+++ b/gobject/valaccodegenerator.vala
@@ -101,7 +101,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
public DataType float_type;
public DataType double_type;
public Typesymbol gtype_type;
- public Typesymbol gtypeinstance_type;
public Typesymbol gobject_type;
public ErrorType gerror_type;
public Class glist_type;
@@ -228,7 +227,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
var glib_ns = root_symbol.scope.lookup ("GLib");
gtype_type = (Typesymbol) glib_ns.scope.lookup ("Type");
- gtypeinstance_type = (Typesymbol) glib_ns.scope.lookup ("TypeInstance");
gobject_type = (Typesymbol) glib_ns.scope.lookup ("Object");
gerror_type = new ErrorType (null, null);
glist_type = (Class) glib_ns.scope.lookup ("List");
@@ -508,7 +506,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
f.accept_children (this);
var cl = f.parent_symbol as Class;
- bool is_gtypeinstance = (cl != null && cl.is_subtype_of (gtypeinstance_type));
+ bool is_gtypeinstance = (cl != null && !cl.is_compact);
CCodeExpression lhs = null;
CCodeStruct st = null;
@@ -2991,7 +2989,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance));
} else if (expr.type_reference.data_type is Class) {
var cl = (Class) expr.type_reference.data_type;
- if (cl.base_class == gtypeinstance_type) {
+ if (!cl.is_compact && cl.base_class == null) {
creation_call.add_argument (new CCodeIdentifier (cl.get_type_id ()));
}
}
@@ -3190,9 +3188,9 @@ public class Vala.CCodeGenerator : CodeGenerator {
}
public override void visit_cast_expression (CastExpression expr) {
- if (expr.type_reference.data_type != null
- && expr.type_reference.data_type.is_subtype_of (gtypeinstance_type)
- && expr.type_reference.data_type != gtypeinstance_type) {
+ var cl = expr.type_reference.data_type as Class;
+ var iface = expr.type_reference.data_type as Interface;
+ if (iface != null || (cl != null && !cl.is_compact)) {
// checked cast for strict subtypes of GTypeInstance
if (expr.is_silent_cast) {
var ccomma = new CCodeCommaExpression ();
@@ -3436,9 +3434,9 @@ public class Vala.CCodeGenerator : CodeGenerator {
return cexpr;
}
- if (context.checking && target_type.data_type != null
- && target_type.data_type.is_subtype_of (gtypeinstance_type)
- && target_type.data_type != gtypeinstance_type) {
+ var cl = target_type.data_type as Class;
+ var iface = target_type.data_type as Interface;
+ if (context.checking && (iface != null || (cl != null && !cl.is_compact))) {
// checked cast for strict subtypes of GTypeInstance
return new InstanceCast (cexpr, target_type.data_type);
} else if (target_type.data_type != null && expression_type.get_cname () != target_type.get_cname ()) {
diff --git a/gobject/valaccodememberaccessbinding.vala b/gobject/valaccodememberaccessbinding.vala
index 83126df10..db4b97a91 100644
--- a/gobject/valaccodememberaccessbinding.vala
+++ b/gobject/valaccodememberaccessbinding.vala
@@ -86,7 +86,8 @@ public class Vala.CCodeMemberAccessBinding : CCodeExpressionBinding {
var instance_target_type = codegen.get_data_type_for_symbol ((Typesymbol) f.parent_symbol);
CCodeExpression typed_inst = codegen.get_implicit_cast_expression (pub_inst, instance_expression_type, instance_target_type);
- bool is_gtypeinstance = (instance_target_type.data_type.is_subtype_of (codegen.gtypeinstance_type));
+ var cl = instance_target_type.data_type as Class;
+ bool is_gtypeinstance = (cl == null || !cl.is_compact);
CCodeExpression inst;
if (is_gtypeinstance && f.access == SymbolAccessibility.PRIVATE) {
diff --git a/gobject/valaccodemethodbinding.vala b/gobject/valaccodemethodbinding.vala
index 4dca49812..e98b52896 100644
--- a/gobject/valaccodemethodbinding.vala
+++ b/gobject/valaccodemethodbinding.vala
@@ -60,9 +60,9 @@ public class Vala.CCodeMethodBinding : CCodeBinding {
if (m is CreationMethod) {
codegen.in_creation_method = true;
var cl = codegen.current_type_symbol as Class;
- if (cl != null && cl.is_subtype_of (codegen.gtypeinstance_type)) {
+ if (cl != null && !cl.is_compact) {
in_gtypeinstance_creation_method = true;
- if (cl.base_class == codegen.gtypeinstance_type) {
+ if (cl.base_class == null) {
in_fundamental_creation_method = true;
} else if (cl.is_subtype_of (codegen.gobject_type)) {
in_gobject_creation_method = true;
@@ -785,7 +785,7 @@ public class Vala.CCodeMethodBinding : CCodeBinding {
private Class find_fundamental_class (Class cl) {
var fundamental_class = cl;
- while (fundamental_class != null && fundamental_class.base_class != codegen.gtypeinstance_type) {
+ while (fundamental_class != null && fundamental_class.base_class != null) {
fundamental_class = fundamental_class.base_class;
}
return fundamental_class;
diff --git a/gobject/valatyperegisterfunction.vala b/gobject/valatyperegisterfunction.vala
index f2edaa0a8..72058beba 100644
--- a/gobject/valatyperegisterfunction.vala
+++ b/gobject/valatyperegisterfunction.vala
@@ -36,7 +36,7 @@ public abstract class Vala.TypeRegisterFunction : Object {
public void init_from_type (bool plugin = false) {
bool fundamental = false;
Class cl = get_type_declaration () as Class;
- if (cl != null && cl.base_class != null && cl.base_class.name == "TypeInstance" && cl.base_class.parent_symbol.name == "GLib") {
+ if (cl != null && !cl.is_compact && cl.base_class == null) {
fundamental = true;
}
diff --git a/tests/classes.exp b/tests/classes.exp
index c416ffb30..795410563 100644
--- a/tests/classes.exp
+++ b/tests/classes.exp
@@ -1,13 +1,13 @@
Classes Test:
-new SimpleClass ()
+new CompactClass ()
new DerivedClass ()
new PublicClass ()
new ClassWithCreationMethod ()
ClassWithCreationMethod
new ClassWithNamedCreationMethod ()
ClassWithNamedCreationMethod
-new ClassWithDestructor ()
-~ClassWithDestructor
+new CompactClassWithDestructor ()
+~CompactClassWithDestructor
new SimpleGTypeInstanceClass ()
new DerivedGTypeInstanceClass ()
new PublicGTypeInstanceClass ()
@@ -20,6 +20,6 @@ new DerivedGObjectClass ()
new PublicGObjectClass ()
new GObjectClassWithCreationMethod ()
new GObjectClassWithNamedCreationMethod ()
-new SimpleClass () { field = 1 }
-simple_class.field = 1
+new CompactClass () { field = 1 }
+compact_class.field = 1
.
diff --git a/tests/classes.vala b/tests/classes.vala
index 674c2dadd..a89f475e6 100644
--- a/tests/classes.vala
+++ b/tests/classes.vala
@@ -1,29 +1,34 @@
using GLib;
-class SimpleClass {
+[Compact]
+class CompactClass {
public int field;
}
-class ClassWithDestructor {
- ~ClassWithDestructor () {
- stdout.printf ("~ClassWithDestructor\n");
+[Compact]
+class CompactClassWithDestructor {
+ ~CompactClassWithDestructor () {
+ stdout.printf ("~CompactClassWithDestructor\n");
}
/* FIXME bug 533977 */
public char dummy;
}
-class DerivedClass : SimpleClass {
+class DerivedClass : CompactClass {
}
+[Compact]
public class PublicClass {
public int field;
}
+[Compact]
abstract class AbstractClass {
public int field;
}
+[Compact]
class ClassWithCreationMethod {
public ClassWithCreationMethod () {
stdout.printf ("ClassWithCreationMethod\n");
@@ -32,6 +37,7 @@ class ClassWithCreationMethod {
public int field;
}
+[Compact]
class ClassWithNamedCreationMethod {
public ClassWithNamedCreationMethod.named () {
stdout.printf ("ClassWithNamedCreationMethod\n");
@@ -40,22 +46,22 @@ class ClassWithNamedCreationMethod {
public int field;
}
-class SimpleGTypeInstanceClass : TypeInstance {
+class SimpleGTypeInstanceClass {
}
class DerivedGTypeInstanceClass : SimpleGTypeInstanceClass {
}
-public class PublicGTypeInstanceClass : TypeInstance {
+public class PublicGTypeInstanceClass {
}
-class GTypeInstanceClassWithCreationMethod : TypeInstance {
+class GTypeInstanceClassWithCreationMethod {
public GTypeInstanceClassWithCreationMethod () {
stdout.printf ("GTypeInstanceClassWithCreationMethod\n");
}
}
-class GTypeInstanceClassWithNamedCreationMethod : TypeInstance {
+class GTypeInstanceClassWithNamedCreationMethod {
public GTypeInstanceClassWithNamedCreationMethod.named () {
stdout.printf ("GTypeInstanceClassWithNamedCreationMethod\n");
}
@@ -86,8 +92,8 @@ class GObjectClassWithNamedCreationMethod : Object {
void main () {
stdout.printf ("Classes Test:\n");
- stdout.printf ("new SimpleClass ()\n");
- var simple_class = new SimpleClass ();
+ stdout.printf ("new CompactClass ()\n");
+ var compact_class = new CompactClass ();
stdout.printf ("new DerivedClass ()\n");
var derived_class = new DerivedClass ();
stdout.printf ("new PublicClass ()\n");
@@ -96,9 +102,9 @@ void main () {
var class_with_creation_method = new ClassWithCreationMethod ();
stdout.printf ("new ClassWithNamedCreationMethod ()\n");
var class_with_named_creation_method = new ClassWithNamedCreationMethod.named ();
- stdout.printf ("new ClassWithDestructor ()\n");
- var class_with_destructor = new ClassWithDestructor ();
- class_with_destructor = null;
+ stdout.printf ("new CompactClassWithDestructor ()\n");
+ var compact_class_with_destructor = new CompactClassWithDestructor ();
+ compact_class_with_destructor = null;
stdout.printf ("new SimpleGTypeInstanceClass ()\n");
var simple_gtypeinstance_class = new SimpleGTypeInstanceClass ();
@@ -122,9 +128,9 @@ void main () {
stdout.printf ("new GObjectClassWithNamedCreationMethod ()\n");
var gobject_class_with_named_creation_method = new GObjectClassWithNamedCreationMethod.named ();
- stdout.printf ("new SimpleClass () { field = 1 }\n");
- simple_class = new SimpleClass () { field = 1 };
- stdout.printf ("simple_class.field = %d\n", simple_class.field);
+ stdout.printf ("new CompactClass () { field = 1 }\n");
+ compact_class = new CompactClass () { field = 1 };
+ stdout.printf ("compact_class.field = %d\n", compact_class.field);
stdout.printf (".\n");
}
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index c9522d3cf..3f0276064 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -45,6 +45,23 @@ public class Vala.Class : Typesymbol {
public bool is_static { get; set; }
/**
+ * Instances of compact classes are fast to create and have a
+ * compact memory layout. Compact classes don't support runtime
+ * type information or virtual methods.
+ */
+ public bool is_compact {
+ get {
+ if (base_class != null) {
+ return base_class.is_compact;
+ }
+ return _is_compact;
+ }
+ set {
+ _is_compact = value;
+ }
+ }
+
+ /**
* Specifies whether this class has private fields.
*/
public bool has_private_fields { get; private set; }
@@ -53,7 +70,6 @@ public class Vala.Class : Typesymbol {
private string const_cname;
private string lower_case_cprefix;
private string lower_case_csuffix;
- private bool has_type_id;
private string type_id;
private string ref_function;
private string unref_function;
@@ -63,6 +79,7 @@ public class Vala.Class : Typesymbol {
private string get_value_function;
private string set_value_function;
private string? type_signature;
+ private bool _is_compact;
private Gee.List<TypeParameter> type_parameters = new ArrayList<TypeParameter> ();
@@ -498,9 +515,6 @@ public class Vala.Class : Typesymbol {
if (a.has_argument ("free_function")) {
set_free_function (a.get_string ("free_function"));
}
- if (a.has_argument ("has_type_id")) {
- has_type_id = a.get_bool ("has_type_id");
- }
if (a.has_argument ("type_id")) {
type_id = a.get_string ("type_id");
}
@@ -546,17 +560,15 @@ public class Vala.Class : Typesymbol {
process_ccode_attribute (a);
} else if (a.name == "ErrorBase") {
is_error_base = true;
+ } else if (a.name == "Compact") {
+ is_compact = true;
}
}
}
- private bool get_has_type_id () {
- return has_type_id || (base_class != null && base_class.get_has_type_id ());
- }
-
public override string? get_type_id () {
if (type_id == null) {
- if (get_has_type_id ()) {
+ if (!is_compact) {
type_id = get_upper_case_cname ("TYPE_");
} else {
type_id = "G_TYPE_POINTER";
@@ -611,9 +623,7 @@ public class Vala.Class : Typesymbol {
}
bool is_fundamental () {
- if (base_class != null
- && base_class.name == "TypeInstance"
- && base_class.parent_symbol.name == "GLib") {
+ if (!is_compact && base_class == null) {
return true;
}
return false;
diff --git a/vala/valainterfacewriter.vala b/vala/valainterfacewriter.vala
index 940b2edaf..78a3b34f4 100644
--- a/vala/valainterfacewriter.vala
+++ b/vala/valainterfacewriter.vala
@@ -92,7 +92,13 @@ public class Vala.InterfaceWriter : CodeVisitor {
if (!check_accessibility (cl)) {
return;
}
-
+
+ if (cl.is_compact) {
+ write_indent ();
+ write_string ("[Compact]");
+ write_newline ();
+ }
+
write_indent ();
write_string ("[CCode (");
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index b619f9175..c6a472026 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -544,6 +544,7 @@ public enum UnicodeBreakType {
HANGUL_LVT_SYLLABLE
}
+[Compact]
[CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", type_signature = "s")]
public class string {
[CCode (cname = "strstr")]
@@ -692,12 +693,12 @@ namespace GLib {
public uint instance_size;
}
+ // deprecated
[CCode (has_type_id = true)]
public class TypeInstance {
- [CCode (cname = "G_TYPE_FROM_INSTANCE")]
- public Type get_type ();
}
+ [Compact]
[CCode (ref_function = "g_type_class_ref", unref_function = "g_type_class_unref")]
public class TypeClass {
[CCode (cname = "G_TYPE_FROM_CLASS")]
@@ -715,6 +716,7 @@ namespace GLib {
public interface TypePlugin {
}
+ [Compact]
public class TypeModule : TypePlugin {
public bool use ();
public void unuse ();
@@ -722,8 +724,7 @@ namespace GLib {
}
[CCode (ref_function = "g_param_spec_ref", unref_function = "g_param_spec_unref")]
- public class ParamSpec : TypeInstance {
- public TypeInstance g_type_instance;
+ public class ParamSpec {
public string name;
public ParamFlags flags;
public Type value_type;
@@ -798,6 +799,7 @@ namespace GLib {
public weak EnumValue? get_value_by_nick (string name);
}
+ [Compact]
public class EnumValue {
public int value;
public weak string value_name;
@@ -811,12 +813,14 @@ namespace GLib {
public weak FlagsValue? get_value_by_nick (string name);
}
+ [Compact]
public class FlagsValue {
public int value;
public weak string value_name;
public weak string value_nick;
}
+ [Compact]
[CCode (cname = "gpointer", has_type_id = true, type_id = "G_TYPE_BOXED", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed")]
public abstract class Boxed {
}
@@ -917,6 +921,7 @@ namespace GLib {
public static delegate void Callback ();
+ [Compact]
public class Closure : Boxed {
}
@@ -1104,7 +1109,8 @@ namespace GLib {
}
/* The Main Event Loop */
-
+
+ [Compact]
[CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref")]
public class MainLoop {
public MainLoop (MainContext? context, bool is_running);
@@ -1121,7 +1127,8 @@ namespace GLib {
DEFAULT_IDLE,
LOW
}
-
+
+ [Compact]
[CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref")]
public class MainContext {
public MainContext ();
@@ -1195,7 +1202,8 @@ namespace GLib {
public IOCondition events;
public IOCondition revents;
}
-
+
+ [Compact]
[CCode (ref_function = "g_source_ref", unref_function = "g_source_unref")]
public class Source {
public Source (SourceFuncs source_funcs, uint struct_size /* = sizeof (Source) */);
@@ -1226,6 +1234,7 @@ namespace GLib {
public static delegate bool SourceDispatchFunc (Source source, SourceFunc _callback);
public static delegate void SourceFinalizeFunc (Source source);
+ [Compact]
public class SourceFuncs {
public SourcePrepareFunc prepare;
public SourceCheckFunc check;
@@ -1237,6 +1246,7 @@ namespace GLib {
public static delegate void SourceCallbackUnrefFunc (void* cb_data);
public static delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func);
+ [Compact]
public class SourceCallbackFuncs {
public SourceCallbackRefFunc @ref;
public SourceCallbackUnrefFunc unref;
@@ -1250,6 +1260,7 @@ namespace GLib {
}
/* Thread support */
+ [Compact]
public class ThreadFunctions {
}
@@ -1263,6 +1274,7 @@ namespace GLib {
URGENT
}
+ [Compact]
public class Thread {
public static void init (ThreadFunctions? vtable = null);
public static bool supported ();
@@ -1279,6 +1291,7 @@ namespace GLib {
public static void usleep (ulong microseconds);
}
+ [Compact]
[CCode (free_function = "g_mutex_free")]
public class Mutex {
public Mutex ();
@@ -1296,6 +1309,7 @@ namespace GLib {
public void lock_full ();
}
+ [Compact]
[CCode (free_function = "g_cond_free")]
public class Cond {
public Cond ();
@@ -1306,7 +1320,8 @@ namespace GLib {
}
/* Thread Pools */
-
+
+ [Compact]
[CCode (free_function = "g_thread_pool_free")]
public class ThreadPool {
public ThreadPool (Func func, void* user_data, int max_threads, bool exclusive) throws ThreadError;
@@ -1325,7 +1340,8 @@ namespace GLib {
}
/* Asynchronous Queues */
-
+
+ [Compact]
[CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")]
public class AsyncQueue {
public AsyncQueue ();
@@ -1374,7 +1390,8 @@ namespace GLib {
}
/* IO Channels */
-
+
+ [Compact]
[CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref")]
public class IOChannel : Boxed {
[CCode (cname = "g_io_channel_unix_new")]
@@ -1465,6 +1482,7 @@ namespace GLib {
/* Error Reporting */
+ [Compact]
[ErrorBase]
[CCode (copy_function = "g_error_copy", free_function = "g_error_free")]
public class Error {
@@ -1602,6 +1620,7 @@ namespace GLib {
public ssize_t get_length ();
}
+ [Compact]
[CCode (free_function = "g_checksum_free")]
public class Checksum {
public Checksum (ChecksumType checksum_type);
@@ -1769,7 +1788,8 @@ namespace GLib {
}
/* Random Numbers */
-
+
+ [Compact]
[CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")]
public class Rand {
public Rand.with_seed (uint32 seed);
@@ -1884,6 +1904,7 @@ namespace GLib {
/* Lexical Scanner */
+ [Compact]
[CCode (free_function = "g_scanner_destroy")]
public class Scanner {
public Scanner (ScannerConfig config_templ);
@@ -2012,6 +2033,7 @@ namespace GLib {
/* Timers */
+ [Compact]
[CCode (free_function = "g_timer_destroy")]
public class Timer {
public Timer ();
@@ -2155,6 +2177,7 @@ namespace GLib {
EXISTS
}
+ [Compact]
[CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
public class FileStream {
[CCode (cname = "fopen")]
@@ -2205,6 +2228,7 @@ namespace GLib {
public struct Stat {
}
+ [Compact]
[CCode (free_function = "g_dir_close")]
public class Dir {
public static Dir open (string filename, uint _flags = 0) throws FileError;
@@ -2220,7 +2244,8 @@ namespace GLib {
[CCode (cname = "mkdtemp")]
public static weak string mkdtemp (string template);
}
-
+
+ [Compact]
[CCode (free_function = "g_mapped_file_free")]
public class MappedFile {
public MappedFile (string filename, bool writable) throws FileError;
@@ -2275,6 +2300,7 @@ namespace GLib {
FAILED
}
+ [Compact]
[CCode (free_function = "g_option_context_free")]
public class OptionContext {
public OptionContext (string parameter_string);
@@ -2335,6 +2361,7 @@ namespace GLib {
public weak string arg_description;
}
+ [Compact]
[CCode (free_function = "g_option_group_free")]
public class OptionGroup {
public OptionGroup (string name, string description, string help_description, void* user_data, DestroyNotify? destroy);
@@ -2389,6 +2416,7 @@ namespace GLib {
NEWLINE_ANY
}
+ [Compact]
[CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref")]
public class Regex : Boxed {
public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError;
@@ -2416,6 +2444,7 @@ namespace GLib {
public static delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result, void* user_data);
+ [Compact]
[CCode (free_function = "g_match_info_free")]
public class MatchInfo {
public weak Regex get_regex ();
@@ -2448,7 +2477,8 @@ namespace GLib {
public enum MarkupParseFlags {
TREAT_CDATA_AS_TEXT
}
-
+
+ [Compact]
[CCode (free_function = "g_markup_parse_context_free")]
public class MarkupParseContext {
public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify);
@@ -2493,6 +2523,7 @@ namespace GLib {
INVALID_VALUE
}
+ [Compact]
[CCode (free_function = "g_key_file_free")]
public class KeyFile {
public KeyFile ();
@@ -2551,6 +2582,7 @@ namespace GLib {
/* Bookmark file parser */
+ [Compact]
[CCode (free_function = "g_bookmark_file_free")]
public class BookmarkFile {
public BookmarkFile ();
@@ -2652,7 +2684,8 @@ namespace GLib {
}
/* Doubly-Linked Lists */
-
+
+ [Compact]
[CCode (dup_function = "g_list_copy", free_function = "g_list_free")]
public class List<G> {
[ReturnsModifiedPointer ()]
@@ -2705,7 +2738,8 @@ namespace GLib {
}
/* Singly-Linked Lists */
-
+
+ [Compact]
[CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")]
public class SList<G> {
[ReturnsModifiedPointer ()]
@@ -2762,7 +2796,8 @@ namespace GLib {
public static GLib.CompareFunc strcmp;
/* Double-ended Queues */
-
+
+ [Compact]
[CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")]
public class Queue<G> {
public weak List<G> head;
@@ -2797,6 +2832,7 @@ namespace GLib {
/* Sequences */
+ [Compact]
[CCode (free_function = "g_sequence_free")]
public class Sequence<G> {
public Sequence (DestroyNotify? data_destroy);
@@ -2827,6 +2863,7 @@ namespace GLib {
public static weak SequenceIter<G> range_get_midpoint (SequenceIter<G> begin, SequenceIter<G> end);
}
+ [Compact]
[CCode (ref_function = "", unref_function = "")]
public class SequenceIter<G> {
public bool is_begin ();
@@ -2842,7 +2879,8 @@ namespace GLib {
public delegate int SequenceIterCompareFunc<G> (SequenceIter<G> a, SequenceIter<G> b);
/* Hash Tables */
-
+
+ [Compact]
[CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref")]
public class HashTable<K,V> : Boxed {
public HashTable (HashFunc hash_func, EqualFunc key_equal_func);
@@ -2886,6 +2924,7 @@ namespace GLib {
/* Strings */
+ [Compact]
[CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
public class StringBuilder : Boxed {
public StringBuilder (string init = "");
@@ -2914,19 +2953,22 @@ namespace GLib {
}
/* Pointer Arrays */
-
+
+ [Compact]
[CCode (free_function = "g_ptr_array_free")]
public class PtrArray {
}
/* Byte Arrays */
+ [Compact]
[CCode (free_function = "g_byte_array_free")]
public class ByteArray {
}
/* N-ary Trees */
+ [Compact]
[CCode (free_function = "g_node_destroy")]
public class Node<G> {
public G data;
@@ -2965,7 +3007,8 @@ namespace GLib {
public delegate void DataForeachFunc<G> (Quark key_id, G data);
/* GArray */
-
+
+ [Compact]
public class Array<G> {
public Array (bool zero_terminated, bool clear, uint element_size);
[CCode (cname = "g_array_sized_new")]
@@ -3006,7 +3049,8 @@ namespace GLib {
POST_ORDER,
LEVEL_ORDER
}
-
+
+ [Compact]
[CCode (free_function = "g_tree_destroy")]
public class Tree<K,V> {
public Tree (CompareFunc key_compare_func);
@@ -3120,6 +3164,7 @@ namespace GLib {
UNBLOCKED
}
+ [Compact]
public class PatternSpec {
public PatternSpec (string pattern);
public void free ();