--- a/stage4/generate_c/generate_c_vardecl.cc Fri Dec 23 15:17:45 2011 +0100
+++ b/stage4/generate_c/generate_c_vardecl.cc Fri Dec 30 18:25:39 2011 +0100
@@ -811,7 +811,8 @@
localinit_vf,
init_vf,
constructorinit_vf,
- globalinit_vf
+ globalinit_vf,
+ globalprototype_vf,
} varformat_t;
@@ -1991,14 +1992,29 @@
symbol->global_var_name->accept(*this);
else
symbol->location->accept(*this);
- s4o.print(",__INITIAL_VALUE(");
+ s4o.print(",");
+ s4o.print(INITIAL_VALUE);
+ s4o.print("(");
this->current_var_init_symbol->accept(*this);
s4o.print(")");
print_retain();
s4o.print(")");
}
break;
-
+
+ case globalprototype_vf:
+ s4o.print(s4o.indent_spaces);
+ s4o.print(DECLARE_GLOBAL_PROTOTYPE);
+ s4o.print("(");
+ this->current_var_type_symbol->accept(*this);
+ s4o.print(",");
+ if (symbol->global_var_name != NULL)
+ symbol->global_var_name->accept(*this);
+ else
+ symbol->location->accept(*this);
+ s4o.print(")\n");
+ break;
+
default:
ERROR;
} /* switch() */
@@ -2052,7 +2068,9 @@
this->current_var_type_symbol->accept(*this);
s4o.print(",");
list->elements[i]->accept(*this);
- s4o.print(",__INITIAL_VALUE(");
+ s4o.print(",");
+ s4o.print(INITIAL_VALUE);
+ s4o.print("(");
this->current_var_init_symbol->accept(*this);
s4o.print(")");
print_retain();
@@ -2084,6 +2102,18 @@
}
break;
+ case globalprototype_vf:
+ for(int i = 0; i < list->n; i++) {
+ s4o.print(s4o.indent_spaces);
+ s4o.print(DECLARE_GLOBAL_PROTOTYPE);
+ s4o.print("(");
+ this->current_var_type_symbol->accept(*this);
+ s4o.print(",");
+ list->elements[i]->accept(*this);
+ s4o.print(")\n");
+ }
+ break;
+
default:
ERROR; /* not supported, and not needed either... */
}