stage4/generate_c/generate_c_vardecl.cc
changeset 396 155560bfe837
parent 392 9b88b8b6bccd
child 547 dab341e80664
equal deleted inserted replaced
395:25f3b479a8ce 396:155560bfe837
   809                   foutputassign_vf,
   809                   foutputassign_vf,
   810                   local_vf,
   810                   local_vf,
   811                   localinit_vf,
   811                   localinit_vf,
   812                   init_vf,
   812                   init_vf,
   813                   constructorinit_vf,
   813                   constructorinit_vf,
   814                   globalinit_vf
   814                   globalinit_vf,
       
   815                   globalprototype_vf,
   815                  } varformat_t;
   816                  } varformat_t;
   816 
   817 
   817 
   818 
   818   private:
   819   private:
   819     /* variable used to store the types of variables that need to be processed... */
   820     /* variable used to store the types of variables that need to be processed... */
  1989 	    s4o.print(",");
  1990 	    s4o.print(",");
  1990 	    if (symbol->global_var_name != NULL)
  1991 	    if (symbol->global_var_name != NULL)
  1991 		  symbol->global_var_name->accept(*this);
  1992 		  symbol->global_var_name->accept(*this);
  1992 	    else
  1993 	    else
  1993 		  symbol->location->accept(*this);
  1994 		  symbol->location->accept(*this);
  1994 	    s4o.print(",__INITIAL_VALUE(");
  1995 	    s4o.print(",");
       
  1996 	    s4o.print(INITIAL_VALUE);
       
  1997 	    s4o.print("(");
  1995 	    this->current_var_init_symbol->accept(*this);
  1998 	    this->current_var_init_symbol->accept(*this);
  1996 	    s4o.print(")");
  1999 	    s4o.print(")");
  1997 	    print_retain();
  2000 	    print_retain();
  1998 	    s4o.print(")");
  2001 	    s4o.print(")");
  1999       }
  2002       }
  2000       break;
  2003       break;
  2001 
  2004     
       
  2005     case globalprototype_vf:
       
  2006       s4o.print(s4o.indent_spaces);
       
  2007       s4o.print(DECLARE_GLOBAL_PROTOTYPE);
       
  2008 	  s4o.print("(");
       
  2009 	  this->current_var_type_symbol->accept(*this);
       
  2010 	  s4o.print(",");
       
  2011 	  if (symbol->global_var_name != NULL)
       
  2012 		symbol->global_var_name->accept(*this);
       
  2013 	  else
       
  2014 		symbol->location->accept(*this);
       
  2015 	  s4o.print(")\n");
       
  2016       break;
       
  2017     
  2002     default:
  2018     default:
  2003       ERROR;
  2019       ERROR;
  2004   } /* switch() */
  2020   } /* switch() */
  2005 
  2021 
  2006   return NULL;
  2022   return NULL;
  2050           s4o.print(INIT_GLOBAL);
  2066           s4o.print(INIT_GLOBAL);
  2051           s4o.print("(");
  2067           s4o.print("(");
  2052           this->current_var_type_symbol->accept(*this);
  2068           this->current_var_type_symbol->accept(*this);
  2053           s4o.print(",");
  2069           s4o.print(",");
  2054           list->elements[i]->accept(*this);
  2070           list->elements[i]->accept(*this);
  2055           s4o.print(",__INITIAL_VALUE(");
  2071           s4o.print(",");
       
  2072           s4o.print(INITIAL_VALUE);
       
  2073           s4o.print("(");
  2056           this->current_var_init_symbol->accept(*this);
  2074           this->current_var_init_symbol->accept(*this);
  2057           s4o.print(")");
  2075           s4o.print(")");
  2058           print_retain();
  2076           print_retain();
  2059           s4o.print(")");
  2077           s4o.print(")");
  2060 #if 0
  2078 #if 0
  2079             s4o.print(")");
  2097             s4o.print(")");
  2080 	  }
  2098 	  }
  2081           s4o.print(";\n");
  2099           s4o.print(";\n");
  2082 #endif
  2100 #endif
  2083         }
  2101         }
       
  2102       }
       
  2103       break;
       
  2104 
       
  2105     case globalprototype_vf:
       
  2106       for(int i = 0; i < list->n; i++) {
       
  2107         s4o.print(s4o.indent_spaces);
       
  2108         s4o.print(DECLARE_GLOBAL_PROTOTYPE);
       
  2109         s4o.print("(");
       
  2110         this->current_var_type_symbol->accept(*this);
       
  2111         s4o.print(",");
       
  2112         list->elements[i]->accept(*this);
       
  2113         s4o.print(")\n");
  2084       }
  2114       }
  2085       break;
  2115       break;
  2086 
  2116 
  2087     default:
  2117     default:
  2088       ERROR; /* not supported, and not needed either... */
  2118       ERROR; /* not supported, and not needed either... */