From ce69ad7c2aaf517ec3f789300bf1ae29d8f0dc5d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 2 Sep 2022 07:08:17 +0200 Subject: Rename in.substitution variable to in.mode The original name is still recognized for backwards compatibility. --- NEWS | 12 +++++++++--- doc/manual.cli | 29 +++++++++++++++-------------- libbuild2/in/init.cxx | 6 +++++- libbuild2/in/rule.cxx | 2 +- tests/in/testscript | 2 +- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index 0467910..4a42ec3 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ Version 0.15.0 + * The in.substitution variable has been renamed to in.mode. + + The original name is still recognized for backwards compatibility. + +Version 0.15.0 + * Generated C/C++ headers and ad hoc sources are now updated during match. Specifically, all headers as well as ad hoc headers and sources are now @@ -1552,10 +1558,10 @@ Version 0.8.0 The alternative variable substitution symbol can be specified with the in.symbol variable and lax (instead of the default strict) mode with - in.substitution. For example: + in.mode. For example: file{test}: in.symbol = '@' - file{test}: in.substitution = lax + file{test}: in.mode = lax * New 'bash' build system module that provides modularization support for bash scripts. See the build system manual for all the details. @@ -1730,7 +1736,7 @@ Version 0.7.0 * Support for forwarded configurations with target backlinking. See the configure meta-operation discussion in b(1) for details. - * Improvements to the in module (in.symbol, in.substitution={strict|lax}). + * Improvements to the in module (in.symbol, in.mode={strict|lax}). * New $directory(), $base(), $leaf() and $extension() path functions. diff --git a/doc/manual.cli b/doc/manual.cli index 6b463f6..72611bc 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -3459,7 +3459,7 @@ example: h{config}: in{config} { in.symbol = '@' - in.substitution = lax + in.mode = lax SYSTEM_NAME = $c.target.system SYSTEM_PROCESSOR = $c.target.cpu @@ -8838,13 +8838,13 @@ symbol is expected to start a substitution with unresolved (to a variable value) names treated as errors. The double substitution symbol (for example, \c{$$}) serves as an escape sequence. -The substitution mode can be relaxed using the \c{in.substitution} variable. -Its valid values are \c{strict} (default) and \c{lax}. In the lax mode a pair -of substitution symbols is only treated as a substitution if what's between -them looks like a build system variable name (that is, it doesn't contain -spaces, etc). Everything else, including unterminated substitution symbols, is -copied as is. Note also that in this mode the double substitution symbol is -not treated as an escape sequence. +The substitution mode can be relaxed using the \c{in.mode} variable. Its +valid values are \c{strict} (default) and \c{lax}. In the lax mode a pair of +substitution symbols is only treated as a substitution if what's between them +looks like a build system variable name (that is, it doesn't contain spaces, +etc). Everything else, including unterminated substitution symbols, is copied +as is. Note also that in this mode the double substitution symbol is not +treated as an escape sequence. The lax mode is mostly useful when trying to reuse existing \c{.in} files from other build systems, such as \c{autoconf}. Note, however, that the lax mode is @@ -8857,7 +8857,7 @@ substitutions as is. For example: h{config}: in{config} # config.h.in { in.symbol = '@' - in.substitution = lax + in.mode = lax CMAKE_SYSTEM_NAME = $c.target.system CMAKE_SYSTEM_PROCESSOR = $c.target.cpu @@ -8884,11 +8884,12 @@ h{config}: in{config} } \ -A number of other build system modules, for example, \l{#module-version -\c{version}} and \l{#module-bash \c{bash}}, are based on the \c{in} module and -provide extended functionality. The \c{in} preprocessing rule matches any -\c{file{\}}-based target that has the corresponding \c{in{\}} prerequisite -provided none of the extended rules match. +A number of other build system modules, for example, +\l{https://github.com/build2/libbuild2-autoconf/ \c{autoconf}}, +\l{#module-version \c{version}}, and \l{#module-bash \c{bash}}, are based on +the \c{in} module and provide extended functionality. The \c{in} preprocessing +rule matches any \c{file{\}}-based target that has the corresponding \c{in{\}} +prerequisite provided none of the extended rules match. \h1#module-bash|\c{bash} Module| diff --git a/libbuild2/in/init.cxx b/libbuild2/in/init.cxx index 18071f8..6743e31 100644 --- a/libbuild2/in/init.cxx +++ b/libbuild2/in/init.cxx @@ -58,7 +58,11 @@ namespace build2 // is still stricter than the autoconf's semantics which also leaves // unknown substitutions as is. // - vp.insert ("in.substitution"); + const variable& im (vp.insert ("in.mode")); + + // Original name of this variable for backwards compatibility. + // + vp.insert_alias (im, "in.substitution"); // Fallback value to use for NULL value substitutions. If unspecified, // NULL substitutions are an error. diff --git a/libbuild2/in/rule.cxx b/libbuild2/in/rule.cxx index 5a6db30..3aa92a2 100644 --- a/libbuild2/in/rule.cxx +++ b/libbuild2/in/rule.cxx @@ -108,7 +108,7 @@ namespace build2 // Substitution mode. // bool strict (strict_); - if (const string* s = cast_null (t["in.substitution"])) + if (const string* s = cast_null (t["in.mode"])) { if (*s == "lax") strict = false; diff --git a/tests/in/testscript b/tests/in/testscript index 0d5be48..c4f534c 100644 --- a/tests/in/testscript +++ b/tests/in/testscript @@ -33,7 +33,7 @@ cat <=test.in; EOI $* <>EOO $10 -- cgit v1.1