Example #1
0
DeclStemnt*
DeclStemnt::convertToTypedef()
{
    // Nothing to do?
    if (isTypedef())
        return this;

    TypedefStemnt *ret = new TypedefStemnt(location);

    // Since we are really the same thing,
    // let's just steal the insides.
    LabelVector::iterator    k;
    for (k=labels.begin(); k != labels.end(); k++)
    {
        ret->addLabel(*k);
    }
    labels.clear();

    ret->next    = next;
    next = NULL;

    DeclVector::iterator    j;

    for (j=decls.begin(); j != decls.end(); j++)
    {
        ret->addDecl(*j);
    }

    decls.clear();

    delete this;        // Danger - Will Robinson!

    return ret;
}
Example #2
0
bool Decl::printStructureStreamShapeInternals(std::ostream& out)
{
  if(isTypedef()) return true;
  if((storage & ST_Static) != 0) return true;
  
  if (form)
  {
    if(!form->printStructureStreamShape(out))
      return false;
  }
  return true;
}
Example #3
0
void Decl::printStructureStreamHelpers( std::ostream& out ) const
{
    assert(this != NULL);

    if(!isTypedef()) return;

    std::ostringstream stringout;

    stringout << "typedef ";
    if(!form->printStructureStreamHelperType( stringout, std::string("__cpustruct_") + name->name ))
      return;
    stringout << ";\n";
    out << stringout.str();
}
Example #4
0
bool Decl::printStructureStreamShape(std::ostream& out)
{
  assert(this != NULL);
  if(!isTypedef()) return false;

  std::ostringstream stringout;

  stringout << "\nnamespace brook {\n";
  stringout << "\ttemplate<> const __BRTStreamType* getStreamType(";
  stringout << name->name << "*) {\n";
  stringout << "\t\tstatic const __BRTStreamType result[] = {";
  if(!form->printStructureStreamShape( stringout ))
    return false;
  stringout << "__BRTNONE};\n";
  stringout << "\t\treturn result;\n";
  stringout << "\t}\n}\n";
  out << stringout.str();
  return true;
}