+ file << indent << "memcpy(ptr, data, len);\n"
+ << indent << "sptr = (";
+ cpp_output_name(file, sym);
+ file << " *)ptr;\n";
+
+ marshall_members(sym);
+ indent.indent_level--;
+
+ file << indent << "\treturn 0;\n"
+ << indent << "}\n\n";
+}
+
+void CPPFile::output_marshall_inline_method(Struct *sym)
+{
+ file << indent << "__attribute__((weak)) __attribute__((unused))\n"
+ << indent << "void *_marshall_inline(::System::RunTime::MarshCtx &ctx, ";
+ cpp_output_name(file, sym);
+ file << " *data, ";
+ cpp_output_name(file, sym);
+ file << " *sptr)\n"
+ << indent << "{\n";
+
+ indent.indent_level++;
+
+ file << indent << "__attribute__((unused)) void *ptr;\n"
+ << indent << "__attribute__((unused)) size_t len;\n"
+ << indent << "__attribute__((unused)) size_t i = 0;\n";
+
+ marshall_members(sym);
+ indent.indent_level--;
+
+ file << indent << "\treturn 0;\n"
+ << indent << "}\n";
+}
+
+void CPPFile::output_marshall(Struct *sym, Datum *d)
+{
+ bool array = d->is_array(), inl = d->is_inline();
+ const char *index = "";
+
+ file << '\n';
+
+ if (array) {
+ file << indent << "for (size_t i = 0; i < ";
+
+ if (inl)
+ file << d->array->cons[0].con.ucon;
+ else
+ file << "data->" << **d->name << ".count";
+
+ file << "; i++) {\n";
+
+ indent.indent_level++;
+ index = "[i]";
+ }
+
+ if (!inl) {
+ file << indent << "if (data->" << **d->name << index << ")\n";
+ indent.indent_level++;
+ }
+
+ file << indent;
+ cpp_output_name(file, sym);
+ file << "_ns::_marshall";
+
+ if (inl)
+ file << "_inline(ctx, &";
+ else
+ file << "(ctx, ";
+
+ file << "data->" << **d->name << index
+ << ", &sptr->" << **d->name << index << ");\n";
+
+ if (!inl)
+ indent.indent_level--;
+
+ if (array) {
+ indent.indent_level--;
+ file << indent << "}\n";
+ }
+}
+
+void CPPFile::output_marshall(Interface *sym, Datum *d)
+{
+ printf("marshall iface\n");
+}
+
+void CPPFile::output_marshall(Enum *sym, Datum *d)
+{
+ if (!d->is_array() || d->is_inline())
+ return;
+
+ output_marshall_array(d);
+}
+
+void CPPFile::output_marshall(BitField *sym, Datum *d)
+{
+ if (!d->is_array() || d->is_inline())
+ return;
+
+ output_marshall_array(d);
+}
+
+void CPPFile::output_marshall(BasicType *sym, Datum *d)
+{
+ if (!d->is_array() || d->is_inline())
+ return;
+
+ output_marshall_array(d);
+}
+
+void CPPFile::output_marshall(CompiledBasicType &cbt, Datum *d)
+{
+ if (!d->is_array() || d->is_inline())
+ return;
+
+ output_marshall_array(d);
+}
+
+void CPPFile::output_marshall_pass(Struct *sym, int pass)
+{
+ switch (pass) {
+ case trav_nsdecl:
+ extra_newline();
+
+ file << indent << "void *_marshall(::System::RunTime::MarshCtx &ctx,\n"
+ << indent << " ";
+ cpp_output_name(file, sym);
+ file << " *data, ";
+ cpp_output_name(file, sym);
+ file << " **link);\n";
+
+ file << indent << "void *_marshall_inline(::System::RunTime::MarshCtx &ctx,\n"
+ << indent << " ";
+ cpp_output_name(file, sym);
+ file << " *data, ";
+ cpp_output_name(file, sym);
+ file << " *sptr);\n";
+
+ file << indent << "void _unmarshall(::System::RunTime::MarshCtx &ctx,\n"
+ << indent << " ";
+ cpp_output_name(file, sym);
+ file << " *data);\n";
+ break;
+
+ case trav_full:
+ output_marshall_method(sym);
+ output_marshall_inline_method(sym);
+
+#if 0
+ file << indent << "__attribute__((weak)) __attribute__((unused))\n"
+ << indent << "void _unmarshall(::System::RunTime::Array<uint8_t, ::System::RunTime::ORBMM> buf,\n"
+ << indent << " ::System::RunTime::Array< ::System::_i_Object *, ::System::RunTime::ORBMM> objlist,\n"
+ << indent << " ::System::RunTime::ParamInfoBlock::Segment *segs,\n"
+ << indent << " int nsegs)\n"
+ << indent << "{\n"
+ << indent << "}\n";
+#endif
+
+ break;
+ }