]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Emit GType definition for error domains
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 17 Nov 2018 21:22:03 +0000 (22:22 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 24 Feb 2022 18:59:24 +0000 (19:59 +0100)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/699

46 files changed:
codegen/Makefile.am
codegen/valaccode.vala
codegen/valaccodeattribute.vala
codegen/valaerrordomainregisterfunction.vala [new file with mode: 0644]
codegen/valagerrormodule.vala
codegen/valagirwriter.vala
codegen/valagtypemodule.vala
codegen/valatyperegisterfunction.vala
tests/asynchronous/bug793158.c-expected
tests/asynchronous/catch-error-scope.c-expected
tests/asynchronous/catch-in-finally.c-expected
tests/asynchronous/out-parameter-free-on-error.c-expected
tests/basic-types/default-gtype.c-expected
tests/control-flow/bug764440.c-expected
tests/control-flow/lock-if-throw.c-expected
tests/dbus/errors_client.c-expected
tests/dbus/errors_server.c-expected
tests/delegates/error-pos.c-expected
tests/delegates/params-array-with-throws.c-expected
tests/delegates/variadic.c-expected
tests/errors/bug567181.c-expected
tests/errors/bug579101.c-expected
tests/errors/bug623049.c-expected
tests/errors/bug778224.c-expected
tests/errors/catch-error-code.c-expected
tests/errors/catch-in-finally.c-expected
tests/errors/default-gtype.c-expected
tests/errors/delegate-throws-error-code.c-expected
tests/errors/errorcode.c-expected
tests/errors/errordomain-static-method.c-expected
tests/errors/errordomain.c-expected
tests/errors/errors.c-expected
tests/errors/loops.c-expected
tests/errors/method-throws-error-code.c-expected
tests/errors/unhandled.c-expected
tests/genie/exception.c-expected
tests/girwriter/GirTest-1.0.gir-expected
tests/girwriter/girtest.vala
tests/girwriter/girtest.vapi-expected
tests/girwriter/girtest.vapigen-expected
tests/methods/bug781061.c-expected
tests/methods/parameter-out-free-on-error.c-expected
tests/methods/params-array-with-throws.c-expected
tests/methods/print-attribute.c-expected
tests/objects/signals-error-marshal.c-expected
vala/valaerrorcode.vala

index c7fc9134143ae3d8c844393a2c7dbfb1f6845d9c..b786e66ec112dbb5be97ad4f38c22ba1483424d8 100644 (file)
@@ -40,6 +40,7 @@ libvalaccodegen_la_VALASOURCES = \
        valaclassregisterfunction.vala \
        valactype.vala \
        valaenumregisterfunction.vala \
+       valaerrordomainregisterfunction.vala \
        valagasyncmodule.vala \
        valagdbusclientmodule.vala \
        valagdbusmodule.vala \
index 80e0f1c0f7c4d3678dd9f195484d8d9b0cbf310f..25a0d11af9e642d3f37d6eadd8bbd448d9630b3b 100644 (file)
@@ -237,7 +237,7 @@ namespace Vala {
        }
 
        public static string get_ccode_type_function (TypeSymbol sym) {
-               assert (!((sym is Class && ((Class) sym).is_compact) || sym is ErrorCode || sym is ErrorDomain || sym is Delegate));
+               assert (!((sym is Class && ((Class) sym).is_compact) || sym is ErrorCode || sym is Delegate));
                return "%s_get_type".printf (get_ccode_lower_case_name (sym));
        }
 
index bd4c6b29d8648de699f784af6bf7dd3d149156c8..3c3b18ef43a0575871a2648b098330c657c3ff11 100644 (file)
@@ -1073,6 +1073,13 @@ public class Vala.CCodeAttribute : AttributeCache {
                                } else {
                                        return en.is_flags ? "G_TYPE_UINT" : "G_TYPE_INT";
                                }
+                       } else if (sym is ErrorDomain) {
+                               unowned ErrorDomain edomain = (ErrorDomain) sym;
+                               if (get_ccode_has_type_id (edomain)) {
+                                       return get_ccode_upper_case_name (edomain, "TYPE_");
+                               } else {
+                                       return "G_TYPE_ERROR";
+                               }
                        } else {
                                return "G_TYPE_POINTER";
                        }
