[vala/wip/attributes: 51/121] gidlparser: Drop usage of CCode array-related attribute arguments
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 51/121] gidlparser: Drop usage of CCode array-related attribute arguments
- Date: Mon, 4 Jul 2011 17:13:03 +0000 (UTC)
commit fdc164dc0ee0ea2cfa7f155b8115c6ffae9de8e0
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Jun 29 15:16:51 2011 +0200
gidlparser: Drop usage of CCode array-related attribute arguments
vapigen/valagidlparser.vala | 53 +++++++++++++++++++++++-------------------
1 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 96c8c2c..e25bb3e 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -567,7 +567,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (nv[0] == "error_types") {
error_types = eval (nv[1]);
} else if (nv[0] == "array_length_type") {
- cb.array_length_type = eval (nv[1]);
+ cb.set_attribute_string ("CCode", "array_length_type", eval (nv[1]));
} else if (nv[0] == "type_name") {
cb.return_type = return_type = parse_type_from_string (eval (nv[1]), return_type.value_owned);
} else if (nv[0] == "deprecated") {
@@ -678,14 +678,14 @@ public class Vala.GIdlParser : CodeVisitor {
parse_type_arguments_from_string (param_type, eval (nv[1]));
} else if (nv[0] == "no_array_length") {
if (eval (nv[1]) == "1") {
- p.no_array_length = true;
+ p.set_attribute_bool ("CCode", "array_length", false);
}
} else if (nv[0] == "array_length_type") {
- p.array_length_type = eval (nv[1]);
+ p.set_attribute_string ("CCode", "array_length_type", eval (nv[1]));
} else if (nv[0] == "array_null_terminated") {
if (eval (nv[1]) == "1") {
- p.no_array_length = true;
- p.array_null_terminated = true;
+ p.set_attribute_bool ("CCode", "array_length", false);
+ p.set_attribute_bool ("CCode", "array_null_terminated", true);
}
} else if (nv[0] == "type_name") {
p.variable_type = param_type = parse_type_from_string (eval (nv[1]), false);
@@ -1695,8 +1695,13 @@ public class Vala.GIdlParser : CodeVisitor {
if (finish_method != null) {
m.return_type = finish_method.return_type.copy ();
- m.no_array_length = finish_method.no_array_length;
- m.array_null_terminated = finish_method.array_null_terminated;
+ var a = finish_method.get_attribute ("CCode");
+ if (a.has_argument ("array_length")) {
+ m.set_attribute_bool ("CCode", "array_length", a.get_bool ("array_length"));
+ }
+ if (a.has_argument ("array_null_terminated")) {
+ m.set_attribute_bool ("CCode", "array_null_terminated", a.get_bool ("array_null_terminated"));
+ }
foreach (var param in finish_method.get_parameters ()) {
if (param.direction == ParameterDirection.OUT) {
var async_param = param.copy ();
@@ -2170,15 +2175,15 @@ public class Vala.GIdlParser : CodeVisitor {
error_types = eval (nv[1]);
} else if (nv[0] == "no_array_length") {
if (eval (nv[1]) == "1") {
- m.no_array_length = true;
+ m.set_attribute_bool ("CCode", "array_length", false);
}
} else if (nv[0] == "array_null_terminated") {
if (eval (nv[1]) == "1") {
- m.no_array_length = true;
- m.array_null_terminated = true;
+ m.set_attribute_bool ("CCode", "array_length", false);
+ m.set_attribute_bool ("CCode", "array_null_terminated", true);;
}
} else if (nv[0] == "array_length_type") {
- m.array_length_type = eval (nv[1]);
+ m.set_attribute_string ("CCode", "array_length_type", eval (nv[1]));
} else if (nv[0] == "type_name") {
m.return_type = return_type = parse_type_from_string (eval (nv[1]), return_type.value_owned);
} else if (nv[0] == "type_arguments") {
@@ -2354,14 +2359,14 @@ public class Vala.GIdlParser : CodeVisitor {
}
} else if (nv[0] == "no_array_length") {
if (eval (nv[1]) == "1") {
- p.no_array_length = true;
+ p.set_attribute_bool ("CCode", "array_length", false);
}
} else if (nv[0] == "array_length_type") {
- p.array_length_type = eval (nv[1]);
+ p.set_attribute_string ("CCode", "array_length_type", eval (nv[1]));
} else if (nv[0] == "array_null_terminated") {
if (eval (nv[1]) == "1") {
- p.no_array_length = true;
- p.array_null_terminated = true;
+ p.set_attribute_bool ("CCode", "array_length", false);
+ p.set_attribute_bool ("CCode", "array_null_terminated", true);
}
} else if (nv[0] == "array_length_pos") {
set_array_length_pos = true;
@@ -2554,8 +2559,8 @@ public class Vala.GIdlParser : CodeVisitor {
prop.interface_only = true;
if (prop_node.type.is_interface && prop_node.type.interface == "GStrv") {
- prop.no_array_length = true;
- prop.array_null_terminated = true;
+ prop.set_attribute_bool ("CCode", "array_length", false);
+ prop.set_attribute_bool ("CCode", "array_null_terminated", true);
}
if (prop_node.readable) {
@@ -2786,7 +2791,7 @@ public class Vala.GIdlParser : CodeVisitor {
}
if (array_null_terminated) {
- field.array_null_terminated = true;
+ field.set_attribute_bool ("CCode", "array_null_terminated", true);
}
if (array_length_cname != null || array_length_type != null) {
@@ -2794,10 +2799,10 @@ public class Vala.GIdlParser : CodeVisitor {
field.set_array_length_cname (array_length_cname);
}
if (array_length_type != null) {
- field.array_length_type = array_length_type;
+ field.set_attribute_string ("CCode", "array_length_type", array_length_type);
}
} else {
- field.no_array_length = true;
+ field.set_attribute_bool ("CCode", "array_length", false);
}
if (no_delegate_target) {
@@ -2970,14 +2975,14 @@ public class Vala.GIdlParser : CodeVisitor {
}
} else if (nv[0] == "no_array_length") {
if (eval (nv[1]) == "1") {
- p.no_array_length = true;
+ p.set_attribute_bool ("CCode", "array_length", false);
}
} else if (nv[0] == "array_length_type") {
- p.array_length_type = eval (nv[1]);
+ p.set_attribute_string ("CCode", "array_length_type", nv[1]);
} else if (nv[0] == "array_null_terminated") {
if (eval (nv[1]) == "1") {
- p.no_array_length = true;
- p.array_null_terminated = true;
+ p.set_attribute_bool ("CCode", "array_length", false);
+ p.set_attribute_bool ("CCode", "array_null_terminated", true);
}
} else if (nv[0] == "is_out") {
if (eval (nv[1]) == "1") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]