From 8916f1190f3b26a489e17e401cfe024d31dbdcc7 Mon Sep 17 00:00:00 2001 From: Clement David Date: Wed, 29 Jan 2020 17:34:49 +0100 Subject: [PATCH] update CHANGES and help pages after c1dbf528 Change-Id: Ic66374254472001351eada1514ddcaa601e72675 --- scilab/CHANGES.md | 8 +- scilab/modules/functions/help/en_US/argn.xml | 128 +++++++------------------- scilab/modules/functions/help/fr_FR/argn.xml | 118 ++++++------------------ 3 files changed, 66 insertions(+), 188 deletions(-) diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index 47b025e6..78a59a8 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -33,6 +33,7 @@ In summary, the main new features are: - complex numbers are aligned for matrices - numbers (IEEE 754 double) are not rounded * importgui function has been added to easily interface csvRead +* function calls with zero output arguments can be detected with `argn` Installation @@ -175,9 +176,14 @@ Xcos * `CURVE_c` settings did not always display a window. * Exporting all layers from a diagram will generate one unique file per layer. -API modification +API/ABI modification ---------------- +* Functions could return zeros arguments, the following gateway functions have been updated: + - on APIv5 C `CheckOutputArgument(ctx, min, max)` the `min` argument should be set to `0` if needed. + - on APIv5 C `getNbOutputArgument(ctx)` the return value could be `0` + - on APIv6 C++ the `_iRetCount` argument value could be `0`. +* On APIv6 C++, a virtual method has been added on internal types which break the ABI. Toolboxes need to be recompiled. Obsolete functions or features ------------------------------ diff --git a/scilab/modules/functions/help/en_US/argn.xml b/scilab/modules/functions/help/en_US/argn.xml index 91e270f..f5130a1 100644 --- a/scilab/modules/functions/help/en_US/argn.xml +++ b/scilab/modules/functions/help/en_US/argn.xml @@ -36,8 +36,7 @@ lhs - Number of expected Left-Hand-Side output arguments. Is set to 1 when no output - argument is expected. + Number of expected Left-Hand-Side output arguments assigned at the function call. @@ -54,15 +53,15 @@ Description This function is used inside a function definition. - It gives the number of actual inputs arguments (rhs) - and output arguments (lhs) passed to the function when the function is - called. It is usually used in function definitions to deal with - optional arguments. + It gives the number of actual inputs arguments (rhs) and output arguments (lhs) passed to the function when the function is called. It is usually used in function definitions to deal with optional arguments. Testing the existence of a named input argument with isdef(..,"l") is more robust that with argn(). Please see examples. + + When the caller function has either no output argument or only varargout, the (lhs) is set to 0. Otherwise, the number of expected arguments is set. + Examples @@ -83,73 +82,38 @@ test(3, -1, c=8); out1 = test(); [o1, o2] = test(%pi); ]]> - test(); - 1. 0. - ---> test(4.321); - 1. 1. - ---> test(3, -1); - 1. 2. - ---> test(3, -1, a=0); -Wrong number of input arguments. - ---> test(3, -1, c=8); -Wrong number of input arguments. - ---> out1 = test(); - 1. 0. - ---> [o1, o2] = test(%pi); - 2. 1. -]]> With varargin and varargout: - test(); - 1. 0. - ---> test(4.321); - 1. 1. - ---> test(3, -1); - 1. 2. - ---> test(3, -1, a=0); - 1. 3. - ---> test(3, -1, 8); - 1. 3. - ---> out1 = test(); - 1. 0. - ---> [o1, o2] = test(%pi); - 2. 1. - ---> [o1, o2, o3] = test(%pi); - 3. 1. -]]> Robust test of the existence of input arguments: - test() - ans = - ---> test(4.321) - ans = - a passed. - ---> test(4.321, %z) - ans = - a passed. b passed. - ---> test(b=3) - ans = - b passed. - ---> test(c=3) - ans = - c passed. - ---> test(-1, c=3) - ans = - a passed. c passed. - ---> test(-1, a=2, c=3) // argins in varargin are/become always anonymous - ans = - a passed. - ---> test(b=-1, a=2, c=3) - ans = - a passed. b passed. -]]> Another usage: varargout - + macrovar @@ -242,4 +174,8 @@ endfunction + + History + 6.1.0The lhs argument is set to zero when the caller function has no output assignement. + diff --git a/scilab/modules/functions/help/fr_FR/argn.xml b/scilab/modules/functions/help/fr_FR/argn.xml index 0d22f2b..2140244 100644 --- a/scilab/modules/functions/help/fr_FR/argn.xml +++ b/scilab/modules/functions/help/fr_FR/argn.xml @@ -37,8 +37,7 @@ lhs - Nombre d'arguments de sortie attendus. Vaut 1 (au lieu de 0) si la fonction - a été appelée sans argument de sortie. + Nombre d'arguments de sortie attendus. Vaut 0 si la fonction a été appelée sans argument de sortie. @@ -84,73 +83,38 @@ test(3, -1, c=8); out1 = test(); [o1, o2] = test(%pi); ]]> - test(); - 1. 0. - ---> test(4.321); - 1. 1. - ---> test(3, -1); - 1. 2. - ---> test(3, -1, a=0); -Wrong number of input arguments. - ---> test(3, -1, c=8); -Wrong number of input arguments. - ---> out1 = test(); - 1. 0. - ---> [o1, o2] = test(%pi); - 2. 1. -]]> Avec varargin ou/et varargout: - test(); - 1. 0. - ---> test(4.321); - 1. 1. - ---> test(3, -1); - 1. 2. - ---> test(3, -1, a=0); - 1. 3. - ---> test(3, -1, 8); - 1. 3. - ---> out1 = test(); - 1. 0. - ---> [o1, o2] = test(%pi); - 2. 1. - ---> [o1, o2, o3] = test(%pi); - 3. 1. -]]> Test robuste de l'existence d'un argument d'entrée: - test() - ans = - ---> test(4.321) - ans = - a passed. - ---> test(4.321, %z) - ans = - a passed. b passed. - ---> test(b=3) - ans = - b passed. - ---> test(c=3) - ans = - c passed. - ---> test(-1, c=3) - ans = - a passed. c passed. - ---> test(-1, a=2, c=3) // Les arguments passés via varargin sont toujours anonymes - ans = - a passed. - ---> test(b=-1, a=2, c=3) - ans = - a passed. b passed. -]]> Autre usage fréquent: + + History + 6.1.0L'argument lhs est assigné à zero si appelé sans argument de sortie. + -- 1.7.9.5