stage4/generate_c/generate_c_vardecl.cc
changeset 122 9e57c6d79398
parent 98 d0cdf1d00b74
child 128 fd5760f30682
equal deleted inserted replaced
121:9e8ce092e169 122:9e57c6d79398
   970 
   970 
   971     case constructorinit_vf:
   971     case constructorinit_vf:
   972       s4o.print(nv->get());
   972       s4o.print(nv->get());
   973       s4o.print("{extern ");
   973       s4o.print("{extern ");
   974       this->current_var_type_symbol->accept(*this);
   974       this->current_var_type_symbol->accept(*this);
   975       s4o.print(" ");
   975       s4o.print("* ");
   976       symbol->location->accept(*this);
   976       symbol->location->accept(*this);
   977       s4o.print("; ");
   977       s4o.print("; ");
   978       print_variable_prefix();
   978       print_variable_prefix();
   979       if (symbol->variable_name != NULL)
   979       if (symbol->variable_name != NULL)
   980         symbol->variable_name->accept(*this);
   980         symbol->variable_name->accept(*this);
   981       else
   981       else
   982         symbol->location->accept(*this);
   982         symbol->location->accept(*this);
   983       s4o.print(" = &");
   983       s4o.print(" = ");
   984       symbol->location->accept(*this);
   984       symbol->location->accept(*this);
   985       s4o.print(";}");
   985       s4o.print(";}");
   986       break;
   986       break;
   987 
   987 
   988     case globalinit_vf:
   988     case globalinit_vf:
  1209        */
  1209        */
  1210       s4o.print(s4o.indent_spaces);
  1210       s4o.print(s4o.indent_spaces);
  1211       if (symbol->global_var_name != NULL) {
  1211       if (symbol->global_var_name != NULL) {
  1212         s4o.print("extern ");
  1212         s4o.print("extern ");
  1213         this->current_var_type_symbol->accept(*this);
  1213         this->current_var_type_symbol->accept(*this);
  1214         s4o.print(" ");
  1214         s4o.print("* ");
  1215         symbol->location->accept(*this);
  1215         symbol->location->accept(*this);
  1216         s4o.print(";\n");
  1216         s4o.print(";\n");
  1217         if (wanted_varformat == localstatic_vf)
  1217         if (wanted_varformat == localstatic_vf)
  1218           s4o.print("static ");
  1218           s4o.print("static ");
  1219         this->current_var_type_symbol->accept(*this);
  1219         this->current_var_type_symbol->accept(*this);
  1220         s4o.print(" *");
  1220         s4o.print(" *");
  1221         symbol->global_var_name->accept(*this);
  1221         symbol->global_var_name->accept(*this);
  1222         s4o.print(" = &");
  1222         s4o.print(" = ");
  1223         symbol->location->accept(*this);
  1223         symbol->location->accept(*this);
  1224         s4o.print(";\n");
  1224         s4o.print(";\n");
  1225       }
  1225       }
  1226       break;
  1226       break;
  1227 
  1227