* Bug 15861 fixed [cacsd]: overloadname() removed (== typeof(,'overload') 29/20929/5
Samuel GOUGEON [Sun, 7 Apr 2019 07:57:40 +0000 (09:57 +0200)]
  http://bugzilla.scilab.org/15861

Change-Id: Ib4cb6d0a7392df71a487fd257c82231180867145

21 files changed:
scilab/CHANGES.md
scilab/modules/cacsd/macros/black.sci
scilab/modules/cacsd/macros/bode.sci
scilab/modules/cacsd/macros/bode_asymp.sci
scilab/modules/cacsd/macros/calfrq.sci
scilab/modules/cacsd/macros/csim.sci
scilab/modules/cacsd/macros/damp.sci
scilab/modules/cacsd/macros/dscr.sci
scilab/modules/cacsd/macros/flts.sci
scilab/modules/cacsd/macros/freson.sci
scilab/modules/cacsd/macros/g_margin.sci
scilab/modules/cacsd/macros/gainplot.sci
scilab/modules/cacsd/macros/krac2.sci
scilab/modules/cacsd/macros/nyquist.sci
scilab/modules/cacsd/macros/nyquistfrequencybounds.sci
scilab/modules/cacsd/macros/overloadname.sci [deleted file]
scilab/modules/cacsd/macros/p_margin.sci
scilab/modules/cacsd/macros/phaseplot.sci
scilab/modules/cacsd/macros/repfreq.sci
scilab/modules/cacsd/macros/rlocus.sci
scilab/modules/cacsd/macros/trzeros.sci

index 666571f..c7e9ccb 100644 (file)
@@ -380,6 +380,7 @@ Bug Fixes
 * [#15821](https://bugzilla.scilab.org/15821): `fac3d` and `fac3d1` were still in Scilab 6.0 despite they were tagged obsolete 14 years ago in Scilab 4.1
 * [#15825](https://bugzilla.scilab.org/15825): `gsort` could not sort completely dense matrices of complex numbers.
 * [#15840](https://bugzilla.scilab.org/15840): `grand(1,"prm",m)` yielded an unsqueezed size([size(m) 1]) hypermatrix
+* [#15861](https://bugzilla.scilab.org/15861): The `overloadname` internal macro defined in CACSD was a duplicate of `typeof(,"overload")`. It is removed.
 * [#15874](https://bugzilla.scilab.org/15874): The `scatter3` function name was an unfounded naming exception. It had to be renamed `scatter3d`.
 * [#15934](https://bugzilla.scilab.org/15934): The `^ hat` page wrongly indicated that `^` applied to a rectangular matrix not being a vector is done element-wise.
 * [#15948](https://bugzilla.scilab.org/15948): `xlabel`, `ylabel`, `zlabel` and `title` needed to be upgraded.
index 88781c9..d8e5f19 100644 (file)
@@ -103,7 +103,7 @@ function black(varargin)
             error(msprintf(_("%s: Wrong number of input arguments: %d to %d expected.\n"),fname,2,4))
         end
     else
-        ierr=execstr("%"+overloadname(varargin(1))+"_black(varargin(:))","errcatch")
+        ierr=execstr("%"+typeof(varargin(1),"overload")+"_black(varargin(:))","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n"),fname,1))
         end
index a9125dc..b16c1f6 100644 (file)
@@ -93,7 +93,7 @@ function bode(varargin)
             error(msprintf(_("%s: Wrong number of input arguments: %d to %d expected.\n"), fname, 2, 4))
         end
     else
-        ierr=execstr("%"+overloadname(varargin(1))+"_bode(varargin(:))","errcatch")
+        ierr=execstr("%"+typeof(varargin(1),"overload")+"_bode(varargin(:))","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n"),fname,1))
         end
index f640520..81b4dc8 100644 (file)
@@ -29,7 +29,7 @@ function [] = bode_asymp(sl, w_min, w_max)
 
     if and(typeof(sl) <> ["state-space" "rational" "zpk"]) then
         args=["sl", "w_min", "w_max"]
-        ierr=execstr("%"+overloadname(sl)+"_bode_asymp("+strcat(args(1:rhs),",")+")","errcatch")
+        ierr=execstr("%"+typeof(sl,"overload")+"_bode_asymp("+strcat(args(1:rhs),",")+")","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n"),"bode_asymp",1))
         end
index 81176aa..9eb9244 100644 (file)
@@ -24,7 +24,7 @@ function [frq, bnds, splitf] = calfrq(h, fmin, fmax)
     // ------------
     if and(typeof(h) <> ["state-space" "rational" "zpk"]) then
         args=["h", "fmin", "fmax"]
-        ierr=execstr("%"+overloadname(h)+"_calfrq("+strcat(args(1:rhs),",")+")","errcatch")
+        ierr=execstr("%"+typeof(h,"overload")+"_calfrq("+strcat(args(1:rhs),",")+")","errcatch")
         if ierr<>0 then
             msg = _("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n")
             error(msprintf(msg, "calfrq", 1))
index df1d975..db66fea 100644 (file)
@@ -50,7 +50,7 @@ function [y,x]=csim(u,dt,sl,x0,tol)
     sltyp=typeof(sl)
     if and(sltyp<>["state-space" "rational" "zpk"]) then
         args=["u","dt","sl","x0","tol"];
-        ierr=execstr("[y,x]=%"+overloadname(sl)+"_csim("+strcat(args(1:rhs),",")+")","errcatch")
+        ierr=execstr("[y,x]=%"+typeof(sl,"overload")+"_csim("+strcat(args(1:rhs),",")+")","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"csim",3))
         end
index b913e88..abac1bd 100644 (file)
@@ -78,7 +78,7 @@ function [wn,z,p] = damp(R,dt1)
         p=R;
         toBeOrdered=%f
     else
-        ierr=execstr("[wn,z,p]=%"+overloadname(R)+"_damp(R)","errcatch")
+        ierr=execstr("[wn,z,p]=%"+typeof(R,"overload")+"_damp(R)","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Array of floats, Polynomial or linear dynamical system expected.\n"),..
             "damp",1))
index 3dc4c51..3a5ffbf 100644 (file)
@@ -14,7 +14,7 @@ function [f,r]=dscr(sys,dt,m)
     [lhs,rhs]=argn(0);
     if and(typeof(sys) <> ["state-space" "rational" "zpk"]) then
         args=["sys","dt","m"]
-        ierr=execstr("%"+overloadname(sys)+"_dscr("+strcat(args(1:rhs),",")+")","errcatch")
+        ierr=execstr("%"+typeof(sys,"overload")+"_dscr("+strcat(args(1:rhs),",")+")","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"dscr",1))
         end
index 5efc6bd..64171f7 100644 (file)
@@ -109,7 +109,7 @@ function [y,xf] = flts(u, sl, x0)
         y=y(:,1:min(mu,l));
     else
         args = ["u","sl","x0"]
-        ierr = execstr("[y,xf]=%"+overloadname(sl)+"_flts("+strcat(args(1:rhs),",")+")", "errcatch")
+        ierr = execstr("[y,xf]=%"+typeof(sl,"overload")+"_flts("+strcat(args(1:rhs),",")+")", "errcatch")
         if ierr <> 0 then
             msg = _("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n")
             error(msprintf(msg, fname, 2))
index 9140372..7c55a3f 100644 (file)
@@ -18,7 +18,7 @@ function fr = freson(h)
         error(msprintf(msg, "freson", 1));
     end
     if and(typeof(h)<>["state-space","rational","zpk"]) then
-        ierr = execstr("[gm,fr]=%"+overloadname(sys)+"_freson(h)","errcatch")
+        ierr = execstr("[gm,fr]=%"+typeof(sys,"overload")+"_freson(h)","errcatch")
         if ierr<>0 then
             msg = gettext("%s: Wrong type for input argument: Linear dynamical system expected.\n")
             error(msprintf(msg, "freson", 1))
index 9cda690..aef8606 100644 (file)
@@ -15,7 +15,7 @@ function [gm,fr] = g_margin(h)
         error(msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"),"g_margin",1));
     end
     if and(typeof(h)<>["state-space","rational","zpk"]) then
-        ierr=execstr("[gm,fr]=%"+overloadname(h)+"_g_margin(h)","errcatch")
+        ierr=execstr("[gm,fr]=%"+typeof(h,"overload")+"_g_margin(h)","errcatch")
         if ierr<>0 then
             error(msprintf(gettext("%s: Wrong type for input argument: Linear dynamical system expected.\n"),"g_margin",1))
         end
index f361433..5cfed9f 100644 (file)
@@ -75,7 +75,7 @@ function []=gainplot(varargin)
             error(msprintf(_("%s: Wrong number of input arguments: %d to %d expected.\n"),fname,2,4))
         end
     else
-        ierr=execstr("%"+overloadname(varargin(1))+"_gainplot(varargin(:))","errcatch")
+        ierr=execstr("%"+typeof(varargin(1),"overload")+"_gainplot(varargin(:))","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n"),fname,1))
         end
index c8f65cf..b347c15 100644 (file)
@@ -18,7 +18,7 @@ function [kp,s]=krac2(sys)
     // K'= 0 --> den'*num-den*num'=0
     //  http://www.scribd.com/doc/21374148/An-Introduction-to-Control-Systems
     if and(typeof(sys)<>["state-space" "rational" "zpk"]) then
-        ierr=execstr("[kp,s]=%"+overloadname(sys)+"_krac2(sys)","errcatch")
+        ierr=execstr("[kp,s]=%"+typeof(sys,"overload")+"_krac2(sys)","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"krac2",1))
         end
index 90369de..8eb4e2b 100644 (file)
@@ -89,7 +89,7 @@ function nyquist(varargin)
             error(msprintf(_("%s: Wrong number of input arguments: %d to %d expected.\n"),fname,2,4))
         end
     else
-        ierr=execstr("%"+overloadname(varargin(1))+"_nyquist(varargin(:))","errcatch")
+        ierr=execstr("%"+typeof(varargin(1),"overload")+"_nyquist(varargin(:))","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n"),fname,1))
         end
