aboutsummaryrefslogtreecommitdiff
path: root/build/context
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-01-08 13:27:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-01-08 13:27:15 +0200
commitab4421747146aa7995f0cfb1a639c9121c82c915 (patch)
treedeb08893c02ed0238f73becbbe80ede5568b946e /build/context
parentd3e624ef7c0fb274e62b81c4c7bd59640770520a (diff)
Implement tracing support
Also use to-relative path translation in diagnostics.
Diffstat (limited to 'build/context')
-rw-r--r--build/context21
1 files changed, 21 insertions, 0 deletions
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 <string>
+#include <ostream>
+
#include <build/path>
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