From c1dc06dfd1d329f8c6499dbe2166725ab9c35e17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 20 Jul 2018 15:31:13 +0200 Subject: Implement bash module --- build2/algorithm.ixx | 57 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 20 deletions(-) (limited to 'build2/algorithm.ixx') diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index 16117ab..fb77e9c 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -504,43 +504,60 @@ namespace build2 } void - match_prerequisites (action, target&, const scope*); + match_prerequisites (action, target&, const match_search&, const scope*); void - match_prerequisite_members (action, target&, const scope*); + match_prerequisite_members (action, target&, + const match_search_member&, + const scope*); inline void - match_prerequisites (action a, target& t) + match_prerequisites (action a, target& t, const match_search& ms) { match_prerequisites ( a, t, + ms, (a.operation () != clean_id ? nullptr : &t.root_scope ())); } inline void - match_prerequisite_members (action a, target& t) + match_prerequisite_members (action a, target& t, + const match_search_member& msm) { if (a.operation () != clean_id) - match_prerequisite_members (a, t, nullptr); + match_prerequisite_members (a, t, msm, nullptr); else - // Note that here we don't iterate over members even for see- - // through groups since the group target should clean eveything - // up. A bit of an optimization. + { + // Note that here we don't iterate over members even for see-through + // groups since the group target should clean eveything up. A bit of an + // optimization. // - match_prerequisites (a, t, &t.root_scope ()); + match_search ms ( + msm + ? [&msm] (action a, + const target& t, + const prerequisite& p, + include_type i) + { + return msm (a, t, prerequisite_member {p, nullptr}, i); + } + : match_search ()); + + match_prerequisites (a, t, ms, &t.root_scope ()); + } } inline void match_prerequisites (action a, target& t, const scope& s) { - match_prerequisites (a, t, &s); + match_prerequisites (a, t, nullptr, &s); } inline void match_prerequisite_members (action a, target& t, const scope& s) { - match_prerequisite_members (a, t, &s); + match_prerequisite_members (a, t, nullptr, &s); } target_state @@ -657,24 +674,24 @@ namespace build2 pair, const target*> execute_prerequisites (const target_type*, action, const target&, - const timestamp&, const prerequisite_filter&, + const timestamp&, const execute_filter&, size_t); inline optional execute_prerequisites (action a, const target& t, - const timestamp& mt, const prerequisite_filter& pf, + const timestamp& mt, const execute_filter& ef, size_t n) { - return execute_prerequisites (nullptr, a, t, mt, pf, n).first; + return execute_prerequisites (nullptr, a, t, mt, ef, n).first; } template inline pair, const T&> execute_prerequisites (action a, const target& t, - const timestamp& mt, const prerequisite_filter& pf, + const timestamp& mt, const execute_filter& ef, size_t n) { - auto p (execute_prerequisites (T::static_type, a, t, mt, pf, n)); + auto p (execute_prerequisites (T::static_type, a, t, mt, ef, n)); return pair, const T&> ( p.first, static_cast (p.second)); } @@ -682,10 +699,10 @@ namespace build2 inline pair, const target&> execute_prerequisites (const target_type& tt, action a, const target& t, - const timestamp& mt, const prerequisite_filter& pf, + const timestamp& mt, const execute_filter& ef, size_t n) { - auto p (execute_prerequisites (&tt, a, t, mt, pf, n)); + auto p (execute_prerequisites (&tt, a, t, mt, ef, n)); return pair, const target&> (p.first, *p.second); } @@ -693,10 +710,10 @@ namespace build2 inline pair, const T&> execute_prerequisites (const target_type& tt, action a, const target& t, - const timestamp& mt, const prerequisite_filter& pf, + const timestamp& mt, const execute_filter& ef, size_t n) { - auto p (execute_prerequisites (tt, a, t, mt, pf, n)); + auto p (execute_prerequisites (tt, a, t, mt, ef, n)); return pair, const T&> ( p.first, static_cast (p.second)); } -- cgit v1.1