[vala/0.48] girwriter: Respect GIR.name for constants, errordomains and delegates



commit 3d79c9d6fb9a66078b9e402d2e4dee462f9e1ca6
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Jun 25 08:58:12 2021 +0200

    girwriter: Respect GIR.name for constants, errordomains and delegates
    
    See https://gitlab.gnome.org/GNOME/vala/issues/1196

 codegen/valagirwriter.vala               |   6 +-
 tests/girwriter/GirTest-1.0.gir-expected | 151 +++++++++++++++++++++++++++++++
 tests/girwriter/girtest.vala             |  66 ++++++++++++++
 tests/girwriter/girtest.vapi-expected    |  60 ++++++++++++
 tests/girwriter/girtest.vapigen-expected |  54 +++++++++++
 5 files changed, 334 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 96e9a307e..fd1f45d3b 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -902,7 +902,7 @@ public class Vala.GIRWriter : CodeVisitor {
                }
 
                write_indent ();
-               buffer.append_printf ("<enumeration name=\"%s\"", edomain.name);
+               buffer.append_printf ("<enumeration name=\"%s\"", get_gir_name (edomain));
                write_ctype_attributes (edomain);
                buffer.append_printf (" glib:error-domain=\"%s\"", get_ccode_quark_name (edomain));
                write_symbol_attributes (edomain);