index c71af07..f9ca416 100644 (file)
@@ -24,7 +24,7 @@ function [fmin,fmax]=nyquistfrequencybounds(H,bounds)
         error(msprintf(msg, fname, 2))
     end
     if and(typeof(H)<>["state-space" "rational" "zpk"]) then
-        ierr = execstr("[fmin,fmax]=%"+overloadname(H)+"_nyquistfrequencybounds(H,bounds)","errcatch")
+        ierr = execstr("[fmin,fmax]=%"+typeof(H,"overload")+"_nyquistfrequencybounds(H,bounds)","errcatch")
         if ierr<>0 then
             msg = _("%s: Wrong type for input argument: Linear dynamical system expected.\n");
             error(msprintf(msg, fname, 1))
diff --git a/scilab/modules/cacsd/macros/overloadname.sci b/scilab/modules/cacsd/macros/overloadname.sci
deleted file mode 100644 (file)
index 7e7cb31..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2016 - INRIA - Serge Steer
-//
-// 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.
-// For more information, see the COPYING file which you should have received
-// along with this program.
-function name=overloadname(a)
-    //return the short name associated with input variable a to be used for
-    //function overloading
-    t=type(a)
-    if or(t==(15:17)) then
-        name=typeof(a)
-    else
-        [types,names]=typename()
-        k=find(types==t)
-        name=names(k)
-    end
-endfunction
index ad1eb39..f347015 100644 (file)
@@ -16,7 +16,7 @@ function [phm,fr]=p_margin(h)
         error(msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"),"g_margin",1));
     end
     if and(typeof(h)<>["state-space","rational","zpk"]) then
-        ierr=execstr("[phm,fr]=%"+overloadname(h)+"_p_margin(h)","errcatch")
+        ierr=execstr("[phm,fr]=%"+typeof(h,"overload")+"_p_margin(h)","errcatch")
         if ierr<>0 then
             error(msprintf(gettext("%s: Wrong type for input argument: Linear dynamical system expected.\n"),"p_margin",1))
         end
index 9b21709..12e32bc 100644 (file)
@@ -63,7 +63,7 @@ function []=phaseplot(varargin)
             error(msprintf(_("%s: Wrong number of input arguments: %d to %d expected.\n"),fname,2,4))
         end
     else
-        ierr=execstr("%"+overloadname(varargin(1))+"_phaseplot(varargin(:))","errcatch")
+        ierr=execstr("%"+typeof(varargin(1),"overload")+"_phaseplot(varargin(:))","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n"),fname,1))
         end
