From 71dec1fe08fd40b599028fbbafb39e0661aeafff Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 21 Nov 2016 15:13:26 +0200 Subject: Add process_path.{recall,effect} build2 functions --- build2/functions-process-path.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 build2/functions-process-path.cxx (limited to 'build2/functions-process-path.cxx') 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 +#include + +using namespace std; + +namespace build2 +{ + void + process_path_functions () + { + function_family f ("process_path"); + + // As discussed in value_traits, 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::convert ( + move (n[0]), n.size () > 1 ? &n[1] : nullptr)); + + return move (p.effect.empty () ? p.recall : p.effect); + }; + } +} -- cgit v1.1