var fun = new CCodeFunction (cname, "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeParameter ("array", "%s *".printf (get_ccode_name (st))));
- fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (int_type)));
+ fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (ssize_t_type)));
push_function (fun);
var ccondarr = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("array"), new CCodeConstant ("NULL"));
ccode.open_if (ccondarr);
- ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
+ ccode.add_declaration (get_ccode_name (ssize_t_type), new CCodeVariableDeclarator ("i"));
append_struct_array_free_loop (st);
ccode.close ();
var fun = new CCodeFunction (cname, "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeParameter ("array", "%s *".printf (get_ccode_name (st))));
- fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (int_type)));
+ fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (ssize_t_type)));
push_function (fun);
var ccondarr = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("array"), new CCodeConstant ("NULL"));
ccode.open_if (ccondarr);
- ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
+ ccode.add_declaration (get_ccode_name (ssize_t_type), new CCodeVariableDeclarator ("i"));
append_struct_array_free_loop (st);
ccode.close ();
var fun = new CCodeFunction ("_vala_array_destroy", "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeParameter ("array", get_ccode_name (pointer_type)));
- fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (int_type)));
+ fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (ssize_t_type)));
fun.add_parameter (new CCodeParameter ("destroy_func", get_ccode_name (delegate_target_destroy_type)));
push_function (fun);
var ccondfunc = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("destroy_func"), new CCodeConstant ("NULL"));
ccode.open_if (new CCodeBinaryExpression (CCodeBinaryOperator.AND, ccondarr, ccondfunc));
- ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
+ ccode.add_declaration (get_ccode_name (ssize_t_type), new CCodeVariableDeclarator ("i"));
append_vala_array_free_loop ();
ccode.close ();
fun = new CCodeFunction ("_vala_array_free", "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeParameter ("array", get_ccode_name (pointer_type)));
- fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (int_type)));
+ fun.add_parameter (new CCodeParameter ("array_length", get_ccode_name (ssize_t_type)));
fun.add_parameter (new CCodeParameter ("destroy_func", get_ccode_name (delegate_target_destroy_type)));
push_function (fun);
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeParameter ("array", get_ccode_name (pointer_type)));
fun.add_parameter (new CCodeParameter ("element_size", get_ccode_name (size_t_type)));
- fun.add_parameter (new CCodeParameter ("src", get_ccode_name (int_type)));
- fun.add_parameter (new CCodeParameter ("dest", get_ccode_name (int_type)));
- fun.add_parameter (new CCodeParameter ("length", get_ccode_name (int_type)));
+ fun.add_parameter (new CCodeParameter ("src", get_ccode_name (ssize_t_type)));
+ fun.add_parameter (new CCodeParameter ("dest", get_ccode_name (ssize_t_type)));
+ fun.add_parameter (new CCodeParameter ("length", get_ccode_name (ssize_t_type)));
push_function (fun);
}
public override void append_vala_array_length () {
- var fun = new CCodeFunction ("_vala_array_length", get_ccode_name (int_type));
+ var fun = new CCodeFunction ("_vala_array_length", get_ccode_name (ssize_t_type));
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeParameter ("array", get_ccode_name (pointer_type)));
push_function (fun);
- ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("length", new CCodeConstant ("0")));
+ ccode.add_declaration (get_ccode_name (ssize_t_type), new CCodeVariableDeclarator ("length", new CCodeConstant ("0")));
// return 0 if the array is NULL
// avoids an extra NULL check on the caller side
function.add_parameter (new CCodeParameter ("self", get_ccode_name (array_type)));
// total length over all dimensions
- function.add_parameter (new CCodeParameter ("length", get_ccode_name (int_type)));
+ function.add_parameter (new CCodeParameter ("length", get_ccode_name (ssize_t_type)));
if (array_type.element_type is GenericType) {
// dup function array elements
string func_name = "%s_dup_func".printf (((GenericType) array_type.element_type).type_parameter.name.ascii_down ());
ccode.add_declaration (get_ccode_name (array_type), cvardecl);
ccode.add_assignment (new CCodeIdentifier ("result"), gnew);
- ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
+ ccode.add_declaration (get_ccode_name (ssize_t_type), new CCodeVariableDeclarator ("i"));
ccode.open_for (new CCodeAssignment (new CCodeIdentifier ("i"), new CCodeConstant ("0")),
new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new CCodeIdentifier ("i"), new CCodeIdentifier ("length")),
public DataType int64_type;
public DataType uint64_type;
public DataType size_t_type;
+ public DataType ssize_t_type;
public DataType string_type;
public DataType regex_type;
public DataType float_type;
int64_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int64"));
uint64_type = new IntegerType ((Struct) root_symbol.scope.lookup ("uint64"));
size_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("size_t"));
+ ssize_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ssize_t"));
float_type = new FloatingType ((Struct) root_symbol.scope.lookup ("float"));
double_type = new FloatingType ((Struct) root_symbol.scope.lookup ("double"));
string_type = new ObjectType ((Class) root_symbol.scope.lookup ("string"));
function.modifiers = CCodeModifiers.STATIC;
function.add_parameter (new CCodeParameter ("stack", "%s *".printf (get_ccode_name (array_type.element_type))));
- function.add_parameter (new CCodeParameter ("stack_length", get_ccode_name (int_type)));
+ function.add_parameter (new CCodeParameter ("stack_length", get_ccode_name (ssize_t_type)));
if (array_type.element_type is StructValueType) {
function.add_parameter (new CCodeParameter ("needle", "const %s *".printf (get_ccode_name (array_type.element_type))));
} else {
push_function (function);
- ccode.add_declaration (get_ccode_name (int_type), new CCodeVariableDeclarator ("i"));
+ ccode.add_declaration (get_ccode_name (ssize_t_type), new CCodeVariableDeclarator ("i"));
var cloop_initializer = new CCodeAssignment (new CCodeIdentifier ("i"), new CCodeConstant ("0"));
var cloop_condition = new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new CCodeIdentifier ("i"), new CCodeIdentifier ("stack_length"));