index f9831be..5dbf3b7 100644 (file)
@@ -18,7 +18,7 @@ function [frq,rep,splitf]=repfreq(sys,fmin,fmax,pas)
     //discretization
     if and(typeof(sys)<>[ "rational" "state-space" "zpk"]) then
         args=["sys","fmin","fmax","pas"];
-        ierr=execstr("[frq,rep,splitf]=%"+overloadname(sys)+"_repfreq("+strcat(args(1:rhs),",")+")","errcatch")
+        ierr=execstr("[frq,rep,splitf]=%"+typeof(sys,"overload")+"_repfreq("+strcat(args(1:rhs),",")+")","errcatch")
         if ierr<>0 then
             msg = gettext("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n")
             error(msprintf(msg, "repfreq", 1))
index 98f8a2a..ea72fd2 100644 (file)
@@ -13,7 +13,7 @@ function [kk,ol_poles,ol_zeros,cl_poles,AsymptotesOrigin,AsymptotesAngles]=rlocu
     sltyp=typeof(sys)
     if and(sltyp<>["state-space" "rational" "zpk"]) then
         args=["sys","kmax"];
-        ierr=execstr("[kk,ol_poles,ol_zeros,cl_poles,AsymptotesOrigin,AsymptotesAngles]=%"+overloadname(sys)+"_rlocus("+strcat(args(1:rhs),",")+")","errcatch")
+        ierr=execstr("[kk,ol_poles,ol_zeros,cl_poles,AsymptotesOrigin,AsymptotesAngles]=%"+typeof(sys,"overload")+"_rlocus("+strcat(args(1:rhs),",")+")","errcatch")
         if ierr<>0 then
             error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"rlocus",1))
         end
index 0d6e642..8884db1 100644 (file)
@@ -49,7 +49,7 @@ function [nt,dt,rk]=trzeros(Sl)
     end
 
     if typeof(Sl)<>"state-space" then
-        ierr=execstr("[nt,dt,rk]=%"+overloadname(Sl)+"_trzeros(Sl)","errcatch")
+        ierr=execstr("[nt,dt,rk]=%"+typeof(Sl,"overload")+"_trzeros(Sl)","errcatch")
         if ierr<>0 then
             error(msprintf(gettext("%s: Wrong type for input argument: Linear dynamical system expected.\n"),"trzeros",1))
         end