}
var cdecl = new CCodeDeclaration (field_ctype);
- cdecl.add_declarator (new CCodeVariableDeclarator (f.get_cname ()));
+ cdecl.add_declarator (new CCodeVariableDeclarator (f.get_cname (), null, f.field_type.get_cdeclarator_suffix ()));
if (f.is_private_symbol ()) {
cdecl.modifiers = CCodeModifiers.STATIC;
} else {
if (f.field_type is ArrayType && !f.no_array_length) {
var array_type = (ArrayType) f.field_type;
- for (int dim = 1; dim <= array_type.rank; dim++) {
- var len_type = int_type.copy ();
+ if (!array_type.fixed_length) {
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ var len_type = int_type.copy ();
- cdecl = new CCodeDeclaration (len_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator (head.get_array_length_cname (f.get_cname (), dim)));
- if (f.is_private_symbol ()) {
- cdecl.modifiers = CCodeModifiers.STATIC;
- } else {
- cdecl.modifiers = CCodeModifiers.EXTERN;
+ cdecl = new CCodeDeclaration (len_type.get_cname ());
+ cdecl.add_declarator (new CCodeVariableDeclarator (head.get_array_length_cname (f.get_cname (), dim)));
+ if (f.is_private_symbol ()) {
+ cdecl.modifiers = CCodeModifiers.STATIC;
+ } else {
+ cdecl.modifiers = CCodeModifiers.EXTERN;
+ }
+ decl_space.add_type_member_declaration (cdecl);
}
- decl_space.add_type_member_declaration (cdecl);
}
} else if (f.field_type is DelegateType) {
var delegate_type = (DelegateType) f.field_type;
lhs = new CCodeIdentifier (f.get_cname ());
- var var_decl = new CCodeVariableDeclarator (f.get_cname ());
+ var var_decl = new CCodeVariableDeclarator (f.get_cname (), null, f.field_type.get_cdeclarator_suffix ());
var_decl.initializer = default_value_for_type (f.field_type, true);
if (f.initializer != null) {
if (f.field_type is ArrayType && !f.no_array_length) {
var array_type = (ArrayType) f.field_type;
- for (int dim = 1; dim <= array_type.rank; dim++) {
- var len_type = int_type.copy ();
+ if (!array_type.fixed_length) {
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ var len_type = int_type.copy ();
- var len_def = new CCodeDeclaration (len_type.get_cname ());
- len_def.add_declarator (new CCodeVariableDeclarator (head.get_array_length_cname (f.get_cname (), dim), new CCodeConstant ("0")));
- if (!f.is_private_symbol ()) {
- len_def.modifiers = CCodeModifiers.EXTERN;
- } else {
- len_def.modifiers = CCodeModifiers.STATIC;
+ var len_def = new CCodeDeclaration (len_type.get_cname ());
+ len_def.add_declarator (new CCodeVariableDeclarator (head.get_array_length_cname (f.get_cname (), dim), new CCodeConstant ("0")));
+ if (!f.is_private_symbol ()) {
+ len_def.modifiers = CCodeModifiers.EXTERN;
+ } else {
+ len_def.modifiers = CCodeModifiers.STATIC;
+ }
+ source_declarations.add_type_member_declaration (len_def);
}
- source_declarations.add_type_member_declaration (len_def);
- }
- if (array_type.rank == 1 && f.is_internal_symbol ()) {
- var len_type = int_type.copy ();
+ if (array_type.rank == 1 && f.is_internal_symbol ()) {
+ var len_type = int_type.copy ();
- var cdecl = new CCodeDeclaration (len_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator (head.get_array_size_cname (f.get_cname ()), new CCodeConstant ("0")));
- cdecl.modifiers = CCodeModifiers.STATIC;
- source_declarations.add_type_member_declaration (cdecl);
+ var cdecl = new CCodeDeclaration (len_type.get_cname ());
+ cdecl.add_declarator (new CCodeVariableDeclarator (head.get_array_size_cname (f.get_cname ()), new CCodeConstant ("0")));
+ cdecl.modifiers = CCodeModifiers.STATIC;
+ source_declarations.add_type_member_declaration (cdecl);
+ }
}
} else if (f.field_type is DelegateType) {
var delegate_type = (DelegateType) f.field_type;
if (f.binding == MemberBinding.INSTANCE) {
generate_type_declaration (f.field_type, decl_space);
- instance_struct.add_field (field_ctype, f.get_cname ());
+ instance_struct.add_field (field_ctype, f.get_cname (), f.field_type.get_cdeclarator_suffix ());
if (f.field_type is ArrayType && !f.no_array_length) {
// create fields to store array dimensions
var array_type = (ArrayType) f.field_type;
- var len_type = int_type.copy ();
- for (int dim = 1; dim <= array_type.rank; dim++) {
- instance_struct.add_field (len_type.get_cname (), head.get_array_length_cname (f.name, dim));
- }
+ if (!array_type.fixed_length) {
+ var len_type = int_type.copy ();
- if (array_type.rank == 1 && f.is_internal_symbol ()) {
- instance_struct.add_field (len_type.get_cname (), head.get_array_size_cname (f.name));
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ instance_struct.add_field (len_type.get_cname (), head.get_array_length_cname (f.name, dim));
+ }
+
+ if (array_type.rank == 1 && f.is_internal_symbol ()) {
+ instance_struct.add_field (len_type.get_cname (), head.get_array_size_cname (f.name));
+ }
}
} else if (f.field_type is DelegateType) {
var delegate_type = (DelegateType) f.field_type;