[vala] codegen: Rename append_array_size and get_array_sizes to *_length(s)
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Rename append_array_size and get_array_sizes to *_length(s)
- Date: Wed, 19 Jan 2011 21:14:08 +0000 (UTC)
commit f0f6be1dc2067bfe0fd5a19cd8f13d3f7661caf0
Author: Luca Bruno <lucabru src gnome org>
Date: Tue Jan 18 15:00:00 2011 +0100
codegen: Rename append_array_size and get_array_sizes to *_length(s)
The code of these two functions actually append a length C expression to
the array expression, not its size.
codegen/valaccodearraymodule.vala | 6 +++---
codegen/valaccodebasemodule.vala | 18 +++++++++---------
codegen/valaccodememberaccessmodule.vala | 18 +++++++++---------
codegen/valaccodemethodcallmodule.vala | 18 +++++++++---------
4 files changed, 30 insertions(+), 30 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 1d8d193..06b370a 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -81,9 +81,9 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
csize = new CCodeAssignment (name_cnode, csize);
- append_array_size (expr, name_cnode);
+ append_array_length (expr, name_cnode);
} else {
- append_array_size (expr, csize);
+ append_array_length (expr, csize);
}
if (first) {
@@ -202,7 +202,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var splicelen = new CCodeBinaryExpression (CCodeBinaryOperator.MINUS, cstop, cstart);
set_cvalue (expr, cstartpointer);
- append_array_size (expr, splicelen);
+ append_array_length (expr, splicelen);
}
void append_struct_array_free_loop (Struct st) {
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 5b80cfe..00b1f40 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3479,7 +3479,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var delegate_type = expr.target_type as DelegateType;
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
- append_array_size (expr, new CCodeConstant ("0"));
+ append_array_length (expr, new CCodeConstant ("0"));
}
} else if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
set_delegate_target (expr, new CCodeConstant ("NULL"));
@@ -4331,7 +4331,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var array_type = expr.value_type as ArrayType;
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
- append_array_size (expr, new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_array_length_cexpression (expr.inner, dim)));
+ append_array_length (expr, new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_array_length_cexpression (expr.inner, dim)));
}
}
@@ -4387,7 +4387,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
// null-terminated string array
var len_call = new CCodeFunctionCall (new CCodeIdentifier ("g_strv_length"));
len_call.add_argument (rv);
- append_array_size (expr, len_call);
+ append_array_length (expr, len_call);
} else if (to is StructValueType) {
var temp_decl = get_temp_variable (to, true, null, true);
emit_temp_var (temp_decl);
@@ -4442,7 +4442,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression (temp_decl.name)));
cfunc.add_parameter (new CCodeParameter (get_array_length_cname ("result", dim), "int*"));
- append_array_size (expr, get_variable_cexpression (temp_decl.name));
+ append_array_length (expr, get_variable_cexpression (temp_decl.name));
}
}
@@ -4516,13 +4516,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var array_type = expr.type_reference as ArrayType;
if (array_type != null && expr.inner.value_type is ArrayType) {
for (int dim = 1; dim <= array_type.rank; dim++) {
- append_array_size (expr, get_array_length_cexpression (expr.inner, dim));
+ append_array_length (expr, get_array_length_cexpression (expr.inner, dim));
}
} else if (array_type != null) {
// cast from non-array to array, set invalid length
// required by string.data, e.g.
for (int dim = 1; dim <= array_type.rank; dim++) {
- append_array_size (expr, new CCodeConstant ("-1"));
+ append_array_length (expr, new CCodeConstant ("-1"));
}
}
@@ -4585,7 +4585,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var array_type = expr.value_type as ArrayType;
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
- append_array_size (expr, get_array_length_cexpression (expr.inner, dim));
+ append_array_length (expr, get_array_length_cexpression (expr.inner, dim));
}
}
@@ -5821,7 +5821,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
glib_value.delegate_target_destroy_notify_cvalue = destroy_notify;
}
- public void append_array_size (Expression expr, CCodeExpression size) {
+ public void append_array_length (Expression expr, CCodeExpression size) {
var glib_value = (GLibValue) expr.target_value;
if (glib_value == null) {
glib_value = new GLibValue (expr.value_type);
@@ -5830,7 +5830,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
glib_value.append_array_length_cvalue (size);
}
- public List<CCodeExpression>? get_array_sizes (Expression expr) {
+ public List<CCodeExpression>? get_array_lengths (Expression expr) {
var glib_value = (GLibValue) expr.target_value;
if (glib_value == null) {
glib_value = new GLibValue (expr.value_type);
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 30b115c..391f1c3 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -162,7 +162,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
requires_array_length = true;
var len_call = new CCodeFunctionCall (new CCodeIdentifier ("_vala_array_length"));
len_call.add_argument (carray_expr);
- append_array_size (expr, len_call);
+ append_array_length (expr, len_call);
} else if (!field.no_array_length) {
for (int dim = 1; dim <= array_type.rank; dim++) {
CCodeExpression length_expr = null;
@@ -196,7 +196,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
}
}
- append_array_size (expr, length_expr);
+ append_array_length (expr, length_expr);
}
if (array_type.rank == 1 && field.is_internal_symbol ()) {
string size_cname = get_array_size_cname (field.name);
@@ -209,7 +209,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
} else {
for (int dim = 1; dim <= array_type.rank; dim++) {
- append_array_size (expr, new CCodeConstant ("-1"));
+ append_array_length (expr, new CCodeConstant ("-1"));
}
}
} else if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
@@ -274,13 +274,13 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
requires_array_length = true;
var len_call = new CCodeFunctionCall (new CCodeIdentifier ("_vala_array_length"));
len_call.add_argument (new CCodeIdentifier (field.get_cname ()));
- append_array_size (expr, len_call);
+ append_array_length (expr, len_call);
} else if (!field.no_array_length) {
for (int dim = 1; dim <= array_type.rank; dim++) {
if (field.has_array_length_cexpr) {
- append_array_size (expr, new CCodeConstant (field.get_array_length_cexpr ()));
+ append_array_length (expr, new CCodeConstant (field.get_array_length_cexpr ()));
} else {
- append_array_size (expr, new CCodeIdentifier (get_array_length_cname (field.get_cname (), dim)));
+ append_array_length (expr, new CCodeIdentifier (get_array_length_cname (field.get_cname (), dim)));
}
}
if (array_type.rank == 1 && field.is_internal_symbol ()) {
@@ -288,7 +288,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
} else {
for (int dim = 1; dim <= array_type.rank; dim++) {
- append_array_size (expr, new CCodeConstant ("-1"));
+ append_array_length (expr, new CCodeConstant ("-1"));
}
}
} else if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
@@ -336,7 +336,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
if (array_type != null) {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("G_N_ELEMENTS"));
ccall.add_argument (new CCodeIdentifier (c.get_cname ()));
- append_array_size (expr, ccall);
+ append_array_length (expr, ccall);
}
} else if (expr.symbol_reference is Property) {
var prop = (Property) expr.symbol_reference;
@@ -445,7 +445,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
ctemp = get_variable_cexpression (temp_var.name);
emit_temp_var (temp_var);
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
- append_array_size (expr, ctemp);
+ append_array_length (expr, ctemp);
}
} else {
delegate_type = base_property.property_type as DelegateType;
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index e54d79c..6b4025c 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -412,8 +412,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
for (int dim = 1; dim <= array_type.rank; dim++) {
var temp_array_length = get_temp_variable (array_length_type);
emit_temp_var (temp_array_length);
- append_array_size (arg, get_variable_cexpression (temp_array_length.name));
- carg_map.set (get_param_pos (param.carray_length_parameter_position + 0.01 * dim), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_array_sizes (arg).get (dim - 1)));
+ append_array_length (arg, get_variable_cexpression (temp_array_length.name));
+ carg_map.set (get_param_pos (param.carray_length_parameter_position + 0.01 * dim), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_array_lengths (arg).get (dim - 1)));
}
} else if (param.variable_type is DelegateType) {
var deleg_type = (DelegateType) param.variable_type;
@@ -484,7 +484,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
var len_call = new CCodeFunctionCall (new CCodeIdentifier ("_vala_array_length"));
len_call.add_argument (temp_ref);
- append_array_size (expr, len_call);
+ append_array_length (expr, len_call);
} else if (!m.no_array_length) {
LocalVariable temp_var;
@@ -499,9 +499,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
out_arg_map.set (get_param_pos (m.carray_length_parameter_position + 0.01 * dim), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
- append_array_size (expr, temp_ref);
+ append_array_length (expr, temp_ref);
} else {
- append_array_size (expr, new CCodeConstant ("-1"));
+ append_array_length (expr, new CCodeConstant ("-1"));
}
}
} else if (m != null && m.return_type is DelegateType && async_call != ccall) {
@@ -548,7 +548,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
var len_call = new CCodeFunctionCall (new CCodeIdentifier ("_vala_array_length"));
len_call.add_argument (temp_ref);
- append_array_size (expr, len_call);
+ append_array_length (expr, len_call);
} else if (!deleg.no_array_length) {
var temp_var = get_temp_variable (int_type);
var temp_ref = get_variable_cexpression (temp_var.name);
@@ -557,9 +557,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
out_arg_map.set (get_param_pos (deleg.carray_length_parameter_position + 0.01 * dim), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
- append_array_size (expr, temp_ref);
+ append_array_length (expr, temp_ref);
} else {
- append_array_size (expr, new CCodeConstant ("-1"));
+ append_array_length (expr, new CCodeConstant ("-1"));
}
}
} else if (deleg != null && deleg.return_type is DelegateType) {
@@ -787,7 +787,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
var array_type = arg.value_type as ArrayType;
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
- ccode.add_assignment (get_array_sizes (unary.inner).get (dim - 1), get_array_sizes (unary).get (dim - 1));
+ ccode.add_assignment (get_array_lengths (unary.inner).get (dim - 1), get_array_lengths (unary).get (dim - 1));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]