@@ -1199,7 +1206,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                                return get_ccode_lower_case_name (cl, "value_get_");
                        } else if (cl.base_class != null) {
                                return get_ccode_get_value_function (cl.base_class);
-                       } else if (type_id == "G_TYPE_POINTER") {
+                       } else if (type_id == "G_TYPE_POINTER" || cl.is_error_base) {
                                return "g_value_get_pointer";
                        } else {
                                return "g_value_get_boxed";
@@ -1257,7 +1264,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                                return get_ccode_lower_case_name (cl, "value_set_");
                        } else if (cl.base_class != null) {
                                return get_ccode_set_value_function (cl.base_class);
-                       } else if (type_id == "G_TYPE_POINTER") {
+                       } else if (type_id == "G_TYPE_POINTER" || cl.is_error_base) {
                                return "g_value_set_pointer";
                        } else {
                                return "g_value_set_boxed";
@@ -1315,7 +1322,7 @@ public class Vala.CCodeAttribute : AttributeCache {
                                return get_ccode_lower_case_name (cl, "value_take_");
                        } else if (cl.base_class != null) {
                                return get_ccode_take_value_function (cl.base_class);
-                       } else if (type_id == "G_TYPE_POINTER") {
+                       } else if (type_id == "G_TYPE_POINTER" || cl.is_error_base) {
                                return "g_value_set_pointer";
                        } else {
                                return "g_value_take_boxed";
diff --git a/codegen/valaerrordomainregisterfunction.vala b/codegen/valaerrordomainregisterfunction.vala
new file mode 100644 (file)
index 0000000..b4be329
--- /dev/null
@@ -0,0 +1,51 @@
+/* valaerrordomainregisterfunction.vala
+ *
+ * Copyright (C) 2018  Rico Tzschichholz
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ *     Rico Tzschichholz <ricotz@ubuntu.com>
+ */
+
+using GLib;
+
+/**
+ * C function to register an error domain at runtime.
+ */
+public class Vala.ErrorDomainRegisterFunction : TypeRegisterFunction {
+       /**
+        * Specifies the error domain to be registered.
+        */
+       public weak ErrorDomain error_domain_reference { get; set; }
+
+       /**
+        * Creates a new C function to register the specified error domain at runtime.
+        *
+        * @param edomain an error domain
+        * @return        newly created error domain register function
+        */
+       public ErrorDomainRegisterFunction (ErrorDomain edomain) {
+               error_domain_reference = edomain;
+       }
+
+       public override TypeSymbol get_type_declaration () {
+               return error_domain_reference;
+       }
+
+       public override SymbolAccessibility get_accessibility () {
+               return error_domain_reference.access;
+       }
+}
index a559a4d002dce99a59d4342a1fbed0e70e34c7fd..2b4c6cf85d267035250d17cd02d1478887d7482a 100644 (file)
@@ -56,6 +56,31 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                requires_vala_extern = true;
 
                decl_space.add_function_declaration (cquark_fun);
+               decl_space.add_type_definition (new CCodeNewline ());
+
+               if (!get_ccode_has_type_id (edomain)) {
+                       return;
+               }
+
+               decl_space.add_include ("glib-object.h");
+               decl_space.add_type_declaration (new CCodeNewline ());
+
+               var fun_name = get_ccode_type_function (edomain);
+
+               var macro = "(%s ())".printf (fun_name);
+               decl_space.add_type_declaration (new CCodeMacroReplacement (get_ccode_type_id (edomain), macro));
+
+               var regfun = new CCodeFunction (fun_name, "GType");
+               regfun.modifiers = CCodeModifiers.CONST;
+
+               if (edomain.is_private_symbol ()) {
+                       // avoid C warning as this function is not always used
+                       regfun.modifiers |= CCodeModifiers.STATIC | CCodeModifiers.UNUSED;
+               } else if (context.hide_internal && edomain.is_internal_symbol ()) {
+                       regfun.modifiers |= CCodeModifiers.INTERNAL;
+               }
+
+               decl_space.add_function_declaration (regfun);
        }
 
        public override void visit_error_domain (ErrorDomain edomain) {
index 696c6c8a634b00add6963f602165acb78db64b0b..115d4ff98d8fc50666cd743a4ef9d5b3d11b12ad 100644 (file)
@@ -932,7 +932,11 @@ public class Vala.GIRWriter : CodeVisitor {
 
                write_indent ();
                buffer.append_printf ("<enumeration name=\"%s\"", get_gir_name (edomain));
-               write_ctype_attributes (edomain);
+               if (get_ccode_has_type_id (edomain)) {
+                       write_gtype_attributes (edomain);
+               } else {
+                       write_ctype_attributes (edomain);
+               }
                buffer.append_printf (" glib:error-domain=\"%s\"", get_ccode_quark_name (edomain));
                write_symbol_attributes (edomain);
                buffer.append_printf (">\n");
index 28a29744c04b8ada9edd02cd00735d37231c1135..7bc8eaf8337e44996b52e11286a2034621ee7d30 100644 (file)
@@ -2408,6 +2408,18 @@ public class Vala.GTypeModule : GErrorModule {
                }
        }
 
+       public override void visit_error_domain (ErrorDomain edomain) {
+               base.visit_error_domain (edomain);
+
+               if (get_ccode_has_type_id (edomain)) {
+                       push_line (edomain.source_reference);
+                       var type_fun = new ErrorDomainRegisterFunction (edomain);
+                       type_fun.init_from_type (context, false, false);
+                       cfile.add_type_member_definition (type_fun.get_definition ());
+                       pop_line ();
+               }
+       }
+
        public override void visit_method_call (MethodCall expr) {
                var ma = expr.call as MemberAccess;
                var mtype = expr.call.value_type as MethodType;
index a3236b94c64b332a9ac1074316ee510ff8231438..7502294cb2a5e5b1fbb2960f3b49ea0c24a129fa 100644 (file)
@@ -155,6 +155,8 @@ public abstract class Vala.TypeRegisterFunction {
                        } else {
                                reg_call = new CCodeFunctionCall (new CCodeIdentifier ("g_enum_register_static"));
                        }
+               } else if (type_symbol is ErrorDomain) {
+                       reg_call = new CCodeFunctionCall (new CCodeIdentifier ("g_enum_register_static"));
                } else if (fundamental) {
                        reg_call = new CCodeFunctionCall (new CCodeIdentifier ("g_type_register_fundamental"));
                        reg_call.add_argument (new CCodeFunctionCall (new CCodeIdentifier ("g_type_fundamental_next")));
@@ -203,6 +205,34 @@ public abstract class Vala.TypeRegisterFunction {
 
                        type_init.add_statement (cdecl);
 
+                       reg_call.add_argument (new CCodeIdentifier ("values"));
+               } else if (type_symbol is ErrorDomain) {
+                       unowned ErrorDomain edomain = (ErrorDomain) type_symbol;
+                       var clist = new CCodeInitializerList (); /* or during visit time? */
+
+                       CCodeInitializerList clist_ec = null;
+                       foreach (ErrorCode ec in edomain.get_codes ()) {
+                               clist_ec = new CCodeInitializerList ();
+                               clist_ec.append (new CCodeConstant (get_ccode_name (ec)));
+                               clist_ec.append (new CCodeConstant ("\"%s\"".printf (get_ccode_name (ec))));
+                               clist_ec.append (new CCodeConstant ("\"%s\"".printf (ec.nick)));
+                               clist.append (clist_ec);
+                       }
+
+                       clist_ec = new CCodeInitializerList ();
+                       clist_ec.append (new CCodeConstant ("0"));
+                       clist_ec.append (new CCodeConstant ("NULL"));
+                       clist_ec.append (new CCodeConstant ("NULL"));
+                       clist.append (clist_ec);
+
+                       var edomain_decl = new CCodeVariableDeclarator ("values[]", clist);
+
+                       cdecl = new CCodeDeclaration ("const GEnumValue");
+                       cdecl.add_declarator (edomain_decl);
+                       cdecl.modifiers = CCodeModifiers.STATIC;
+
+                       type_init.add_statement (cdecl);
+
                        reg_call.add_argument (new CCodeIdentifier ("values"));
                } else {
                        reg_call.add_argument (new CCodeIdentifier ("&g_define_type_info"));
index 218575392ca636835e110112b2d9ab79ec9c8fbc..8ad749607cd8787df82116674fb94926099dd72f 100644 (file)
@@ -15,6 +15,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_FOO (foo_get_type ())
 #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
 #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
@@ -38,6 +40,7 @@ typedef enum  {
        FOO_ERROR_BAR
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Foo {
        GObject parent_instance;
        FooPrivate * priv;
@@ -61,6 +64,7 @@ VALA_EXTERN GMainLoop* loop;
 GMainLoop* loop = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 static void foo_bar_data_free (gpointer _data);
@@ -87,6 +91,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static void
 foo_bar_data_free (gpointer _data)
 {
index 289b790294ca5ed9c4f33f947633a566916be233..4f15904f89ae87784814253bee36166d1cade67a 100644 (file)
@@ -2,10 +2,10 @@
  * generated from asynchronous_catch_error_scope.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <gio/gio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <glib-object.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_MSC_VER)
@@ -17,6 +17,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 typedef struct _FooData FooData;
 typedef struct _Block1Data Block1Data;
@@ -30,6 +31,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _FooData {
        int _state_;
        GObject* _source_object_;
@@ -50,6 +52,7 @@ struct _Block1Data {
 };
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 static void foo_data_free (gpointer _data);
 VALA_EXTERN void foo (GAsyncReadyCallback _callback_,
           gpointer _user_data_);
@@ -71,6 +74,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static void
 foo_data_free (gpointer _data)
 {
index 9779a393a15ce327d237d1d906c1875532ccd522..ca37912bb1402d372a70a913f575c32344c6f00e 100644 (file)
@@ -2,8 +2,8 @@
  * generated from asynchronous_catch_in_finally.vala, do not modify */
 
 #include <glib.h>
-#include <gio/gio.h>
 #include <glib-object.h>
+#include <gio/gio.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -17,6 +17,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 typedef struct _FailData FailData;
 typedef struct _MayFailData MayFailData;
 typedef struct _FooData FooData;
@@ -33,6 +34,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _FailData {
        int _state_;
        GObject* _source_object_;
@@ -78,6 +80,7 @@ VALA_EXTERN GMainLoop* loop;
 GMainLoop* loop = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 static void fail_data_free (gpointer _data);
 VALA_EXTERN void fail (GAsyncReadyCallback _callback_,
            gpointer _user_data_);
@@ -131,6 +134,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static void
 fail_data_free (gpointer _data)
 {
index f6468651bdfcb939332ccd1d12d06f412ba02a3c..a4673d0a8e79f9e81a480ef2daea438719ede946 100644 (file)
@@ -15,6 +15,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_MANAM (manam_get_type ())
 #define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
 #define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
@@ -43,6 +45,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Manam {
        GObject parent_instance;
        ManamPrivate * priv;
@@ -82,6 +85,7 @@ VALA_EXTERN GMainLoop* loop;
 GMainLoop* loop = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
 VALA_EXTERN Manam* manam_new (void);
@@ -111,6 +115,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 Manam*
 manam_construct (GType object_type)
 {
index 4d1268f2e6367cd10e0586252b0220e2c1babbd4..995f00be50b6cde3bda5a8ceb31bf93ae4a00e9b 100644 (file)
@@ -35,6 +35,8 @@ typedef enum  {
 
 #define TYPE_FOO_FLAG (foo_flag_get_type ())
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_FOO_STRUCT (foo_struct_get_type ())
 typedef struct _FooStruct FooStruct;
 typedef enum  {
@@ -60,6 +62,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _FooStruct {
        gint i;
 };
@@ -77,6 +80,7 @@ static GType ifoo_get_type_once (void);
 VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType foo_flag_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
 VALA_EXTERN void foo_struct_free (FooStruct* self);
@@ -159,6 +163,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 FooStruct*
 foo_struct_dup (const FooStruct* self)
 {
index b497769964db4224d845127c476ae50922a1e8ad..e5e3b5b8a40eff53a7f8d802de62b781e5f99b16 100644 (file)
@@ -2,6 +2,7 @@
  * generated from control_flow_bug764440.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
 
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 typedef enum  {
        FOO_ERROR_BAR
 } FooError;
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN const gchar* get_bar (GError** error);
 static void _vala_main (void);
 
@@ -30,6 +34,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 const gchar*
 get_bar (GError** error)
 {
index ee259cffcca34d740ff5879f97ef59896b8bd2a1..7912c9826f829b892d7139b185d0cc2c1520f883 100644 (file)
@@ -15,6 +15,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_FOO (foo_get_type ())
 #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
 #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
@@ -32,6 +34,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Foo {
        GTypeInstance parent_instance;
        volatile int ref_count;
@@ -56,6 +59,7 @@ static gint Foo_private_offset;
 static gpointer foo_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN gpointer foo_ref (gpointer instance);
 VALA_EXTERN void foo_unref (gpointer instance);
 VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
@@ -84,6 +88,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static inline gpointer
 foo_get_instance_private (Foo* self)
 {
index 908ddc35c06c9f0b20904c480ef7e248771d24a4..8f1209285f53dd0f4e3e6a126e4fa41d2c9c1abb 100644 (file)
@@ -17,6 +17,8 @@
 #endif
 #endif
 
+#define TYPE_TEST_ERROR (test_error_get_type ())
+
 #define TYPE_TEST (test_get_type ())
 #define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
 #define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
@@ -42,6 +44,7 @@ typedef enum  {
        TEST_ERROR_WORSE
 } TestError;
 #define TEST_ERROR test_error_quark ()
+
 struct _TestIface {
        GTypeInterface parent_iface;
        void (*test_void) (Test* self, GError** error);
@@ -52,6 +55,7 @@ struct _TestIface {
 };
 
 VALA_EXTERN GQuark test_error_quark (void);
+GType test_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN guint test_register_object (void* object,
                             GDBusConnection* connection,
index 3bcdc0c487754d8990e3c0e00b27e62ab32527fd..8406a6eabfbbc2743353b1151192c51813412052 100644 (file)
@@ -17,6 +17,8 @@
 #endif
 #endif
 
+#define TYPE_TEST_ERROR (test_error_get_type ())
+
 #define TYPE_TEST (test_get_type ())
 #define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
 #define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
@@ -47,6 +49,7 @@ typedef enum  {
        TEST_ERROR_WORSE
 } TestError;
 #define TEST_ERROR test_error_quark ()
+
 struct _Test {
        GObject parent_instance;
        TestPrivate * priv;
@@ -61,6 +64,7 @@ VALA_EXTERN GMainLoop* main_loop;
 GMainLoop* main_loop = NULL;
 
 VALA_EXTERN GQuark test_error_quark (void);
+GType test_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN guint test_register_object (void* object,
index 25e92dc3bd1d7aa24318105dc595638e922c1169..1aa5874f1fd85d331f53e6e66dc972682a8a2e47 100644 (file)
@@ -2,9 +2,9 @@
  * generated from delegates_error_pos.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
-#include <glib-object.h>
 #include <gobject/gvaluecollector.h>
 
 #if !defined(VALA_EXTERN)
@@ -17,6 +17,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 typedef gchar* (*FooFunc) (gint i, GError** error, gpointer user_data);
 
 #define TYPE_BAR (bar_get_type ())
@@ -42,6 +43,7 @@ typedef enum  {
        FOO_ERROR_BAR
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Bar {
        GTypeInstance parent_instance;
        volatile int ref_count;
@@ -60,6 +62,7 @@ struct _ParamSpecBar {
 static gpointer bar_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN gpointer bar_ref (gpointer instance);
 VALA_EXTERN void bar_unref (gpointer instance);
 VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
@@ -97,6 +100,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 gchar*
 bar_foo (Bar* self,
          GError** error,
index a006039069e3c84a9007f0358c8e4cef598a4939..68b33b8d71a991b986700bf9f457f1c2ea9d04ab 100644 (file)
@@ -2,6 +2,7 @@
  * generated from delegates_params_array_with_throws.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -15,6 +16,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 typedef void (*FooFunc) (GError** error, const gchar* _first_array, ...);
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
@@ -28,6 +30,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void foo (GError** error,
           gchar* _first_array,
           ...);
@@ -50,6 +53,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAD, "FOO_ERROR_BAD", "bad"}, {FOO_ERROR_WORSE, "FOO_ERROR_WORSE", "worse"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static void
 _vala_array_add1 (const gchar** * array,
                   gint* length,
index ae5d477d6c4f3d1f4f4159bf9448d83d1433a3ea..176dd015e107c0977c3d3c8bef492cf393da3c38 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
+#include <glib-object.h>
 #include <stdarg.h>
 
 #if !defined(VALA_EXTERN)
@@ -18,6 +19,8 @@
 
 typedef void (*FooFunc) (const gchar* first, ...);
 typedef void (*BarFunc) (const gchar* first, ...);
+
+#define TYPE_BAZ_ERROR (baz_error_get_type ())
 typedef void (*BazFunc) (const gchar* first, GError** error, ...);
 #define _g_free0(var) (var = (g_free (var), NULL))
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
@@ -32,6 +35,7 @@ typedef enum  {
 #define BAZ_ERROR baz_error_quark ()
 
 VALA_EXTERN GQuark baz_error_quark (void);
+GType baz_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void foo (const gchar* first,
           ...);
 VALA_EXTERN void baz (const gchar* first,
@@ -49,6 +53,27 @@ baz_error_quark (void)
        return g_quark_from_static_string ("baz-error-quark");
 }
 
+static GType
+baz_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{BAZ_ERROR_BAD, "BAZ_ERROR_BAD", "bad"}, {BAZ_ERROR_WORSE, "BAZ_ERROR_WORSE", "worse"}, {0, NULL, NULL}};
+       GType baz_error_type_id;
+       baz_error_type_id = g_enum_register_static ("BazError", values);
+       return baz_error_type_id;
+}
+
+GType
+baz_error_get_type (void)
+{
+       static volatile gsize baz_error_type_id__once = 0;
+       if (g_once_init_enter (&baz_error_type_id__once)) {
+               GType baz_error_type_id;
+               baz_error_type_id = baz_error_get_type_once ();
+               g_once_init_leave (&baz_error_type_id__once, baz_error_type_id);
+       }
+       return baz_error_type_id__once;
+}
+
 void
 foo (const gchar* first,
      ...)
index db3a661b0649d1fe59e62a1cf37868dcf5daa8ff..6d811473f7524ddf436e3f9a433975bfc55a26dd 100644 (file)
@@ -23,6 +23,8 @@
 
 typedef struct _Foo Foo;
 typedef struct _FooClass FooClass;
+
+#define TYPE_ERROR (error_get_type ())
 typedef struct _FooPrivate FooPrivate;
 enum  {
        FOO_0_PROPERTY,
@@ -39,6 +41,7 @@ typedef enum  {
        ERROR_FOOBAR
 } Error;
 #define ERROR error_quark ()
+
 struct _Foo {
        GObject parent_instance;
        FooPrivate * priv;
@@ -55,6 +58,7 @@ static gpointer foo_parent_class = NULL;
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN GQuark error_quark (void);
+GType error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN Foo* foo_new (GError** error);
 VALA_EXTERN Foo* foo_construct (GType object_type,
                     GError** error);
@@ -69,6 +73,27 @@ error_quark (void)
        return g_quark_from_static_string ("error-quark");
 }
 
+static GType
+error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{ERROR_FOOBAR, "ERROR_FOOBAR", "foobar"}, {0, NULL, NULL}};
+       GType error_type_id;
+       error_type_id = g_enum_register_static ("Error", values);
+       return error_type_id;
+}
+
+GType
+error_get_type (void)
+{
+       static volatile gsize error_type_id__once = 0;
+       if (g_once_init_enter (&error_type_id__once)) {
+               GType error_type_id;
+               error_type_id = error_get_type_once ();
+               g_once_init_leave (&error_type_id__once, error_type_id);
+       }
+       return error_type_id__once;
+}
+
 static gpointer
 _g_object_ref0 (gpointer self)
 {
index a3b312bab8d611f05f6bbb911dbc107e5afaea39..0fac3fdd2e5e9893b1ddab2e790e0c2b2125cadf 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_bug579101.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -15,6 +16,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 #define _g_free0(var) (var = (g_free (var), NULL))
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
@@ -27,6 +29,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void do_foo (gint* i);
 VALA_EXTERN gchar* do_bar (gint* i);
 VALA_EXTERN gchar* do_manam (gint* i);
@@ -38,6 +41,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 void
 do_foo (gint* i)
 {
index 0dc36ff537e65965e0024e84f4813a380ff43555..403ab58afd5acfae00d659aa744d640dc0310a80 100644 (file)
@@ -14,6 +14,8 @@
 #endif
 #endif
 
+#define TYPE_FOO (foo_get_type ())
+
 #define TYPE_CLS_A (cls_a_get_type ())
 #define CLS_A(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLS_A, ClsA))
 #define CLS_A_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLS_A, ClsAClass))
@@ -51,6 +53,7 @@ typedef enum  {
        FOO_BAR
 } Foo;
 #define FOO foo_quark ()
+
 struct _ClsA {
        GObject parent_instance;
        ClsAPrivate * priv;
@@ -73,6 +76,7 @@ static gpointer cls_a_parent_class = NULL;
 static gpointer cls_b_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_quark (void);
+GType foo_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType cls_a_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClsA, g_object_unref)
 VALA_EXTERN ClsA* cls_a_new (GError** error);
@@ -93,6 +97,27 @@ foo_quark (void)
        return g_quark_from_static_string ("foo-quark");
 }
 
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__once = 0;
+       if (g_once_init_enter (&foo_type_id__once)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__once, foo_type_id);
+       }
+       return foo_type_id__once;
+}
+
 ClsA*
 cls_a_construct (GType object_type,
                  GError** error)
index b6203644823b5fd0bd1a0d26a117315efd366be2..1ebb8379a2dc381925cd9dfebecc8487e535a580 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_bug778224.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_MSC_VER)
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 typedef struct _Foo Foo;
 
 typedef enum  {
        FOO_ERROR_BAR
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Foo {
        gint i;
 };
@@ -27,6 +30,7 @@ VALA_EXTERN gboolean true;
 gboolean true = TRUE;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN Foo foo (GError** error);
 static void _vala_main (void);
 
@@ -36,6 +40,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 Foo
 foo (GError** error)
 {
index e5132b73698cc2531a7b786a4b266ea2f76502d1..7fcd6f486c1f8de26d38686e7c8e51856de48f4b 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_catch_error_code.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_MSC_VER)
@@ -13,6 +14,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 typedef enum  {
        FOO_ERROR_BAR,
        FOO_ERROR_FOO
@@ -20,6 +23,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 static void _vala_main (void);
 
 GQuark
@@ -28,6 +32,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {FOO_ERROR_FOO, "FOO_ERROR_FOO", "foo"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static void
 _vala_main (void)
 {
index cecb359e85e09f4f1df597ca9e7c335f8b49e994..fadaeed6da2287f885064357b4537da74760e199 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_catch_in_finally.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -15,6 +16,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
@@ -27,6 +29,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void fail (GError** error);
 VALA_EXTERN void may_fail (GError** error);
 VALA_EXTERN void foo (GError** error);
@@ -39,6 +42,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 void
 fail (GError** error)
 {
index a65b92b1fa601ab40db1dfb3c85d4f6cb388bec7..d38b8aaf23af3ecafc0f36e5765ac4e9ea8b4290 100644 (file)
@@ -14,6 +14,7 @@
 #endif
 #endif
 
+#define TYPE_FOO (foo_get_type ())
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
 #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
@@ -25,6 +26,7 @@ typedef enum  {
 #define FOO foo_quark ()
 
 VALA_EXTERN GQuark foo_quark (void);
+GType foo_get_type (void) G_GNUC_CONST ;
 static void _vala_main (void);
 
 GQuark
@@ -33,6 +35,27 @@ foo_quark (void)
        return g_quark_from_static_string ("foo-quark");
 }
 
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_MANAM, "FOO_MANAM", "manam"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__once = 0;
+       if (g_once_init_enter (&foo_type_id__once)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__once, foo_type_id);
+       }
+       return foo_type_id__once;
+}
+
 static void
 _vala_main (void)
 {
index 5ccd6e4de2f5002114b1f873fcc48a0fbce93f80..fadfb48f83d90f5356255362637287e61e38ee7e 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_delegate_throws_error_code.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_MSC_VER)
@@ -13,6 +14,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 typedef void (*FooFunc) (gpointer user_data, GError** error);
 
 typedef enum  {
@@ -22,6 +24,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 static void _vala_main (void);
 static void __lambda4_ (GError** error);
 static void ___lambda4__foo_func (gpointer self,
@@ -33,6 +36,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FOO, "FOO_ERROR_FOO", "foo"}, {FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static void
 __lambda4_ (GError** error)
 {
index 45c7db84749e5d7ace6656040fd457cfb6a48b51..1e25de2fb39f3d093a450e6d137caceb465966ed 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_errorcode.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <gio/gio.h>
 
 #if !defined(VALA_EXTERN)
@@ -14,6 +15,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
@@ -28,6 +30,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void bar (gint code);
 static void _vala_main (void);
 
@@ -37,6 +40,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_REALLY_BAD, "FOO_ERROR_REALLY_BAD", "really-bad"}, {FOO_ERROR_NOT_SO_GOOD, "FOO_ERROR_NOT_SO_GOOD", "not-so-good"}, {FOO_ERROR_EVEN_WORSE, "FOO_ERROR_EVEN_WORSE", "even-worse"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 void
 bar (gint code)
 {
index f369c2d79cd20dc62cb32989a9dd648dd161a1d2..070ee2e7c60ef2d5a76794a48d855e43a9af50b4 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_errordomain_static_method.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -15,6 +16,7 @@
 #endif
 #endif
 
+#define TYPE_FOO (foo_get_type ())
 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
@@ -27,6 +29,7 @@ typedef enum  {
 #define FOO foo_quark ()
 
 VALA_EXTERN GQuark foo_quark (void);
+GType foo_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GError* foo_from_string (const gchar* _error_);
 static void _vala_main (void);
 
@@ -48,6 +51,27 @@ foo_quark (void)
        return g_quark_from_static_string ("foo-quark");
 }
 
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAD, "FOO_BAD", "bad"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__once = 0;
+       if (g_once_init_enter (&foo_type_id__once)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__once, foo_type_id);
+       }
+       return foo_type_id__once;
+}
+
 static void
 _vala_main (void)
 {
index 3ef447771f63593878c2ca5f6921a67a0f65ae85..51d8a1f069f87cdaf4704b66974c29876e893cd0 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_errordomain.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_MSC_VER)
 #endif
 #endif
 
+#define TYPE_FOO (foo_get_type ())
+
 typedef enum  {
        FOO_BAD
 } Foo;
 #define FOO foo_quark ()
 
 VALA_EXTERN GQuark foo_quark (void);
+GType foo_get_type (void) G_GNUC_CONST ;
 static void _vala_main (void);
 
 GQuark
@@ -27,6 +31,27 @@ foo_quark (void)
        return g_quark_from_static_string ("foo-quark");
 }
 
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAD, "FOO_BAD", "bad"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__once = 0;
+       if (g_once_init_enter (&foo_type_id__once)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__once, foo_type_id);
+       }
+       return foo_type_id__once;
+}
+
 static void
 _vala_main (void)
 {
index 6294d88eaa39b7180e54e44aca9dd1e44735509d..25c46745ad0435a8f1a240621b04831cc1b58f0b 100644 (file)
@@ -17,6 +17,8 @@
 #endif
 #endif
 
+#define TYPE_BAR_ERROR (bar_error_get_type ())
+
 #define TYPE_BAR (bar_get_type ())
 #define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
 #define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
@@ -40,6 +42,7 @@ typedef enum  {
        BAR_ERROR_BAR
 } BarError;
 #define BAR_ERROR bar_error_quark ()
+
 struct _Bar {
        GObject parent_instance;
        BarPrivate * priv;
@@ -52,6 +55,7 @@ struct _BarClass {
 static gpointer bar_parent_class = NULL;
 
 VALA_EXTERN GQuark bar_error_quark (void);
+GType bar_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
 VALA_EXTERN void bar_foo (Bar* self,
@@ -76,6 +80,27 @@ bar_error_quark (void)
        return g_quark_from_static_string ("bar-error-quark");
 }
 
+static GType
+bar_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{BAR_ERROR_FOO, "BAR_ERROR_FOO", "foo"}, {BAR_ERROR_BAR, "BAR_ERROR_BAR", "bar"}, {0, NULL, NULL}};
+       GType bar_error_type_id;
+       bar_error_type_id = g_enum_register_static ("BarError", values);
+       return bar_error_type_id;
+}
+
+GType
+bar_error_get_type (void)
+{
+       static volatile gsize bar_error_type_id__once = 0;
+       if (g_once_init_enter (&bar_error_type_id__once)) {
+               GType bar_error_type_id;
+               bar_error_type_id = bar_error_get_type_once ();
+               g_once_init_leave (&bar_error_type_id__once, bar_error_type_id);
+       }
+       return bar_error_type_id__once;
+}
+
 void
 bar_foo (Bar* self,
          GError** error)
index b85da1cf9bb09dc382890a38b1e7de388e7e1565..e421380133f5e346ec2b7535a642408860dc37e6 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_loops.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -15,6 +16,7 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
 #define _g_free0(var) (var = (g_free (var), NULL))
 
 typedef enum  {
@@ -23,6 +25,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN gchar** get_array (gint* result_length1,
                    GError** error);
 VALA_EXTERN gboolean get_bool (GError** error);
@@ -45,6 +48,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 gchar**
 get_array (gint* result_length1,
            GError** error)
index 1fa8f2be480360d78aeb7f6f52cadcc3fb64b10e..dceef5dfb2facfd5c04734c880707f0cf176f96f 100644 (file)
@@ -2,6 +2,7 @@
  * generated from errors_method_throws_error_code.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_MSC_VER)
@@ -13,6 +14,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 typedef enum  {
        FOO_ERROR_FOO,
        FOO_ERROR_BAR
@@ -20,6 +23,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void foo (GError** error);
 static void _vala_main (void);
 
@@ -29,6 +33,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FOO, "FOO_ERROR_FOO", "foo"}, {FOO_ERROR_BAR, "FOO_ERROR_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 void
 foo (GError** error)
 {
index 6de43da7cfeb15457ad9e0c4eec8067bf2d8e98b..deb2f7f3f12a45ed1b7309c5d1c5ca95eb97b88c 100644 (file)
@@ -16,6 +16,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_FOO (foo_get_type ())
 #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
 #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
@@ -37,6 +39,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Foo {
        GObject parent_instance;
        FooPrivate * priv;
@@ -49,6 +52,7 @@ struct _FooClass {
 static gpointer foo_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN Foo* foo_new (void);
@@ -80,6 +84,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 Foo*
 foo_construct (GType object_type)
 {
index 976e2c57931e51c2c74528616cdf6dd3a3fa35da..d75111d7f223a318d8317803aa6928479bc96b10 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
+#include <glib-object.h>
 
 #if !defined(VALA_EXTERN)
 #if defined(_MSC_VER)
@@ -15,6 +16,7 @@
 #endif
 #endif
 
+#define TYPE_TEST_ERROR (test_error_get_type ())
 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
 typedef enum  {
@@ -27,6 +29,7 @@ typedef enum  {
 static void _vala_main (gchar** args,
                  gint args_length1);
 VALA_EXTERN GQuark test_error_quark (void);
+GType test_error_get_type (void) G_GNUC_CONST ;
 
 static void
 _vala_main (gchar** args,
@@ -53,3 +56,24 @@ test_error_quark (void)
        return g_quark_from_static_string ("test-error-quark");
 }
 
+static GType
+test_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{TEST_ERROR_FAIL, "TEST_ERROR_FAIL", "fail"}, {TEST_ERROR_BAD, "TEST_ERROR_BAD", "bad"}, {TEST_ERROR_WORSE, "TEST_ERROR_WORSE", "worse"}, {0, NULL, NULL}};
+       GType test_error_type_id;
+       test_error_type_id = g_enum_register_static ("TestError", values);
+       return test_error_type_id;
+}
+
+GType
+test_error_get_type (void)
+{
+       static volatile gsize test_error_type_id__once = 0;
+       if (g_once_init_enter (&test_error_type_id__once)) {
+               GType test_error_type_id;
+               test_error_type_id = test_error_get_type_once ();
+               g_once_init_leave (&test_error_type_id__once, test_error_type_id);
+       }
+       return test_error_type_id__once;
+}
+
index 72b408d5a75786a188d785ffdd06a81c9c2e84d3..c308e62a1661de423ba487b76938364da02beaee 100644 (file)
        <bitfield name="RenamedBitfield" c:type="GirTestNamedBitfield" glib:type-name="GirTestNamedBitfield" glib:get-type="gir_test_named_bitfield_get_type">
                <member name="value1" c:identifier="GIR_TEST_NAMED_BITFIELD_VALUE1" value="1"/>
        </bitfield>
-       <enumeration name="ErrorTest" c:type="GirTestErrorTest" glib:error-domain="gir-test-error-test-quark">
+       <enumeration name="ErrorTest" c:type="GirTestErrorTest" glib:type-name="GirTestErrorTest" glib:get-type="gir_test_error_test_get_type" glib:error-domain="gir-test-error-test-quark">
                <member name="failed" c:identifier="GIR_TEST_ERROR_TEST_FAILED" value="0"/>
                <member name="smelly" c:identifier="GIR_TEST_ERROR_TEST_SMELLY" value="1"/>
                <member name="fishy" c:identifier="GIR_TEST_ERROR_TEST_FISHY" value="23"/>
        </enumeration>
-       <enumeration name="RenamedError" c:type="GirTestNamedError" glib:error-domain="gir-test-named-error-quark">
+       <enumeration name="PlainErrorTest" c:type="GirTestPlainErrorTest" glib:error-domain="gir-test-plain-error-test-quark">
+               <member name="failed" c:identifier="GIR_TEST_PLAIN_ERROR_TEST_FAILED" value="0"/>
+               <member name="smelly" c:identifier="GIR_TEST_PLAIN_ERROR_TEST_SMELLY" value="1"/>
+               <member name="fishy" c:identifier="GIR_TEST_PLAIN_ERROR_TEST_FISHY" value="23"/>
+       </enumeration>
+       <enumeration name="RenamedError" c:type="GirTestNamedError" glib:type-name="GirTestNamedError" glib:get-type="gir_test_named_error_get_type" glib:error-domain="gir-test-named-error-quark">
                <member name="failed" c:identifier="GIR_TEST_NAMED_ERROR_FAILED" value="0"/>
        </enumeration>
        <class name="TypeTest" c:type="GirTestTypeTest" c:symbol-prefix="typetest" glib:type-name="GirTestTypeTest" glib:get-type="gir_test_typetest_get_type" glib:type-struct="TypeTestClass" glib:fundamental="1" glib:ref-func="gir_test_typetest_ref" glib:unref-func="gir_test_typetest_unref" glib:set-value-func="gir_test_value_set_typetest" glib:get-value-func="gir_test_value_get_typetest">
index 82d146eccef9dfdf648dbf7edb0cf06a2d911e3b..b2b1073856cb1d266ffb24249afd6c9f024008e1 100644 (file)
@@ -111,6 +111,13 @@ namespace GirTest {
                FISHY = 23
        }
 
+       [CCode (has_type_id = false)]
+       public errordomain PlainErrorTest {
+               FAILED,
+               SMELLY,
+               FISHY = 23
+       }
+
        [GIR (name = "RenamedError")]
        public errordomain NamedError {
                FAILED
index 0350bd8e6e8499c289de472404ca52c111c985d3..578d588dc841ac6cc5469a416146d1ab6d9c838a 100644 (file)
@@ -249,6 +249,12 @@ namespace GirTest {
        public errordomain NamedError {
                FAILED
        }
+       [CCode (cheader_filename = "girtest.h", has_type_id = false)]
+       public errordomain PlainErrorTest {
+               FAILED,
+               SMELLY,
+               FISHY
+       }
        [CCode (cheader_filename = "girtest.h")]
        public delegate bool DelegateErrorTest () throws GirTest.ErrorTest;
        [CCode (cheader_filename = "girtest.h")]
index ad33e3c9686d24ceb6415b5df4b7d4d3afb6bb41..d559fbea0d6e541481f2749abfffac2e5e3645d4 100644 (file)
@@ -251,13 +251,19 @@ namespace GirTest {
        public enum RenamedEnumeration {
                VALUE1
        }
-       [CCode (cheader_filename = "girtest.h", cprefix = "GIR_TEST_ERROR_TEST_")]
+       [CCode (cheader_filename = "girtest.h", cprefix = "GIR_TEST_ERROR_TEST_", type_id = "gir_test_error_test_get_type ()")]
        public errordomain ErrorTest {
                FAILED,
                SMELLY,
                FISHY
        }
-       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedError", cprefix = "GIR_TEST_NAMED_ERROR_")]
+       [CCode (cheader_filename = "girtest.h", cprefix = "GIR_TEST_PLAIN_ERROR_TEST_", has_type_id = false)]
+       public errordomain PlainErrorTest {
+               FAILED,
+               SMELLY,
+               FISHY
+       }
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedError", cprefix = "GIR_TEST_NAMED_ERROR_", type_id = "gir_test_named_error_get_type ()")]
        public errordomain RenamedError {
                FAILED
        }
index 91d787d5e4f71e83b152e4d95d1fd19312f3e838..352fa1e2f082f0661bc910f4c5f5cb89ac2b654a 100644 (file)
@@ -2,6 +2,7 @@
  * generated from methods_bug781061.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 typedef enum  {
        FOO_ERROR_FAILED
 } FooError;
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void print_something_throws (gboolean ok,
                              const gchar* format,
                              GError** error,
@@ -46,6 +50,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAILED, "FOO_ERROR_FAILED", "failed"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 void
 print_something_throws (gboolean ok,
                         const gchar* format,
index db888bd11c1e1c5e5a847a75546865eec340ed73..18e4fcc18e5a48f332ffa55731d98866748c992f 100644 (file)
@@ -14,6 +14,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_MANAM (manam_get_type ())
 #define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
 #define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
@@ -39,6 +41,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Manam {
        GObject parent_instance;
        ManamPrivate * priv;
@@ -51,6 +54,7 @@ struct _ManamClass {
 static gpointer manam_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
 VALA_EXTERN Manam* manam_new (void);
@@ -70,6 +74,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 Manam*
 manam_construct (GType object_type)
 {
index a456b3329d204bab9125630e383586379fde22a6..0d25797cc198bb8807d6a3033ba547b230cea076 100644 (file)
@@ -2,9 +2,9 @@
  * generated from methods_params_array_with_throws.vala, do not modify */
 
 #include <glib.h>
+#include <glib-object.h>
 #include <stdlib.h>
 #include <string.h>
-#include <glib-object.h>
 #include <gobject/gvaluecollector.h>
 
 #if !defined(VALA_EXTERN)
@@ -17,6 +17,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_FOO (foo_get_type ())
 #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
 #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
@@ -39,6 +41,7 @@ typedef enum  {
        FOO_ERROR_WORSE
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Foo {
        GTypeInstance parent_instance;
        volatile int ref_count;
@@ -57,6 +60,7 @@ struct _ParamSpecFoo {
 static gpointer foo_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN void foo (GError** error,
           const gchar* _first_array,
           ...);
@@ -113,6 +117,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAD, "FOO_ERROR_BAD", "bad"}, {FOO_ERROR_WORSE, "FOO_ERROR_WORSE", "worse"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 static void
 _vala_array_add1 (const gchar** * array,
                   gint* length,
index bd627c80918fd1b88fd9d931c98e867de247d093..d3b9ae59e66d358aa4a138fd12ef40ad13f09454 100644 (file)
@@ -17,6 +17,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_FOO (foo_get_type ())
 #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
 #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
@@ -39,6 +41,7 @@ typedef enum  {
        FOO_ERROR_FAIL
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Foo {
        GTypeInstance parent_instance;
        volatile int ref_count;
@@ -57,6 +60,7 @@ struct _ParamSpecFoo {
 static gpointer foo_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN gpointer foo_ref (gpointer instance);
 VALA_EXTERN void foo_unref (gpointer instance);
 VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
@@ -88,6 +92,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_FAIL, "FOO_ERROR_FAIL", "fail"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 void
 foo_foo (Foo* self,
          const gchar* s)
index 35e69052cda99e10dbbcb481913d806abd8b080b..110f63cf438b398b2397b0aef690386f87392566 100644 (file)
@@ -15,6 +15,8 @@
 #endif
 #endif
 
+#define TYPE_FOO_ERROR (foo_error_get_type ())
+
 #define TYPE_BAR (bar_get_type ())
 typedef struct _Bar Bar;
 
@@ -50,6 +52,7 @@ typedef enum  {
        FOO_ERROR_BAD
 } FooError;
 #define FOO_ERROR foo_error_quark ()
+
 struct _Bar {
        gint i;
 };
@@ -66,6 +69,7 @@ struct _FooClass {
 static gpointer foo_parent_class = NULL;
 
 VALA_EXTERN GQuark foo_error_quark (void);
+GType foo_error_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN Bar* bar_dup (const Bar* self);
 VALA_EXTERN void bar_free (Bar* self);
@@ -101,6 +105,27 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+static GType
+foo_error_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ERROR_BAD, "FOO_ERROR_BAD", "bad"}, {0, NULL, NULL}};
+       GType foo_error_type_id;
+       foo_error_type_id = g_enum_register_static ("FooError", values);
+       return foo_error_type_id;
+}
+
+GType
+foo_error_get_type (void)
+{
+       static volatile gsize foo_error_type_id__once = 0;
+       if (g_once_init_enter (&foo_error_type_id__once)) {
+               GType foo_error_type_id;
+               foo_error_type_id = foo_error_get_type_once ();
+               g_once_init_leave (&foo_error_type_id__once, foo_error_type_id);
+       }
+       return foo_error_type_id__once;
+}
+
 Bar*
 bar_dup (const Bar* self)
 {
index 525fb7d556d7e7e68c143b33e83efb9512d59cc8..5fcff75858867c3c488059ed5cd538a8524efc31 100644 (file)
@@ -54,8 +54,24 @@ public class Vala.ErrorCode : TypeSymbol {
                }
        }
 
+       /**
+        * The nick of this error code
+        */
+       public string nick {
+               get {
+                       if (_nick == null) {
+                               _nick = get_attribute_string ("Description", "nick");
+                               if (_nick == null) {
+                                       _nick = name.down ().replace ("_", "-");
+                               }
+                       }
+                       return _nick;
+               }
+       }
+
        private Expression _value;
        private Constant _code;
+       private string? _nick = null;
 
        /**
         * Creates a new enum value.