aboutsummaryrefslogtreecommitdiff
path: root/xsde/cxx/hybrid/generator.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-05-11 12:20:11 +0200
commit2e501c68a8641a2b3c430b55f13491a9c1c5d0f5 (patch)
tree49c2748443fe3c1f01108756b647440e0647a11b /xsde/cxx/hybrid/generator.cxx
parent161beba6cdb0d91b15ad19fa8b3e51d986203915 (diff)
Add support for custom allocators
New example: examples/cxx/hybrid/allocator.
Diffstat (limited to 'xsde/cxx/hybrid/generator.cxx')
-rw-r--r--xsde/cxx/hybrid/generator.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/xsde/cxx/hybrid/generator.cxx b/xsde/cxx/hybrid/generator.cxx
index 34cfa2d..0ccbb91 100644
--- a/xsde/cxx/hybrid/generator.cxx
+++ b/xsde/cxx/hybrid/generator.cxx
@@ -132,6 +132,7 @@ namespace CXX
extern Key generate_xml_schema = "generate-xml-schema";
extern Key extern_xml_schema = "extern-xml-schema";
extern Key suppress_reset = "suppress-reset";
+ extern Key custom_allocator = "custom-allocator";
extern Key generate_polymorphic = "generate-polymorphic";
extern Key runtime_polymorphic = "runtime-polymorphic";
extern Key polymorphic_type = "polymorphic-type";
@@ -309,6 +310,11 @@ namespace CXX
<< " reset code."
<< endl;
+ e << "--custom-allocator" << endl
+ << " Generate code that uses custom allocator functions\n"
+ << " instead of operator new/delete."
+ << endl;
+
e << "--generate-polymorphic" << endl
<< " Generate polymorphism-aware code. Specify this\n"
<< " option if you use substitution groups or xsi:type."
@@ -836,6 +842,7 @@ namespace CXX
r->value<P::generate_xml_schema> () = h.value<H::generate_xml_schema> ();
r->value<P::extern_xml_schema> () = h.value<H::extern_xml_schema> ();
r->value<P::suppress_reset> () = h.value<H::suppress_reset> ();
+ r->value<P::custom_allocator> () = h.value<H::custom_allocator> ();
r->value<P::generate_polymorphic> () = h.value<H::generate_polymorphic> ();
r->value<P::runtime_polymorphic> () = h.value<H::runtime_polymorphic> ();
r->value<P::output_dir> () = h.value<H::output_dir> ();
@@ -918,6 +925,7 @@ namespace CXX
r->value<S::generate_xml_schema> () = h.value<H::generate_xml_schema> ();
r->value<S::extern_xml_schema> () = h.value<H::extern_xml_schema> ();
r->value<S::suppress_reset> () = h.value<H::suppress_reset> ();
+ r->value<S::custom_allocator> () = h.value<H::custom_allocator> ();
r->value<S::generate_polymorphic> () = h.value<H::generate_polymorphic> ();
r->value<S::runtime_polymorphic> () = h.value<H::runtime_polymorphic> ();
r->value<S::output_dir> () = h.value<H::output_dir> ();
@@ -1634,6 +1642,25 @@ namespace CXX
<< endl;
}
+ if (ops.value<CLI::custom_allocator> ())
+ {
+ hxx << "#ifndef XSDE_CUSTOM_ALLOCATOR" << endl
+ << "#error the generated code uses custom allocator while " <<
+ "the XSD/e runtime does not (reconfigure the runtime or " <<
+ "remove --custom-allocator)" << endl
+ << "#endif" << endl
+ << endl;
+ }
+ else
+ {
+ hxx << "#ifdef XSDE_CUSTOM_ALLOCATOR" << endl
+ << "#error the XSD/e runtime uses custom allocator while " <<
+ "the generated code does not (reconfigure the runtime or " <<
+ "add --custom-allocator)" << endl
+ << "#endif" << endl
+ << endl;
+ }
+
//
//