diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-09 14:52:34 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-09 14:52:34 +0200 |
commit | 1b2da148946713f57dfe883c25953c488889e5a9 (patch) | |
tree | 31740f00d3118acf981726b97354cd205c8f77cb /odb/odb.cxx | |
parent | edae7d98cfac5f55782236d397c831f68ebe11a6 (diff) |
Add support for standard and custom ODB compilation prologues and epilogues
Diffstat (limited to 'odb/odb.cxx')
-rw-r--r-- | odb/odb.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/odb/odb.cxx b/odb/odb.cxx index 2a947f5..1f1d45a 100644 --- a/odb/odb.cxx +++ b/odb/odb.cxx @@ -480,6 +480,16 @@ main (int argc, char* argv[]) pi.fd, ios_base::out | ios_base::binary); ostream os (&fb); + // Add custom prologue if any. + // + strings const& pro (ops.odb_prologue ()); + for (size_t i (0); i < pro.size (); ++i) + { + os << "#line 1 \"<odb-prologue-" << i + 1 << ">\"" << endl + << pro[i] + << endl; + } + // Write the synthesized translation unit to stdout. // os << "#line 1 \"" << escape_path (input) << "\"" << endl; @@ -490,6 +500,21 @@ main (int argc, char* argv[]) wait_process (pi, argv[0]); return 1; } + + // Add the standard epilogue. + // + os << "#line 1 \"<standard-odb-epilogue>\"" << endl + << "#include <odb/container-traits.hxx>" << endl; + + // Add custom epilogue if any. + // + strings const& epi (ops.odb_epilogue ()); + for (size_t i (0); i < epi.size (); ++i) + { + os << "#line 1 \"<odb-epilogue-" << i + 1 << ">\"" << endl + << epi[i] + << endl; + } } if (!wait_process (pi, argv[0])) |