Sometimes it is needed to process array when result depends not
on item value only, but also from its position or collection content.
So make array.map() and array.apply() functions more flexible by
supporting optional additional parameters in callback: item index
and reference to array being processed.
(The design is like in https://underscorejs.org/#map)
After doing a `return SQ_ERROR;` in the else branch the following code is never reached. So the function either returns SQ_ERROR on failure to invoke the closure or SQ_OK in all other cases. Same behavior different code.
For native closures this method returns _nparamscheck value
which can be negative when function accepts variable number of
arguments - and it's incorrect to cast it to unsigned.
Also, _nparameters, _noutervalues and _nparamscheck fields are
actually signed integers, so it is better to keep them signed.
And casting _noutervalues is ok since it has enough capacity.
For native closures this method returns _nparamscheck value
which can be negative when function accepts variable number of
arguments - and it's incorrect to cast it to unsigned.
Also, _nparameters, _noutervalues and _nparamscheck fields are
actually signed integers, so it is better to keep them signed.
And casting _noutervalues is ok since it has enough capacity.
Checking them for being defined would get the user intention wrong if they are
passed as -DDISABLE_STATIC=Off as that would still count as being defined. Just
check for the variable, which has the desired effect. An unset variable is
always false. Since these flags are options now the variables are always set,
so one cannot disable this features anymore otherwise.
Toralf noticed a minor infelicity in option declarations:
```
build $ cmake -DLONG_OUTPUT_NAMES=YES ..
CMake Warning:
Manually-specified variables were not used by the project:
LONG_OUTPUT_NAMES
```
Note, CMake complains here about "unused" LONG_OUTPUT_NAMES.
The option is used but not declares as user-tweakable via 'option()'.
This change adds declarations for variables used in Gentoo.
Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/659880
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>