aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/action.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-04-28 08:48:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-05-27 15:47:28 +0200
commitb808c255b6a9ddba085bf5646e7d20ec344f2e2d (patch)
tree32730291f7e6de8ef0a227905520dd66fb4ec0f3 /libbuild2/action.hxx
parent3552356a87402727e663131994fa87f48b3cd4fb (diff)
Initial support for ad hoc recipes (still work in progress)
Diffstat (limited to 'libbuild2/action.hxx')
-rw-r--r--libbuild2/action.hxx21
1 files changed, 16 insertions, 5 deletions
diff --git a/libbuild2/action.hxx b/libbuild2/action.hxx
index c1e4697..906d7eb 100644
--- a/libbuild2/action.hxx
+++ b/libbuild2/action.hxx
@@ -11,11 +11,11 @@
namespace build2
{
- // 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
- // life easier when it comes to defining switch labels for action
- // ids (no need to mess with endian-ness).
+ // While we are using uint8_t for the meta/operation ids, we assume that
+ // each is limited to 4 bits (max 15 entries @@ this is probably too low) so
+ // that we can store the combined action id in uint8_t as well. This makes
+ // our life easier when it comes to defining switch labels for action ids
+ // (no need to mess with endian-ness).
//
// Note that 0 is not a valid meta/operation/action id.
//
@@ -61,6 +61,8 @@ namespace build2
{
action (): inner_id (0), outer_id (0) {} // Invalid action.
+ action (action_id a): action (a >> 4, a & 0xF) {}
+
// If this is not a nested operation, then outer should be 0.
//
action (meta_operation_id m, operation_id inner, operation_id outer = 0)
@@ -103,6 +105,11 @@ namespace build2
inline bool
operator!= (action x, action y) {return !(x == y);}
+ inline bool operator== (action x, action_id y) {return x == action (y);}
+ inline bool operator!= (action x, action_id y) {return x != action (y);}
+ inline bool operator== (action_id x, action y) {return action (x) == y;}
+ inline bool operator!= (action_id x, action y) {return action (x) == y;}
+
bool operator> (action, action) = delete;
bool operator< (action, action) = delete;
bool operator>= (action, action) = delete;
@@ -140,6 +147,8 @@ namespace build2
// Id constants for build-in and pre-defined meta/operations.
//
+ // Note: currently max 15 (see above).
+ //
const meta_operation_id noop_id = 1; // nomop?
const meta_operation_id perform_id = 2;
const meta_operation_id configure_id = 3;
@@ -152,6 +161,8 @@ namespace build2
// that no operation was explicitly specified by the user. If adding
// something here remember to update the man page.
//
+ // Note: currently max 15 (see above).
+ //
const operation_id default_id = 1; // Shall be first.
const operation_id update_id = 2; // Shall be second.
const operation_id clean_id = 3;