Esempio n. 1
0
void be_exception::GenerateAssignmentOperator (be_ClientImplementation& source)
{
   ostream & os = source.Stream ();
   DDS_StdString that ("");
   be_Type * btype;

   if (nmembers ())
   {
      that = " that";
   }

   os << ScopedName () << " & "
      << ScopedName () << "::operator = (const "
      << LocalName () << " &" << that << ")" << nl;
   os << "{" << nl;

   UTL_Scope * s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);
   assert (s);

   UTL_ScopeActiveIterator *it;

   // Iterate through decls

   for 
   (
      it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
      ! it->is_done ();
      it->next ()
   )
   {
      AST_Decl * adecl = it->item ();
      assert (adecl);

      be_field *bfield = (be_field *) adecl->narrow ((long) & be_field::type_id);

      if (bfield)
      {
         btype = bfield->get_be_type ();
         if (btype && btype->IsArrayType ())
         {
            // Need to copy array elements

            os << "   "
               << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ())
               << "_copy (" << bfield->get_local_name () 
               << ", that." << bfield->get_local_name () << ");" << nl;
         }
         else
         {
            os << "   " << bfield->get_local_name () << " = that."
               << bfield->get_local_name() << ";" << nl;
         }
      }
   }

   delete it;

   os << "   return *this;" << nl;
   os << "}" << nl << nl;
}
Esempio n. 2
0
void be_Type::GenerateStreamOps (be_ClientHeader& source)
{
   ostream & os = source.Stream ();
   be_Tab tab (source);

   // insertion

   os << tab << DLLMACRO << "inline void" << nl
   << "IOP::put(DDS::Codec::OutStream& os, const "
   << ScopedName() << "& v" << XBE_Ev::arg (XBE_ENV_ARGN) << ")" << nl;
   os << "{" << nl;
   tab.indent();
   os << tab << "DDS::Codec::Param putArg = ";
   os << "{ " << Scope(TypeCodeTypeName()) << ", ";
   os << "(" << TypeName() << "*)" << "&v, DDS::PARAM_IN ";
   os << "};" << nl;
   os << tab << "os.put (&putArg, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   tab.outdent();
   os << "}" << nl << nl;

   //
   // extraction
   //
   os << DLLMACRO << "inline void" << nl
   << "IOP::get(DDS::Codec::InStream& is, "
   << ScopedName() << "& v" << XBE_Ev::arg (XBE_ENV_ARGN) << ")" << nl;
   os << "{" << nl;
   tab.indent();
   os << tab << "DDS::Codec::Param getArg = ";
   os << "{ " << Scope(TypeCodeTypeName()) << ", ";
   os << "&v, DDS::PARAM_OUT };" << nl;
   os << tab << "is.get (&getArg, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   tab.outdent();
   os << "}" << nl << nl;
}
Esempio n. 3
0
void be_structure::generate_tc_get_val (be_Source & source)
{
   ostream & os = source.Stream ();
   be_Tab tab (source);
   unsigned long uid = 0;

   // declare reader body

   os << "void " << m_tc_get_val << nl;
   os << "(" << nl;
   tab.indent ();
   os << tab << "DDS::Codec::InStream & is," << nl;
   os << tab << "void * arg," << nl;
   os << tab << "DDS::ParameterMode mode" << nl;
   if (XBE_Ev::generate ())
   {
      os << tab << XBE_Ev::arg (XBE_ENV_ARGN, false) << nl;
   }
   tab.outdent ();
   os << ")" << nl;
   os << "{" << nl;
   tab.indent ();

   // first, cast that pesky void *

   os << tab << ScopedName () << " * p = (" << ScopedName () << "*) arg;" << nl;

   // now, let's get our fields

   getter (os, tab, "p", uid);

   tab.outdent ();
   os << tab << "}" << nl << nl;
}
Esempio n. 4
0
void be_exception::GenerateConvenienceConstructor (be_ClientHeader& source)
{
   ostream & os = source.Stream ();
   const char * argPrefix = "_";
   pbbool first = pbtrue;
   be_Tab tab (source);

   os << tab << LocalName () << " (";

   UTL_Scope * s = (UTL_Scope*)narrow ((long) & UTL_Scope::type_id);
   assert (s);

   // Iterate through decls

   UTL_ScopeActiveIterator *it;

   for
   (
      it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
      !it->is_done ();
      it->next ()
   )
   {
      AST_Decl * adecl = it->item();
      assert (adecl);
      be_field * bfield = be_field::_narrow (adecl);
      be_Type * btype;

      if (bfield)
      {
         btype = bfield->get_be_type ();

         if (!first)
         {
            os << ", ";
         }

         first = pbfalse;

         if (btype && btype->IsStringType ())
         {
            // Strings are special case

            os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->InTypeName ());
         }
         else
         {
            os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ());
         }

         os << " " << argPrefix << (char*) bfield->get_local_name ();
      }
   }

   delete it;

   os << ");" << nl;
}
Esempio n. 5
0
DDS_StdString
be_Type::TypedefName()
{
   DDS_StdString noColons = (const char *)ScopedName(); // make own copy

   if (strchr((char *)ScopedName(), ':'))
   {
      ColonColonToBar((char *)noColons);
   }

   return noColons;
}
Esempio n. 6
0
void be_Type::generate_tc_assign_val (be_Source & source)
{
   ostream & os = source.Stream ();

   // declare assign body

   os << "static void " << m_tc_assign_val << " (void * dest, void * src)" << nl;
   os << "{" << nl;

   // just cast and assign

   os << "   *(" << ScopedName () << "*) dest = *(" << ScopedName () << "*) src;" << nl;
   os << "}" << nl << nl;
}
Esempio n. 7
0
ostream & be_structure::get_for_struct
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
   //
   // first declare the field
   //
   os << tab << ScopedName() << " * ___" << fld << " = &("
   << sptr << "->" << fld << ");" << nl;

   //
   // now get it
   //
   tab.indent();
   os << tab << m_tc_get_val << "(is, (void*&)___"
   << fld << ", DDS::PARAM_OUT" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   tab.outdent();

   return os;
}
Esempio n. 8
0
DDS_StdString
be_enum::swap_call(const DDS_StdString & arg)
{
   DDS_StdString ret = "(" + NoColons(ScopedName()) + ")" + m_swapCall + "(*" + arg + ")";

   return ret;
}
Esempio n. 9
0
be_exception::be_exception (UTL_ScopedName *n, const UTL_Pragmas &p)
:
   AST_Decl (AST_Decl::NT_except, n, p),
   UTL_Scope (AST_Decl::NT_except, n, p),
   AST_Structure (AST_Decl::NT_except, n, p),
   m_isFixedLength (TRUE),
   m_elemAlignment (0),
   m_elemSize (0),
   m_marshalInCore (false)
{
   isAtModuleScope (pbfalse);
   const DDS_StdString userException = "DDS::UserException";
   DDS_StdString barScopedName = NameToString(name(), "_");

   localName = local_name()->get_string();
   SetName(localName);
   enclosingScope = be_Type::EnclosingScopeString(this);

   m_tc_ctor_val = (DDS_StdString) barScopedName + "_ctor";
   m_tc_dtor_val = (DDS_StdString) barScopedName + "_dtor";
   m_tc_put_val = "(DDS::TypeCode::PutFunc) 0";
   m_tc_get_val = "(DDS::TypeCode::GetFunc) 0";
   m_tc_assign_val = (DDS_StdString) barScopedName +
      "_copy";

   SetScopedClassName(ScopedName());
   AddParent (new be_ClassParent (userException, userException, true, false));

   m_typecode->kind = DDS::tk_except;
   m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string();
   m_typecode->name_of_type = localName;

   InitializeTypeMap(this);
}
Esempio n. 10
0
DDS_StdString
be_sequence::NullReturnArg()
{
   DDS_StdString ret = (DDS_StdString)"(" + ScopedName() + "*)0";

   return ret;
}
Esempio n. 11
0
DDSString be_DispatchableType::DereferenceMvalue
   (int getargIndex) const
{
   DDSString result = "*(";
   result += ScopedName ();
   result += (DDSString)"*)_out_[";
   result += getargIndex;
   result += "].m_value";
   return result;
}
Esempio n. 12
0
void be_Type::generate_tc_ctor_val (be_Source & source)
{
   ostream & os = source.Stream ();

   // declare ctor body
   os << "static void * " << m_tc_ctor_val << " ()" << nl;
   os << "{" << nl;
   os << "   return new " << ScopedName () << ";" << nl;
   os << "}" << nl << nl;
}
Esempio n. 13
0
void be_exception::GenerateCopyConstructor (be_ClientImplementation & source)
{
   ostream & os = source.Stream ();

   os << ScopedName () << "::" << LocalName ()
      << " (const " << LocalName () << " & that)" << nl
      << "   : DDS::UserException (that)" << nl
      << "{" << nl
      << "   *this = that;" << nl
      << "}" << nl << nl;
}
Esempio n. 14
0
ostream &
be_structure::put_for_array(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid)
{
   DDS_StdString uids = BE_Globals::ulong_to_string(uid);
   DDS_StdString sptr = (DDS_StdString)"sptr" + uids;

   os << tab << ScopedName() << " * "
      << sptr << " = (" << ScopedName() << "*)&"
      << arg << "[" << index << "];" << nl;

   os << tab << m_tc_put_val << " (os, " << sptr << ", DDS::PARAM_IN"
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Esempio n. 15
0
DDS_StdString
be_structure::NullReturnArg()
{
   DDS_StdString ret = m_nullArg;

   if (!m_isFixedLength)
   {
      ret = (DDS_StdString)"(" + ScopedName() + "*)0";
   }

   return ret;
}
Esempio n. 16
0
DDS::Boolean be_sequence::declare_for_union_get
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
   os << tab << sptr << "->" << fld << " = new " << ScopedName() << ";" << nl;

   return TRUE;
}
Esempio n. 17
0
ostream &
be_sequence::get_for_union(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid)
{
   //
   // the struct has a sequence member, we'll need a pointer to it
   //
   DDS_StdString uids = BE_Globals::ulong_to_string(uid);
   DDS_StdString seqptr = (DDS_StdString)"seqptr" + uids;

   os << " " << ScopedName() << " * " << seqptr << " = ("
      << ScopedName() << "*)"
      << sptr << "->" << fld << ";" << nl;

   os << tab << m_tc_get_val << "(is, (void*&)" << seqptr
      << ", DDS::PARAM_OUT" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Esempio n. 18
0
DDSString be_DispatchableType::PutargMvalueInout
(
   const be_CppName& argName,
   int getargIndex
) const
{
   DDSString result;

   switch (HowStoredInDispatcher (VT_InParam))
   {
      case STORED_AS_STACK_VARIABLE:
      case STORED_IN_VAR:
      case STORED_IN_STRING_VAR:
      case STORED_IN_ALLOCED_VAR:
      {
         result = "_out_[";
         result += getargIndex;
         result += "].m_value";
      }
      break;

      case STORED_IN_DESCENDANT_VAR:
      {
         result += "*(";
         result += ScopedName();
         result += "**)_out_[";
         result += getargIndex;
         result += "].m_value";
      }
      break;

      case STORED_IN_IOR_VAR:
      {
         result = "(";
         result += argName;
         result += ".in()) ? ";
         result += argName;
         result += "->get_ior() : 0";
      }
      break;

      default:
      {
         assert(0);
      }
   }

   return result;
}
Esempio n. 19
0
void be_DispatchableType::DeclareInout
(
   ostream& os,
   be_Tab& tab,
   const be_CppName& implClassName,
   const be_CppName& argName
) const
{
   switch (HowStoredInDispatcher (VT_InOutParam))
   {
      case STORED_AS_STACK_VARIABLE:
      {
         os << tab << TypeName () << " " << argName << ";" << nl;
      }
      break;

      case STORED_IN_VAR:
      case STORED_IN_STRING_VAR:
      case STORED_IN_DESCENDANT_VAR:
      {
         os << tab << TypeName () << DDSVarExtension << " " << argName << ";" << nl;
      }
      break;

      case STORED_IN_ALLOCED_VAR:
      {
         DDSString relTypeName =
            BE_Globals::RelativeScope(DDSString(implClassName), typeName);
         os << tab << relTypeName << DDSVarExtension << " " << argName << " = "
         << relTypeName << "_alloc ();" << nl;
      }
      break;

      case STORED_IN_IOR_VAR:
      {
         DDSString stubFactory =
            BE_Globals::RelativeScope(DDSString(implClassName),
                                      Scope(localName) + "");
         os << tab << ScopedName() << DDSVarExtension << " " << argName
            << " (new " << stubFactory << DDSStubExtension << " ());" << nl;
      }
      break;

      default:
      {
         assert(0);
      }
   }
}
Esempio n. 20
0
ostream &
be_structure::put_for_union(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid)
{
   if (m_isFixedLength)
   {
      //
      // just put it
      //
      os << tab << m_tc_put_val << "(os, (void*)&"
         << sptr << "->" << fld << ", DDS::PARAM_IN"
         << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   }
   else
   {
      //
      // first declare the field
      //
      os << tab << ScopedName() << " * ___" << fld
      << " = (" << ScopedName() << "*) &(" << sptr << "->" << fld << ");"
      << nl << nl;

      //
      // now put it
      //
      os << tab << m_tc_put_val << "(os, (void*)&___"
         << fld << ", DDS::PARAM_IN"
         << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   }

   return os;
}
Esempio n. 21
0
DDS::Boolean
be_structure::declare_for_union_get(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid)
{
   if (!m_isFixedLength)
   {
      os << tab << sptr << "->" << fld << " = (void*) new "
      << ScopedName() << ";" << nl;
   }

   return FALSE;
}
Esempio n. 22
0
DDS_StdString
be_sequence::SyncStreamOut(const DDS_StdString& arg, const DDS_StdString& out, VarType vt) const
{
   DDS_StdString ret = out;

   if (!IsFixedLength() && (vt == VT_Return || vt == VT_OutParam))
   {
      ret += " << (" + ScopedName() + " *)" + arg + ";";
   }
   else
   {
      ret += " << " + arg + ";";
   }

   return ret;
}
Esempio n. 23
0
ostream & be_sequence::get_for_sequence
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & data,
   const DDS_StdString & index,
   unsigned long uid
)
{
   DDS_StdString get_val = BE_Globals::ScopeOf(ScopedName()) + "::"
      + TypeCodeTypeName() + "->get_val";

   os << tab << get_val << "(is, (void*)&"
      << data << "[" << index << "], DDS::PARAM_OUT"
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Esempio n. 24
0
DDSString be_DispatchableType::PassInoutToServantMethod
(
   const be_CppName& argName,
   int getargIndex
) const
{
   DDSString result;

   switch (HowStoredInDispatcher (VT_InOutParam))
   {
      case STORED_AS_STACK_VARIABLE:
      case STORED_IN_VAR:
      case STORED_IN_STRING_VAR:
      case STORED_IN_ALLOCED_VAR:
      {
         result = DereferenceMvalue (getargIndex);
      }
      break;

      case STORED_IN_DESCENDANT_VAR:
      {
         result = "*(";
         result += ScopedName();
         result += "**&)_out_[";
         result += getargIndex;
         result += "].m_value";
      }
      break;

      case STORED_IN_IOR_VAR:
      {
         result = DDSString(argName) + DDSString(".inout()");
      }
      break;

      default:
      {
         assert(0);
      }
   }

   return result;
}
Esempio n. 25
0
ostream &
be_structure::get_for_sequence(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid)
{
   DDS_StdString uids = BE_Globals::ulong_to_string(uid);
   DDS_StdString sptr = (DDS_StdString)"sptr" + uids;

   os << tab << ScopedName() << " * "
      << sptr << " = &" << arg << "[" << index
      << "];" << nl;

   os << tab << m_tc_get_val << " (is, (void*&)" << sptr 
      << ", DDS::PARAM_OUT" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Esempio n. 26
0
void
be_exception::GenerateMembers(be_ClientHeader& source)
{
   ostream & os = source.Stream();
   pbbool first = pbtrue;
   be_Tab tab(source);

   UTL_Scope * s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);
   assert(s);

   // ITERATE THROUGH DECLS
   UTL_ScopeActiveIterator *it;

   for ( it = new UTL_ScopeActiveIterator(s, UTL_Scope::IK_decls);
         !it->is_done();
         it->next())
   {
      AST_Decl * adecl = it->item();

      assert(adecl);

      if (first)
      {
         os << nl << tab << "public: " << nl << nl;
         first = pbfalse;
      }

      be_field * bfield = be_field::_narrow(adecl);

      if (bfield)
      {
         os << tab;
         os << BE_Globals::RelativeScope(
            ScopedName(),
            bfield->StructMemberTypeName());
         os << " " << bfield->get_local_name() << ";" << nl;
      }
   }

   delete it;
}
Esempio n. 27
0
void be_Type::generate_tc_dtor_val (be_Source & source, pbbool isCounted)
{
   ostream & os = source.Stream ();

   // declare dtor body
   os << "static void " << m_tc_dtor_val << " (void * arg)" << nl;
   os << "{" << nl;

   // Cast and delete as appropriate

   if (isCounted)
   {
      os << "   DDS::release";
   }
   else
   {
      os << "   delete"; 
   }
   os << " ((" << ScopedName() << "*) arg);" << nl;
   os << "}" << nl << nl;
}
Esempio n. 28
0
be_structure::be_structure(UTL_ScopedName *n, const UTL_Pragmas &p)
   :
   AST_Decl (AST_Decl::NT_struct, n, p),
   UTL_Scope (AST_Decl::NT_struct, n, p),
   m_isFixedLength (pbtrue),
   m_elemAlignment (0),
   m_maxElemAlignment (1),
   m_elemSize (0),
   m_canOptimize (pbfalse),
   m_lastFieldSize (0),
   m_cppScope (g_feScopeStack.Top()),
   m_cppType (g_feScopeStack.Top(), *n),
   m_interface_dependant (pbfalse)
{
   DDS_StdString barScopedName = NameToString(name(), "_");
   isAtModuleScope(pbfalse);

   localName = local_name()->get_string();
   enclosingScope = be_Type::EnclosingScopeString(this);

   m_tc_ctor_val = (DDS_StdString) barScopedName + "_ctor";
   m_tc_dtor_val = (DDS_StdString) barScopedName + "_dtor";
   m_tc_put_val = (DDS_StdString) barScopedName + "_put";
   m_tc_get_val = (DDS_StdString) barScopedName + "_get";
   m_tc_assign_val = (DDS_StdString) barScopedName + "_copy";

   m_any_op_id = barScopedName;
   m_nullArg = (DDS_StdString)"*(new " + ScopedName() + ")";
   m_typecode->kind = DDS::tk_struct;
   m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string();
   m_typecode->name_of_type = localName;
   m_marshalInCore = FALSE;

   InitializeTypeMap(this);

   be_CppFwdDecl::Add(be_CppFwdDecl::STRUCT, this, m_cppScope);
}
Esempio n. 29
0
void be_exception::Generate (be_ClientImplementation& source)
{
   ostream & os = source.Stream();
   be_Tab tab (source);
   UTL_String * repID = get_decl_pragmas().get_repositoryID();
   const DDS_StdString corbaException = "DDS::Exception";

   // convenience constructor

   if (nmembers())
   {
      GenerateConvenienceConstructor(source);
   }

   // copy constructor

   GenerateCopyConstructor (source);

   // assignment operator

   GenerateAssignmentOperator (source);

   be_CodeGenerator::Generate (source);

   // name and id

   assert (repID);
   os << "const char * " << ScopedName () << "::m_name = \"" 
      << LocalName () << "\";" << nl << nl;
   os << "const char * " << ScopedName () << "::m_id = \"" 
      << repID->get_string () << "\";" << nl << nl;

   // downcast

   os << tab << ScopedName () << " * ";
   os << ScopedName () << "::";
   os << "_downcast (DDS::Exception * e)" << nl;
   os << tab << "{" << nl;
   tab.indent ();
   os << tab << "if (e && (e->_rep_id () == m_id))" << nl;
   os << tab << "{" << nl;
   tab.indent ();
   os << tab << "return static_cast < " << LocalName () << "*> (e);" << nl;
   tab.outdent ();
   os << tab << "}" << nl;
   os << tab << "return 0;" << nl;
   tab.outdent ();
   os << tab << "}" << nl << nl;

   // const downcast

   os << tab << "const " << ScopedName() << " * ";
   os << ScopedName () << "::";
   os << "_downcast (const DDS::Exception * e)" << nl;
   os << tab << "{" << nl;
   tab.indent ();
   os << tab << "if (e && (e->_rep_id () == m_id))" << nl;
   os << tab << "{" << nl;
   tab.indent ();
   os << tab << "return static_cast < " << LocalName () 
      << "*> ((" << LocalName () << "*) e);" << nl;
   tab.outdent ();
   os << tab << "}" << nl;
   os << tab << "return 0;" << nl;
   tab.outdent ();
   os << tab << "}" << nl << nl;

   // _clone

   os << tab << corbaException << " * " << ScopedName ();
   os << "::_clone () const" << nl;
   os << tab << "{" << nl;
   tab.indent ();
   os << tab << "return (" << corbaException << "*) new ";
   os << ScopedName () << " (*this);" << nl;
   tab.outdent ();
   os << tab << "}" << nl << nl;

   // raise

   os << tab << "void " << ScopedName () << "::_raise ("
      << XBE_Ev::arg (XBE_ENV_ARG1) << ") const" << nl;
   os << tab << "{" << nl;
   tab.indent ();
   os << tab;
   XBE_Ev::throwex (os, "*this");
   os << nl;
   tab.outdent ();
   os << tab << "}" << nl << nl;

   // factory

   os << tab << "DDS::Exception * " << ScopedName() << "::factory ()" << nl;
   os << tab << "{" << nl;
   tab.indent ();
   os << tab << "return new " << ScopedName () << ";" << nl;
   tab.outdent ();
   os << tab << "}" << nl << nl;

   // initilaizer

   os << "DDS::ExceptionInitializer " << ScopedName() << "::m_initializer (";
   os << "\"" << repID->get_string () << "\"";
   os << ", " << ScopedName () << "::factory);" << nl;
}
Esempio n. 30
0
void be_exception::GenerateConvenienceConstructor (be_ClientImplementation & source)
{
   ostream & os = source.Stream ();
   const char * argPrefix = "_";
   pbbool first = pbtrue;
   be_Tab tab (source);
   be_Type * btype;

   os << ScopedName () << "::" << LocalName () << " (";

   UTL_Scope * s = (UTL_Scope*)narrow ((long) & UTL_Scope::type_id);
   assert (s);

   // Iterate through decls

   UTL_ScopeActiveIterator * it;

   for
   (
      it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
      !it->is_done ();
      it->next ()
   )
   {
      AST_Decl * adecl = it->item ();
      assert (adecl);

      be_field *bfield = (be_field *)adecl->narrow ((long) & be_field::type_id);

      if (bfield)
      {
         btype = bfield->get_be_type ();

         if (!first)
         {
            os << ", ";
         }

         first = pbfalse;

         if (btype && btype->IsStringType ())
         {
            // Strings are special case

            os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->InTypeName ());
         }
         else
         {
            os << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ());
         }

         os << " " << argPrefix << (char*) bfield->get_local_name ();
      }
   }
   delete it;

   os << ")" << nl;

   // Iterate thru members initializing

   if (nmembers ())
   {
      source.Indent ();

      first = pbtrue;

      for
      (
         it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
         !it->is_done ();
         it->next ()
      )
      {
         AST_Decl * adecl = it->item ();
         assert (adecl);

         be_field *bfield = (be_field *)adecl->narrow ((long) & be_field::type_id);

         if (bfield)
         {
            btype = bfield->get_be_type ();

            // Array members are assigned in body of method

            if (btype && ! btype->IsArrayType ())
            {
               if (first)
               {
                  first = pbfalse;
                  os << "   : " << nl;
               }
               else
               {
                  os << "," << nl;
               }

               os << "   " << (char*) bfield->get_local_name () << "(" << argPrefix
               << (char*) bfield->get_local_name () << ")";
            }
         }
      }
      delete it;

      source.Outdent ();
   }

   os << nl;
   os << tab << "{" << nl;

   for 
   (
      it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
      ! it->is_done ();
      it->next ()
   )
   {
      AST_Decl * adecl = it->item ();
      assert (adecl);

      be_field *bfield = (be_field *) adecl->narrow ((long) & be_field::type_id);

      if (bfield)
      {
         btype = bfield->get_be_type ();
         if (btype && btype->IsArrayType ())
         {
            // Need to copy array elements

            os << "   "
               << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ())
               << "_copy (" << argPrefix << bfield->get_local_name () 
               << ", " << bfield->get_local_name () << ");" << nl;
         }
      }
   }
   delete it;

   os << "}" << nl << nl;
}