aboutsummaryrefslogtreecommitdiff
path: root/build2/operation
diff options
context:
space:
mode:
Diffstat (limited to 'build2/operation')
-rw-r--r--build2/operation51
1 files changed, 37 insertions, 14 deletions
diff --git a/build2/operation b/build2/operation
index 39bb799..ca51ee5 100644
--- a/build2/operation
+++ b/build2/operation
@@ -10,6 +10,8 @@
#include <build2/types>
#include <build2/utility>
+#include <build2/variable>
+
namespace build2
{
class location;
@@ -188,35 +190,48 @@ namespace build2
const string name_did; // E.g., 'configured'.
const string name_done; // E.g., 'is configured'.
+ // The first argument in all the callback is the meta-operation
+ // parameters.
+ //
+ // If the meta-operation expects parameters, then it should have a
+ // non-NULL meta_operation_pre(). Failed that, any parameters will be
+ // diagnosed as unexpected.
+
+ // Start of meta-operation and operation batches.
+ //
// If operation_pre() is not NULL, then it may translate default_id
// (and only default_id) to some other operation. If not translated,
// then default_id is used. If, however, operation_pre() is NULL,
// then default_id is translated to update_id.
//
- void (*meta_operation_pre) (); // Start of meta-operation batch.
- operation_id (*operation_pre) (operation_id); // Start of operation batch.
+ void (*meta_operation_pre) (const values&, const location&);
+ operation_id (*operation_pre) (const values&, operation_id);
// Meta-operation-specific logic to load the buildfile, search and match
// the targets, and execute the action on the targets.
//
- void (*load) (scope& root,
+ void (*load) (const values&,
+ scope& root,
const path& buildfile,
const dir_path& out_base,
const dir_path& src_base,
const location&);
- void (*search) (const scope& root,
+ void (*search) (const values&,
+ const scope& root,
const scope& base,
const target_key&,
const location&,
action_targets&);
- void (*match) (action, action_targets&);
+ void (*match) (const values&, action, action_targets&);
- void (*execute) (action, action_targets&, bool quiet);
+ void (*execute) (const values&, action, action_targets&, bool quiet);
- void (*operation_post) (operation_id); // End of operation batch.
- void (*meta_operation_post) (); // End of meta-operation batch.
+ // Start of operation and meta-operation batches.
+ //
+ void (*operation_post) (const values&, operation_id);
+ void (*meta_operation_post) (const values&);
};
// Built-in meta-operations.
@@ -231,7 +246,8 @@ namespace build2
// scope.
//
void
- load (scope&,
+ load (const values&,
+ scope&,
const path&,
const dir_path&,
const dir_path&,
@@ -241,21 +257,22 @@ namespace build2
// that does just that and adds a pointer to the target to the list.
//
void
- search (const scope&,
+ search (const values&,
+ const scope&,
const scope&,
const target_key&,
const location&,
action_targets&);
void
- match (action, action_targets&);
+ match (const values&, action, action_targets&);
// Execute the action on the list of targets. This is the default
// implementation that does just that while issuing appropriate
// diagnostics (unless quiet).
//
void
- execute (action, const action_targets&, bool quiet);
+ execute (const values&, action, const action_targets&, bool quiet);
extern const meta_operation_info noop;
extern const meta_operation_info perform;
@@ -285,12 +302,18 @@ namespace build2
//
const size_t concurrency;
+ // The first argument in all the callback is the operation parameters.
+ //
+ // If the meta-operation expects parameters, then it should have a
+ // non-NULL pre(). Failed that, any parameters will be diagnosed as
+ // unexpected.
+
// If the returned operation_id's are not 0, then they are injected
// as pre/post operations for this operation. Can be NULL if unused.
// The returned operation_id shall not be default_id.
//
- operation_id (*pre) (meta_operation_id);
- operation_id (*post) (meta_operation_id);
+ operation_id (*pre) (const values&, meta_operation_id, const location&);
+ operation_id (*post) (const values&, meta_operation_id);
};
// Built-in operations.