support simple_type attribute in metadata
authorJuerg Billeter <j@bitron.ch>
Tue, 8 Jan 2008 17:26:45 +0000 (17:26 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 8 Jan 2008 17:26:45 +0000 (17:26 +0000)
2008-01-08  Juerg Billeter  <j@bitron.ch>

* vala/valainterfacewriter.vala, vala/valastruct.vala,
  vapigen/valagidlparser.vala: support simple_type attribute in metadata

* vapi/packages/gdk-2.0/gdk-2.0.metadata: mark GdkAtom as simple type

* vapi/gdk-2.0.vapi: regenerated

svn path=/trunk/; revision=808

ChangeLog
vala/valainterfacewriter.vala
vala/valastruct.vala
vapi/gdk-2.0.vapi
vapi/packages/gdk-2.0/gdk-2.0.metadata
vapigen/valagidlparser.vala

index 68106ab..41d77d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-01-08  Jürg Billeter  <j@bitron.ch>
 
+       * vala/valainterfacewriter.vala, vala/valastruct.vala,
+         vapigen/valagidlparser.vala: support simple_type attribute in metadata
+
+       * vapi/packages/gdk-2.0/gdk-2.0.metadata: mark GdkAtom as simple type
+
+       * vapi/gdk-2.0.vapi: regenerated
+
+2008-01-08  Jürg Billeter  <j@bitron.ch>
+
        * vapi/packages/gtk+-2.0/: fix GtkTreeViewDropPosition out parameters
 
        * vapi/gtk+-2.0.vapi: regenerated
index 818dec1..0404f1e 100644 (file)
@@ -1,6 +1,6 @@
 /* valainterfacewriter.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -201,6 +201,12 @@ public class Vala.InterfaceWriter : CodeVisitor {
                write_string ("[CCode (cheader_filename = \"%s\")]".printf (cheaders));
                write_newline ();
 
+               if (st.is_simple_type ()) {
+                       write_indent ();
+                       write_string ("[SimpleType]");
+                       write_newline ();
+               }
+
                write_indent ();
                write_accessibility (st);
                write_string ("struct ");
index c5c3217..036d182 100644 (file)
@@ -1,6 +1,6 @@
 /* valastruct.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2008  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -402,6 +402,14 @@ public class Vala.Struct : Typesymbol {
                return simple_type;
        }
 
+       /**
+        * Marks this struct as simple type, i.e. instances will be passed by
+        * value.
+        */
+       public void set_simple_type (bool simple_type) {
+               this.simple_type = simple_type;
+       }
+
        public override void replace_type (DataType! old_type, DataType! new_type) {
                for (int i = 0; i < base_types.size; i++) {
                        if (base_types[i] == old_type) {
index ea47e54..4c49705 100644 (file)
@@ -1603,6 +1603,7 @@ namespace Gdk {
                public void withdraw ();
        }
        [CCode (cheader_filename = "gdk/gdk.h")]
+       [SimpleType]
        public struct Atom {
                public static Gdk.Atom intern (string atom_name, bool only_if_exists);
                public static Gdk.Atom intern_static_string (string atom_name);
index bef14f3..78436ef 100644 (file)
@@ -1,5 +1,5 @@
 Gdk cheader_filename="gdk/gdk.h"
-GdkAtom is_value_type="1"
+GdkAtom is_value_type="1" simple_type="1"
 gdk_cairo_create transfer_ownership="1"
 GdkColor is_value_type="1"
 gdk_color_parse.color is_out="1"
index 57dcde3..764e099 100644 (file)
@@ -336,6 +336,10 @@ public class Vala.GIdlParser : CodeVisitor {
                                                        if (eval (nv[1]) == "1") {
                                                                return;
                                                        }
+                                               } else if (nv[0] == "simple_type") {
+                                                       if (eval (nv[1]) == "1") {
+                                                               st.set_simple_type (true);
+                                                       }
                                                }
                                        }
                                }