From 1b2da148946713f57dfe883c25953c488889e5a9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 9 Nov 2010 14:52:34 +0200 Subject: Add support for standard and custom ODB compilation prologues and epilogues --- odb/odb.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'odb/odb.cxx') 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 \"\"" << 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 \"\"" << endl + << "#include " << endl; + + // Add custom epilogue if any. + // + strings const& epi (ops.odb_epilogue ()); + for (size_t i (0); i < epi.size (); ++i) + { + os << "#line 1 \"\"" << endl + << epi[i] + << endl; + } } if (!wait_process (pi, argv[0])) -- cgit v1.1