From f59d82eb8fda3ddcf790556c6c3615e40ae8b15b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 3 Oct 2022 21:23:22 +0300 Subject: Add support for 'for' loop second (... | for x) and third (for x <...) forms in script --- libbuild2/script/script.hxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'libbuild2/script/script.hxx') diff --git a/libbuild2/script/script.hxx b/libbuild2/script/script.hxx index 5eb4ee9..aa96b7f 100644 --- a/libbuild2/script/script.hxx +++ b/libbuild2/script/script.hxx @@ -28,7 +28,8 @@ namespace build2 cmd_elifn, cmd_else, cmd_while, - cmd_for, + cmd_for_args, // `for x: ...` + cmd_for_stream, // `... | for x` and `for x <...` cmd_end }; @@ -42,7 +43,7 @@ namespace build2 union { - const variable* var; // Pre-entered for line_type::var. + const variable* var; // Pre-entered for line_type::{var,cmd_for_*}. }; }; @@ -547,7 +548,7 @@ namespace build2 // Set variable value with optional (non-empty) attributes. // virtual void - set_variable (string&& name, + set_variable (string name, names&&, const string& attrs, const location&) = 0; @@ -580,6 +581,17 @@ namespace build2 ~environment () = default; }; + // Custom command function that can be executed at the end of the pipe. + // Should throw io_error on the underlying OS error. + // + using command_function = void (environment&, + const strings& args, + auto_fd in, + bool pipe, + const optional&, + const command& deadline_cmd, + const location&); + // Helpers. // // Issue diagnostics with the specified prefix and fail if the string -- cgit v1.1