@@ -967,7 +967,7 @@ public class Vala.GIRWriter : CodeVisitor {
                string value = literal_expression_to_value_string (initializer);
 
                write_indent ();
-               buffer.append_printf ("<constant name=\"%s\" c:identifier=\"%s\"", c.name, get_ccode_name 
(c));
+               buffer.append_printf ("<constant name=\"%s\" c:identifier=\"%s\"", get_gir_name (c), 
get_ccode_name (c));
                buffer.append_printf (" value=\"%s\"", value);
                write_symbol_attributes (c);
                buffer.append_printf (">\n");
@@ -1228,7 +1228,7 @@ public class Vala.GIRWriter : CodeVisitor {
                }
 
                write_indent ();
-               buffer.append_printf ("<callback name=\"%s\"", cb.name);
+               buffer.append_printf ("<callback name=\"%s\"", get_gir_name (cb));
                buffer.append_printf (" c:type=\"%s\"", get_ccode_name (cb));
                if (cb.tree_can_fail) {
                        buffer.append_printf (" throws=\"1\"");
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 64fe6bb0e..00f5d9a87 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -31,11 +31,20 @@
        <bitfield name="SkippedFlags" c:type="GirTestSkippedFlags" glib:type-name="GirTestSkippedFlags" 
glib:get-type="gir_test_skipped_flags_get_type" introspectable="0">
                <member name="value1" c:identifier="GIR_TEST_SKIPPED_FLAGS_VALUE1" value="1"/>
        </bitfield>
+       <enumeration name="RenamedEnumeration" c:type="GirTestNamedEnumeration" 
glib:type-name="GirTestNamedEnumeration" glib:get-type="gir_test_named_enumeration_get_type">
+               <member name="value1" c:identifier="GIR_TEST_NAMED_ENUMERATION_VALUE1" value="0"/>
+       </enumeration>
+       <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">
                <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">
+               <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">
                <field name="parent_instance" readable="0" private="1">
                        <type name="GObject.TypeInstance" c:type="GTypeInstance"/>
@@ -1774,6 +1783,41 @@
                </field>
        </record>
        <record name="DeprecatedClassTestPrivate" c:type="GirTestDeprecatedClassTestPrivate" disguised="1"/>
+       <class name="RenamedClass" c:type="GirTestNamedClass" c:symbol-prefix="namedclass" 
glib:type-name="GirTestNamedClass" glib:get-type="gir_test_namedclass_get_type" 
glib:type-struct="RenamedClassClass" glib:fundamental="1" glib:ref-func="gir_test_namedclass_ref" 
glib:unref-func="gir_test_namedclass_unref" glib:set-value-func="gir_test_value_set_namedclass" 
glib:get-value-func="gir_test_value_get_namedclass">
+               <field name="parent_instance" readable="0" private="1">
+                       <type name="GObject.TypeInstance" c:type="GTypeInstance"/>
+               </field>
+               <field name="ref_count">
+                       <type name="gint" c:type="volatile int"/>
+               </field>
+               <field name="priv" readable="0" private="1">
+                       <type name="RenamedClassPrivate" c:type="GirTestNamedClassPrivate*"/>
+               </field>
+               <constructor name="new" c:identifier="gir_test_namedclass_new">
+                       <return-value transfer-ownership="full">
+                               <type name="GirTest.RenamedClass" c:type="GirTestNamedClass*"/>
+                       </return-value>
+               </constructor>
+       </class>
+       <record name="RenamedClassClass" c:type="GirTestNamedClassClass" 
glib:is-gtype-struct-for="RenamedClass">
+               <field name="parent_class" readable="0" private="1">
+                       <type name="GObject.TypeClass" c:type="GTypeClass"/>
+               </field>
+       </record>
+       <record name="RenamedClassPrivate" c:type="GirTestNamedClassPrivate" disguised="1"/>
+       <record name="RenamedCompactClass">
+               <field name="s">
+                       <type name="utf8" c:type="gchar*"/>
+               </field>
+               <field name="i">
+                       <type name="gint" c:type="gint"/>
+               </field>
+               <constructor name="new" c:identifier="gir_test_named_compactclass_new">
+                       <return-value transfer-ownership="full">
+                               <type name="GirTest.RenamedCompactClass" c:type="GirTestNamedCompactClass*"/>
+                       </return-value>
+               </constructor>
+       </record>
        <class name="GenericsTest" c:type="GirTestGenericsTest" c:symbol-prefix="generics_test" 
glib:type-name="GirTestGenericsTest" glib:get-type="gir_test_generics_test_get_type" 
glib:type-struct="GenericsTestClass" glib:fundamental="1" glib:ref-func="gir_test_generics_test_ref" 
glib:unref-func="gir_test_generics_test_unref" glib:set-value-func="gir_test_value_set_generics_test" 
glib:get-value-func="gir_test_value_get_generics_test">
                <field name="parent_instance" readable="0" private="1">
                        <type name="GObject.TypeInstance" c:type="GTypeInstance"/>
@@ -2539,6 +2583,14 @@
                        <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
                </field>
        </record>
+       <interface name="RenamedInterface" c:type="GirTestNamedInterface" c:symbol-prefix="named_interface" 
glib:type-name="GirTestNamedInterface" glib:get-type="gir_test_named_interface_get_type" 
glib:type-struct="RenamedInterfaceIface">
+               <prerequisite name="GObject.Object"/>
+       </interface>
+       <record name="RenamedInterfaceIface" c:type="GirTestNamedInterfaceIface" 
glib:is-gtype-struct-for="RenamedInterface">
+               <field name="parent_iface" readable="0" private="1">
+                       <type name="GObject.TypeInterface" c:type="GTypeInterface"/>
+               </field>
+       </record>
        <interface name="PrerequisiteTest" c:type="GirTestPrerequisiteTest" 
c:symbol-prefix="prerequisite_test" glib:type-name="GirTestPrerequisiteTest" 
glib:get-type="gir_test_prerequisite_test_get_type" glib:type-struct="PrerequisiteTestIface">
                <prerequisite name="GirTest.InterfaceTest"/>
        </interface>
@@ -2602,6 +2654,11 @@
                        <type name="gint" c:type="gint"/>
                </field>
        </record>
+       <record name="RenamedStruct" c:type="GirTestNamedStruct" c:symbol-prefix="named_struct" 
glib:type-name="GirTestNamedStruct" glib:get-type="gir_test_named_struct_get_type">
+               <field name="field_name">
+                       <type name="gint" c:type="gint"/>
+               </field>
+       </record>
        <callback name="DelegateTest" c:type="GirTestDelegateTest">
                <return-value transfer-ownership="full">
                        <type name="gboolean" c:type="gboolean"/>
@@ -2662,11 +2719,105 @@
                        <type name="none" c:type="void"/>
                </return-value>
        </callback>
+       <callback name="RenamedDelegate" c:type="GirTestNamedDelegate">
+               <return-value transfer-ownership="full">
+                       <type name="none" c:type="void"/>
+               </return-value>
+       </callback>
        <constant name="CONSTANT_NUMBER" c:identifier="GIR_TEST_CONSTANT_NUMBER" value="42">
                <type name="gint" c:type="gint"/>
        </constant>
        <constant name="CONSTANT_STRING" c:identifier="GIR_TEST_CONSTANT_STRING" value="const ♥ utf8">
                <type name="utf8" c:type="const gchar*"/>
        </constant>
+       <constant name="RENAMED_CONSTANT" c:identifier="GIR_TEST_NAMED_CONSTANT" value="23">
+               <type name="gint" c:type="gint"/>
+       </constant>
+       <function name="use_renamed_class" c:identifier="gir_test_use_renamed_class">
+               <return-value transfer-ownership="full">
+                       <type name="GirTest.RenamedClass" c:type="GirTestNamedClass*"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none">
+                               <type name="GirTest.RenamedClass" c:type="GirTestNamedClass*"/>
+                       </parameter>
+               </parameters>
+       </function>
+       <function name="use_renamed_compact_class" c:identifier="gir_test_use_renamed_compact_class">
+               <return-value transfer-ownership="none">
+                       <type name="GirTest.RenamedCompactClass" c:type="GirTestNamedCompactClass*"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none">
+                               <type name="GirTest.RenamedCompactClass" c:type="GirTestNamedCompactClass*"/>
+                       </parameter>
+               </parameters>
+       </function>
+       <function name="use_renamed_interface" c:identifier="gir_test_use_renamed_interface">
+               <return-value transfer-ownership="full">
+                       <type name="GirTest.RenamedInterface" c:type="GirTestNamedInterface*"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none">
+                               <type name="GirTest.RenamedInterface" c:type="GirTestNamedInterface*"/>
+                       </parameter>
+               </parameters>
+       </function>
+       <function name="use_renamed_struct" c:identifier="gir_test_use_renamed_struct">
+               <return-value transfer-ownership="full" allow-none="1">
+                       <type name="GirTest.RenamedStruct" c:type="GirTestNamedStruct*"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none">
+                               <type name="GirTest.RenamedStruct" c:type="GirTestNamedStruct"/>
+                       </parameter>
+               </parameters>
+       </function>
+       <function name="use_renamed_enumeration" c:identifier="gir_test_use_renamed_enumeration">
+               <return-value transfer-ownership="full">
+                       <type name="GirTest.RenamedEnumeration" c:type="GirTestNamedEnumeration"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none">
+                               <type name="GirTest.RenamedEnumeration" c:type="GirTestNamedEnumeration"/>
+                       </parameter>
+               </parameters>
+       </function>
+       <function name="use_renamed_flags" c:identifier="gir_test_use_renamed_flags">
+               <return-value transfer-ownership="full">
+                       <type name="GirTest.RenamedBitfield" c:type="GirTestNamedBitfield"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none">
+                               <type name="GirTest.RenamedBitfield" c:type="GirTestNamedBitfield"/>
+                       </parameter>
+               </parameters>
+       </function>
+       <function name="use_renamed_delegate" c:identifier="gir_test_use_renamed_delegate">
+               <return-value transfer-ownership="none" closure="2" scope="call">
+                       <type name="GirTest.RenamedDelegate" c:type="GirTestNamedDelegate"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none" closure="1" scope="call">
+                               <type name="GirTest.RenamedDelegate" c:type="GirTestNamedDelegate"/>
+                       </parameter>
+                       <parameter name="param_target" transfer-ownership="none" allow-none="1">
+                               <type name="gpointer" c:type="void*"/>
+                       </parameter>
+                       <parameter name="result_target" direction="out" transfer-ownership="none" 
allow-none="1">
+                               <type name="gpointer" c:type="void**"/>
+                       </parameter>
+               </parameters>
+       </function>
+       <function name="use_renamed_error" c:identifier="gir_test_use_renamed_error">
+               <return-value transfer-ownership="full">
+                       <type name="GirTest.RenamedError" c:type="GError*"/>
+               </return-value>
+               <parameters>
+                       <parameter name="param" transfer-ownership="none">
+                               <type name="GirTest.RenamedError" c:type="GError*"/>
+                       </parameter>
+               </parameters>
+       </function>
 </namespace>
 </repository>
diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala
index 9d5ed982b..bb01db502 100644
--- a/tests/girwriter/girtest.vala
+++ b/tests/girwriter/girtest.vala
@@ -26,8 +26,15 @@ namespace GirTest {
                public int field_name;
        }
 
+       [GIR (name = "RenamedStruct")]
+       public struct NamedStruct {
+               public int field_name;
+       }
+
        public const int CONSTANT_NUMBER = 42;
        public const string CONSTANT_STRING = "const ♥ utf8";
+       [GIR (name = "RENAMED_CONSTANT")]
+       public const int NAMED_CONSTANT = 23;
 
        public enum EnumTest {
                VALUE1,
@@ -60,12 +67,28 @@ namespace GirTest {
                VALUE1
        }
 
+       [GIR (name = "RenamedEnumeration")]
+       public enum NamedEnumeration {
+               VALUE1
+       }
+
+       [GIR (name = "RenamedBitfield")]
+       [Flags]
+       public enum NamedBitfield {
+               VALUE1
+       }
+
        public errordomain ErrorTest {
                FAILED,
                SMELLY,
                FISHY = 23
        }
 
+       [GIR (name = "RenamedError")]
+       public errordomain NamedError {
+               FAILED
+       }
+
        public interface InterfaceTest : Object {
                public abstract int property { get; construct set; }
                public virtual void int8_in (int8 param) {
@@ -95,6 +118,10 @@ namespace GirTest {
        public interface SkippedInterface {
        }
 
+       [GIR (name = "RenamedInterface")]
+       public interface NamedInterface : Object {
+       }
+
        public delegate bool DelegateTest (void* a, void* b);
 
        public delegate bool DelegateErrorTest () throws ErrorTest;
@@ -104,6 +131,9 @@ namespace GirTest {
        [GIR (visible = false)]
        public delegate void SkippedDelegate ();
 
+       [GIR (name = "RenamedDelegate")]
+       public delegate void NamedDelegate ();
+
        public class TypeTest {
                public string some_property { get; set; }
        }
@@ -336,6 +366,17 @@ namespace GirTest {
        public class DeprecatedClassTest {
        }
 
+       [GIR (name = "RenamedClass")]
+       public class NamedClass {
+       }
+
+       [GIR (name = "RenamedCompactClass")]
+       [Compact]
+       public class NamedCompactClass {
+               public string s;
+               public int i;
+       }
+
        public class GenericsTest<G,T> {
                public GenericsTest (owned DelegateTest cb) {
                }
@@ -356,6 +397,31 @@ namespace GirTest {
                public void function () {
                }
        }
+
+       public NamedClass use_renamed_class (NamedClass param) {
+               return param;
+       }
+       public unowned NamedCompactClass use_renamed_compact_class (NamedCompactClass param) {
+               return param;
+       }
+       public NamedInterface use_renamed_interface (NamedInterface param) {
+               return param;
+       }
+       public NamedStruct? use_renamed_struct (NamedStruct param) {
+               return param;
+       }
+       public NamedEnumeration use_renamed_enumeration (NamedEnumeration param) {
+               return param;
+       }
+       public NamedBitfield use_renamed_flags (NamedBitfield param) {
+               return param;
+       }
+       public unowned NamedDelegate use_renamed_delegate (NamedDelegate param) {
+               return param;
+       }
+       public NamedError use_renamed_error (NamedError param) {
+               return param;
+       }
 }
 
 public enum InvalidEnum {
diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected
index 04b26ab30..c38aa0648 100644
--- a/tests/girwriter/girtest.vapi-expected
+++ b/tests/girwriter/girtest.vapi-expected
@@ -48,6 +48,19 @@ namespace GirTest {
                public ImplementionTest ();
        }
        [CCode (cheader_filename = "girtest.h")]
+       [GIR (name = "RenamedClass")]
+       public class NamedClass {
+               public NamedClass ();
+       }
+       [CCode (cheader_filename = "girtest.h")]
+       [Compact]
+       [GIR (name = "RenamedCompactClass")]
+       public class NamedCompactClass {
+               public int i;
+               public string s;
+               public NamedCompactClass ();
+       }
+       [CCode (cheader_filename = "girtest.h")]
        public class ObjectTest : GLib.Object {
                public int field;
                public int fixed_array_field[23];
@@ -142,6 +155,10 @@ namespace GirTest {
                public signal void some_signal (int param);
        }
        [CCode (cheader_filename = "girtest.h")]
+       [GIR (name = "RenamedInterface")]
+       public interface NamedInterface : GLib.Object {
+       }
+       [CCode (cheader_filename = "girtest.h")]
        public interface PrerequisiteTest : GirTest.InterfaceTest {
        }
        [CCode (cheader_filename = "girtest.h")]
@@ -155,6 +172,11 @@ namespace GirTest {
                public void inv ();
        }
        [CCode (cheader_filename = "girtest.h")]
+       [GIR (name = "RenamedStruct")]
+       public struct NamedStruct {
+               public int field_name;
+       }
+       [CCode (cheader_filename = "girtest.h")]
        [GIR (visible = false)]
        public struct SkippedStruct {
                public int field_name;
@@ -178,6 +200,17 @@ namespace GirTest {
                VALUE2,
                VALUE3
        }
+       [CCode (cheader_filename = "girtest.h")]
+       [Flags]
+       [GIR (name = "RenamedBitfield")]
+       public enum NamedBitfield {
+               VALUE1
+       }
+       [CCode (cheader_filename = "girtest.h")]
+       [GIR (name = "RenamedEnumeration")]
+       public enum NamedEnumeration {
+               VALUE1
+       }
        [CCode (cheader_filename = "girtest.h", has_type_id = false)]
        public enum PlainEnumTest {
                VALUE1,
@@ -202,18 +235,45 @@ namespace GirTest {
                FISHY
        }
        [CCode (cheader_filename = "girtest.h")]
+       [GIR (name = "RenamedError")]
+       public errordomain NamedError {
+               FAILED
+       }
+       [CCode (cheader_filename = "girtest.h")]
        public delegate bool DelegateErrorTest () throws GirTest.ErrorTest;
        [CCode (cheader_filename = "girtest.h")]
        public delegate bool DelegateGenericsTest<G,T> (G g, T t);
        [CCode (cheader_filename = "girtest.h")]
        public delegate bool DelegateTest (void* a, void* b);
        [CCode (cheader_filename = "girtest.h")]
+       [GIR (name = "RenamedDelegate")]
+       public delegate void NamedDelegate ();
+       [CCode (cheader_filename = "girtest.h")]
        [GIR (visible = false)]
        public delegate void SkippedDelegate ();
        [CCode (cheader_filename = "girtest.h")]
        public const int CONSTANT_NUMBER;
        [CCode (cheader_filename = "girtest.h")]
        public const string CONSTANT_STRING;
+       [CCode (cheader_filename = "girtest.h")]
+       [GIR (name = "RENAMED_CONSTANT")]
+       public const int NAMED_CONSTANT;
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.NamedClass use_renamed_class (GirTest.NamedClass param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static unowned GirTest.NamedCompactClass use_renamed_compact_class (GirTest.NamedCompactClass 
param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static unowned GirTest.NamedDelegate use_renamed_delegate (GirTest.NamedDelegate param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.NamedEnumeration use_renamed_enumeration (GirTest.NamedEnumeration param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.NamedError use_renamed_error (GirTest.NamedError param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.NamedBitfield use_renamed_flags (GirTest.NamedBitfield param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.NamedInterface use_renamed_interface (GirTest.NamedInterface param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.NamedStruct? use_renamed_struct (GirTest.NamedStruct param);
 }
 [CCode (cheader_filename = "girtest.h")]
 public enum InvalidEnum {
diff --git a/tests/girwriter/girtest.vapigen-expected b/tests/girwriter/girtest.vapigen-expected
index 35a839f72..f60fe6264 100644
--- a/tests/girwriter/girtest.vapigen-expected
+++ b/tests/girwriter/girtest.vapigen-expected
@@ -138,6 +138,17 @@ namespace GirTest {
                public virtual signal void signal_with_default_handlder (int i1);
                public signal void some_signal (int param);
        }
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedClass", lower_case_csuffix = 
"namedclass", type_id = "gir_test_namedclass_get_type ()")]
+       public class RenamedClass {
+               public int ref_count;
+               [CCode (has_construct_function = false)]
+               public RenamedClass ();
+       }
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedStruct", copy_function = "g_boxed_copy", 
free_function = "g_boxed_free", lower_case_csuffix = "named_struct", type_id = 
"gir_test_named_struct_get_type ()")]
+       [Compact]
+       public class RenamedStruct {
+               public int field_name;
+       }
        [CCode (cheader_filename = "girtest.h", type_id = "gir_test_sub_type_test_get_type ()")]
        public class SubTypeTest : GirTest.TypeTest {
                [CCode (array_length_cname = "array_field_length1")]
@@ -175,12 +186,22 @@ namespace GirTest {
        [CCode (cheader_filename = "girtest.h", type_id = "gir_test_prerequisite_test_get_type ()")]
        public interface PrerequisiteTest : GirTest.InterfaceTest, GLib.Object {
        }
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedInterface", lower_case_csuffix = 
"named_interface", type_id = "gir_test_named_interface_get_type ()")]
+       public interface RenamedInterface : GLib.Object {
+       }
        [CCode (cheader_filename = "girtest.h", copy_function = "g_boxed_copy", free_function = 
"g_boxed_free", type_id = "gir_test_boxed_struct_get_type ()")]
        public struct BoxedStruct {
                public int field_name;
                public void inv ();
        }
        [CCode (cheader_filename = "girtest.h", has_type_id = false)]
+       public struct RenamedCompactClass {
+               public weak string s;
+               public int i;
+               [CCode (cname = "gir_test_named_compactclass_new", has_construct_function = false, type = 
"GirTestNamedCompactClass*")]
+               public RenamedCompactClass ();
+       }
+       [CCode (cheader_filename = "girtest.h", has_type_id = false)]
        public struct Struct {
                public int field_name;
                public void inv ();
@@ -204,20 +225,53 @@ namespace GirTest {
                VALUE2,
                VALUE3
        }
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedBitfield", cprefix = 
"GIR_TEST_NAMED_BITFIELD_", type_id = "gir_test_named_bitfield_get_type ()")]
+       [Flags]
+       public enum RenamedBitfield {
+               VALUE1
+       }
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedEnumeration", cprefix = 
"GIR_TEST_NAMED_ENUMERATION_", type_id = "gir_test_named_enumeration_get_type ()")]
+       public enum RenamedEnumeration {
+               VALUE1
+       }
        [CCode (cheader_filename = "girtest.h", cprefix = "GIR_TEST_ERROR_TEST_")]
        public errordomain ErrorTest {
                FAILED,
                SMELLY,
                FISHY
        }
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedError", cprefix = 
"GIR_TEST_NAMED_ERROR_")]
+       public errordomain RenamedError {
+               FAILED
+       }
        [CCode (cheader_filename = "girtest.h", has_target = false)]
        public delegate bool DelegateErrorTest () throws GirTest.ErrorTest;
        [CCode (cheader_filename = "girtest.h", instance_pos = 8.9)]
        public delegate bool DelegateGenericsTest (GLib.Type g_type, GLib.BoxedCopyFunc g_dup_func, 
GLib.DestroyNotify g_destroy_func, GLib.Type t_type, GLib.BoxedCopyFunc t_dup_func, GLib.DestroyNotify 
t_destroy_func, void* g, void* t);
        [CCode (cheader_filename = "girtest.h", instance_pos = 2.9)]
        public delegate bool DelegateTest (void* a, void* b);
+       [CCode (cheader_filename = "girtest.h", cname = "GirTestNamedDelegate", has_target = false)]
+       public delegate void RenamedDelegate ();
        [CCode (cheader_filename = "girtest.h", cname = "GIR_TEST_CONSTANT_NUMBER")]
        public const int CONSTANT_NUMBER;
        [CCode (cheader_filename = "girtest.h", cname = "GIR_TEST_CONSTANT_STRING")]
        public const string CONSTANT_STRING;
+       [CCode (cheader_filename = "girtest.h", cname = "GIR_TEST_NAMED_CONSTANT")]
+       public const int RENAMED_CONSTANT;
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.RenamedClass use_renamed_class (GirTest.RenamedClass param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static unowned GirTest.RenamedCompactClass? use_renamed_compact_class 
(GirTest.RenamedCompactClass param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static unowned GirTest.RenamedDelegate use_renamed_delegate ([CCode (delegate_target_pos = 
1.5)] GirTest.RenamedDelegate param, out void* result_target);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.RenamedEnumeration use_renamed_enumeration (GirTest.RenamedEnumeration param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.RenamedError use_renamed_error (GirTest.RenamedError param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.RenamedBitfield use_renamed_flags (GirTest.RenamedBitfield param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.RenamedInterface use_renamed_interface (GirTest.RenamedInterface param);
+       [CCode (cheader_filename = "girtest.h")]
+       public static GirTest.RenamedStruct? use_renamed_struct (GirTest.RenamedStruct param);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]