From 78b14d860d585f77a7e88a829629ebadd862cb1b Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Thu, 27 Sep 2007 18:37:56 -0500 Subject: [PATCH] idlcomp/c++: Separate output_nsdecl into begin/children/end. --- idlcomp/languages/c++/c++.h | 9 +++---- idlcomp/languages/c++/main.cc | 51 ++++++++++++++++++----------------- include/c++/orb.h | 4 +-- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/idlcomp/languages/c++/c++.h b/idlcomp/languages/c++/c++.h index 214f2cd..a8fb246 100644 --- a/idlcomp/languages/c++/c++.h +++ b/idlcomp/languages/c++/c++.h @@ -82,8 +82,6 @@ class CPPFile : public LangCallback { bool prototype, bool retval); void output_one_method_ptr(Method *m, Interface *iface); - static void output_iface_ns(CPPFile *file, NameSpace *sym); - //// Misc members: // Output the static const guid[] value, and the IFaceInfo struct. @@ -96,7 +94,6 @@ class CPPFile : public LangCallback { int output_datum(Struct *ns, Datum *d, int offset); - static void output_vstruct_ns(CPPFile *file, NameSpace *sym); void output_vstruct_info(Struct *sym); void output_vstruct_main(Struct *sym); void output_struct_ctor(Struct *sym, bool extra_vstruct); @@ -142,8 +139,10 @@ class CPPFile : public LangCallback { // namespace, before any namespace members have been // emitted. - typedef void (*nsdecl_callback)(CPPFile *file, NameSpace *ns); - void output_nsdecl(NameSpace *ns, nsdecl_callback cb = NULL); + void output_nsdecl_begin(NameSpace *ns); + void output_nsdecl_children(NameSpace *ns); + void output_nsdecl_end(NameSpace *ns); + void output_nsdecl(NameSpace *ns); void output_aliases_and_types(NameSpace *ns); diff --git a/idlcomp/languages/c++/main.cc b/idlcomp/languages/c++/main.cc index 12cb65c..8fb4b72 100644 --- a/idlcomp/languages/c++/main.cc +++ b/idlcomp/languages/c++/main.cc @@ -403,7 +403,7 @@ void CPPFile::output_guid(const uint64_t *guid64) do_extra_newline = true; } -void CPPFile::output_nsdecl(NameSpace *ns, nsdecl_callback cb) +void CPPFile::output_nsdecl_begin(NameSpace *ns) { // If indent level is not zero, this is a nested struct or interface. if (indent.indent_level == 0) @@ -413,10 +413,10 @@ void CPPFile::output_nsdecl(NameSpace *ns, nsdecl_callback cb) file << indent << "namespace " << **ns->name << "_ns {\n"; downscope(); +} - if (cb) - cb(this, ns); - +void CPPFile::output_nsdecl_children(NameSpace *ns) +{ for (NameSpace::const_iterator i = ns->begin(); i != ns->end(); ++i) { Symbol *sym = (*i).second; @@ -427,7 +427,10 @@ void CPPFile::output_nsdecl(NameSpace *ns, nsdecl_callback cb) output_pass(sym, trav_forward); output_pass(sym, trav_nsdecl); } - +} + +void CPPFile::output_nsdecl_end(NameSpace *ns) +{ upscope(); file << indent << "}\n"; @@ -436,6 +439,13 @@ void CPPFile::output_nsdecl(NameSpace *ns, nsdecl_callback cb) ns_out(ns); } +void CPPFile::output_nsdecl(NameSpace *ns) +{ + output_nsdecl_begin(ns); + output_nsdecl_children(ns); + output_nsdecl_end(ns); +} + void CPPFile::output_aliases_and_types(NameSpace *ns) { for (NameSpace::const_iterator i = ns->begin(); i != ns->end(); ++i) { @@ -445,15 +455,6 @@ void CPPFile::output_aliases_and_types(NameSpace *ns) } } -void CPPFile::output_vstruct_ns(CPPFile *cpp, NameSpace *sym) -{ - Struct *str = dynamic_cast(sym); - assert(str); - assert(str->is_virtual()); - - cpp->output_guid(str->def.guid); -} - void CPPFile::output_vstruct_info(Struct *sym) { all_ns_in(sym, true, "VINFO_"); @@ -638,7 +639,10 @@ void CPPFile::output(Struct *sym, int pass, void *arg2) switch (pass) { case trav_nsdecl: if (sym->is_virtual()) { - output_nsdecl(sym, output_vstruct_ns); + output_nsdecl_begin(sym); + output_nsdecl_children(sym); + output_guid(sym->def.guid); + output_nsdecl_end(sym); } else { output_nsdecl(sym); } @@ -734,20 +738,17 @@ void CPPFile::output(Struct *sym, int pass, void *arg2) } } -void CPPFile::output_iface_ns(CPPFile *file, NameSpace *sym) -{ - Interface *i = dynamic_cast(sym); - assert(i); - - file->output_guid(i->def.guid); - file->output_ifaceinfo(i); -} - void CPPFile::output(Interface *sym, int pass, void *arg2) { switch (pass) { case trav_nsdecl: - output_nsdecl(sym, output_iface_ns); + output_nsdecl_begin(sym); + output_nsdecl_children(sym); + + output_guid(sym->def.guid); + output_ifaceinfo(sym); + + output_nsdecl_end(sym); break; case trav_forward: { diff --git a/include/c++/orb.h b/include/c++/orb.h index 484c142..a20f44d 100644 --- a/include/c++/orb.h +++ b/include/c++/orb.h @@ -337,8 +337,8 @@ namespace System { struct ParamInfoBlock { uint32_t buffer_size; uint32_t copy_size; - ID *objlist; - uint32_t objlist_len; + ID *objlist, *newobj; + uint32_t objlist_len, newobj_len; uint32_t num_segments; struct Segment { -- 2.39.2