diff options
Diffstat (limited to 'build/operation')
-rw-r--r-- | build/operation | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/build/operation b/build/operation index 3469f21..c759d59 100644 --- a/build/operation +++ b/build/operation @@ -7,13 +7,19 @@ #include <string> #include <iosfwd> +#include <vector> #include <cstdint> #include <functional> // reference_wrapper +#include <build/path> #include <build/string-table> namespace build { + struct location; + class scope; + struct target_key; + // While we are using uint8_t for the meta/operation ids, we assume // that each is limited to 4 bits (max 128 entries) so that we can // store the combined action id in uint8_t as well. This makes our @@ -104,17 +110,76 @@ namespace build // enum class execution_mode {first, last}; - // Meta/operation info. + // Meta-operation info. + // + + // Normally a list of resolved and matched targets to execute. But + // can be something else, depending on the meta-operation. // + typedef std::vector<void*> action_targets; + struct meta_operation_info { const std::string name; + + void (*meta_operation_pre) (); // Start of meta-operation batch. + operation_id (*operation_pre) (operation_id); // Start of operation batch. + + // Meta-operation-specific logic to load the buildfile, resolve and match + // the targets, and execute the action on the targets. + // + void (*load) (const path& buildfile, + scope& root, + const path& out_base, + const path& src_base, + const location&); + + void (*match) (action, + const target_key&, + const location&, + action_targets&); + + void (*execute) (action, const action_targets&); + + void (*operation_post) (operation_id); // End of operation batch. + void (*meta_operation_post) (); // End of meta-operation batch. }; // Built-in meta-operations. // + + // perform + // + + // Load the buildfile. This is the default implementation that first + // calls root_pre(), then creates the scope for out_base, and, finally, + // loads the buildfile unless it has already been loaded for the root + // scope. + // + void + load (const path& buildfile, + scope& root, + const path& out_base, + const path& src_base, + const location&); + + // Resolve and match the target. This is the default implementation + // that does just that and adds a pointer to the target to the list. + // + void + match (action, const target_key&, const location&, action_targets&); + + // Execute the action on the list of targets. This is the default + // implementation that does just that while issuing appropriate + // diagnostics. + // + void + execute (action, const action_targets&); + extern meta_operation_info perform; + // Operation info. + // struct operation_info { const std::string name; |