* `sgolay` and the companion `sgolayfilter` and `sgolaydiff` functions have been added to implement Savitsky-Golay filters.
* `clock` now returns the milliseconds, the time zone, and the daylight saving time.
* `mapsound` upgraded to have a colormap argument
-
+* `mprintf`, `msprintf` and `mfprintf` can now print input booleans, as `0`|`1` or as `T`|`F`.
Help pages:
-----------
* [#12532](https://bugzilla.scilab.org/12532): From `browsevar`, clicking on any function did not edit it with `edit`. The content of libraries could not be displayed either.
* [#12719](https://bugzilla.scilab.org/12719): `A(%s)` gave the same result as `A($)`.
* [#12889](https://bugzilla.scilab.org/12889): In the help browser, add a menu allowing to select the language of help pages, regardless of the language of the session.
+* [#13303](https://bugzilla.scilab.org/13303): `mprintf`, `msprintf` and `mfprintf` could not print input booleans.
* [#13417](https://bugzilla.scilab.org/13417): `csvRead` page did not document the way to use the `range` up to the last row/column.
* [#13593](https://bugzilla.scilab.org/13593): `csvRead()` did not take the `range` into account when `header` is provided. `[]` could not be used as default `range`.
* [#13762](https://bugzilla.scilab.org/13762): In the `fft` page, the formula for the inverse FFT missed the 1/n normalization factor.
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+//
+
+function %b_mfprintf(fd, Format, varargin)
+ varargin = %printf_boolean(Format, varargin(:))
+ mfprintf(fd, Format, varargin(:))
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+//
+
+function %b_mprintf(Format, varargin)
+ varargin = %printf_boolean(Format, varargin(:))
+ mprintf(Format, varargin(:))
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+//
+
+function r = %b_msprintf(Format, varargin)
+ varargin = %printf_boolean(Format, varargin(:))
+ r = msprintf(Format, varargin(:))
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+//
+
+function r = %printf_boolean(Format, varargin)
+ r = varargin
+ Format = strsubst(Format, "%%", "")
+ [s, e, Fields] = regexp(Format, "/%.*?[diuoxXfeEgGcs]/")
+ if grep(Fields, "$") <> [] then
+ // numbered formats: reordering fields in order to know
+ // the expected output format for each input argument.
+ for f = Fields'
+ [s,e,m,n] = regexp(f, "/%([0-9])\$/")
+ tmp(evstr(n)) = f
+ end
+ Fields = tmp
+ end
+ for i = 1:length(varargin)
+ if type(r(i)) == 4 // boolean
+ if or(part(Fields(i),$)==["s" "c"])
+ r(i) = string(r(i))
+ else
+ r(i) = bool2s(r(i))
+ end
+ end
+ end
+endfunction
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA
+// Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
==> row 8 : 048.1851 069.7085 089.0622<==
==> row 9 : 026.3956 084.1552 050.4221<==
==> row 10 : 041.4810 040.6202 034.9362<==
+// Booleans
+// =============================================================================
+n = [%pi ; %e];
+b = [%T ; %F];
+for f = ["d" "i" "u" "o" "x" "X" "g" "G"]
+ mprintf("%"+f+"\n", b);
+ mprintf("%"+f+" %d\n", b, n);
+ if and(f <> ["u" "o" "x" "X"]) // http://bugzilla.scilab.org/16563
+ mprintf("%2$"+f+" %1$d\n", n, b);
+ end
+end
+1
+0
+1 3
+0 2
+1 3
+0 2
+1
+0
+1 3
+0 2
+1 3
+0 2
+1
+0
+1 3
+0 2
+1
+0
+1 3
+0 2
+1
+0
+1 3
+0 2
+1
+0
+1 3
+0 2
+1
+0
+1 3
+0 2
+1 3
+0 2
+1
+0
+1 3
+0 2
+1 3
+0 2
+// %f
+msprintf("%f\n", b);
+mprintf("%f %d\n", b, n);
+1.000000 3
+0.000000 2
+mprintf("%2$f %1$d\n", n, b);
+1.000000 3
+0.000000 2
+// %e
+mprintf("%e\n", b);
+1.000000e+00
+0.000000e+00
+mprintf("%e %d\n", b, n);
+1.000000e+00 3
+0.000000e+00 2
+mprintf("%2$e %1$d\n", n, b);
+1.000000e+00 3
+0.000000e+00 2
+// %E
+mprintf("%E\n", b);
+1.000000E+00
+0.000000E+00
+mprintf("%E %d\n", b, n);
+1.000000E+00 3
+0.000000E+00 2
+mprintf("%2$E %1$d\n", n, b);
+1.000000E+00 3
+0.000000E+00 2
+// %s, %c
+for f = ["s" "c"]
+ mprintf("%"+f+"\n", b);
+ mprintf("%"+f+" %d\n", b, n);
+ mprintf("%2$"+f+" %1$d\n", n, b);
+end
+T
+F
+T 3
+F 2
+T 3
+F 2
+T
+F
+T 3
+F 2
+T 3
+F 2
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA
+// Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
34.936154 ];
mprintf("==>%10s : %08.4f %08.4f %08.4f<==\n\n",A,C,D);
+
+// Booleans
+// =============================================================================
+n = [%pi ; %e];
+b = [%T ; %F];
+for f = ["d" "i" "u" "o" "x" "X" "g" "G"]
+ mprintf("%"+f+"\n", b);
+ mprintf("%"+f+" %d\n", b, n);
+ if and(f <> ["u" "o" "x" "X"]) // http://bugzilla.scilab.org/16563
+ mprintf("%2$"+f+" %1$d\n", n, b);
+ end
+end
+// %f
+msprintf("%f\n", b);
+mprintf("%f %d\n", b, n);
+mprintf("%2$f %1$d\n", n, b);
+// %e
+mprintf("%e\n", b);
+mprintf("%e %d\n", b, n);
+mprintf("%2$e %1$d\n", n, b);
+// %E
+mprintf("%E\n", b);
+mprintf("%E %d\n", b, n);
+mprintf("%2$E %1$d\n", n, b);
+// %s, %c
+for f = ["s" "c"]
+ mprintf("%"+f+"\n", b);
+ mprintf("%"+f+" %d\n", b, n);
+ mprintf("%2$"+f+" %1$d\n", n, b);
+end
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA
// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+// Copyright (C) 2020 - Samuel GOUGEON - Le Mans Université
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
assert_checkequal(msprintf("%10.3s","text"), " tex");
assert_checkequal(msprintf("%-10s","text"), "text ");
assert_checkequal(msprintf("%s","t"), "t");
+assert_checkequal(msprintf("%s","éàöαβδ"), "éàöαβδ");
// format '%x'
// =============================================================================
assert_checkerror("msprintf(""%2$d"", 1);", refMsg);
assert_checkerror("msprintf(""%d%1$d"", 1);", refMsg);
assert_checkerror("msprintf(""%1$d%d"", 1);", refMsg);
+
+// Booleans
+// =============================================================================
+n = [%pi ; %e];
+b = [%T ; %F];
+for f = ["d" "i" "u" "o" "x" "X" "g" "G"]
+ assert_checkequal(msprintf("%"+f+"\n", b), ["1" ; "0"]);
+ assert_checkequal(msprintf("%"+f+" %d\n", b, n), ["1 3" ; "0 2"]);
+ if and(f <> ["u" "o" "x" "X"]) // http://bugzilla.scilab.org/16563
+ assert_checkequal(msprintf("%2$"+f+" %1$d\n", n, b), ["1 3" ; "0 2"]);
+ end
+end
+// %f
+assert_checkequal(msprintf("%f\n", b), ["1.000000" ; "0.000000"]);
+assert_checkequal(msprintf("%f %d\n", b, n), ["1.000000 3" ; "0.000000 2"]);
+assert_checkequal(msprintf("%2$f %1$d\n", n, b), ["1.000000 3" ; "0.000000 2"]);
+// %e
+assert_checkequal(msprintf("%e\n", b), ["1.000000e+00" ; "0.000000e+00"]);
+assert_checkequal(msprintf("%e %d\n", b, n), ["1.000000e+00 3" ; "0.000000e+00 2"]);
+assert_checkequal(msprintf("%2$e %1$d\n", n, b), ["1.000000e+00 3" ; "0.000000e+00 2"]);
+// %E
+assert_checkequal(msprintf("%E\n", b), ["1.000000E+00" ; "0.000000E+00"]);
+assert_checkequal(msprintf("%E %d\n", b, n), ["1.000000E+00 3" ; "0.000000E+00 2"]);
+assert_checkequal(msprintf("%2$E %1$d\n", n, b), ["1.000000E+00 3" ; "0.000000E+00 2"]);
+// %s, %c
+for f = ["s" "c"]
+ assert_checkequal(msprintf("%"+f+"\n", b), ["T" ; "F"]);
+ assert_checkequal(msprintf("%"+f+" %d\n", b, n), ["T 3" ; "F 2"]);
+ assert_checkequal(msprintf("%2$"+f+" %1$d\n", n, b), ["T 3" ; "F 2"]);
+end