From ab4421747146aa7995f0cfb1a639c9121c82c915 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 8 Jan 2015 13:27:15 +0200 Subject: Implement tracing support Also use to-relative path translation in diagnostics. --- build/context | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'build/context') diff --git a/build/context b/build/context index 4c86b14..a369ade 100644 --- a/build/context +++ b/build/context @@ -5,6 +5,9 @@ #ifndef BUILD_CONTEXT #define BUILD_CONTEXT +#include +#include + #include namespace build @@ -17,6 +20,24 @@ namespace build extern path src_base; extern path out_base; + + // If possible, translate an absolute, normalized path into relative to + // the work directory. + // + path + translate (const path&); + + // In addition to calling translate() above, this function also uses + // shorter notations such as ~/. + // + std::string + diagnostic_string (const path&); + + inline std::ostream& + operator<< (std::ostream& os, const path& p) + { + return os << diagnostic_string (p); + } } #endif // BUILD_CONTEXT -- cgit v1.1