Partially fixes bug 644420.
if (!d.no_array_length && d.return_type is ArrayType) {
// return array length if appropriate
var array_type = (ArrayType) d.return_type;
+ var array_length_type = d.array_length_type != null ? d.array_length_type : "int";
+ array_length_type += "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- var cparam = new CCodeParameter (get_array_length_cname ("result", dim), "int*");
+ var cparam = new CCodeParameter (get_array_length_cname ("result", dim), array_length_type);
cfundecl.add_parameter (cparam);
}
} else if (d.return_type is DelegateType) {
if (!d.no_array_length && d.return_type is ArrayType) {
// return array length if appropriate
var array_type = (ArrayType) d.return_type;
+ var array_length_type = d.array_length_type != null ? d.array_length_type : "int";
+ array_length_type += "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- var cparam = new CCodeParameter (get_array_length_cname ("result", dim), "int*");
+ var cparam = new CCodeParameter (get_array_length_cname ("result", dim), array_length_type);
cparam_map.set (get_param_pos (d.carray_length_parameter_position + 0.01 * dim), cparam);
}
} else if (d.return_type is DelegateType) {
} else if (!m.no_array_length && m.return_type is ArrayType) {
// return array length if appropriate
var array_type = (ArrayType) m.return_type;
+ var array_length_type = m.array_length_type != null ? m.array_length_type : "int";
+ array_length_type += "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- var cparam = new CCodeParameter (get_array_length_cname ("result", dim), "int*");
+ var cparam = new CCodeParameter (get_array_length_cname ("result", dim), array_length_type);
cparam_map.set (get_param_pos (m.carray_length_parameter_position + 0.01 * dim), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (m.carray_length_parameter_position + 0.01 * dim), get_variable_cexpression (cparam.name));
write_string (", has_target = false");
} else if (!float_equal (cb.cinstance_parameter_position, -2)) {
write_string (", instance_pos = %g".printf (cb.cinstance_parameter_position));
+ } else if (cb.array_length_type != null) {
+ write_string (", array_length_type = \"%s\"".printf (cb.array_length_type));
}
write_string (")]");
*/
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> ();
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");
}
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;
// track usage for flow analyzer
method.used = true;
method.check_deprecated (source_reference);
public bool array_null_terminated { get; set; }
/**
- * Specified a custom type for the array length parameter.
+ * Specifies a custom type for the array length parameter.
*/
public string? array_length_type { get; set; default = null; }