]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Drop C specific methods from the code tree
authorLuca Bruno <lucabru@src.gnome.org>
Wed, 6 Jul 2011 07:56:18 +0000 (09:56 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Mon, 1 Aug 2011 17:09:01 +0000 (19:09 +0200)
40 files changed:
codegen/valaccodeattribute.vala
vala/valaarrayresizemethod.vala
vala/valaarraytype.vala
vala/valaclass.vala
vala/valaclasstype.vala
vala/valaconstant.vala
vala/valacreationmethod.vala
vala/valadatatype.vala
vala/valadelegate.vala
vala/valadelegatetype.vala
vala/valadynamicmethod.vala
vala/valadynamicproperty.vala
vala/valaenum.vala
vala/valaenumvalue.vala
vala/valaerrorcode.vala
vala/valaerrordomain.vala
vala/valaerrortype.vala
vala/valafield.vala
vala/valagenerictype.vala
vala/valainterface.vala
vala/valainterfacetype.vala
vala/valalambdaexpression.vala
vala/valamethod.vala
vala/valamethodtype.vala
vala/valanamespace.vala
vala/valanulltype.vala
vala/valaobjectcreationexpression.vala
vala/valaobjecttype.vala
vala/valaparameter.vala
vala/valapointertype.vala
vala/valaproperty.vala
vala/valapropertyaccessor.vala
vala/valasemanticanalyzer.vala
vala/valasignal.vala
vala/valastruct.vala
vala/valasymbol.vala
vala/valatypesymbol.vala
vala/valavaluetype.vala
vala/valavariable.vala
vala/valavoidtype.vala

index d8a3dd7bafcfe4570f7e690bd0c6a320db261a11..b28e96843f50223a7d9b89fe84d05045fd67b47e 100644 (file)
@@ -593,11 +593,15 @@ public class Vala.CCodeAttribute : AttributeCache {
                } else if (node is ErrorType) {
                        return "GError*";
                } else if (node is GenericType) {
-                       var type = (GenericType) node;
-                       if (type.value_owned) {
-                               return "gpointer";
+                       if (CodeContext.get ().profile == Profile.GOBJECT) {
+                               var type = (GenericType) node;
+                               if (type.value_owned) {
+                                       return "gpointer";
+                               } else {
+                                       return "gconstpointer";
+                               }
                        } else {
-                               return "gconstpointer";
+                               return "void *";
                        }
                } else if (node is MethodType) {
                        return "gpointer";
index ff9bc617325fcde2af09c79410be6974f3bfdc9d..c1008777ef268a71bd0fc0c280c5c6f938e6f40b 100644 (file)
@@ -34,6 +34,6 @@ public class Vala.ArrayResizeMethod : Method {
        public ArrayResizeMethod (SourceReference source_reference) {
                base ("resize", new VoidType (), source_reference);
                external = true;
-               cinstance_parameter_position = 0.1;
+               set_attribute_double ("CCode", "instance_pos", 0.1);
        }
 }
index ed284105fc617dba061a6fb06f9f66025636a07e..4bba50ec351bd1206e34206063b871b0abfc37bc 100644 (file)
@@ -102,7 +102,7 @@ public class Vala.ArrayType : ReferenceType {
                        resize_method.return_type = new VoidType ();
                        resize_method.access = SymbolAccessibility.PUBLIC;
 
-                       resize_method.set_cname ("g_renew");
+                       resize_method.set_attribute_string ("CCode", "cname", "g_renew");
                        
                        var root_symbol = source_reference.file.context.root;
                        var int_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int"));
@@ -121,7 +121,7 @@ public class Vala.ArrayType : ReferenceType {
                        move_method.return_type = new VoidType ();
                        move_method.access = SymbolAccessibility.PUBLIC;
 
-                       move_method.set_cname ("_vala_array_move");
+                       move_method.set_attribute_string ("CCode", "cname", "_vala_array_move");
 
                        var root_symbol = source_reference.file.context.root;
                        var int_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int"));
@@ -148,18 +148,6 @@ public class Vala.ArrayType : ReferenceType {
                return result;
        }
 
-       public override string? get_cname () {
-               if (inline_allocated) {
-                       return element_type.get_cname ();
-               } else {
-                       if (CodeContext.get ().profile == Profile.DOVA) {
-                               return "DovaArray";
-                       } else {
-                               return element_type.get_cname () + "*";
-                       }
-               }
-       }
-
        public override string get_cdeclarator_suffix () {
                if (fixed_length) {
                        return "[%d]".printf (length);
@@ -179,14 +167,16 @@ public class Vala.ArrayType : ReferenceType {
        }
 
        public override bool compatible (DataType target_type) {
-               if (target_type.get_type_id () == "G_TYPE_VALUE" && element_type.data_type == CodeContext.get ().root.scope.lookup ("string")) {
-                       // allow implicit conversion from string[] to GValue
-                       return true;
-               }
+               if (CodeContext.get ().profile == Profile.GOBJECT && target_type.data_type != null) {
+                       if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type) && element_type.data_type == CodeContext.get ().root.scope.lookup ("string")) {
+                               // allow implicit conversion from string[] to GValue
+                               return true;
+                       }
 
-               if (target_type.get_type_id () == "G_TYPE_VARIANT") {
-                       // allow implicit conversion to GVariant
-                       return true;
+                       if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
+                               // allow implicit conversion to GVariant
+                               return true;
+                       }
                }
 
                if (target_type is PointerType || (target_type.data_type != null && target_type.data_type.get_attribute ("PointerType") != null)) {
@@ -243,14 +233,6 @@ public class Vala.ArrayType : ReferenceType {
                return element_type.check (context);
        }
 
-       public override string? get_type_id () {
-               if (element_type.data_type == CodeContext.get ().root.scope.lookup ("string")) {
-                       return "G_TYPE_STRV";
-               } else {
-                       return null;
-               }
-       }
-
        public override DataType get_actual_type (DataType? derived_instance_type, MemberAccess? method_access, CodeNode node_reference) {
                if (derived_instance_type == null && method_access == null) {
                        return this;
index 038550e09da2740edb4cf1feb14949b2ef399699..87a0441872de6ebc364f82a64ef2000eb82e4315 100644 (file)
@@ -44,8 +44,12 @@ public class Vala.Class : ObjectTypeSymbol {
         */
        public bool is_compact {
                get {
-                       if (base_class != null) {
-                               return base_class.is_compact;
+                       if (_is_compact == null) {
+                               if (base_class != null) {
+                                       _is_compact = base_class.is_compact;
+                               } else {
+                                       _is_compact = get_attribute ("Compact") != null;
+                               }
                        }
                        if (_is_compact == null) {
                                _is_compact = get_attribute ("Compact") != null;
@@ -63,8 +67,12 @@ public class Vala.Class : ObjectTypeSymbol {
         */
        public bool is_immutable {
                get {
-                       if (base_class != null) {
-                               return base_class.is_immutable;
+                       if (_is_immutable == null) {
+                               if (base_class != null) {
+                                       _is_immutable = base_class.is_immutable;
+                               } else {
+                                       _is_immutable = get_attribute ("Immutable") != null;
+                               }
                        }
                        if (_is_immutable == null) {
                                _is_immutable = get_attribute ("Immutable") != null;
@@ -77,29 +85,6 @@ public class Vala.Class : ObjectTypeSymbol {
                }
        }
 
-       /**
-        * Specifies wheather the ref function returns void instead of the
-        * object.
-        */
-       public bool ref_function_void {
-               get {
-                       if (base_class != null) {
-                               return base_class.ref_function_void;
-                       }
-                       return _ref_function_void;
-               }
-               set {
-                       _ref_function_void = value;
-               }
-       }
-
-       /**
-        * The name of the function to use to check whether a value is an instance of
-        * this class. If this is null then the default type check function should be 
-        * used instead.
-        */
-       public string? type_check_function { get; set; }
-
        /**
         * Specifies whether this class has private fields.
         */
@@ -110,30 +95,6 @@ public class Vala.Class : ObjectTypeSymbol {
         */
        public bool has_class_private_fields { get; private set; }
 
-       /**
-        * Specifies whether the free function requires the address of a
-        * pointer instead of just the pointer.
-        */
-       public bool free_function_address_of { get; private set; }
-
-       public bool is_gboxed { get { return (free_function == "g_boxed_free"); } }
-
-       private string cname;
-       public string const_cname { get; set; }
-       private string lower_case_cprefix;
-       private string lower_case_csuffix;
-       private string type_id;
-       private string ref_function;
-       private string unref_function;
-       private bool _ref_function_void;
-       private string ref_sink_function;
-       private string param_spec_function;
-       private string copy_function;
-       private string free_function;
-       private string marshaller_type_name;
-       private string get_value_function;
-       private string set_value_function;
-       private string take_value_function;
        private bool? _is_compact;
        private bool? _is_immutable;
 
@@ -592,281 +553,10 @@ public class Vala.Class : ObjectTypeSymbol {
                }
        }
 
-       public override string get_cprefix () {
-               return get_cname ();
-       }
-
-       public override string get_cname (bool const_type = false) {
-               if (const_type) {
-                       if (const_cname != null) {
-                               return const_cname;
-                       } else if (is_immutable) {
-                               return "const " + get_cname (false);
-                       }
-               }
-
-               if (cname == null) {
-                       var attr = get_attribute ("CCode");
-                       if (attr != null) {
-                               cname = attr.get_string ("cname");
-                       }
-                       if (cname == null) {
-                               cname = get_default_cname ();
-                       }
-               }
-               return cname;
-       }
-
-       /**
-        * Returns the default name of this class as it is used in C code.
-        *
-        * @return the name to be used in C code by default
-        */
-       public string get_default_cname () {
-               return "%s%s".printf (parent_symbol.get_cprefix (), name);
-       }
-
-       /**
-        * Sets the name of this class as it is used in C code.
-        *
-        * @param cname the name to be used in C code
-        */
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-
-       private string get_lower_case_csuffix () {
-               if (lower_case_csuffix == null) {
-                       lower_case_csuffix = camel_case_to_lower_case (name);
-
-                       // remove underscores in some cases to avoid conflicts of type macros
-                       if (lower_case_csuffix.has_prefix ("type_")) {
-                               lower_case_csuffix = "type" + lower_case_csuffix.substring ("type_".length);
-                       } else if (lower_case_csuffix.has_prefix ("is_")) {
-                               lower_case_csuffix = "is" + lower_case_csuffix.substring ("is_".length);
-                       }
-                       if (lower_case_csuffix.has_suffix ("_class")) {
-                               lower_case_csuffix = lower_case_csuffix.substring (0, lower_case_csuffix.length - "_class".length) + "class";
-                       }
-               }
-               return lower_case_csuffix;
-       }
-
-       public override string? get_lower_case_cname (string? infix) {
-               if (infix == null) {
-                       infix = "";
-               }
-               return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ());
-       }
-       
-       public override string get_lower_case_cprefix () {
-               if (lower_case_cprefix == null) {
-                       lower_case_cprefix = "%s_".printf (get_lower_case_cname (null));
-               }
-               return lower_case_cprefix;
-       }
-
-       public void set_lower_case_cprefix (string cprefix) {
-               lower_case_cprefix = cprefix;
-       }
-       
-       public override string? get_upper_case_cname (string? infix) {
-               return get_lower_case_cname (infix).up ();
-       }
-
        public override bool is_reference_type () {
                return true;
        }
 
-       private void process_gir_attribute (Attribute a) {
-               if (a.has_argument ("name")) {
-                       gir_name = a.get_string ("name");
-               }
-       }
-       
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("ref_function")) {
-                       set_ref_function (a.get_string ("ref_function"));
-               }
-               if (a.has_argument ("ref_function_void")) {
-                       this.ref_function_void = a.get_bool ("ref_function_void");
-               }
-               if (a.has_argument ("unref_function")) {
-                       set_unref_function (a.get_string ("unref_function"));
-               }
-               if (a.has_argument ("ref_sink_function")) {
-                       set_ref_sink_function (a.get_string ("ref_sink_function"));
-               }
-               if (a.has_argument ("copy_function")) {
-                       set_dup_function (a.get_string ("copy_function"));
-               }
-               if (a.has_argument ("free_function")) {
-                       set_free_function (a.get_string ("free_function"));
-               }
-               if (a.has_argument ("free_function_address_of")) {
-                       free_function_address_of = a.get_bool ("free_function_address_of");
-               }
-               if (a.has_argument ("type_id")) {
-                       type_id = a.get_string ("type_id");
-               }
-               if (a.has_argument ("marshaller_type_name")) {
-                       marshaller_type_name = a.get_string ("marshaller_type_name");
-               }
-               if (a.has_argument ("get_value_function")) {
-                       get_value_function = a.get_string ("get_value_function");
-               }
-               if (a.has_argument ("set_value_function")) {
-                       set_value_function = a.get_string ("set_value_function");
-               }
-               if (a.has_argument ("take_value_function")) {
-                       take_value_function = a.get_string ("take_value_function");
-               }
-
-               if (a.has_argument ("const_cname")) {
-                       const_cname = a.get_string ("const_cname");
-               }
-               if (a.has_argument ("cprefix")) {
-                       lower_case_cprefix = a.get_string ("cprefix");
-               }
-               if (a.has_argument ("lower_case_csuffix")) {
-                       lower_case_csuffix = a.get_string ("lower_case_csuffix");
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-               if (a.has_argument ("type_check_function")) {
-                       type_check_function = a.get_string ("type_check_function");
-               }
-
-               if (a.has_argument ("param_spec_function")) {
-                       param_spec_function = a.get_string ("param_spec_function");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       } else if (a.name == "GIR") {
-                               process_gir_attribute (a);
-                       }
-               }
-       }
-
-       public string? get_default_type_id () {
-               if (is_compact) {
-                       return "G_TYPE_POINTER";
-               }
-
-               return get_upper_case_cname ("TYPE_");
-       }
-
-       public override string? get_type_id () {
-               if (type_id == null) {
-                       type_id = get_default_type_id ();
-               }
-
-               return type_id;
-       }
-
-       public void set_type_id (string type_id) {
-               this.type_id = type_id;
-       }
-
-       public override string? get_marshaller_type_name () {
-               if (marshaller_type_name == null) {
-                       if (base_class != null) {
-                               marshaller_type_name = base_class.get_marshaller_type_name ();
-                       } else if (!is_compact) {
-                               marshaller_type_name = get_upper_case_cname ();
-                       } else if (get_type_id () == "G_TYPE_POINTER") {
-                               marshaller_type_name = "POINTER";
-                       } else {
-                               marshaller_type_name = "BOXED";
-                       }
-               }
-
-               return marshaller_type_name;
-       }
-
-       public override string? get_param_spec_function () {
-               if (param_spec_function == null) {
-                       param_spec_function = get_default_param_spec_function ();
-               }
-
-               return param_spec_function;
-       }
-
-       public string? get_default_param_spec_function () {
-               if (is_fundamental ()) {
-                       return get_lower_case_cname ("param_spec_");
-               } else if (base_class != null) {
-                       return base_class.get_param_spec_function ();
-               } else if (get_type_id () == "G_TYPE_POINTER") {
-                       return "g_param_spec_pointer";
-               } else {
-                       return "g_param_spec_boxed";
-               }
-       }
-
-       public override string? get_get_value_function () {
-               if (get_value_function == null) {
-                       if (is_fundamental ()) {
-                               get_value_function = get_lower_case_cname ("value_get_");
-                       } else if (base_class != null) {
-                               get_value_function = base_class.get_get_value_function ();
-                       } else if (get_type_id () == "G_TYPE_POINTER") {
-                               get_value_function = "g_value_get_pointer";
-                       } else {
-                               get_value_function = "g_value_get_boxed";
-                       }
-               }
-
-               return get_value_function;
-       }
-       
-       public override string? get_set_value_function () {
-               if (set_value_function == null) {
-                       if (is_fundamental ()) {
-                               set_value_function = get_lower_case_cname ("value_set_");
-                       } else if (base_class != null) {
-                               set_value_function = base_class.get_set_value_function ();
-                       } else if (get_type_id () == "G_TYPE_POINTER") {
-                               set_value_function = "g_value_set_pointer";
-                       } else {
-                               set_value_function = "g_value_set_boxed";
-                       }
-               }
-
-               return set_value_function;
-       }
-
-       public override string? get_take_value_function () {
-               if (take_value_function == null) {
-                       if (is_fundamental ()) {
-                               take_value_function = get_lower_case_cname ("value_take_");
-                       } else if (base_class != null) {
-                               take_value_function = base_class.get_take_value_function ();
-                       } else if (get_type_id () == "G_TYPE_POINTER") {
-                               take_value_function = "g_value_set_pointer";
-                       } else {
-                               take_value_function = "g_value_take_boxed";
-                       }
-               }
-
-               return take_value_function;
-       }
-
-       public override bool is_reference_counting () {
-               return get_ref_function () != null;
-       }
-
        public bool is_fundamental () {
                if (!is_compact && base_class == null) {
                        return true;
@@ -876,76 +566,6 @@ public class Vala.Class : ObjectTypeSymbol {
                return false;
        }
 
-       public override string? get_ref_function () {
-               if (ref_function == null && is_fundamental ()) {
-                       ref_function = get_lower_case_cprefix () + "ref";
-               }
-
-               if (ref_function == null && base_class != null) {
-                       return base_class.get_ref_function ();
-               } else {
-                       return ref_function;
-               }
-       }
-
-       public void set_ref_function (string? name) {
-               this.ref_function = name;
-       }
-
-       public override string? get_unref_function () {
-               if (unref_function == null && is_fundamental ()) {
-                       unref_function = get_lower_case_cprefix () + "unref";
-               }
-
-               if (unref_function == null && base_class != null) {
-                       return base_class.get_unref_function ();
-               } else {
-                       return unref_function;
-               }
-       }
-
-       public void set_unref_function (string? name) {
-               this.unref_function = name;
-       }
-
-       public override string? get_ref_sink_function () {
-               if (ref_sink_function == null && base_class != null) {
-                       return base_class.get_ref_sink_function ();
-               } else {
-                       return ref_sink_function;
-               }
-       }
-
-       public void set_ref_sink_function (string? name) {
-               this.ref_sink_function = name;
-       }
-
-       public override string? get_dup_function () {
-               return copy_function;
-       }
-
-       public void set_dup_function (string? name) {
-               this.copy_function = name;
-       }
-
-       public string get_default_free_function () {
-               if (base_class != null) {
-                       return base_class.get_free_function ();
-               }
-               return get_lower_case_cprefix () + "free";
-       }
-
-       public override string? get_free_function () {
-               if (free_function == null) {
-                       free_function = get_default_free_function ();
-               }
-               return free_function;
-       }
-       
-       public void set_free_function (string name) {
-               this.free_function = name;
-       }
-       
        public override bool is_subtype_of (TypeSymbol t) {
                if (this == t) {
                        return true;
@@ -1010,8 +630,6 @@ public class Vala.Class : ObjectTypeSymbol {
 
                checked = true;
 
-               process_attributes ();
-
                var old_source_file = context.analyzer.current_source_file;
                var old_symbol = context.analyzer.current_symbol;
 
index aef62b71ebb6555880a14e42a148077e14acb5cc..a0430a12cd44c12f9db5f472b1295db826354026 100644 (file)
@@ -49,8 +49,4 @@ public class Vala.ClassType : ReferenceType {
                
                return result;
        }
-
-       public override string? get_cname () {
-               return "%sClass*".printf (class_symbol.get_cname ());
-       }
 }
index 0934ac07efe3b69fb8ce5209e2cc9572bc414dba..7361f9b06f13b8685e92b70f5959bc2db32acbf2 100644 (file)
@@ -50,8 +50,6 @@ public class Vala.Constant : Symbol, Lockable {
                }
        }
 
-       private string cname;
-       
        private bool lock_used = false;
 
        private DataType _data_type;
@@ -87,37 +85,6 @@ public class Vala.Constant : Symbol, Lockable {
                }
        }
 
-       /**
-        * Returns the name of this constant as it is used in C code.
-        *
-        * @return the name to be used in C code
-        */
-       public string get_cname () {
-               if (cname == null) {
-                       cname = get_default_cname ();
-               }
-               return cname;
-       }
-
-       /**
-        * Returns the default name of this constant as it is used in C
-        * code.
-        *
-        * @return the name to be used in C code by default
-        */
-       public virtual string get_default_cname () {
-               if (parent_symbol == null) {
-                       // global constant
-                       return name;
-               } else {
-                       return "%s%s".printf (parent_symbol.get_lower_case_cprefix ().up (), name);
-               }
-       }
-
-       public void set_cname (string value) {
-               this.cname = value;
-       }
-
        public bool get_lock_used () {
                return lock_used;
        }
@@ -138,29 +105,6 @@ public class Vala.Constant : Symbol, Lockable {
                }
        }
 
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cname")) {
-                       cname = a.get_string ("cname");
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -168,8 +112,6 @@ public class Vala.Constant : Symbol, Lockable {
 
                checked = true;
 
-               process_attributes ();
-
                var old_source_file = context.analyzer.current_source_file;
                var old_symbol = context.analyzer.current_symbol;
 
index 7ece293caa80146f8597a6254b92d3c4ed98f86b..826a0db90d32f46db32ef115c478831134cbec24 100644 (file)
@@ -49,9 +49,6 @@ public class Vala.CreationMethod : Method {
        public CreationMethod (string? class_name, string? name, SourceReference? source_reference = null, Comment? comment = null) {
                base (name, new VoidType (), source_reference, comment);
                this.class_name = class_name;
-
-               carray_length_parameter_position = -3;
-               cdelegate_target_parameter_position = -3;
        }
 
        public override void accept (CodeVisitor visitor) {
@@ -80,61 +77,6 @@ public class Vala.CreationMethod : Method {
                }
        }
 
-       public override string get_default_cname () {
-               var parent = parent_symbol as TypeSymbol;
-
-               string infix = "new";
-               var st = parent as Struct;
-               if (st != null) {
-                       if (CodeContext.get ().profile == Profile.DOVA) {
-                               if (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ()) {
-                                       // don't use any infix for basic types
-                                       if (name == ".new") {
-                                               return parent.get_lower_case_cname ();
-                                       } else {
-                                               return "%s%s".printf (parent.get_lower_case_cprefix (), name);
-                                       }
-                               }
-                       }
-                       infix = "init";
-               }
-
-               if (name == ".new") {
-                       return "%s%s".printf (parent.get_lower_case_cprefix (), infix);
-               } else {
-                       return "%s%s_%s".printf (parent.get_lower_case_cprefix (), infix, name);
-               }
-       }
-
-       public override string get_real_cname () {
-               var ccode_attribute = get_attribute ("CCode");
-               if (ccode_attribute != null && ccode_attribute.has_argument ("construct_function")) {
-                       return ccode_attribute.get_string ("construct_function");
-               }
-
-               return get_default_construct_function ();
-       }
-
-       public string get_default_construct_function () {
-               var parent = parent_symbol as Class;
-
-               if (parent == null || parent.is_compact) {
-                       return get_cname ();
-               }
-
-               string infix = "construct";
-
-               if (CodeContext.get ().profile == Profile.DOVA) {
-                       infix = "init";
-               }
-
-               if (name == ".new") {
-                       return "%s%s".printf (parent.get_lower_case_cprefix (), infix);
-               } else {
-                       return "%s%s_%s".printf (parent.get_lower_case_cprefix (), infix, name);
-               }
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -142,8 +84,6 @@ public class Vala.CreationMethod : Method {
 
                checked = true;
 
-               process_attributes ();
-
                if (class_name != null && class_name != parent_symbol.name) {
                        // class_name is null for constructors generated by GIdlParser
                        Report.error (source_reference, "missing return type in method `%s.%s´".printf (context.analyzer.current_symbol.get_full_name (), class_name));
index c53ce5c7c268d55fc3d10cd7384f3093f285ca76..0b2847cf1f31629d6aeb9cbead3646572d4cd81a 100644 (file)
@@ -117,57 +117,10 @@ public abstract class Vala.DataType : CodeNode {
                }
        }
 
-       /**
-        * Returns the name and qualifiers of this type as it is used in C code.
-        *
-        * @return the type string to be used in C code
-        */
-       public virtual string? get_cname () {
-               // raise error
-               Report.error (source_reference, "unresolved type reference");
-               return null;
-       }
-
        public virtual string get_cdeclarator_suffix () {
                return "";
        }
 
-       /**
-        * Returns the name and qualifiers of this type as it is used in C code
-        * in a const declaration.
-        *
-        * @return the type string to be used in C code const declarations
-        */
-       public string get_const_cname () {
-               string ptr;
-               TypeSymbol t;
-               // FIXME: workaround to make constant arrays possible
-               if (this is ArrayType) {
-                       t = ((ArrayType) this).element_type.data_type;
-               } else {
-                       t = data_type;
-               }
-               if (!t.is_reference_type ()) {
-                       ptr = "";
-               } else {
-                       ptr = "*";
-               }
-               
-               return "const %s%s".printf (t.get_cname (), ptr);
-       }
-
-       /**
-        * Returns the C name of this data type in lower case. Words are
-        * separated by underscores.
-        *
-        * @param infix a string to be placed between namespace and data type
-        *              name or null
-        * @return      the lower case name to be used in C code
-        */
-       public virtual string? get_lower_case_cname (string? infix = null) {
-               return data_type.get_lower_case_cname (infix);
-       }
-
        public override string to_string () {
                return to_qualified_string (null);
        }
@@ -313,14 +266,16 @@ public abstract class Vala.DataType : CodeNode {
                        return false;
                }
 
-               if (target_type.get_type_id () == "G_TYPE_VALUE" && get_type_id () != null) {
-                       // allow implicit conversion to GValue
-                       return true;
-               }
+               if (CodeContext.get ().profile == Profile.GOBJECT && target_type.data_type != null) {
+                       if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
+                               // allow implicit conversion to GValue
+                               return true;
+                       }
 
-               if (target_type.get_type_id () == "G_TYPE_VARIANT") {
-                       // allow implicit conversion to GVariant
-                       return true;
+                       if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
+                               // allow implicit conversion to GVariant
+                               return true;
+                       }
                }
 
                if (this is ValueType && target_type.data_type != null && target_type.data_type.get_full_name () == "Dova.Value") {
@@ -474,14 +429,6 @@ public abstract class Vala.DataType : CodeNode {
                return is_real_struct_type () && !nullable;
        }
 
-       public virtual string? get_type_id () {
-               if (data_type != null) {
-                       return data_type.get_type_id ();
-               } else {
-                       return null;
-               }
-       }
-
        /**
         * Returns whether the value needs to be disposed, i.e. whether
         * allocated memory or other resources need to be released when
index d4cfaa0b9018acaeb2810442766f35bb6c282a89..d949c611f18e47992e1c8da31e59ebffa55b2f56 100644 (file)
@@ -61,43 +61,9 @@ public class Vala.Delegate : TypeSymbol {
 
        public DataType? sender_type { get; set; }
 
-       /**
-        * Specifies the position of the instance parameter in the C function.
-        */
-       public double cinstance_parameter_position { get; set; }
-
-       /**
-        * Specifies the position of the array length out parameter in the C
-        * function.
-        */
-       public double carray_length_parameter_position { get; set; }
-
-       /**
-        * Specifies the position of the delegate target out parameter in the C
-        * function.
-        */
-       public double cdelegate_target_parameter_position { get; set; }
-
-       /**
-        * Specifies whether the array length should be returned implicitly
-        * if the return type is an array.
-        */
-       public bool no_array_length { get; set; }
-
-       /**
-        * Specifies whether the array is null terminated.
-        */
-       public bool array_null_terminated { get; set; }
-
-       /**
-        * Specifies a custom type for the array length parameter.
-        */
-       public string? array_length_type { get; set; default = null; }
-
        private List<TypeParameter> type_parameters = new ArrayList<TypeParameter> ();
 
        private List<Parameter> parameters = new ArrayList<Parameter> ();
-       private string cname;
 
        private DataType _return_type;
        private bool? _has_target;
@@ -113,11 +79,6 @@ public class Vala.Delegate : TypeSymbol {
        public Delegate (string? name, DataType return_type, SourceReference? source_reference = null, Comment? comment = null) {
                base (name, source_reference, comment);
                this.return_type = return_type;
-
-               // error is -1 (right of user_data)
-               cinstance_parameter_position = -2;
-               carray_length_parameter_position = -3;
-               cdelegate_target_parameter_position = -3;
        }
 
        /**
@@ -151,12 +112,6 @@ public class Vala.Delegate : TypeSymbol {
         * @param param a formal parameter
         */
        public void add_parameter (Parameter param) {
-               // default C parameter position
-               param.cparameter_position = parameters.size + 1;
-               param.carray_length_parameter_position = param.cparameter_position + 0.1;
-               param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
-               param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
-
                parameters.add (param);
                scope.add (param.name, param);
        }
@@ -268,94 +223,10 @@ public class Vala.Delegate : TypeSymbol {
                }
        }
 
-       public override string get_cname (bool const_type = false) {
-               if (cname == null) {
-                       cname = "%s%s".printf (parent_symbol.get_cprefix (), name);
-               }
-               return cname;
-       }
-
-       /**
-        * Sets the name of this callback as it is used in C code.
-        *
-        * @param cname the name to be used in C code
-        */
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-
-       public override string? get_lower_case_cname (string? infix) {
-               if (infix == null) {
-                       infix = "";
-               }
-               return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, camel_case_to_lower_case (name));
-       }
-
-       public override string? get_upper_case_cname (string? infix) {
-               return get_lower_case_cname (infix).up ();
-       }
-
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cname")) {
-                       set_cname (a.get_string ("cname"));
-               }
-               if (a.has_argument ("instance_pos")) {
-                       cinstance_parameter_position = a.get_double ("instance_pos");
-               }
-               if (a.has_argument ("array_length")) {
-                       no_array_length = !a.get_bool ("array_length");
-               }
-               if (a.has_argument ("array_length_type")) {
-                       array_length_type = a.get_string ("array_length_type");
-               }
-               if (a.has_argument ("array_null_terminated")) {
-                       array_null_terminated = a.get_bool ("array_null_terminated");
-               }
-               if (a.has_argument ("array_length_pos")) {
-                       carray_length_parameter_position = a.get_double ("array_length_pos");
-               }
-               if (a.has_argument ("delegate_target_pos")) {
-                       cdelegate_target_parameter_position = a.get_double ("delegate_target_pos");
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-       }
-       
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
-
        public override bool is_reference_type () {
                return false;
        }
 
-       public override string? get_type_id () {
-               return "G_TYPE_POINTER";
-       }
-
-       public override string? get_marshaller_type_name () {
-               return "POINTER";
-       }
-
-       public override string? get_get_value_function () {
-               return "g_value_get_pointer";
-       }
-       
-       public override string? get_set_value_function () {
-               return "g_value_set_pointer";
-       }
-
        public override void replace_type (DataType old_type, DataType new_type) {
                if (return_type == old_type) {
                        return_type = new_type;
@@ -425,8 +296,6 @@ public class Vala.Delegate : TypeSymbol {
 
                checked = true;
 
-               process_attributes ();
-
                var old_source_file = context.analyzer.current_source_file;
 
                if (source_reference != null) {
index 11648cad120940fc8ae15ada8e5d9b661e732f82..2cc6cf0db6ea5f693d71f67a449a8b8ede2b4458 100644 (file)
@@ -107,22 +107,10 @@ public class Vala.DelegateType : DataType {
                return result;
        }
 
-       public override string? get_cname () {
-               if (CodeContext.get ().profile == Profile.DOVA) {
-                       return "%s*".printf (delegate_symbol.get_cname ());
-               } else {
-                       return delegate_symbol.get_cname ();
-               }
-       }
-
        public override bool is_accessible (Symbol sym) {
                return delegate_symbol.is_accessible (sym);
        }
 
-       public override string? get_type_id () {
-               return "G_TYPE_POINTER";
-       }
-
        public override bool check (CodeContext context) {
                return delegate_symbol.check (context);
        }
index 3fc98f6f6bfac5bb5dc11e1ce5804aa439485860..845c0af5414cedf321518c149036c147a2022294 100644 (file)
@@ -30,26 +30,11 @@ public class Vala.DynamicMethod : Method {
 
        public MethodCall invocation { get; set; }
 
-       private string cname;
-       static int dynamic_method_id;
-
        public DynamicMethod (DataType dynamic_type, string name, DataType return_type, SourceReference? source_reference = null, Comment? comment = null) {
                base (name, return_type, source_reference, comment);
                this.dynamic_type = dynamic_type;
        }
 
-       public override List<string> get_cheader_filenames () {
-               return new ArrayList<string> ();
-       }
-
-       public override string get_default_cname () {
-               // return cname of wrapper method
-               if (cname == null) {
-                       cname = "_dynamic_%s%d".printf (name, dynamic_method_id++);
-               }
-               return cname;
-       }
-
        public override bool check (CodeContext context) {
                return true;
        }
index dc9acb568c23a2f1b8558dd35004d1ce6b1c5b55..a15ff2f7dec8d50341eddf4ec453743321822cfc 100644 (file)
@@ -33,10 +33,6 @@ public class Vala.DynamicProperty : Property {
                this.dynamic_type = dynamic_type;
        }
 
-       public override List<string> get_cheader_filenames () {
-               return new ArrayList<string> ();
-       }
-
        public override bool check (CodeContext context) {
                return true;
        }
index 28d3151f8857ad2238ab672a8a5ebbd1b66573c0..eeabda917b7abbb6385476c468bbbc63cf605111 100644 (file)
@@ -29,21 +29,20 @@ public class Vala.Enum : TypeSymbol {
        /**
         * Specifies whether this is a flags enum.
         */
-       public bool is_flags { get; set; }
-
-       /**
-        * Specifies whether this enum has a registered GType.
-        */
-       public bool has_type_id { get; set; default = true; }
+       public bool is_flags {
+               get {
+                       if (_is_flags == null) {
+                               _is_flags = get_attribute ("Flags") != null;
+                       }
+                       return _is_flags;
+               }
+       }
 
        private List<EnumValue> values = new ArrayList<EnumValue> ();
        private List<Method> methods = new ArrayList<Method> ();
        private List<Constant> constants = new ArrayList<Constant> ();
-       private string cname;
-       private string cprefix;
-       private string lower_case_cprefix;
-       private string lower_case_csuffix;
-       private string type_id;
+
+       private bool? _is_flags;
 
        /**
         * Creates a new enum.
@@ -153,180 +152,10 @@ public class Vala.Enum : TypeSymbol {
                }
        }
 
-       public override string get_cname (bool const_type = false) {
-               if (cname == null) {
-                       var attr = get_attribute ("CCode");
-                       if (attr != null) {
-                               cname = attr.get_string ("cname");
-                       }
-                       if (cname == null) {
-                               cname = get_default_cname ();
-                       }
-               }
-               return cname;
-       }
-
-       /**
-        * Returns the default name of this enum as it is used in C code.
-        *
-        * @return the name to be used in C code by default
-        */
-       public string get_default_cname () {
-               return "%s%s".printf (parent_symbol.get_cprefix (), name);
-       }
-
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-
-       public override string get_lower_case_cprefix () {
-               if (lower_case_cprefix == null) {
-                       lower_case_cprefix = "%s_".printf (get_lower_case_cname (null));
-               }
-               return lower_case_cprefix;
-       }
-
-       private string get_lower_case_csuffix () {
-               if (lower_case_csuffix == null) {
-                       lower_case_csuffix = camel_case_to_lower_case (name);
-               }
-               return lower_case_csuffix;
-       }
-
-       public override string? get_lower_case_cname (string? infix) {
-               if (infix == null) {
-                       infix = "";
-               }
-               return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ());
-       }
-
-       public override string? get_upper_case_cname (string? infix = null) {
-               return get_lower_case_cname (infix).up ();
-       }
-
        public override bool is_reference_type () {
                return false;
        }
 
-       public override string get_cprefix () {
-               if (cprefix == null) {
-                       cprefix = "%s_".printf (get_upper_case_cname ());
-               }
-               return cprefix;
-       }
-       
-       /**
-        * Sets the string to be prepended to the name of members of this enum
-        * when used in C code.
-        *
-        * @param cprefix the prefix to be used in C code
-        */
-       public void set_cprefix (string? cprefix) {
-               this.cprefix = cprefix;
-       }
-       
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cprefix")) {
-                       set_cprefix (a.get_string ("cprefix"));
-               }
-               if (a.has_argument ("lower_case_csuffix")) {
-                       lower_case_csuffix = a.get_string ("lower_case_csuffix");
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-               if (a.has_argument ("has_type_id")) {
-                       has_type_id = a.get_bool ("has_type_id");
-               }
-               if (a.has_argument ("type_id")) {
-                       type_id = a.get_string ("type_id");
-               }
-       }
-       
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       } else if (a.name == "Flags") {
-                               is_flags = true;
-                       }
-               }
-       }
-
-       public void set_type_id (string? type_id) {
-               this.type_id = type_id;
-       }
-
-       public override string? get_type_id () {
-               if (type_id == null) {
-                       if (has_type_id) {
-                               type_id = get_upper_case_cname ("TYPE_");
-                       } else {
-                               type_id = is_flags ? "G_TYPE_UINT" : "G_TYPE_INT";
-                       }
-               }
-
-               return type_id;
-       }
-       
-       public override string? get_marshaller_type_name () {
-               if (has_type_id) {
-                       if (is_flags) {
-                               return "FLAGS";
-                       } else {
-                               return "ENUM";
-                       }
-               } else {
-                       if (is_flags) {
-                               return "UINT";
-                       } else {
-                               return "INT";
-                       }
-               }
-       }
-
-       public override string? get_get_value_function () {
-               if (has_type_id) {
-                       if (is_flags) {
-                               return "g_value_get_flags";
-                       } else {
-                               return "g_value_get_enum";
-                       }
-               } else {
-                       if (is_flags) {
-                               return "g_value_get_uint";
-                       } else {
-                               return "g_value_get_int";
-                       }
-               }
-       }
-       
-       public override string? get_set_value_function () {
-               if (has_type_id) {
-                       if (is_flags) {
-                               return "g_value_set_flags";
-                       } else {
-                               return "g_value_set_enum";
-                       }
-               } else {
-                       if (is_flags) {
-                               return "g_value_set_uint";
-                       } else {
-                               return "g_value_set_int";
-                       }
-               }
-       }
-
-       public override string? get_default_value () {
-               return "0";
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -334,8 +163,6 @@ public class Vala.Enum : TypeSymbol {
 
                checked = true;
 
-               process_attributes ();
-
                var old_source_file = context.analyzer.current_source_file;
                var old_symbol = context.analyzer.current_symbol;
 
index 4a04b85698a477cc61ca8c7bd7dab44de2adae3a..05d4494c32db5c25dec351de87a831947a87747d 100644 (file)
@@ -74,11 +74,6 @@ public class Vala.EnumValue : Constant {
                }
        }
 
-       public override string get_default_cname () {
-               var en = (Enum) parent_symbol;
-               return "%s%s".printf (en.get_cprefix (), name);
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -86,8 +81,6 @@ public class Vala.EnumValue : Constant {
 
                checked = true;
 
-               process_attributes ();
-
                if (value != null) {
                        value.check (context);
                }
index eace48cce8a2ff6136d025ea3cf21b5dac72e188..aa97641c51aef0af3d1bfc6cc653a3a4fe9c8611 100644 (file)
@@ -31,8 +31,6 @@ public class Vala.ErrorCode : TypeSymbol {
         */
        public Expression value { get; set; }
 
-       private string cname;
-
        /**
         * Creates a new enum value.
         *
@@ -65,43 +63,6 @@ public class Vala.ErrorCode : TypeSymbol {
                }
        }
 
-       public override string get_cname (bool const_type = false) {
-               if (cname == null) {
-                       cname = get_default_cname ();
-               }
-               return cname;
-       }
-
-       public string get_default_cname () {
-               var edomain = (ErrorDomain) parent_symbol;
-               return "%s%s".printf (edomain.get_cprefix (), name);
-       }
-
-       public void set_cname (string value) {
-               this.cname = value;
-       }
-
-       public override string? get_lower_case_cname (string? infix) {
-               return get_cname ().down ();
-       }
-
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cname")) {
-                       cname = a.get_string ("cname");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -109,8 +70,6 @@ public class Vala.ErrorCode : TypeSymbol {
 
                checked = true;
 
-               process_attributes ();
-
                if (value != null) {
                        value.check (context);
                }
index 2ac860c38429cee84c6c77965741955222a1ea50..a73dcf84ddad0d8c37a1708653813f9bd597b2bd 100644 (file)
@@ -28,10 +28,6 @@ using GLib;
 public class Vala.ErrorDomain : TypeSymbol {
        private List<ErrorCode> codes = new ArrayList<ErrorCode> ();
        private List<Method> methods = new ArrayList<Method> ();
-       private string cname;
-       private string cprefix;
-       private string lower_case_cprefix;
-       private string lower_case_csuffix;
 
        /**
         * Creates a new error domain.
@@ -107,114 +103,10 @@ public class Vala.ErrorDomain : TypeSymbol {
                }
        }
 
-       public override string get_cname (bool const_type = false) {
-               if (cname == null) {
-                       cname = "%s%s".printf (parent_symbol.get_cprefix (), name);
-               }
-               return cname;
-       }
-
-       public override string get_lower_case_cprefix () {
-               if (lower_case_cprefix == null) {
-                       lower_case_cprefix = "%s_".printf (get_lower_case_cname (null));
-               }
-               return lower_case_cprefix;
-       }
-
-       private string get_lower_case_csuffix () {
-               if (lower_case_csuffix == null) {
-                       lower_case_csuffix = camel_case_to_lower_case (name);
-               }
-               return lower_case_csuffix;
-       }
-
-       public override string? get_lower_case_cname (string? infix) {
-               if (infix == null) {
-                       infix = "";
-               }
-
-               string cprefix = "";
-               if (parent_symbol != null) {
-                       cprefix = parent_symbol.get_lower_case_cprefix ();
-               }
-
-               return "%s%s%s".printf (cprefix, infix, get_lower_case_csuffix ());
-       }
-
-       public override string? get_upper_case_cname (string? infix) {
-               return get_lower_case_cname (infix).up ();
-       }
-
        public override bool is_reference_type () {
                return false;
        }
        
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-       
-       public override string get_cprefix () {
-               if (cprefix == null) {
-                       cprefix = "%s_".printf (get_upper_case_cname (null));
-               }
-               return cprefix;
-       }
-       
-       /**
-        * Sets the string to be prepended to the name of members of this error
-        * domain when used in C code.
-        *
-        * @param cprefix the prefix to be used in C code
-        */
-       public void set_cprefix (string cprefix) {
-               this.cprefix = cprefix;
-       }
-       
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cname")) {
-                       set_cname (a.get_string ("cname"));
-               }
-               if (a.has_argument ("cprefix")) {
-                       set_cprefix (a.get_string ("cprefix"));
-               }
-               if (a.has_argument ("lower_case_csuffix")) {
-                       lower_case_csuffix = a.get_string ("lower_case_csuffix");
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-       }
-       
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
-
-       public override string? get_type_id () {
-               return "G_TYPE_POINTER";
-       }
-       
-       public override string? get_marshaller_type_name () {
-               return "POINTER";
-       }
-
-       public override string? get_get_value_function () {
-               return "g_value_get_pointer";
-       }
-       
-       public override string? get_set_value_function () {
-               return "g_value_set_pointer";
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -222,8 +114,6 @@ public class Vala.ErrorDomain : TypeSymbol {
 
                checked = true;
 
-               process_attributes ();
-
                foreach (ErrorCode ecode in codes) {
                        ecode.check (context);
                }
index 33f5e41fe4fdeed5ec10610379e9f221c012b031..c7c9f9348fd31524c53625c1716b9f96c4c04e64 100644 (file)
@@ -101,24 +101,6 @@ public class Vala.ErrorType : ReferenceType {
                return result;
        }
 
-       public override string? get_cname () {
-               return "GError*";
-       }
-
-       public override string? get_lower_case_cname (string? infix = null) {
-               if (error_domain == null) {
-                       if (infix == null) {
-                               return "g_error";
-                       } else {
-                               return "g_%s_error".printf (infix);
-                       }
-               } else if (error_code == null) {
-                       return error_domain.get_lower_case_cname (infix);
-               } else {
-                       return error_code.get_lower_case_cname (infix);
-               }
-       }
-
        public override bool equals (DataType type2) {
                var et = type2 as ErrorType;
 
@@ -135,14 +117,6 @@ public class Vala.ErrorType : ReferenceType {
                return gerror_symbol.scope.lookup (member_name);
        }
 
-       public override string? get_type_id () {
-               if (source_reference != null && source_reference.file.context.require_glib_version (2, 26)) {
-                       return "G_TYPE_ERROR";
-               } else {
-                       return "G_TYPE_POINTER";
-               }
-       }
-
        public override bool is_reference_type_or_type_parameter () {
                return true;
        }
index 5926a3179ae2026681eea5fca0b9ed6b52ee8483..8b932a5df6ea0eee30fce0dbde5301dc5e0c6241 100644 (file)
@@ -38,8 +38,6 @@ public class Vala.Field : Variable, Lockable {
         */
        public bool is_volatile { get; set; }
 
-       private string cname;
-       
        private bool lock_used = false;
 
        /**
@@ -67,65 +65,6 @@ public class Vala.Field : Variable, Lockable {
                }
        }
 
-       /**
-        * Returns the name of this field as it is used in C code.
-        *
-        * @return the name to be used in C code
-        */
-       public string get_cname () {
-               if (cname == null) {
-                       cname = get_default_cname ();
-               }
-               return cname;
-       }
-
-       /**
-        * Sets the name of this field as it is used in C code.
-        *
-        * @param cname the name to be used in C code
-        */
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-
-       /**
-        * Returns the default name of this field as it is used in C code.
-        *
-        * @return the name to be used in C code by default
-        */
-       public string get_default_cname () {
-               if (binding == MemberBinding.STATIC) {
-                       return parent_symbol.get_lower_case_cprefix () + name;
-               } else {
-                       return name;
-               }
-       }
-
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cname")) {
-                       set_cname (a.get_string ("cname"));
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-       }
-       
-       /**
-        * Process all associated attributes.
-        */
-       public override void process_attributes () {
-               base.process_attributes ();
-
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
-
        public bool get_lock_used () {
                return lock_used;
        }
@@ -147,20 +86,11 @@ public class Vala.Field : Variable, Lockable {
        }
 
        public string? get_ctype () {
-               var attr = get_attribute ("CCode");
-               if (attr == null) {
-                       return null;
-               }
-               return attr.get_string ("type");
+               return get_attribute_string ("CCode", "type");
        }
 
        public void set_ctype (string ctype) {
-               var attr = get_attribute ("CCode");
-               if (attr == null) {
-                       attr = new Attribute ("CCode");
-                       attributes.append (attr);
-               }
-               attr.add_argument ("type", "\"%s\"".printf (ctype));
+               set_attribute_string ("CCode", "type", ctype);
        }
 
        public override bool check (CodeContext context) {
@@ -193,8 +123,6 @@ public class Vala.Field : Variable, Lockable {
                        return false;
                }
 
-               process_attributes ();
-
                if (initializer != null) {
                        initializer.target_type = variable_type;
 
index 3e881e5184bb85296e2a92c12e1d33a78a98b686..c7d7991c6b262f88a1b79f015e4ea6827b67d9ae 100644 (file)
@@ -42,22 +42,6 @@ public class Vala.GenericType : DataType {
                return result;
        }
 
-       public override string? get_cname () {
-               if (CodeContext.get ().profile == Profile.GOBJECT) {
-                       if (value_owned) {
-                               return "gpointer";
-                       } else {
-                               return "gconstpointer";
-                       }
-               } else {
-                       return "void *";
-               }
-       }
-
-       public override string? get_type_id () {
-               return "G_TYPE_POINTER";
-       }
-
        public override string to_qualified_string (Scope? scope = null) {
                return type_parameter.name;
        }
index e738e79fa5b8c8566d09bc507ae0fc28a1b1e3a6..548304f0770581b6c6d9c64175521b35095e5b8b 100644 (file)
@@ -40,11 +40,6 @@ public class Vala.Interface : ObjectTypeSymbol {
        private List<Enum> enums = new ArrayList<Enum> ();
        private List<Delegate> delegates = new ArrayList<Delegate> ();
 
-       private string cname;
-       private string lower_case_csuffix;
-       private string type_cname;
-       private string type_id;
-
        /**
         * Returns a copy of the list of classes.
         *
@@ -276,96 +271,6 @@ public class Vala.Interface : ObjectTypeSymbol {
                scope.add (d.name, d);
        }
 
-       public override string get_cprefix () {
-               return get_cname ();
-       }
-
-       public override string get_cname (bool const_type = false) {
-               if (cname == null) {
-                       var attr = get_attribute ("CCode");
-                       if (attr != null) {
-                               cname = attr.get_string ("cname");
-                       }
-                       if (cname == null) {
-                               cname = "%s%s".printf (parent_symbol.get_cprefix (), name);
-                       }
-               }
-               return cname;
-       }
-
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-       
-       /**
-        * Returns the string to be prepended to the name of members of this
-        * interface when used in C code.
-        *
-        * @return the suffix to be used in C code
-        */
-       public string get_lower_case_csuffix () {
-               if (lower_case_csuffix == null) {
-                       lower_case_csuffix = get_default_lower_case_csuffix ();
-               }
-               return lower_case_csuffix;
-       }
-
-       /**
-        * Returns default string to be prepended to the name of members of this
-        * interface when used in C code.
-        *
-        * @return the suffix to be used in C code
-        */
-       public string get_default_lower_case_csuffix () {
-               string result = camel_case_to_lower_case (name);
-
-               // remove underscores in some cases to avoid conflicts of type macros
-               if (result.has_prefix ("type_")) {
-                       result = "type" + result.substring ("type_".length);
-               } else if (result.has_prefix ("is_")) {
-                       result = "is" + result.substring ("is_".length);
-               }
-               if (result.has_suffix ("_class")) {
-                       result = result.substring (0, result.length - "_class".length) + "class";
-               }
-
-               return result;
-       }
-
-       /**
-        * Returns default string for the type struct when used in C code.
-        *
-        * @return the type struct to be used in C code
-        */
-       public string get_default_type_cname () {
-               return "%sIface".printf (get_cname ());
-       }
-       
-       /**
-        * Sets the string to be prepended to the name of members of this
-        * interface when used in C code.
-        *
-        * @param csuffix the suffix to be used in C code
-        */
-       public void set_lower_case_csuffix (string csuffix) {
-               this.lower_case_csuffix = csuffix;
-       }
-       
-       public override string? get_lower_case_cname (string? infix) {
-               if (infix == null) {
-                       infix = "";
-               }
-               return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ());
-       }
-       
-       public override string get_lower_case_cprefix () {
-               return "%s_".printf (get_lower_case_cname (null));
-       }
-       
-       public override string? get_upper_case_cname (string? infix) {
-               return get_lower_case_cname (infix).up ();
-       }
-
        public override void accept (CodeVisitor visitor) {
                visitor.visit_interface (this);
        }
@@ -420,41 +325,7 @@ public class Vala.Interface : ObjectTypeSymbol {
        public override bool is_reference_type () {
                return true;
        }
-
-       public override bool is_reference_counting () {
-               return true;
-       }
        
-       public override string? get_ref_function () {
-               foreach (DataType prerequisite in prerequisites) {
-                       string ref_func = prerequisite.data_type.get_ref_function ();
-                       if (ref_func != null) {
-                               return ref_func;
-                       }
-               }
-               return null;
-       }
-       
-       public override string? get_unref_function () {
-               foreach (DataType prerequisite in prerequisites) {
-                       string unref_func = prerequisite.data_type.get_unref_function ();
-                       if (unref_func != null) {
-                               return unref_func;
-                       }
-               }
-               return null;
-       }
-
-       public override string? get_ref_sink_function () {
-               foreach (DataType prerequisite in prerequisites) {
-                       string ref_sink_func = prerequisite.data_type.get_ref_sink_function ();
-                       if (ref_sink_func != null) {
-                               return ref_sink_func;
-                       }
-               }
-               return null;
-       }
-
        public override bool is_subtype_of (TypeSymbol t) {
                if (this == t) {
                        return true;
@@ -469,109 +340,6 @@ public class Vala.Interface : ObjectTypeSymbol {
                return false;
        }
        
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("type_cname")) {
-                       set_type_cname (a.get_string ("type_cname"));
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-               if (a.has_argument ("lower_case_csuffix")) {
-                       lower_case_csuffix = a.get_string ("lower_case_csuffix");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
-       
-       /**
-        * Returns the name of the type struct as it is used in C code.
-        *
-        * @return the type struct name to be used in C code
-        */
-       public string get_type_cname () {
-               if (type_cname == null) {
-                       type_cname = get_default_type_cname ();
-               }
-               return type_cname;
-       }
-       
-       /**
-        * Sets the name of the type struct as it is used in C code.
-        *
-        * @param type_cname the type struct name to be used in C code
-        */
-       public void set_type_cname (string type_cname) {
-               this.type_cname = type_cname;
-       }
-
-       public override string? get_marshaller_type_name () {
-               foreach (DataType prerequisite in prerequisites) {
-                       string type_name = prerequisite.data_type.get_marshaller_type_name ();
-                       if (type_name != null) {
-                               return type_name;
-                       }
-               }
-               return "POINTER";
-       }
-
-       public override string? get_get_value_function () {
-               foreach (DataType prerequisite in prerequisites) {
-                       string get_value_func = prerequisite.data_type.get_get_value_function ();
-                       if (get_value_func != null) {
-                               return get_value_func;
-                       }
-               }
-               return "g_value_get_pointer";
-       }
-       
-       public override string? get_set_value_function () {
-               foreach (DataType prerequisite in prerequisites) {
-                       string set_value_func = prerequisite.data_type.get_set_value_function ();
-                       if (set_value_func != null) {
-                               return set_value_func;
-                       }
-               }
-               return "g_value_set_pointer";
-       }
-
-       public override string? get_take_value_function () {
-               foreach (DataType prerequisite in prerequisites) {
-                       string take_value_func = prerequisite.data_type.get_take_value_function ();
-                       if (take_value_func != null) {
-                               return take_value_func;
-                       }
-               }
-               return "g_value_set_pointer";
-       }
-
-       public string? get_default_type_id () {
-               return get_upper_case_cname ("TYPE_");
-       }
-
-       public override string? get_type_id () {
-               if (type_id == null) {
-                       type_id = get_default_type_id ();
-               }
-               
-               return type_id;
-       }
-
-       public void set_type_id (string type_id) {
-               this.type_id = type_id;
-       }
-
        public override void replace_type (DataType old_type, DataType new_type) {
                for (int i = 0; i < prerequisites.size; i++) {
                        if (prerequisites[i] == old_type) {
@@ -581,25 +349,6 @@ public class Vala.Interface : ObjectTypeSymbol {
                }
        }
 
-       public override string? get_param_spec_function () {
-               foreach (DataType prerequisite in prerequisites) {
-                       var prereq = prerequisite as ObjectType;
-                       var cl = prereq.type_symbol as Class;
-                       if (cl != null) {
-                               return cl.get_param_spec_function ();
-                       }
-                       var interf = prereq.type_symbol as Interface;
-                       if (interf != null) {
-                               var param_spec_function = interf.get_param_spec_function ();
-                               if (param_spec_function != null) {
-                                       return param_spec_function;
-                               }
-                       }
-               }
-
-               return "g_param_spec_pointer";
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -607,8 +356,6 @@ public class Vala.Interface : ObjectTypeSymbol {
 
                checked = true;
 
-               process_attributes ();
-
                var old_source_file = context.analyzer.current_source_file;
                var old_symbol = context.analyzer.current_symbol;
 
index b767f14b509560718161e74df319acb3a2efb015..3ca1a2c857db1fc220d5432a005a234cb12a3740 100644 (file)
@@ -49,8 +49,4 @@ public class Vala.InterfaceType : ReferenceType {
                
                return result;
        }
-
-       public override string? get_cname () {
-               return "%s*".printf (interface_symbol.get_type_cname ());
-       }
 }
index 1d791af3238efc198b076d03ed6e6f0c268c799b..8ad3a08343d568e1f80905999330688dc60ee3ae 100644 (file)
@@ -135,9 +135,7 @@ public class Vala.LambdaExpression : Expression {
                var cb = (Delegate) ((DelegateType) target_type).delegate_symbol;
                var return_type = cb.return_type.get_actual_type (target_type, null, this);
                method = new Method (get_lambda_name (context), return_type, source_reference);
-               method.no_array_length = cb.no_array_length;
-               method.array_null_terminated = cb.array_null_terminated;
-               method.array_length_type = cb.array_length_type;
+               method.attributes = cb.attributes.copy ();
                // track usage for flow analyzer
                method.used = true;
                method.check_deprecated (source_reference);
index b2ac9aae619e1b42dba51a6ff041d2f9124b6b4c..c2de41d21a7ff432112da80b4c5a39976657fbbc 100644 (file)
@@ -30,8 +30,6 @@ using GLib;
 public class Vala.Method : Subroutine {
        List<TypeParameter> type_parameters;
 
-       public const string DEFAULT_SENTINEL = "NULL";
-
        /**
         * The return type of this method.
         */
@@ -52,38 +50,6 @@ public class Vala.Method : Subroutine {
         * the contained type.
         */
        public MemberBinding binding { get; set; default = MemberBinding.INSTANCE; }
-
-       /**
-        * The name of the vfunc of this method as it is used in C code.
-        */
-       public string vfunc_name {
-               get {
-                       if (_vfunc_name == null) {
-                               _vfunc_name = this.name;
-                       }
-                       return _vfunc_name;
-               }
-               set {
-                       _vfunc_name = value;
-               }
-       }
-
-       /**
-        * The sentinel to use for terminating variable length argument lists.
-        */
-       public string sentinel {
-               get {
-                       if (_sentinel == null) {
-                               return DEFAULT_SENTINEL;
-                       }
-
-                       return _sentinel;
-               }
-
-               set {
-                       _sentinel = value;
-               }
-       }
        
        /**
         * Specifies whether this method is abstract. Abstract methods have no
@@ -118,12 +84,19 @@ public class Vala.Method : Subroutine {
                }
        }
 
-       /**
+       /*
         * Specifies whether the C method returns a new instance pointer which
         * may be different from the previous instance pointer. Only valid for
         * imported methods.
         */
-       public bool returns_modified_pointer { get; set; }
+       public bool returns_modified_pointer {
+               get {
+                       return get_attribute ("ReturnsModifiedPointer") != null;
+               }
+               set {
+                       set_attribute ("ReturnsModifiedPointer", value);
+               }
+       }
 
        /**
         * Specifies the virtual or abstract method this method overrides.
@@ -154,44 +127,6 @@ public class Vala.Method : Subroutine {
         */
        public Parameter this_parameter { get; set; }
 
-       /**
-        * Specifies the position of the instance parameter in the C function.
-        */
-       public double cinstance_parameter_position { get; set; }
-
-       /**
-        * Specifies the position of the array length out parameter in the C
-        * function.
-        */
-       public double carray_length_parameter_position { get; set; }
-
-       /**
-        * Specifies the position of the delegate target out parameter in the C
-        * function.
-        */
-       public double cdelegate_target_parameter_position { get; set; }
-
-       /**
-        * Specifies whether the array length should be returned implicitly
-        * if the return type is an array.
-        */
-       public bool no_array_length { get; set; }
-
-       /**
-        * Specifies whether the array is null terminated.
-        */
-       public bool array_null_terminated { get; set; }
-
-       /**
-        * Specifies a custom type for the array length parameter.
-        */
-       public string? array_length_type { get; set; default = null; }
-
-       /**
-        * Specifies a custom C return type for this method.
-        */
-       public string? custom_return_type_cname { get; set; }
-
        /**
         * Specifies whether this method expects printf-style format arguments.
         */
@@ -216,12 +151,6 @@ public class Vala.Method : Subroutine {
                }
        }
 
-       /**
-        * Specifies whether a new function without a GType parameter is
-        * available. This is only applicable to creation methods.
-        */
-       public bool has_new_function { get; set; default = true; }
-
        /**
         * Specifies whether a construct function with a GType parameter is
         * available. This is only applicable to creation methods.
@@ -235,12 +164,6 @@ public class Vala.Method : Subroutine {
                }
        }
 
-       public bool has_generic_type_parameter { get; set; }
-
-       public double generic_type_parameter_position { get; set; }
-
-       public bool simple_generics { get; set; }
-
        public weak Signal signal_reference { get; set; }
 
        public bool closure { get; set; }
@@ -252,10 +175,6 @@ public class Vala.Method : Subroutine {
        public int yield_count { get; set; }
 
        private List<Parameter> parameters = new ArrayList<Parameter> ();
-       private string cname;
-       private string finish_name;
-       private string _vfunc_name;
-       private string _sentinel;
        private List<Expression> preconditions;
        private List<Expression> postconditions;
        private DataType _return_type;
@@ -283,9 +202,6 @@ public class Vala.Method : Subroutine {
        public Method (string? name, DataType return_type, SourceReference? source_reference = null, Comment? comment = null) {
                base (name, source_reference, comment);
                this.return_type = return_type;
-
-               carray_length_parameter_position = -3;
-               cdelegate_target_parameter_position = -3;
        }
 
        /**
@@ -295,15 +211,8 @@ public class Vala.Method : Subroutine {
         */
        public void add_parameter (Parameter param) {
                // default C parameter position
-               param.cparameter_position = parameters.size + 1;
-               param.carray_length_parameter_position = param.cparameter_position + 0.1;
-               param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
-               param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
-
                parameters.add (param);
-               if (!param.ellipsis) {
-                       scope.add (param.name, param);
-               }
+               scope.add (param.name, param);
        }
        
        public List<Parameter> get_parameters () {
@@ -364,167 +273,6 @@ public class Vala.Method : Subroutine {
                }
        }
 
-       /**
-        * Returns the interface name of this method as it is used in C code.
-        *
-        * @return the name to be used in C code
-        */
-       public string get_cname () {
-               if (cname == null) {
-                       cname = get_default_cname ();
-               }
-               return cname;
-       }
-
-       public string get_finish_cname () {
-               assert (coroutine);
-               if (finish_name == null) {
-                       finish_name = get_default_finish_cname ();
-               }
-               return finish_name;
-       }
-
-       public void set_finish_cname (string name) {
-               finish_name = name;
-       }
-
-       /**
-        * Returns the default interface name of this method as it is used in C
-        * code.
-        *
-        * @return the name to be used in C code by default
-        */
-       public virtual string get_default_cname () {
-               if (name == "main" && parent_symbol.name == null) {
-                       // avoid conflict with generated main function
-                       return "_vala_main";
-               } else if (name.has_prefix ("_")) {
-                       return "_%s%s".printf (parent_symbol.get_lower_case_cprefix (), name.substring (1));
-               } else {
-                       return "%s%s".printf (parent_symbol.get_lower_case_cprefix (), name);
-               }
-       }
-
-       /**
-        * Returns the implementation name of this data type as it is used in C
-        * code.
-        *
-        * @return the name to be used in C code
-        */
-       public virtual string get_real_cname () {
-               if (base_method != null || base_interface_method != null) {
-                       return "%sreal_%s".printf (parent_symbol.get_lower_case_cprefix (), name);
-               } else {
-                       return get_cname ();
-               }
-       }
-
-       protected string get_finish_name_for_basename (string basename) {
-               string result = basename;
-               if (result.has_suffix ("_async")) {
-                       result = result.substring (0, result.length - "_async".length);
-               }
-               result += "_finish";
-               return result;
-       }
-
-       public string get_finish_real_cname () {
-               assert (coroutine);
-               return get_finish_name_for_basename (get_real_cname ());
-       }
-
-       public string get_finish_vfunc_name () {
-               assert (coroutine);
-               return get_finish_name_for_basename (vfunc_name);
-       }
-
-       public string get_default_finish_cname () {
-               return get_finish_name_for_basename (get_cname ());
-       }
-       
-       /**
-        * Sets the name of this method as it is used in C code.
-        *
-        * @param cname the name to be used in C code
-        */
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-       
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cname")) {
-                       set_cname (a.get_string ("cname"));
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-               if (a.has_argument ("vfunc_name")) {
-                       this.vfunc_name = a.get_string ("vfunc_name");
-               }
-               if (a.has_argument ("finish_name")) {
-                       this.finish_name = a.get_string ("finish_name");
-               }
-               if (a.has_argument ("sentinel")) {
-                       this.sentinel = a.get_string ("sentinel");
-               }
-               if (a.has_argument ("instance_pos")) {
-                       cinstance_parameter_position = a.get_double ("instance_pos");
-               }
-               if (a.has_argument ("array_length")) {
-                       no_array_length = !a.get_bool ("array_length");
-               }
-               if (a.has_argument ("array_length_type")) {
-                       array_length_type = a.get_string ("array_length_type");
-               }
-               if (a.has_argument ("array_null_terminated")) {
-                       array_null_terminated = a.get_bool ("array_null_terminated");
-               }
-               if (a.has_argument ("array_length_pos")) {
-                       carray_length_parameter_position = a.get_double ("array_length_pos");
-               }
-               if (a.has_argument ("delegate_target_pos")) {
-                       cdelegate_target_parameter_position = a.get_double ("delegate_target_pos");
-               }
-               if (a.has_argument ("has_new_function")) {
-                       has_new_function = a.get_bool ("has_new_function");
-               }
-               if (a.has_argument ("generic_type_pos")) {
-                       has_generic_type_parameter = true;
-                       generic_type_parameter_position = a.get_double ("generic_type_pos");
-               }
-               if (a.has_argument ("simple_generics")) {
-                       simple_generics = a.get_bool ("simple_generics");
-               }
-               if (a.has_argument ("type")) {
-                       custom_return_type_cname = a.get_string ("type");
-               }
-       }
-       
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       } else if (a.name == "ReturnsModifiedPointer") {
-                               returns_modified_pointer = true;
-                       } else if (a.name == "FloatingReference") {
-                               return_type.floating_reference = true;
-                       } else if (a.name == "NoArrayLength") {
-                               Report.warning (source_reference, "NoArrayLength attribute is deprecated, use [CCode (array_length = false)] instead.");
-                               no_array_length = true;
-                       } else if (a.name == "NoThrow") {
-                               get_error_types ().clear ();
-                       } else if (a.name == "DestroysInstance") {
-                               this_parameter.variable_type.value_owned = true;
-                       }
-               }
-       }
-
        /**
         * Checks whether the parameters and return type of this method are
         * compatible with the specified method
@@ -809,7 +557,12 @@ public class Vala.Method : Subroutine {
 
                checked = true;
 
-               process_attributes ();
+               if (get_attribute ("DestroysInstance") != null) {
+                       this_parameter.variable_type.value_owned = true;
+               }
+               if (get_attribute ("NoThrow") != null) {
+                       get_error_types ().clear ();
+               }
 
                if (is_abstract) {
                        if (parent_symbol is Class) {
@@ -1108,7 +861,6 @@ public class Vala.Method : Subroutine {
                        callback_method.binding = MemberBinding.INSTANCE;
                        callback_method.owner = scope;
                        callback_method.is_async_callback = true;
-                       callback_method.set_cname (get_real_cname () + "_co");
                }
                return callback_method;
        }
@@ -1132,8 +884,8 @@ public class Vala.Method : Subroutine {
                var callback_param = new Parameter ("_callback_", callback_type);
                callback_param.initializer = new NullLiteral (source_reference);
                callback_param.initializer.target_type = callback_type.copy ();
-               callback_param.cparameter_position = -1;
-               callback_param.cdelegate_target_parameter_position = -0.9;
+               callback_param.set_attribute_double ("CCode", "pos", -1);
+               callback_param.set_attribute_double ("CCode", "delegate_target_pos", -0.9);
 
                params.add (callback_param);
 
@@ -1149,7 +901,7 @@ public class Vala.Method : Subroutine {
                var result_type = new ObjectType ((ObjectTypeSymbol) glib_ns.scope.lookup ("AsyncResult"));
 
                var result_param = new Parameter ("_res_", result_type);
-               result_param.cparameter_position = 0.1;
+               result_param.set_attribute_double ("CCode", "pos", 0.1);
                params.add (result_param);
 
                foreach (var param in parameters) {
index 594aeb2f486d1a781c0a32e1a15252d5b7a6a987..9a492faebfdccd77f5e812cfc1939920b8043c1b 100644 (file)
@@ -62,10 +62,6 @@ public class Vala.MethodType : DataType {
                return method_symbol.get_full_name ();
        }
 
-       public override string? get_cname () {
-               return "gpointer";
-       }
-
        public override Symbol? get_member (string member_name) {
                if (method_symbol.coroutine && member_name == "begin") {
                        return method_symbol;
index 45abd68de4e6a8fb886a9d21459f9b1d5fefd099..7506e25db5d0196cf2523fa8018c105ec75425f8 100644 (file)
@@ -38,9 +38,6 @@ public class Vala.Namespace : Symbol {
 
        private List<Comment> comments = new ArrayList<Comment> ();
 
-       private List<string> cprefixes = new ArrayList<string> ();
-       private string lower_case_cprefix;
-       
        private List<Namespace> namespaces = new ArrayList<Namespace> ();
 
        private List<UsingDirective> using_directives = new ArrayList<UsingDirective> ();
@@ -499,112 +496,6 @@ public class Vala.Namespace : Symbol {
                        m.accept (visitor);
                }
        }
-       
-       public override string get_cprefix () {
-               if (cprefixes.size > 0) {
-                       return cprefixes[0];
-               } else if (null != name) {
-                       string parent_prefix;
-                       if (parent_symbol == null) {
-                               parent_prefix = "";
-                       } else {
-                               parent_prefix = parent_symbol.get_cprefix ();
-                       }
-                       return parent_prefix + name;
-               } else {
-                       return "";
-               }
-       }
-
-       public List<string> get_cprefixes () {
-               if (0 == cprefixes.size && null != name)
-                       cprefixes.add (name);
-
-               return cprefixes;
-       }
-
-       /**
-        * Adds a camel case string to be prepended to the name of members of
-        * this namespace when used in C code.
-        *
-        * @param cprefixes the camel case prefixes used in C code
-        */
-       public void add_cprefix (string cprefix) {
-               cprefixes.add (cprefix);
-       }
-
-       /**
-        * Returns the lower case string to be prepended to the name of members
-        * of this namespace when used in C code.
-        *
-        * @return the lower case prefix to be used in C code
-        */
-       public override string get_lower_case_cprefix () {
-               if (lower_case_cprefix == null) {
-                       if (name == null) {
-                               lower_case_cprefix = "";
-                       } else {
-                               string parent_prefix;
-                               if (parent_symbol == null) {
-                                       parent_prefix = "";
-                               } else {
-                                       parent_prefix = parent_symbol.get_lower_case_cprefix ();
-                               }
-                               lower_case_cprefix = "%s%s_".printf (parent_prefix, camel_case_to_lower_case (name));
-                       }
-               }
-               return lower_case_cprefix;
-       }
-
-       /**
-        * Sets the lower case string to be prepended to the name of members of
-        * this namespace when used in C code.
-        *
-        * @param cprefix the lower case prefix to be used in C code
-        */
-       public void set_lower_case_cprefix (string cprefix) {
-               this.lower_case_cprefix = cprefix;
-       }
-
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("cprefix")) {
-                       string value = a.get_string ("cprefix");
-                       if (value == "") {
-                               // split of an empty string returns an empty array
-                               add_cprefix ("");
-                       } else {
-                               foreach (string name in value.split (",")) {
-                                       add_cprefix (name);
-                               }
-                       }
-               }
-               if (a.has_argument ("lower_case_cprefix")) {
-                       set_lower_case_cprefix (a.get_string ("lower_case_cprefix"));
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-               if (a.has_argument ("gir_namespace")) {
-                       source_reference.file.gir_namespace = a.get_string ("gir_namespace");
-               }
-               if (a.has_argument ("gir_version")) {
-                       source_reference.file.gir_version = a.get_string ("gir_version");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
 
        public override bool check (CodeContext context) {
                if (checked) {
@@ -613,7 +504,13 @@ public class Vala.Namespace : Symbol {
 
                checked = true;
 
-               process_attributes ();
+               var a = get_attribute ("CCode");
+               if (a != null && a.has_argument ("gir_namespace")) {
+                       source_reference.file.gir_namespace = a.get_string ("gir_namespace");
+               }
+               if (a != null && a.has_argument ("gir_version")) {
+                       source_reference.file.gir_version = a.get_string ("gir_version");
+               }
 
                foreach (Namespace ns in namespaces) {
                        ns.check (context);
index fdba4a73020f3ce3b842163120c8f5db3afff06e..19d110984d7a7ffbc8257f6259bdf8ce830ddf38 100644 (file)
@@ -62,14 +62,6 @@ public class Vala.NullType : ReferenceType {
                return new NullType (source_reference);
        }
 
-       public override string? get_cname () {
-               if (CodeContext.get ().profile == Profile.GOBJECT) {
-                       return "gpointer";
-               } else {
-                       return "void *";
-               }
-       }
-
        public override bool is_disposable () {
                return false;
        }
index 1152b460ff2a3b7ea9c1549c8066bde039e4f34d..a274de01370853c25a5392821f8397301a4b74c9 100644 (file)
@@ -275,7 +275,8 @@ public class Vala.ObjectCreationExpression : Expression {
                        }
 
                        while (cl != null) {
-                               if (cl.get_ref_sink_function () != null) {
+                               // FIXME: use target values in the codegen
+                               if (cl.get_attribute_string ("CCode", "ref_sink_function") != null) {
                                        value_type.floating_reference = true;
                                        break;
                                }
index 42187567e17fa76ff4e85020931a9f30911676b1..6d440b18138249c176619fc7418be911944be6c2 100644 (file)
@@ -51,16 +51,6 @@ public class Vala.ObjectType : ReferenceType {
                return result;
        }
 
-       public override string? get_cname () {
-               if (CodeContext.get ().profile == Profile.DOVA) {
-                       if (type_symbol.get_full_name () == "string") {
-                               return "string_t";
-                       }
-               }
-
-               return "%s*".printf (type_symbol.get_cname (!value_owned));
-       }
-
        public override bool stricter (DataType target_type) {
                var obj_target_type = target_type as ObjectType;
                if (obj_target_type == null) {
index ab4d4a3b09fa32675e298a47702f5f9967c02c53..e34b773f2c4fc23cd424a4f8ac12f69befa464c6 100644 (file)
@@ -42,30 +42,6 @@ public class Vala.Parameter : Variable {
         */
        public bool params_array { get; set; }
        
-       /**
-        * Specifies the position of the parameter in the C function.
-        */
-       public double cparameter_position { get; set; }
-
-       /**
-        * Specifies the position of the array length parameter in the C
-        * function.
-        */
-       public double carray_length_parameter_position { get; set; }
-
-       /**
-        * Specifies the position of the delegate target parameter in the C
-        * function.
-        */
-       public double cdelegate_target_parameter_position { get; set; }
-
-       public double cdestroy_notify_parameter_position { get; set; }
-
-       /**
-        * Specifies the type of the parameter in the C function.
-        */
-       public string? ctype { get; set; }
-
        public bool captured { get; set; }
 
        /**
@@ -119,46 +95,13 @@ public class Vala.Parameter : Variable {
                }
        }
 
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("type")) {
-                       ctype = a.get_string ("type");
-               }
-               if (a.has_argument ("pos")) {
-                       cparameter_position = a.get_double ("pos");
-               }
-               if (a.has_argument ("array_length_pos")) {
-                       carray_length_parameter_position = a.get_double ("array_length_pos");
-               }
-               if (a.has_argument ("delegate_target_pos")) {
-                       cdelegate_target_parameter_position = a.get_double ("delegate_target_pos");
-               }
-               if (a.has_argument ("destroy_notify_pos")) {
-                       cdestroy_notify_parameter_position = a.get_double ("destroy_notify_pos");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public override void process_attributes () {
-               base.process_attributes ();
-
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
-
        public Parameter copy () {
                if (!ellipsis) {
                        var result = new Parameter (name, variable_type, source_reference);
                        result.params_array = params_array;
                        result.direction = this.direction;
                        result.initializer = this.initializer;
-                       result.no_array_length = this.no_array_length;
-                       result.no_delegate_target = this.no_delegate_target;
-                       result.array_null_terminated = this.array_null_terminated;
+                       result.attributes = this.attributes.copy ();
                        return result;
                } else {
                        return new Parameter.with_ellipsis ();
@@ -172,8 +115,6 @@ public class Vala.Parameter : Variable {
 
                checked = true;
 
-               process_attributes ();
-
                var old_source_file = context.analyzer.current_source_file;
                var old_symbol = context.analyzer.current_symbol;
 
index 92345874a5628add17662699a5188413f3305c6f..40016c3426d878d3df8e2137c795b2182fdf5480 100644 (file)
@@ -49,14 +49,6 @@ public class Vala.PointerType : DataType {
                return base_type.to_qualified_string (scope) + "*";
        }
 
-       public override string? get_cname () {
-               if (base_type.data_type != null && base_type.data_type.is_reference_type ()) {
-                       return base_type.get_cname ();
-               } else {
-                       return base_type.get_cname () + "*";
-               }
-       }
-
        public override DataType copy () {
                return new PointerType (base_type.copy ());
        }
@@ -91,7 +83,7 @@ public class Vala.PointerType : DataType {
                        return base_type.compatible (target_type);
                }
 
-               if (target_type.get_type_id () == "G_TYPE_VALUE") {
+               if (CodeContext.get ().profile == Profile.GOBJECT && target_type.data_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
                        // allow implicit conversion to GValue
                        return true;
                }
@@ -127,10 +119,6 @@ public class Vala.PointerType : DataType {
                return base_type.is_accessible (sym);
        }
 
-       public override string? get_type_id () {
-               return "G_TYPE_POINTER";
-       }
-
        public override void accept_children (CodeVisitor visitor) {
                base_type.accept (visitor);
        }
index ea24086cce8a110b015a5e63a4c39a2131c55318..7816020f7fed4618cdaa9404fa987aad2a1e313b 100644 (file)
@@ -71,18 +71,6 @@ public class Vala.Property : Symbol, Lockable {
         */
        public Parameter this_parameter { get; set; }
 
-       /**
-        * Specifies whether a `notify` signal should be emitted on property
-        * changes.
-        */
-       public bool notify { get; set; default = true; }
-
-       /**
-        * Specifies whether the implementation of this property does not
-        * provide getter/setter methods.
-        */
-       public bool no_accessor_method { get; set; }
-       
        /**
         * Specifies whether automatic accessor code generation should be
         * disabled.
@@ -146,43 +134,10 @@ public class Vala.Property : Symbol, Lockable {
         */
        public Expression initializer { get; set; }
 
-       public bool no_array_length { get; set; }
-
-       public bool array_null_terminated { get; set; }
-
-       /**
-        * Nickname of this property.
-        */
-       public string nick {
-               get {
-                       if (_nick == null) {
-                               _nick = get_canonical_name ();
-                       }
-                       return _nick;
-               }
-               set { _nick = value; }
-       }
-
-       /**
-        * The long description of this property.
-        */
-       public string blurb {
-               get {
-                       if (_blurb == null) {
-                               _blurb = get_canonical_name ();
-                       }
-                       return _blurb;
-               }
-               set { _blurb = value; }
-       }
-
        private bool lock_used = false;
 
        private DataType _data_type;
 
-       private string? _nick;
-       private string? _blurb;
-
        private weak Property _base_property;
        private Property _base_interface_property;
        private bool base_properties_valid;
@@ -225,77 +180,6 @@ public class Vala.Property : Symbol, Lockable {
                }
        }
 
-       /**
-        * Returns the C name of this property in upper case. Words are
-        * separated by underscores. The upper case C name of the class is
-        * prefix of the result.
-        *
-        * @return the upper case name to be used in C code
-        */
-       public string get_upper_case_cname () {
-               return "%s_%s".printf (parent_symbol.get_lower_case_cname (null), camel_case_to_lower_case (name)).up ();
-       }
-       
-       /**
-        * Returns the string literal of this property to be used in C code.
-        *
-        * @return string literal to be used in C code
-        */
-       public CCodeConstant get_canonical_cconstant () {
-               return new CCodeConstant ("\"%s\"".printf (get_canonical_name ()));
-       }
-
-       public string get_canonical_name () {
-               var str = new StringBuilder ();
-               
-               string i = name;
-               
-               while (i.length > 0) {
-                       unichar c = i.get_char ();
-                       if (c == '_') {
-                               str.append_c ('-');
-                       } else {
-                               str.append_unichar (c);
-                       }
-                       
-                       i = i.next_char ();
-               }
-               
-               return str.str;
-       }
-
-       void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("notify")) {
-                       notify = a.get_bool ("notify");
-               }
-               if (a.has_argument ("array_length")) {
-                       no_array_length = !a.get_bool ("array_length");
-               }
-               if (a.has_argument ("array_null_terminated")) {
-                       array_null_terminated = a.get_bool ("array_null_terminated");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       } else if (a.name == "NoAccessorMethod") {
-                               no_accessor_method = true;
-                       } else if (a.name == "Description") {
-                               if (a.has_argument ("nick")) {
-                                       nick = a.get_string ("nick");
-                               }
-                               if (a.has_argument ("blurb")) {
-                                       blurb = a.get_string ("blurb");
-                               }
-                       }                       
-               }
-       }
-       
        public bool get_lock_used () {
                return lock_used;
        }
@@ -424,8 +308,6 @@ public class Vala.Property : Symbol, Lockable {
 
                checked = true;
 
-               process_attributes ();
-
                if (is_abstract) {
                        if (parent_symbol is Class) {
                                var cl = (Class) parent_symbol;
index dc4a8b3d305f30f7eb9de0faa43451d5714bd3c8..47a1977723129f2cca481505d15f61881b4c4beb 100644 (file)
@@ -76,29 +76,7 @@ public class Vala.PropertyAccessor : Subroutine {
         */
        public Parameter value_parameter { get; set; }
 
-       public virtual string get_default_cname () {
-               var t = (TypeSymbol) prop.parent_symbol;
-
-               if (readable) {
-                       return "%sget_%s".printf (t.get_lower_case_cprefix (), prop.name);
-               } else {
-                       return "%sset_%s".printf (t.get_lower_case_cprefix (), prop.name);
-               }
-       }
-
-       /**
-        * The publicly accessible name of the function that performs the
-        * access in C code.
-        */
-       public string get_cname () {
-               if (_cname != null) {
-                       return _cname;
-               }
-               return get_default_cname ();
-       }
-
        private DataType _value_type;
-       private string? _cname;
        
        /**
         * Creates a new property accessor.
@@ -136,19 +114,6 @@ public class Vala.PropertyAccessor : Subroutine {
                }
        }
 
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               if (a.has_argument ("cname")) {
-                                       _cname = a.get_string ("cname");
-                               }
-                       }
-               }
-       }
-
        public override bool check (CodeContext context) {
                if (checked) {
                        return !error;
@@ -156,8 +121,6 @@ public class Vala.PropertyAccessor : Subroutine {
 
                checked = true;
 
-               process_attributes ();
-
                if (!value_type.check (context)) {
                        error = true;
                        return false;
@@ -229,8 +192,4 @@ public class Vala.PropertyAccessor : Subroutine {
                        value_type = new_type;
                }
        }
-
-       public override List<string> get_cheader_filenames () {
-               return parent_symbol.get_cheader_filenames ();
-       }
 }
index a2a3a1059afcfae27d3ea50b232b9d25c9bef635..97f910deafaa80484677f06187ff4c4b8b7f5d54 100644 (file)
@@ -152,6 +152,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
        public DataType type_type;
        public Class object_type;
        public StructValueType gvalue_type;
+       public ObjectType gvariant_type;
        public DataType glist_type;
        public DataType gslist_type;
        public DataType garray_type;
@@ -213,6 +214,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        object_type = (Class) glib_ns.scope.lookup ("Object");
                        type_type = new IntegerType ((Struct) glib_ns.scope.lookup ("Type"));
                        gvalue_type = new StructValueType ((Struct) glib_ns.scope.lookup ("Value"));
+                       gvariant_type = new ObjectType ((Class) glib_ns.scope.lookup ("Variant"));
 
                        glist_type = new ObjectType ((Class) glib_ns.scope.lookup ("List"));
                        gslist_type = new ObjectType ((Class) glib_ns.scope.lookup ("SList"));
index e041ec039436875697b8ebdfa70a47225ddeaef4..fb5895ab948afc4910d5fbcfa88c3fbae8e5f454 100644 (file)
@@ -47,11 +47,6 @@ public class Vala.Signal : Symbol, Lockable {
                }
        }
 
-       /**
-        * Specifies whether this signal has an emitter wrapper function.
-        */
-       public bool has_emitter { get; set; }
-       
        /**
         * Specifies whether this signal has virtual method handler.
         */
@@ -64,19 +59,6 @@ public class Vala.Signal : Symbol, Lockable {
         * */
        public Method default_handler { get; private set; }
 
-       public bool is_detailed { get; set; }
-
-       public bool no_recurse { get; set; }
-
-       public string run_type { get; set; }
-
-       public bool is_action { get; set; }
-
-       public bool no_hooks { get; set; }
-
-
-       private string cname;
-       
        private bool lock_used = false;
 
        private DataType _return_type;
@@ -94,7 +76,6 @@ public class Vala.Signal : Symbol, Lockable {
        public Signal (string name, DataType return_type, SourceReference? source_reference = null, Comment? comment = null) {
                base (name, source_reference, comment);
                this.return_type = return_type;
-               this.run_type = "last";
        }
        
        /**
@@ -103,12 +84,6 @@ public class Vala.Signal : Symbol, Lockable {
         * @param param a formal parameter
         */
        public void add_parameter (Parameter param) {
-               // default C parameter position
-               param.cparameter_position = parameters.size + 1;
-               param.carray_length_parameter_position = param.cparameter_position + 0.1;
-               param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
-               param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
-
                parameters.add (param);
                scope.add (param.name, param);
        }
@@ -167,54 +142,7 @@ public class Vala.Signal : Symbol, Lockable {
 
                return generated_delegate;
        }
-
-       /**
-        * Returns the name of this signal as it is used in C code.
-        *
-        * @return the name to be used in C code
-        */
-       public string get_cname () {
-               if (cname == null) {
-                       cname = camel_case_to_lower_case (name);
-               }
-               return cname;
-       }
-       
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
        
-       /**
-        * Returns the string literal of this signal to be used in C code.
-        *
-        * @return string literal to be used in C code
-        */
-       public CCodeConstant get_canonical_cconstant (string? detail = null) {
-               var str = new StringBuilder ("\"");
-               
-               string i = get_cname ();
-               
-               while (i.length > 0) {
-                       unichar c = i.get_char ();
-                       if (c == '_') {
-                               str.append_c ('-');
-                       } else {
-                               str.append_unichar (c);
-                       }
-                       
-                       i = i.next_char ();
-               }
-
-               if (detail != null) {
-                       str.append ("::");
-                       str.append (detail);
-               }
-
-               str.append_c ('"');
-               
-               return new CCodeConstant (str.str);
-       }
-
        public override void accept (CodeVisitor visitor) {
                visitor.visit_signal (this);
        }
@@ -232,46 +160,6 @@ public class Vala.Signal : Symbol, Lockable {
                }
        }
 
-       void process_signal_attribute (Attribute a) {
-               if (a.has_argument ("detailed")) {
-                       is_detailed = a.get_bool ("detailed");
-               }
-               if (a.has_argument ("no_recurse")) {
-                       no_recurse = a.get_bool ("no_recurse");
-               }
-               if (a.has_argument ("run")) {
-                       var arg = a.get_string ("run");
-                       if (arg == "first") {
-                               run_type = "first";
-                       } else if (arg == "last") {
-                               run_type = "last";
-                       } else if (arg == "cleanup") {
-                               run_type = "cleanup";
-                       }
-               }
-
-               if (a.has_argument ("action")) {
-                       is_action = a.get_bool ("action");
-               }
-
-               if (a.has_argument ("no_hooks")) {
-                       no_hooks = a.get_bool ("no_hooks");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "HasEmitter") {
-                               has_emitter = true;
-                       } else if (a.name == "Signal") {
-                               process_signal_attribute (a);
-                       }
-               }
-       }
-       
        public bool get_lock_used () {
                return lock_used;
        }
@@ -293,8 +181,6 @@ public class Vala.Signal : Symbol, Lockable {
 
                checked = true;
 
-               process_attributes ();
-
                return_type.check (context);
                
                foreach (Parameter param in parameters) {
@@ -314,7 +200,6 @@ public class Vala.Signal : Symbol, Lockable {
                        default_handler.external = external;
                        default_handler.hides = hides;
                        default_handler.is_virtual = true;
-                       default_handler.vfunc_name = name;
                        default_handler.signal_reference = this;
                        default_handler.body = body;
 
index 443dc040f0ad05dc925b209c433197e90cfeea1d..f913a019ce18be3d37504e6174e96195b1bb5a84 100644 (file)
@@ -33,11 +33,6 @@ public class Vala.Struct : TypeSymbol {
        private List<Property> properties = new ArrayList<Property> ();
        private DataType _base_type = null;
 
-       private string cname;
-       private string const_cname;
-       private string type_id;
-       private string lower_case_cprefix;
-       private string lower_case_csuffix;
        private bool? boolean_type;
        private bool? integer_type;
        private bool? floating_type;
@@ -47,13 +42,6 @@ public class Vala.Struct : TypeSymbol {
        private int? _width;
        private bool? _signed;
        private bool? _is_immutable;
-       private string marshaller_type_name;
-       private string get_value_function;
-       private string set_value_function;
-       private string take_value_function;
-       private string default_value = null;
-       private string copy_function;
-       private string destroy_function;
 
        /**
         * Specifies the base type.
@@ -102,11 +90,6 @@ public class Vala.Struct : TypeSymbol {
                }
        }
 
-       /**
-        * Specifies whether this struct has a registered GType.
-        */
-       public bool has_type_id { get; set; default = true; }
-
        public int width {
                get {
                        if (_width == null) {
@@ -141,10 +124,6 @@ public class Vala.Struct : TypeSymbol {
                }
        }
 
-       public bool has_copy_function { get; set; default = true; }
-
-       public bool has_destroy_function { get; set; default = true; }
-
        /**
         * Creates a new struct.
         *
@@ -316,70 +295,6 @@ public class Vala.Struct : TypeSymbol {
                }
        }
 
-       public override string get_cname (bool const_type = false) {
-               if (const_type && const_cname != null) {
-                       return const_cname;
-               }
-               
-               if (cname == null) {
-                       var attr = get_attribute ("CCode");
-                       if (attr != null) {
-                               cname = attr.get_string ("cname");
-                       }
-                       if (cname == null) {
-                               cname = get_default_cname ();
-                       }
-               }
-               return cname;
-       }
-
-       public void set_cname (string cname) {
-               this.cname = cname;
-       }
-
-       /**
-        * Returns the default name of this struct as it is used in C code.
-        *
-        * @return the name to be used in C code by default
-        */
-       public string get_default_cname () {
-               // parent_symbol may be null in GIR parser
-               if (parent_symbol != null) {
-                       return "%s%s".printf (parent_symbol.get_cprefix (), name);
-               } else {
-                       return name;
-               }
-       }
-
-       private void set_const_cname (string cname) {
-               this.const_cname = cname;
-       }
-       
-       public override string get_lower_case_cprefix () {
-               if (lower_case_cprefix == null) {
-                       lower_case_cprefix = "%s_".printf (get_lower_case_cname (null));
-               }
-               return lower_case_cprefix;
-       }
-       
-       private string get_lower_case_csuffix () {
-               if (lower_case_csuffix == null) {
-                       lower_case_csuffix = camel_case_to_lower_case (name);
-               }
-               return lower_case_csuffix;
-       }
-
-       public override string? get_lower_case_cname (string? infix) {
-               if (infix == null) {
-                       infix = "";
-               }
-               return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ());
-       }
-       
-       public override string? get_upper_case_cname (string? infix) {
-               return get_lower_case_cname (infix).up ();
-       }
-
        /**
         * Returns whether this is a boolean type.
         *
@@ -446,10 +361,15 @@ public class Vala.Struct : TypeSymbol {
         */
        public int get_rank () {
                if (rank == null) {
-                       if (is_integer_type ()) {
+                       if (is_integer_type () && has_attribute_argument ("IntegerType", "rank")) {
                                rank = get_attribute_integer ("IntegerType", "rank");
-                       } else {
+                       } else if (has_attribute_argument ("FloatingType", "rank")) {
                                rank = get_attribute_integer ("FloatingType", "rank");
+                       } else {
+                               var st = base_struct;
+                               if (st != null) {
+                                       rank = st.get_rank ();
+                               }
                        }
                }
                return rank;
@@ -469,233 +389,6 @@ public class Vala.Struct : TypeSymbol {
                }
        }
 
-       private void process_gir_attribute (Attribute a) {
-               if (a.has_argument ("name")) {
-                       gir_name = a.get_string ("name");
-               }
-       }
-
-       private void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("const_cname")) {
-                       set_const_cname (a.get_string ("const_cname"));
-               }
-               if (a.has_argument ("cprefix")) {
-                       lower_case_cprefix = a.get_string ("cprefix");
-               }
-               if (a.has_argument ("cheader_filename")) {
-                       var val = a.get_string ("cheader_filename");
-                       foreach (string filename in val.split (",")) {
-                               add_cheader_filename (filename);
-                       }
-               }
-               if (a.has_argument ("has_type_id")) {
-                       has_type_id = a.get_bool ("has_type_id");
-               }
-               if (a.has_argument ("type_id")) {
-                       set_type_id (a.get_string ("type_id"));
-               }
-               if (a.has_argument ("marshaller_type_name")) {
-                       set_marshaller_type_name (a.get_string ("marshaller_type_name"));
-               }
-               if (a.has_argument ("get_value_function")) {
-                       set_get_value_function (a.get_string ("get_value_function"));
-               }
-               if (a.has_argument ("set_value_function")) {
-                       set_set_value_function (a.get_string ("set_value_function"));
-               }
-               if (a.has_argument ("take_value_function")) {
-                       set_take_value_function (a.get_string ("take_value_function"));
-               }
-               if (a.has_argument ("default_value")) {
-                       set_default_value (a.get_string ("default_value"));
-               }
-               if (a.has_argument ("copy_function")) {
-                       set_copy_function (a.get_string ("copy_function"));
-               }
-               if (a.has_argument ("has_copy_function")) {
-                       has_copy_function = a.get_bool ("has_copy_function");
-               }
-               if (a.has_argument ("destroy_function")) {
-                       set_destroy_function (a.get_string ("destroy_function"));
-               }
-               if (a.has_argument ("has_destroy_function")) {
-                       has_destroy_function = a.get_bool ("has_destroy_function");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       } else if (a.name == "GIR") {
-                               process_gir_attribute (a);
-                       }
-               }
-       }
-
-       public override string? get_type_id () {
-               if (type_id == null) {
-                       if (!has_type_id) {
-                               if (base_type != null) {
-                                       var st = base_struct;
-                                       if (st != null) {
-                                               return st.get_type_id ();
-                                       }
-                               }
-                               if (is_simple_type ()) {
-                                       return null;
-                               } else {
-                                       return "G_TYPE_POINTER";
-                               }
-                       } else {
-                               type_id = get_upper_case_cname ("TYPE_");
-                       }
-               }
-               return type_id;
-       }
-       
-       public void set_type_id (string? name) {
-               this.type_id = name;
-       }
-
-       public override string? get_marshaller_type_name () {
-               if (marshaller_type_name == null) {
-                       if (base_type != null) {
-                               var st = base_struct;
-                               if (st != null) {
-                                       return st.get_marshaller_type_name ();
-                               }
-                       }
-                       if (is_simple_type ()) {
-                               Report.error (source_reference, "The type `%s` doesn't declare a marshaller type name".printf (get_full_name ()));
-                               // set marshaller_type_name to avoid multiple errors
-                               marshaller_type_name = "";
-                               return "";
-                       } else if (has_type_id) {
-                               return "BOXED";
-                       } else {
-                               return "POINTER";
-                       }
-               }
-               return marshaller_type_name;
-       }
-       
-       private void set_marshaller_type_name (string? name) {
-               this.marshaller_type_name = name;
-       }
-       
-       public override string? get_get_value_function () {
-               if (get_value_function == null) {
-                       if (base_type != null) {
-                               var st = base_struct;
-                               if (st != null) {
-                                       return st.get_get_value_function ();
-                               }
-                       }
-                       if (is_simple_type ()) {
-                               Report.error (source_reference, "The value type `%s` doesn't declare a GValue get function".printf (get_full_name ()));
-                               // set get_value_function to avoid multiple errors
-                               get_value_function = "";
-                               return "";
-                       } else if (has_type_id) {
-                               return "g_value_get_boxed";
-                       } else {
-                               return "g_value_get_pointer";
-                       }
-               } else {
-                       return get_value_function;
-               }
-       }
-       
-       public override string? get_set_value_function () {
-               if (set_value_function == null) {
-                       if (base_type != null) {
-                               var st = base_struct;
-                               if (st != null) {
-                                       return st.get_set_value_function ();
-                               }
-                       }
-                       if (is_simple_type ()) {
-                               Report.error (source_reference, "The value type `%s` doesn't declare a GValue set function".printf (get_full_name ()));
-                               // set set_value_function to avoid multiple errors
-                               set_value_function = "";
-                               return "";
-                       } else if (has_type_id) {
-                               return "g_value_set_boxed";
-                       } else {
-                               return "g_value_set_pointer";
-                       }
-               } else {
-                       return set_value_function;
-               }
-       }
-
-       public override string? get_take_value_function () {
-               if (take_value_function == null) {
-                       if (base_type != null) {
-                               var st = base_struct;
-                               if (st != null) {
-                                       return st.get_take_value_function ();
-                               }
-                       }
-                       if (is_simple_type ()) {
-                               Report.error (source_reference, "The value type `%s` doesn't declare a GValue take function".printf (get_full_name ()));
-                               // set take_value_function to avoid multiple errors
-                               take_value_function = "";
-                               return "";
-                       } else if (has_type_id) {
-                               return "g_value_take_boxed";
-                       } else {
-                               return "g_value_take_pointer";
-                       }
-               } else {
-                       return take_value_function;
-               }
-       }
-
-       private void set_get_value_function (string? function) {
-               get_value_function = function;
-       }
-       
-       private void set_set_value_function (string? function) {
-               set_value_function = function;
-       }
-
-       private void set_take_value_function (string? function) {
-               take_value_function = function;
-       }
-
-       public override string? get_default_value () {
-               if (default_value != null) {
-                       return default_value;
-               }
-
-               // inherit default value from base type
-               if (base_type != null) {
-                       var st = base_struct;
-                       if (st != null) {
-                               return st.get_default_value ();
-                       }
-               }
-
-               if (CodeContext.get ().profile == Profile.DOVA) {
-                       if (is_boolean_type ()) {
-                               return "false";
-                       } else if (is_integer_type () || is_floating_type ()) {
-                               return "0";
-                       }
-               }
-
-               return null;
-       }
-
-       private void set_default_value (string? value) {
-               default_value = value;
-       }
-
        public override int get_type_parameter_index (string name) {
                int i = 0;
                
@@ -756,54 +449,6 @@ public class Vala.Struct : TypeSymbol {
                return false;
        }
 
-       public override string? get_dup_function () {
-               // TODO use attribute check instead
-               if (external_package) {
-                       return null;
-               } else {
-                       return get_lower_case_cprefix () + "dup";
-               }
-       }
-       
-       public override string? get_free_function () {
-               // TODO use attribute check instead
-               if (external_package) {
-                       return null;
-               } else {
-                       return get_lower_case_cprefix () + "free";
-               }
-       }
-
-       public string get_default_copy_function () {
-               return get_lower_case_cprefix () + "copy";
-       }
-
-       public override string? get_copy_function () {
-               if (copy_function == null) {
-                       copy_function = get_default_copy_function ();
-               }
-               return copy_function;
-       }
-
-       public void set_copy_function (string name) {
-               this.copy_function = name;
-       }
-
-       public string get_default_destroy_function () {
-               return get_lower_case_cprefix () + "destroy";
-       }
-
-       public override string? get_destroy_function () {
-               if (destroy_function == null) {
-                       destroy_function = get_default_destroy_function ();
-               }
-               return destroy_function;
-       }
-
-       public void set_destroy_function (string name) {
-               this.destroy_function = name;
-       }
-
        public bool is_disposable () {
                if (get_attribute_string ("CCode", "destroy_function") != null) {
                        return true;
@@ -842,8 +487,6 @@ public class Vala.Struct : TypeSymbol {
 
                checked = true;
 
-               process_attributes ();
-
                var old_source_file = context.analyzer.current_source_file;
                var old_symbol = context.analyzer.current_symbol;
 
index 46e26c28d6d8b0e85a842efc6ef7f5911e9de489..98138019ddf1f1b075fa0b78319d2086e47f0669 100644 (file)
@@ -52,18 +52,6 @@ public abstract class Vala.Symbol : CodeNode {
                }
        }
 
-       /**
-        * The GIR name.
-        */
-       public string? gir_name {
-               get {
-                       return _gir_name == null ? name : _gir_name;
-               }
-               set {
-                       _gir_name = value;
-               }
-       }
-
        /**
         * The symbol name.
         */
@@ -150,8 +138,6 @@ public abstract class Vala.Symbol : CodeNode {
 
        public Comment? comment { get; set; }
 
-       private List<string> cheader_filenames;
-
        /**
         * Specifies whether this method explicitly hides a member of a base
         * type.
@@ -229,7 +215,6 @@ public abstract class Vala.Symbol : CodeNode {
 
        private weak Scope _owner;
        private Scope _scope;
-       private string? _gir_name = null;
        private bool? _deprecated;
        private bool? _experimental;
 
@@ -239,34 +224,7 @@ public abstract class Vala.Symbol : CodeNode {
                this.comment = comment;
                _scope = new Scope (this);
        }
-       
-       /**
-        * Returns the fully expanded GIR name of this symbol
-        *
-        * @return full GIR name
-        */
-       public string get_full_gir_name () {
-               if (parent_symbol == null) {
-                       return gir_name;
-               }
-               
-               if (name == null) {
-                       return parent_symbol.get_full_gir_name ();
-               }
-
-               if (parent_symbol.get_full_gir_name () == null) {
-                       return gir_name;
-               }
 
-               string parent_gir_name = parent_symbol.get_full_gir_name ();
-               string self_gir_name = gir_name.has_prefix (".") ? gir_name.substring (1) : gir_name;
-               if ("." in parent_gir_name) {
-                       return "%s%s".printf (parent_gir_name, self_gir_name);
-               } else {
-                       return "%s.%s".printf (parent_gir_name, self_gir_name);
-               }
-       }
-       
        /**
         * Returns the fully expanded name of this symbol for use in
         * human-readable messages.
@@ -292,76 +250,7 @@ public abstract class Vala.Symbol : CodeNode {
                        return "%s.%s".printf (parent_symbol.get_full_name (), name);
                }
        }
-
-       /**
-        * Returns the camel case string to be prepended to the name of members
-        * of this symbol when used in C code.
-        *
-        * @return the camel case prefix to be used in C code
-        */
-       public virtual string get_cprefix () {
-               if (name == null) {
-                       return "";
-               } else {
-                       return name;
-               }
-       }
        
-       /**
-        * Returns the C name of this symbol in lower case. Words are
-        * separated by underscores. The lower case C name of the parent symbol
-        * is prefix of the result, if there is one.
-        *
-        * @param infix a string to be placed between namespace and data type
-        *              name or null
-        * @return      the lower case name to be used in C code
-        */
-       public virtual string? get_lower_case_cname (string? infix = null) {
-               return null;
-       }
-
-       /**
-        * Returns the string to be prefixed to members of this symbol in
-        * lower case when used in C code.
-        *
-        * @return      the lower case prefix to be used in C code
-        */
-       public virtual string get_lower_case_cprefix () {
-               return "";
-       }
-
-       static List<string> _empty_string_list;
-
-       /**
-        * Returns a list of C header filenames users of this symbol must
-        * include.
-        *
-        * @return list of C header filenames for this symbol
-        */
-       public virtual List<string> get_cheader_filenames () {
-               if (cheader_filenames == null || cheader_filenames.size == 0) {
-                       // parent_symbol can be null on incremental parsing
-                       if (parent_symbol != null) {
-                               /* default to header filenames of the namespace */
-                               var parent_header_filenames = parent_symbol.get_cheader_filenames ();
-                               if (parent_header_filenames.size > 0) {
-                                       return parent_header_filenames;
-                               }
-                       }
-
-                       if (source_reference != null && !external_package) {
-                               // don't add default include directives for VAPI files
-                               add_cheader_filename (source_reference.file.get_cinclude_filename ());
-                       } else {
-                               if (_empty_string_list == null) {
-                                       _empty_string_list = new ArrayList<string> ();
-                               }
-                               return _empty_string_list;
-                       }
-               }
-               return cheader_filenames;
-       }
-
        /**
         * Converts a string from CamelCase to lower_case.
         *
@@ -541,30 +430,6 @@ public abstract class Vala.Symbol : CodeNode {
                }
        }
 
-       /**
-        * Sets the C header filename of this namespace to the specified
-        * filename.
-        *
-        * @param cheader_filename header filename
-        */
-       public void set_cheader_filename (string cheader_filename) {
-               cheader_filenames = new ArrayList<string> ();
-               cheader_filenames.add (cheader_filename);
-       }
-
-       /**
-        * Adds a filename to the list of C header filenames users of this data
-        * type must include.
-        *
-        * @param filename a C header filename
-        */
-       public void add_cheader_filename (string filename) {
-               if (cheader_filenames == null) {
-                       cheader_filenames = new ArrayList<string> ();
-               }
-               cheader_filenames.add (filename);
-       }
-
        public Symbol? get_hidden_member () {
                Symbol sym = null;
 
index 956939b8ef77eb5234099d58dbff05801b2086a4..8ba3aef578a02dfc9fe6cfd2e4c1a05b8028230a 100644 (file)
@@ -33,13 +33,6 @@ public abstract class Vala.TypeSymbol : Symbol {
                base (name, source_reference, comment);
        }
 
-       /**
-        * Returns the name of this data type as it is used in C code.
-        *
-        * @return the name to be used in C code
-        */
-       public abstract string get_cname (bool const_type = false);
-       
        /**
         * Checks whether this data type has value or reference type semantics.
         *
@@ -48,179 +41,6 @@ public abstract class Vala.TypeSymbol : Symbol {
        public virtual bool is_reference_type () {
                return false;
        }
-       
-       /**
-        * Returns the C function name that duplicates instances of this data
-        * type. The specified C function must accept one argument referencing
-        * the instance of this data type and return a reference to the
-        * duplicate.
-        *
-        * @return the name of the C function if supported or null otherwise
-        */
-       public virtual string? get_dup_function () {
-               return null;
-       }
-       
-       /**
-        * Returns the C function name that frees instances of this data type.
-        * The specified C function must accept one argument pointing to the
-        * instance to be freed.
-        *
-        * @return the name of the C function if supported or null otherwise
-        */
-       public virtual string? get_free_function () {
-               return null;
-       }
-
-       /**
-        * Returns the C function name that copies contents of instances of
-        * this data type. This is only applicable to structs. The specified
-        * C function must accept two arguments, the first is the source value
-        * and the second is the destination value.
-        *
-        * @return the name of the C function if supported or null otherwise
-        */
-       public virtual string? get_copy_function () {
-               return null;
-       }
-
-       /**
-        * Returns the C function name that destroys the contents of instances
-        * of this data type. This is only applicable to structs. The specified
-        * C function must accept one argument pointing to the instance to be
-        * destroyed.
-        *
-        * @return the name of the C function if supported or null otherwise
-        */
-       public virtual string? get_destroy_function () {
-               return null;
-       }
-
-       /**
-        * Checks whether this data type supports reference counting. This is
-        * only valid for reference types.
-        *
-        * @return true if this data type supports reference counting
-        */
-       public virtual bool is_reference_counting () {
-               return false;
-       }
-       
-       /**
-        * Returns the C function name that increments the reference count of
-        * instances of this data type. This is only valid for data types
-        * supporting reference counting. The specified C function must accept
-        * one argument referencing the instance of this data type and return
-        * the reference.
-        *
-        * @return the name of the C function or null if this data type does not
-        *         support reference counting
-        */
-       public virtual string? get_ref_function () {
-               return null;
-       }
-       
-       /**
-        * Returns the C function name that decrements the reference count of
-        * instances of this data type. This is only valid for data types
-        * supporting reference counting. The specified C function must accept
-        * one argument referencing the instance of this data type.
-        *
-        * @return the name of the C function or null if this data type does not
-        *         support reference counting
-        */
-       public virtual string? get_unref_function () {
-               return null;
-       }
-
-       /**
-        * Returns the C function name that sinks the reference count of
-        * "floating" instances of this data type. This is only valid for data
-        * types supporting floating references. The specified C function must
-        * accept one argument referencing the instance of this data type and
-        * return a non-floating reference.
-        *
-        * The ref_sink function is called for any constructor of the class and
-        * for other methods that have the class as a return value and are
-        * marked with the 'floating' attribute.
-        *
-        * @return the name of the C function or null if this data type does not
-        *         support floating reference counts
-        */
-       public virtual string? get_ref_sink_function () {
-               return null;
-       }
-
-       /**
-        * Returns the C symbol representing the runtime type id for this data
-        * type. The specified symbol must express a registered GType.
-        *
-        * @return the name of the GType name in C code or null if this data
-        *         type is not registered with GType
-        */
-       public virtual string? get_type_id () {
-               return null;
-       }
-       
-       /**
-        * Returns the name of this data type as used in C code marshallers
-        *
-        * @return type name for marshallers
-        */
-       public virtual string? get_marshaller_type_name () {
-               return null;
-       }
-
-       /**
-        * Returns the cname of the GValue parameter spec function.
-        */
-       public virtual string? get_param_spec_function () {
-               return null;
-       }
-
-       /**
-        * Returns the cname of the GValue getter function.
-        */
-       public virtual string? get_get_value_function () {
-               return null;
-       }
-       
-       /**
-        * Returns the cname of the GValue setter function.
-        */
-       public virtual string? get_set_value_function () {
-               return null;
-       }
-
-       /**
-        * Returns the cname of the GValue taker function.
-        */
-       public virtual string? get_take_value_function () {
-               return null;
-       }
-
-       /**
-        * Returns the C name of this data type in upper case. Words are
-        * separated by underscores. The upper case C name of the namespace is
-        * prefix of the result.
-        *
-        * @param infix a string to be placed between namespace and data type
-        *              name or null
-        * @return      the upper case name to be used in C code
-        */
-       public virtual string? get_upper_case_cname (string? infix = null) {
-               return null;
-       }
-
-       /**
-        * Returns the default value for the given type. Returning null means
-        * there is no default value (i.e. not that the default name is NULL).
-        *
-        * @return the name of the default value
-        */
-       public virtual string? get_default_value () {
-               return null;
-       }
 
        /**
         * Checks whether this data type is equal to or a subtype of the
index baec19eb783ea9a8be8d74888845ab5874f95e1a..d78af996003af9c99dc4633955b8a9f729bce0aa 100644 (file)
@@ -36,14 +36,6 @@ public abstract class Vala.ValueType : DataType {
                data_type = type_symbol;
        }
 
-       public override string? get_cname () {
-               string ptr = "";
-               if (nullable) {
-                       ptr = "*";
-               }
-               return type_symbol.get_cname () + ptr;
-       }
-
        public override bool is_disposable () {
                if (!value_owned) {
                        return false;
index 56cb1aed4a4ee96d79ffbcbefae5e96fe7ffc256..9337751e18df2ac5cc5f6859955dce0fcc58b5e3 100644 (file)
@@ -49,123 +49,12 @@ public class Vala.Variable : Symbol {
                }
        }
 
-       /**
-        * Specifies whether an array length field should implicitly be created
-        * if the field type is an array.
-        */
-       public bool no_array_length { get; set; }
-
-       /**
-        * Specifies whether a delegate target field should implicitly be created
-        * if the field type is a delegate.
-        */
-       public bool no_delegate_target { get; set; }
-
-       /**
-        * Specifies whether the array is null terminated.
-        */
-       public bool array_null_terminated { get; set; }
-
-       /**
-        * Specifies whether the array length field uses a custom name in C.
-        */
-       public bool has_array_length_cname {
-               get { return (array_length_cname != null); }
-       }
-
-       /**
-        * Specifies whether the array uses a custom C expression as length.
-        */
-       public bool has_array_length_cexpr {
-               get { return (array_length_cexpr != null); }
-       }
-
-       /**
-        * Specifies a custom type for the array length.
-        */
-       public string? array_length_type { get; set; default = null; }
-
        Expression? _initializer;
        DataType? _variable_type;
 
-       private string? array_length_cname;
-
-       private string? array_length_cexpr;
-
        public Variable (DataType? variable_type, string? name, Expression? initializer = null, SourceReference? source_reference = null, Comment? comment = null) {
                base (name, source_reference, comment);
                this.variable_type = variable_type;
                this.initializer = initializer;
        }
-
-       /**
-        * Returns the name of the array length variable as it is used in C code
-        *
-        * @return the name of the array length variable to be used in C code
-        */
-       public string? get_array_length_cname () {
-               return this.array_length_cname;
-       }
-
-       /**
-        * Sets the name of the array length variable as it is used in C code
-        *
-        * @param array_length_cname the name of the array length variable to be
-        * used in C code
-        */
-       public void set_array_length_cname (string? array_length_cname) {
-               this.array_length_cname = array_length_cname;
-       }
-
-       /**
-        * Returns the array length expression as it is used in C code
-        *
-        * @return the array length expression to be used in C code
-        */
-       public string? get_array_length_cexpr () {
-               return this.array_length_cexpr;
-       }
-
-
-       /**
-        * Sets the array length expression as it is used in C code
-        *
-        * @param array_length_cexpr the array length expression to be used in C
-        * code
-        */
-       public void set_array_length_cexpr (string? array_length_cexpr) {
-               this.array_length_cexpr = array_length_cexpr;
-       }
-
-       void process_ccode_attribute (Attribute a) {
-               if (a.has_argument ("array_length")) {
-                       no_array_length = !a.get_bool ("array_length");
-               }
-               if (a.has_argument ("array_null_terminated")) {
-                       array_null_terminated = a.get_bool ("array_null_terminated");
-               }
-               if (a.has_argument ("array_length_cname")) {
-                       set_array_length_cname (a.get_string ("array_length_cname"));
-               }
-               if (a.has_argument ("array_length_cexpr")) {
-                       set_array_length_cexpr (a.get_string ("array_length_cexpr"));
-               }
-               if (a.has_argument ("array_length_type")) {
-                       array_length_type = a.get_string ("array_length_type");
-               }
-               if (a.has_argument ("delegate_target")) {
-                       no_delegate_target = !a.get_bool ("delegate_target");
-               }
-       }
-
-       /**
-        * Process all associated attributes.
-        */
-       public virtual void process_attributes () {
-               foreach (Attribute a in attributes) {
-                       if (a.name == "CCode") {
-                               process_ccode_attribute (a);
-                       }
-               }
-       }
 }
index b328f5578fa46b8e29f24bd9ea9670a993ae2268..9035c25c8fc9c1a99ff38faebca3b46e534c8dff 100644 (file)
@@ -38,15 +38,7 @@ public class Vala.VoidType : DataType {
                return "void";
        }
 
-       public override string? get_cname () {
-               return "void";
-       }
-
        public override DataType copy () {
                return new VoidType (source_reference);
        }
-
-       public override string? get_type_id () {
-               return "G_TYPE_NONE";
-       }
 }