aboutsummaryrefslogtreecommitdiff
path: root/build2/functions-process-path.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-21 15:13:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-21 15:13:26 +0200
commit71dec1fe08fd40b599028fbbafb39e0661aeafff (patch)
treeea4b1627b7dd078511c18185d8f16eedfb892bd3 /build2/functions-process-path.cxx
parent3e1c01bb5f46ddd08e73b599c482fdfc5abf77ab (diff)
Add process_path.{recall,effect} build2 functions
Diffstat (limited to 'build2/functions-process-path.cxx')
-rw-r--r--build2/functions-process-path.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/build2/functions-process-path.cxx b/build2/functions-process-path.cxx
new file mode 100644
index 0000000..7069c33
--- /dev/null
+++ b/build2/functions-process-path.cxx
@@ -0,0 +1,35 @@
+// file : build2/functions-process-path.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <build2/function>
+#include <build2/variable>
+
+using namespace std;
+
+namespace build2
+{
+ void
+ process_path_functions ()
+ {
+ function_family f ("process_path");
+
+ // As discussed in value_traits<process_path>, we always have recall.
+ //
+ f["recall"] = &process_path::recall;
+ f["effect"] = [](process_path p)
+ {
+ return move (p.effect.empty () ? p.recall : p.effect);
+ };
+
+ //@@ TMP kludge
+ //
+ f["effect"] = [](names n)
+ {
+ auto p (value_traits<process_path>::convert (
+ move (n[0]), n.size () > 1 ? &n[1] : nullptr));
+
+ return move (p.effect.empty () ? p.recall : p.effect);
+ };
+ }
+}