error(number): converting occurrences remaining in all .sce .sci files 03/19703/10
Samuel GOUGEON [Sat, 27 Jan 2018 03:52:58 +0000 (04:52 +0100)]
  * See also:
   https://codereview.scilab.org/#/c/15553
   http://bugzilla.scilab.org/7659

  * Tests are processed in a separate commit

Change-Id: Ie7697935fe81f06b45ed70a66b9306df532ffe20

96 files changed:
scilab/modules/ast/macros/%p_p_s.sci
scilab/modules/cacsd/macros/arhnk.sci
scilab/modules/cacsd/macros/balreal.sci
scilab/modules/cacsd/macros/calfrq.sci
scilab/modules/cacsd/macros/cont_frm.sci
scilab/modules/cacsd/macros/cont_mat.sci
scilab/modules/cacsd/macros/csim.sci
scilab/modules/cacsd/macros/ctr_gram.sci
scilab/modules/cacsd/macros/flts.sci
scilab/modules/cacsd/macros/minreal.sci
scilab/modules/cacsd/macros/obs_gram.sci
scilab/modules/cacsd/macros/obsv_mat.sci
scilab/modules/cacsd/macros/repfreq.sci
scilab/modules/cacsd/macros/statgain.sci
scilab/modules/cacsd/macros/syssize.sci
scilab/modules/fileio/macros/mdelete.sci
scilab/modules/gui/macros/getvalue.sci
scilab/modules/helptools/macros/find_links.sci
scilab/modules/helptools/macros/help_skeleton.sci
scilab/modules/integer/macros/%i_j_i.sci
scilab/modules/integer/macros/%i_j_s.sci
scilab/modules/integer/macros/%i_p_i.sci
scilab/modules/integer/macros/%i_p_s.sci
scilab/modules/integer/macros/%s_j_i.sci
scilab/modules/integer/macros/%s_p_i.sci
scilab/modules/linear_algebra/macros/coff.sci
scilab/modules/linear_algebra/macros/nlev.sci
scilab/modules/overloading/macros/%b_e.sci
scilab/modules/overloading/macros/%c_b_c.sci
scilab/modules/overloading/macros/%c_b_s.sci
scilab/modules/overloading/macros/%c_e.sci
scilab/modules/overloading/macros/%c_i_lss.sci
scilab/modules/overloading/macros/%c_i_r.sci
scilab/modules/overloading/macros/%cblock_c_cblock.sci
scilab/modules/overloading/macros/%cblock_c_s.sci
scilab/modules/overloading/macros/%cblock_f_cblock.sci
scilab/modules/overloading/macros/%ce_i_ce.sci [deleted file]
scilab/modules/overloading/macros/%hm_a_hm.sci [deleted file]
scilab/modules/overloading/macros/%hm_a_r.sci
scilab/modules/overloading/macros/%hm_a_s.sci [deleted file]
scilab/modules/overloading/macros/%hm_e.sci [deleted file]
scilab/modules/overloading/macros/%hm_m_r.sci [deleted file]
scilab/modules/overloading/macros/%hm_s_hm.sci [deleted file]
scilab/modules/overloading/macros/%hm_s_r.sci
scilab/modules/overloading/macros/%hm_s_s.sci [deleted file]
scilab/modules/overloading/macros/%i_e.sci [deleted file]
scilab/modules/overloading/macros/%ip_a_s.sci
scilab/modules/overloading/macros/%ip_m_s.sci
scilab/modules/overloading/macros/%lss_e.sci
scilab/modules/overloading/macros/%lss_i_lss.sci
scilab/modules/overloading/macros/%lss_inv.sci
scilab/modules/overloading/macros/%p_a_r.sci
scilab/modules/overloading/macros/%p_e.sci
scilab/modules/overloading/macros/%p_i_lss.sci
scilab/modules/overloading/macros/%p_j_s.sci
scilab/modules/overloading/macros/%p_s_r.sci
scilab/modules/overloading/macros/%r_a_hm.sci
scilab/modules/overloading/macros/%r_a_p.sci
scilab/modules/overloading/macros/%r_a_r.sci
scilab/modules/overloading/macros/%r_a_s.sci
scilab/modules/overloading/macros/%r_diag.sci
scilab/modules/overloading/macros/%r_i_lss.sci
scilab/modules/overloading/macros/%r_l_r.sci
scilab/modules/overloading/macros/%r_m_hm.sci [deleted file]
scilab/modules/overloading/macros/%r_m_r.sci
scilab/modules/overloading/macros/%r_m_s.sci
scilab/modules/overloading/macros/%r_r_r.sci
scilab/modules/overloading/macros/%r_s_hm.sci
scilab/modules/overloading/macros/%r_s_p.sci
scilab/modules/overloading/macros/%r_tril.sci
scilab/modules/overloading/macros/%r_triu.sci
scilab/modules/overloading/macros/%s_a_hm.sci [deleted file]
scilab/modules/overloading/macros/%s_a_ip.sci
scilab/modules/overloading/macros/%s_c_cblock.sci
scilab/modules/overloading/macros/%s_e.sci
scilab/modules/overloading/macros/%s_f_cblock.sci
scilab/modules/overloading/macros/%s_i_c.sci
scilab/modules/overloading/macros/%s_i_lss.sci
scilab/modules/overloading/macros/%s_i_st.sci
scilab/modules/overloading/macros/%s_m_ip.sci
scilab/modules/overloading/macros/%s_m_r.sci
scilab/modules/overloading/macros/%s_s_hm.sci [deleted file]
scilab/modules/overloading/macros/%s_s_ip.sci
scilab/modules/overloading/macros/%sp_inv.sci
scilab/modules/overloading/macros/%sp_l_s.sci
scilab/modules/overloading/macros/%sp_l_sp.sci
scilab/modules/overloading/macros/%sp_q_s.sci
scilab/modules/overloading/macros/%sp_y_sp.sci
scilab/modules/overloading/macros/%sp_z_sp.sci
scilab/modules/overloading/macros/%st_i_st.sci
scilab/modules/overloading/macros/generic_i_hm.sci
scilab/modules/overloading/macros/st_i_generic.sci
scilab/modules/scicos/macros/scicos_scicos/scimihm.sci
scilab/modules/scicos/macros/scicos_scicos/setvalue.sci
scilab/modules/scicos/macros/scicos_utils/scicos_getvalue.sci
scilab/modules/tclsci/macros/GEDeditvar.sci

index 0d4470a..a35ce72 100644 (file)
 function f=%p_p_s(p,s)
     // %p_p_s(p,s)  computes p^s for p polynomial matrix in special cases
     //!
+    fname = "%p_p_s"
 
     if s==[] then f=[],return,end
-    if  or(imag(s)<>0)|or(int(s)<>s) then  error(msprintf(_("%s: Wrong type for input argument #%d: An integer matrix expected.\n"),"%p_p_s",2)),end
+    if  or(imag(s)<>0)|or(int(s)<>s) then
+        msg = _("%s: Wrong type for input argument #%d: An integer matrix expected.\n")
+        error(msprintf(msg, fname, 2))
+    end
     [m,n]=size(p)
     [ms,ns]=size(s)
     if ms==1&ns==1 then
         if m==1|n==1 then //Element wise exponentiation p.^s with p vector
             if s<0 then
                 if or(abs(coeff(p(:)))*ones(max(degree(p))+1,1)==0) then
-                    error(27)
+                    msg = _("%s: Division by zero...")
+                    error(msprintf(msg, fname))
                 end
                 f = rlist(ones(p),p.^(-s),[])
             else // this case is in fact hard coded
@@ -38,10 +43,14 @@ function f=%p_p_s(p,s)
                 for k=2:s,f=f*p;end
             end
         else
-            error(20,1)
+            msg = _("%s: Argument #%d: Square matrix expected.\n")
+            error(msprintf(msg, fname, 1))
         end
     elseif ms==1|ns==1 then // Element wise exponentiation f.^s with f "scalar"
-        if m<>1|n<>1 then error(43),end
+        if m<>1 | n<>1 then
+            msg = _("%s: Non implemented feature.\n")
+            error(msprintf(msg, fname))
+        end
 
         kp=find(s>=0)
         kn=find(s<0)
@@ -49,13 +58,14 @@ function f=%p_p_s(p,s)
         den=ones(s)
         num(kp)=p.^s(kp)
         if abs(coeff(p))*ones(degree(p)+1,1)==0 then
-            error(27)
+            msg = _("%s: Division by zero...")
+            error(msprintf(msg, fname))
         end
         den(kn)=p.^(-s(kn))
         f = rlist(num,den,[])
     else
-        error(43)
+        msg = _("%s: Non implemented feature.\n")
+        error(msprintf(msg, fname))
     end
 
-
 endfunction
index 986d4c8..aeed59d 100644 (file)
 function [slm]=arhnk(a,ordre,tol)
 
     [lhs,rhs]=argn(0),
-    if lhs<>1 then error(41),end
-    if typeof(a)<>"state-space" then error(91,1),end;
-    if a.dt<>"c" then error(93,1),end
+    if lhs<>1 then
+        msg = _("%s: Wrong number of output arguments: %d to %d expected.\n");
+        error(msprintf(msg, "arhnk", 0, 1));
+    end
+    if typeof(a)<>"state-space" then
+        msg = _("%s: Argument #%d: Linear state space expected.\n");
+        error(msprintf(msg, "arhnk", 1));
+    end;
+    if a.dt<>"c" then
+        msg = _("%s: Wrong type for input argument #%d: In continuous time expected.\n");
+        error(msprintf(msg, "arhnk",1));
+    end
     select rhs
     case 2 then istol=0;
     case 3 then istol=1;
@@ -23,7 +32,8 @@ function [slm]=arhnk(a,ordre,tol)
 
     [a,b,c,d,x0,dom]=a(2:7);
     if(max(real(spec(a)))) > 0 then
-        error(msprintf(_("%s: Wrong values for input argument #%d: Stable system expected.\n"),"arhnk",1));
+        msg = _("%s: Wrong values for input argument #%d: Stable system expected.\n");
+        error(msprintf(msg, "arhnk", 1));
     end
     domaine="c"
     wc=lyap(a',-b*b',domaine)
index 6dccc21..3b92605 100644 (file)
@@ -15,9 +15,15 @@ function [slb,u]=balreal(a)
 
     [lhs,rhs]=argn(0)
 
-    if typeof(a)<>"state-space" then error(91,1),end
+    if typeof(a)<>"state-space" then
+        msg = _("%s: Argument #%d: Linear state space expected.\n");
+        error(msprintf(msg, "balreal", 1));
+    end
     [a,b,c,d,x0,dom]=a(2:7);
-    if dom==[] then error(96,1),end
+    if dom==[] then
+        msg = _("%s: Argument #%d: Undefined time domain.\n");
+        error(msprintf(msg, "balreal", 1));
+    end
     domain="c";
     if dom<>"c" then domain="d",end
     wc=lyap(a',-b*b',domain)
index 8d83a9d..81176aa 100644 (file)
@@ -26,7 +26,8 @@ function [frq, bnds, splitf] = calfrq(h, fmin, fmax)
         args=["h", "fmin", "fmax"]
         ierr=execstr("%"+overloadname(h)+"_calfrq("+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"),"calfrq",1))
+            msg = _("%s: Wrong type for input argument #%d: Linear dynamical system or row vector of floats expected.\n")
+            error(msprintf(msg, "calfrq", 1))
         end
         return
     end
@@ -44,19 +45,23 @@ function [frq, bnds, splitf] = calfrq(h, fmin, fmax)
     case "d" then
         dom = 1
     case [] then
-        error(96, 1)
+        msg = _("%s: Argument #%d: Undefined time domain.\n");
+        error(msprintf(msg, "calfrq", 1));
     case 0 then
-        error(96, 1)
+        msg = _("%s: Argument #%d: Undefined time domain.\n");
+        error(msprintf(msg, "calfrq", 1));
     end;
 
     if type(dom) == 1 then
         nyq_frq = 1/2/dom;
         if fmax > nyq_frq then
-            warning(msprintf(gettext("%s: Frequencies beyond Nyquist frequency are ignored.\n"), "calfrq"));
+            msg = _("%s: Frequencies beyond Nyquist frequency are ignored.\n")
+            warning(msprintf(msg, "calfrq"));
             fmax = min(fmax, nyq_frq)
         end
         if fmin < -nyq_frq then
-            warning(msprintf(gettext("%s: Negative frequencies below Nyquist frequency are ignored.\n"), "calfrq"));
+            msg = _("%s: Negative frequencies below Nyquist frequency are ignored.\n")
+            warning(msprintf(msg, "calfrq"));
             fmin = max(fmin, -nyq_frq)
         end
     end
@@ -99,8 +104,8 @@ function [frq, bnds, splitf] = calfrq(h, fmin, fmax)
         bnds = [bnds(1), bnds(2), -bnds(4), -bnds(3)];
         return;
     elseif fmin >= fmax then
-        error(msprintf(gettext("%s: Wrong value for input arguments #%d and #%d: %s < %s expected.\n"),..
-        "calfrq", 2, 3, "fmin", "fmax"));
+        msg = _("%s: Wrong value for input arguments #%d and #%d: %s < %s expected.\n");
+        error(msprintf(msg, "calfrq", 2, 3, "fmin", "fmax"));
     end
 
     // Compute dicretisation over a given range
index a2a1488..f814d4f 100644 (file)
@@ -15,7 +15,10 @@ function sl=cont_frm(num,den)
     //Controllable state-space form of the transfer num/den
     //!
     [lhs,rhs]=argn(0)
-    if size(den,"*")<>1 then  error(54,2);end
+    if size(den,"*")<>1 then
+        msg = _("%s: Wrong type for input argument #%d: Polynomial expected.\n");
+        error(msprintf(msg, "cont_frm", 2))
+    end
     [ns,ne]=size(num);
     if type(num)==1 then
         if type(den)==1 then
index c33086a..7393bb9 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function c=cont_mat(a,b)
+function c = cont_mat(a,b)
     //c=cont_mat(a,b) or c=cont_mat(sl) is the controllability matrix.
     // of the pair a,b or of the system sl=[a,b,c,d] (syslin list)
     //                 2       n
     //i.e. c=[b, ab, ab,...; ab ]
     //!
-    [lhs,rhs]=argn(0)
+
+    [lhs,rhs] = argn(0)
     select typeof(a)
     case "constant"  then
         if rhs==1 then
             error(msprintf(gettext("%s: Wrong number of input arguments: %d expected"),"cont_mat",2)),
         end
         [m,n]=size(a)
-        if m<>n then error(20,1),end
+        if m<>n then
+            msg = _("%s: Argument #%d: Square matrix expected.\n");
+            error(msprintf(msg, "cont_mat", 1));
+        end
         [mb,nb]=size(b);
-        if mb<>n then error(60),end
+        if mb<>n then
+        msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n");
+            error(msprintf(msg, "cont_mat", 1, 2));
+        end
 
     case "state-space" then
         if rhs==2 then
@@ -35,11 +42,16 @@ function c=cont_mat(a,b)
         [n,n]=size(a)
     else
         if rhs==1 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"cont_mat",1))
+            msg = _("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n");
+            error(msprintf(msg, "cont_mat", 1))
         else
-            error(msprintf(gettext("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n"),"cont_mat",1))
+            msg = _("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n");
+            error(msprintf(msg, "cont_mat", 1))
         end
 
     end;
-    c=b;for k=1:n-1, c=[b,a*c],end
+    c = b;
+    for k = 1:n-1
+        c = [b, a*c]
+    end
 endfunction
index 50df1e5..c33d6dd 100644 (file)
@@ -43,7 +43,10 @@ function [y,x]=csim(u,dt,sl,x0,tol)
 
     [lhs,rhs]=argn(0)
     //
-    if rhs<3 then error(39),end
+    if rhs<3 then
+        msg = _("%s: Wrong number of input arguments: At least %d expected.\n");
+        error(msprintf(msg, "csim", 3));
+    end
     sltyp=typeof(sl)
     if and(sltyp<>["state-space" "rational" "zpk"]) then
         args=["u","dt","sl","x0","tol"];
index 879f561..4e0be09 100644 (file)
@@ -17,37 +17,52 @@ function [gc]=ctr_gram(a,b,domaine)
     [lhs,rhs]=argn(0)
     select typeof(a)
     case "constant" then
-        if rhs<2 then error(39); end;
+        if rhs<2 then
+            msg = gettext("%s: Wrong number of input arguments: At least %d expected.\n")
+            error(msprintf(msg, "ctr_gram", 2));
+        end;
         if rhs==2 then
             domaine="c";
         else
             if and(domaine<>["d","c"]) then
-                error(msprintf(gettext("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"), "ctr_gram",3,"''d'', ''c''"));
+                msg = gettext("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n")
+                error(msprintf(msg, "ctr_gram",3,"''d'', ''c''"));
             end
         end;
         [m,n]=size(a)
-        if m<>n then error(20,1),end
-        [mb,nb]=size(b);if mb<>n then error(60),end
+        if m<>n then
+            msg = gettext("%s: Argument #%d: Square matrix expected.\n")
+            error(msprintf(msg, "ctr_gram", 1));
+        end
+        [mb,nb]=size(b);
+        if mb<>n then
+            msg = gettext("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+            error(msprintf(msg, "ctr_gram", 1, 2));
+        end
     case "state-space" then
         if rhs>1 then
-            error(msprintf(gettext("%s: Wrong number of input arguments: %d expected"),"ctr_gram",1)),
+            msg = gettext("%s: Wrong number of input arguments: %d expected")
+            error(msprintf(msg, "ctr_gram", 1)),
         end
         [a,b,domaine]=a([2,3,7])
         if domaine==[] then
-            warning(msprintf(gettext("%s: Input argument %d is assumed continuous time.\n"),"ctr_gram",1));
-            domaine="c";
+            msg = gettext("%s: Input argument %d is assumed continuous time.\n")
+            warning(msprintf(msg, "ctr_gram", 1));
+            domaine = "c";
         elseif type(domaine)==1 then
             domaine="d",
         end
         [n,n]=size(a)
     case "rational" then
         if rhs>1 then
-            error(msprintf(gettext("%s: Wrong number of input arguments: %d expected"),"ctr_gram",1)),
+            msg = gettext("%s: Wrong number of input arguments: %d expected")
+            error(msprintf(msg, "ctr_gram", 1)),
         end
         a=tf2ss(a)
         [a,b,domaine]=a([2,3,7])
         if domaine==[] then
-            warning(msprintf(gettext("%s: Input argument %d is assumed continuous time.\n"),"ctr_gram",1));
+            msg = gettext("%s: Input argument %d is assumed continuous time.\n")
+            warning(msprintf(msg, "ctr_gram", 1));
             domaine="c";
         elseif type(domaine)==1 then
             domaine="d",
@@ -55,14 +70,17 @@ function [gc]=ctr_gram(a,b,domaine)
         [n,n]=size(a)
     else
         if rhs==1 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"ctr_gram",1))
+            msg = gettext("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n")
+            error(msprintf(msg, "ctr_gram", 1))
         else
-            error(msprintf(gettext("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n"),"ctr_gram",1))
+            msg = gettext("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n")
+            error(msprintf(msg, "ctr_gram", 1))
         end
     end
     s=spec(a)
     if (domaine=="c"&max(real(s))>=0)|(domaine=="d"&max(abs(s))>=1) then
-        error(msprintf(gettext("%s: Wrong value for input argument #%d: Stable system expected.\n"),"ctr_gram",1));
+        msg = gettext("%s: Wrong value for input argument #%d: Stable system expected.\n")
+        error(msprintf(msg, "ctr_gram", 1));
     end
-    gc=lyap(a',-b*b',domaine)
+    gc = lyap(a',-b*b',domaine)
 endfunction
index 386bb52..70c7514 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function [y,xf]=flts(u,sl,x0)
-    fname="flts";
-    [lhs,rhs]=argn(0)
-    if type(u)<>1 then error(53,1),end
-    if rhs<=1 then error(39),end
-    [nu,mu]=size(u)
-    if typeof(sl)=="zpk" then sl=zpk2tf(sl);end
+function [y,xf] = flts(u, sl, x0)
+    fname = "flts";
+    [lhs, rhs] = argn(0)
+    if type(u) <> 1 then
+        msg = gettext("%s: Argument #%d: Decimal or complex number(s) expected.\n")
+        error(msprintf(msg, fname, 1))
+    end
+    if rhs <= 1 then
+        msg = gettext("%s: Wrong number of input arguments: %d or %d expected.\n")
+        error(msprintf(msg, fname, 2, 3))
+    end
+    [nu,mu] = size(u)
+    if typeof(sl)=="zpk" then
+        sl = zpk2tf(sl)
+    end
     select typeof(sl)
     case "state-space" then
-        if rhs==2 then x0=sl.X0,end
-        [nb,mb]=size(sl.B)
-        if mb<>nu then error(60),end;
-        if sl.dt=="c" then error(94,2),end;
-        np=max(degree(sl.D))
-        [xf,x]=ltitr(sl.A,sl.B,u(:,1:(mu-np)),x0)
-        D=sl.D
+        if rhs==2 then
+            x0 = sl.X0
+        end
+        [nb,mb] = size(sl.B)
+        if mb <> nu then
+          msg = gettext("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+          error(msprintf(msg, fname, 1, 2))
+        end;
+        if sl.dt=="c" then
+          msg = gettext("%s: Wrong type for argument #%d: In discrete time expected.\n")
+          error(msprintf(msg, fname, 2))
+        end
+        np = max(degree(sl.D))
+        [xf,x] = ltitr(sl.A, sl.B, u(:,1:(mu-np)), x0)
+        D = sl.D
         if type(D)==1 then
-            y=sl.C*x+D*u
+            y = sl.C*x + D*u
         else
-            y=sl.C*x+rtitr(D,eye(D),u)
+            y = sl.C*x + rtitr(D,eye(D),u)
         end
     case "rational"  then
         if lhs>1 then
-            error(msprintf(gettext("%s: Wrong number of output argument: %d expected.\n"),"flts",1)),
+            msg = gettext("%s: Wrong number of output argument: %d expected.\n")
+            error(msprintf(msg, fname, 1))
         end
-        [num,den]=sl(["num","den"]);[ns,ne]=size(num)
-        if sl.dt=="c" then error(94,2),end;
-        if ne<>nu then error(60), end;
-        for l=1:1:ns,
+        [num, den] = sl(["num","den"]);
+        [ns, ne] = size(num)
+        if sl.dt=="c" then
+          msg = gettext("%s: Wrong type for argument #%d: In discrete time expected.\n")
+          error(msprintf(msg, fname, 2))
+        end
+        if ne<>nu then
+          msg = gettext("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+          error(msprintf(msg, fname, 1, 2))
+        end
+        for l = 1:1:ns
             pp=den(l,1);
-            for k=2:ne,[pg,uu]=bezout(pp,den(l,k)),pp=pp*uu(1,2),end
-            nden(l)=pp
-            for k=1:ne,nnum(l,k)=num(l,k)*pdiv(pp,den(l,k)),end,
-        end;
-        for l=1:ns, nm(l)=degree(nden(l))-max(degree(nnum(l,:))),end
-        ly=mu+min(nm)
+            for k=2:ne
+                [pg,uu] = bezout(pp,den(l,k)),pp=pp*uu(1,2)
+            end
+            nden(l) = pp
+            for k = 1:ne
+                nnum(l,k) = num(l,k)*pdiv(pp,den(l,k))
+            end
+        end
+        for l = 1:ns
+            nm(l) = degree(nden(l))-max(degree(nnum(l,:)))
+        end
+        ly = mu+min(nm)
         if rhs==3 then
-            [mx,nx]=size(x0);maxdgd=max(degree(nden))
-            if nx<maxdgd then
-                error(msprintf(gettext("%s: At least %s past values needed.\n"),"flts",string(maxdgd)))
-            end;
-            if mx<>ns+ne then error(60),end
-        end;
-        y=0*ones(ns,ly);
-        for l=1:ns
-            ddl=degree(nden(l))
-            dnl=max(degree(nnum(l,:)))
-            lent=ly-ddl+dnl
+            [mx, nx] = size(x0);
+            maxdgd = max(degree(nden))
+            if nx < maxdgd then
+                msg = gettext("%s: At least %s past values needed.\n")
+                error(msprintf(msg, fname, string(maxdgd)))
+            end
+            if mx <> ns+ne then
+                msg = gettext("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+                error(msprintf(msg, fname, 2, 3))
+            end
+        end
+        y = zeros(ns,ly);
+        for l = 1:ns
+            ddl = degree(nden(l))
+            dnl = max(degree(nnum(l,:)))
+            lent = ly-ddl+dnl
             select rhs
-            case 2 then yl=rtitr(nnum(l,:),nden(l),u(:,1:lent));
-                [nn,mm]=size(yl);
-                y(l,1:mm)=yl;
+            case 2 then
+                yl = rtitr(nnum(l,:),nden(l),u(:,1:lent));
+                [nn, mm] = size(yl);
+                y(l, 1:mm) = yl;
                 //                    y=y(:,1:lent);
             case 3 then
-                up=x0(1:ne,maxdgd-ddl+1:maxdgd);
-                yp=x0(ne+l,maxdgd-ddl+1:maxdgd);
-                y(l,:)=rtitr(nnum(l,:),nden(l),u(:,1:lent),up,yp);
+                up = x0(1:ne, maxdgd-ddl+1:maxdgd);
+                yp = x0(ne+l, maxdgd-ddl+1:maxdgd);
+                y(l,:) = rtitr(nnum(l,:), nden(l), u(:,1:lent), up, yp);
             end;
         end,
         l=size(y,2);
         y=y(:,1:min(mu,l));
     else
-        args=["u","sl","x0"]
-        ierr=execstr("[y,xf]=%"+overloadname(sl)+"_flts("+strcat(args(1:rhs),",")+")","errcatch")
-        if ierr<>0 then
-            error(msprintf(_("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),fname,2))
+        args = ["u","sl","x0"]
+        ierr = execstr("[y,xf]=%"+overloadname(sl)+"_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))
         end
-    end;
+    end
 endfunction
index 56da3ce..12d0532 100644 (file)
@@ -17,7 +17,8 @@ function [a,b,c]=minreal(a,b,c,domaine,tol)
     select typeof(a)
     case "state-space" then
         if lhs<>1 then
-            error(msprintf(gettext("%s: Wrong number of output arguments: %d expected.\n"),"minreal",1)),
+            msg = gettext("%s: Wrong number of output arguments: %d expected.\n")
+            error(msprintf(msg, "minreal", 1))
         end;
         select rhs
         case 1 then
@@ -26,11 +27,13 @@ function [a,b,c]=minreal(a,b,c,domaine,tol)
             istol = %t,
             tol = b,
         else
-            error(msprintf(gettext("%s: Wrong number of input arguments: %d or %d expected.\n"),"minreal",1,2)),
-        end;
-        [a,b,c,d,x0,dom] = a(2:7);
+            msg = gettext("%s: Wrong number of input arguments: %d or %d expected.\n");
+            error(msprintf(msg, "minreal", 1, 2))
+        end
+        [a,b,c,d,x0,dom] = a(2:7)
         if dom == [] then
-            error(96,1);
+            msg = gettext("%s: Argument #%d: Undefined time domain.\n");
+            error(msprintf(msg, "minreal", 1));
         end
         domaine="c";
         if dom<>"c" then
@@ -38,16 +41,19 @@ function [a,b,c]=minreal(a,b,c,domaine,tol)
         end
     case "constant" then
         if lhs<>3 then
-            error(msprintf(gettext("%s: Wrong number of output arguments: %d expected.\n"),"minreal",3)),
-        end;
+            msg = gettext("%s: Wrong number of output arguments: %d expected.\n");
+            error(msprintf(msg, "minreal", 3))
+        end
         select rhs
         case 4 then istol = %f
         case 5 then istol = %t,
         else
-            error(msprintf(gettext("%s: Wrong number of input arguments: %d or %d expected.\n"),"minreal",4,5));
-        end;
+            msg = gettext("%s: Wrong number of input arguments: %d or %d expected.\n");
+            error(msprintf(msg, "minreal", 4, 5))
+        end
     else
-        error(91,1);
+        msg = gettext("%s: Argument #%d: Linear state space expected.\n");
+        error(msprintf(msg, "minreal", 1))
     end;
     //
     wc = lyap(a', -b*b', domaine);
index 5e752c3..7fd45cd 100644 (file)
@@ -15,21 +15,34 @@ function [go]=obs_gram(a,c,domaine)
     [lhs,rhs]=argn(0)
     select typeof(a)
     case "constant" then
-        if rhs<2 then error(39); end;
+        if rhs<2 then
+            msg = gettext("%s: Wrong number of input arguments: At least %d expected.\n")
+            error(msprintf(msg, "obs_gram", 2))
+        end;
         if rhs==2 then domaine="c"; end;
         if and(domaine<>["d","c"]) then
-            error(msprintf(gettext("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"), "obs_gram",3,"''d'', ''c''"));
+            msg = gettext("%s: Wrong value for input argument #%d: Must be in the set {%s}.\n")
+            error(msprintf(msg, "obs_gram",3,"''d'', ''c''"));
+        end
+        [m,n] = size(a)
+        if m<>n then
+            msg = gettext("%s: Argument #%d: Square matrix expected.\n")
+            error(msprintf(msg, "obs_gram", 1))
+        end
+        [mb,nb]=size(c);
+        if nb<>n then
+            msg = gettext"%s: Arguments #%d and #%d: Incompatible sizes.\n")
+            error(msprintf(msg, "obs_gram", 1, 2))
         end
-        [m,n]=size(a)
-        if m<>n then error(20,1),end
-        [mb,nb]=size(c);if nb<>n then error(60),end
     case "state-space" then
         if rhs>1 then
-            error(msprintf(gettext("%s: Wrong number of input arguments: %d expected"),"obs_gram",1)),
+            msg = gettext("%s: Wrong number of input arguments: %d expected")
+            error(msprintf(msg, "obs_gram", 1))
         end
         [a,c,domaine]=a([2,4,7])
         if domaine==[] then
-            warning(msprintf(gettext("%s: Input argument #%d is assumed continuous time.\n"),"obs_gram",1));
+            msg = gettext("%s: Input argument #%d is assumed continuous time.\n")
+            warning(msprintf(msg, "obs_gram", 1));
             domaine="c";
         elseif type(domaine)==1 then
             domaine="d",
@@ -37,12 +50,14 @@ function [go]=obs_gram(a,c,domaine)
         [n,n]=size(a)
     case "rational" then
         if rhs>1 then
-            error(msprintf(gettext("%s: Wrong number of input arguments: %d expected"),"obs_gram",1)),
+            msg = gettext("%s: Wrong number of input arguments: %d expected")
+            error(msprintf(msg, "obs_gram", 1)),
         end
         a=tf2ss(a)
-        [a,c,domaine]=a([2,4,7])
+        [a,c,domaine] = a([2,4,7])
         if domaine==[] then
-            warning(msprintf(gettext("%s: Input argument #%d is assumed continuous time.\n"),"obs_gram",1));
+            msg = gettext("%s: Input argument #%d is assumed continuous time.\n")
+            warning(msprintf(msg, "obs_gram", 1));
             domaine="c";
         elseif type(domaine)==1 then
             domaine="d",
@@ -50,15 +65,18 @@ function [go]=obs_gram(a,c,domaine)
         [n,n]=size(a)
     else
         if rhs==1 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: Linear dynamical system  expected.\n"),"obs_gram",1))
+            msg = gettext("%s: Wrong type for input argument #%d: Linear dynamical system  expected.\n")
+            error(msprintf(msg, "obs_gram", 1))
         else
-            error(msprintf(gettext("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n"),"obs_gram",1))
+            msg = gettext("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n")
+            error(msprintf(msg, "obs_gram", 1))
         end
     end;
     //
-    s=spec(a)
-    if (domaine=="c"&max(real(s))>=0)|(domaine=="d"&max(abs(s))>=1) then
-        error(msprintf(gettext("%s: Wrong value for input argument #%d: Stable system expected.\n"),"obs_gram",1));
+    s = spec(a)
+    if (domaine=="c"&max(real(s))>=0) | (domaine=="d"&max(abs(s))>=1) then
+        msg = gettext("%s: Wrong value for input argument #%d: Stable system expected.\n")
+        error(msprintf(msg, "obs_gram", 1));
     end
-    go=lyap(a,-c'*c,domaine)
+    go = lyap(a,-c'*c,domaine)
 endfunction
index db1cc96..6af16bf 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function o=obsv_mat(a,c)
+function o = obsv_mat(a, c)
 
     [lhs,rhs]=argn(0)
     select typeof(a)
     case "constant"  then
         if rhs==1 then
-            error(msprintf(gettext("%s: Wrong number of input arguments: %d expected"),"obsv_mat",2)),
+            msg = _("%s: Wrong number of input arguments: %d expected")
+            error(msprintf(msg, "obsv_mat", 2))
+        end
+        [m,n] = size(a)
+        if m<>n then
+           msg = _("%s: Argument #%d: Square matrix expected.\n")
+            error(msprintf(msg, "obsv_mat", 1))
+        end
+        [mb, nb] = size(c);
+        if nb<>n then
+            msg = _("%s: Arguments #%d and #%d: Same numbers of columns expected.\n")
+            error(msprintf(msg, "obsv_mat", 1, 2))
         end
-        [m,n]=size(a)
-        if m<>n then error(20,1),end
-        [mb,nb]=size(c);if nb<>n then error(60),end
     case "state-space" then
         [a,c]=a([2,4])
         [n,n]=size(a)
     else
         if rhs==1 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"obsv_mat",1))
+            msg = _("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n")
+            error(msprintf(msg,"obsv_mat",1))
         else
-            error(msprintf(gettext("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n"),"obsv_mat",1))
+            msg = _("%s: Wrong type of input argument #%d: Array of floating point numbers expected.\n")
+            error(msprintf(msg, "obsv_mat", 1))
         end
     end;
-    o=c;for k=1:n-1, o=[c;o*a],end
+    o = c;
+    for k = 1:n-1
+        o = [c ; o*a]
+    end
 endfunction
index 188ef7b..f9831be 100644 (file)
@@ -20,13 +20,17 @@ function [frq,rep,splitf]=repfreq(sys,fmin,fmax,pas)
         args=["sys","fmin","fmax","pas"];
         ierr=execstr("[frq,rep,splitf]=%"+overloadname(sys)+"_repfreq("+strcat(args(1:rhs),",")+")","errcatch")
         if ierr<>0 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n"),"repfreq",1))
+            msg = gettext("%s: Wrong type for input argument #%d: Linear dynamical system expected.\n")
+            error(msprintf(msg, "repfreq", 1))
         end
         return
     end
     if typeof(sys)=="zpk" then sys=zpk2tf(sys);end
     dom=sys.dt
-    if dom==[]|dom==0 then error(96,1),end
+    if dom==[] | dom==0 then
+        msg = gettext("%s: Argument #%d: Undefined time domain.\n")
+        error(msprintf(msg, "repfreq", 1));
+    end
     if dom=="d" then dom=1;end
 
     select  rhs
@@ -51,7 +55,8 @@ function [frq,rep,splitf]=repfreq(sys,fmin,fmax,pas)
         pas=pas_def
     case 4 then ,
     else
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "repfreq",1,4))
+        msg = gettext("%s: Wrong number of input arguments: %d to %d expected.\n")
+        error(msprintf(msg, "repfreq", 1, 4))
     end;
     splitf=1
     if rhs<>2 then
@@ -81,8 +86,8 @@ function [frq,rep,splitf]=repfreq(sys,fmin,fmax,pas)
                 frq= [exp(l10*((log(-fmax)/l10):pas:(log(-fmin)/l10))) -fmin];
                 frq=-frq($:-1:1);
             elseif fmin >= fmax then
-                error(msprintf(gettext("%s: Wrong value for input arguments #%d and #%d: %s < %s expected.\n"),..
-                "repfreq",2,3,"fmin","fmax"));
+                msg = gettext("%s: Wrong value for input arguments #%d and #%d: %s < %s expected.\n")
+                error(msprintf(msg, "repfreq", 2, 3, "fmin", "fmax"));
             else
                 fmin=max(eps,fmin);
                 frq=[exp(l10*((log(fmin)/l10):pas:(log(fmax)/l10))) fmax];
@@ -97,7 +102,10 @@ function [frq,rep,splitf]=repfreq(sys,fmin,fmax,pas)
     case "r" then
         [n,d]=sys(["num","den"]),
         [mn,nn]=size(n)
-        if nn<>1 then error(95,1),end
+        if nn<>1 then
+            msg = gettext("%s: Argument #%d: %s expected.\n")
+            error(msprintf(msg, "repfreq", 1, _("SISO system")))
+        end
         if dom=="c" then
             rep=freq(n,d,2*%pi*%i*frq),
         else
@@ -106,7 +114,10 @@ function [frq,rep,splitf]=repfreq(sys,fmin,fmax,pas)
     case "lss" then
         [a,b,c,d]=abcd(sys)
         [mn,nn]=size(d)
-        if nn<>1 then error(95,1),end
+        if nn<>1 then
+            msg = gettext("%s: Argument #%d: %s expected.\n")
+            error(msprintf(msg, "repfreq", 1, _("SISO system")))
+        end
 
         if dom=="c" then
             if a==[] then
@@ -121,7 +132,9 @@ function [frq,rep,splitf]=repfreq(sys,fmin,fmax,pas)
                 rep=freq(a,b,c,d,exp(2*%pi*%i*dom*frq))
             end
         end;
-    else error(97,1),
+    else
+        msg = gettext("%s: Argument #%d: A system in state space or transfer matrix form expected.\n")
+        error(msprintf(msg, "repfreq", 1))
     end;
     //representation
     if lhs==1 then frq=rep,end
index e1a0972..1afd07c 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function st=statgain(sl)
+function st = statgain(sl)
 
     select typeof(sl)
     case "rational" then
@@ -25,17 +25,20 @@ function st=statgain(sl)
         [m,p]=size(sl(2));
         if dom=="c" then
             if rank(sl(2)) <> m then
-                error(msprintf(gettext("%s: Wrong values for input argument #%d: State matrix is singular.\n"),"statgain",1)),
+                msg = gettext("%s: Wrong values for input argument #%d: State matrix is singular.\n");
+                error(msprintf(msg, "statgain", 1));
             end
             st=sl(5)-sl(4)*inv(sl(2))*sl(3);
         else
             if rank(eye(m,m)-sl(2))<>m then
-                error(msprintf(gettext("%s: Wrong values for input argument #%d: State matrix - eye is singular.\n"),"statgain",1))
+                msg = gettext("%s: Wrong values for input argument #%d: State matrix - eye is singular.\n");
+                error(msprintf(msg, "statgain", 1));
             end
-            st=sl(5)+sl(4)*inv(eye(m,m)-sl(2))*sl(3);
-        end;
+            st = sl(5) + sl(4)*inv(eye(m,m) - sl(2))*sl(3);
+        end
     else
-        error(97,1)
+        msg = gettext("%s: Argument #%d: A system in state space or transfer matrix form expected.\n")
+        error(msprintf(msg, "statgain", 1));
     end
 
 endfunction
index 4df899b..9116e9e 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function [io,s]=syssize(sys)
+function [io,s] = syssize(sys)
     //Old stuff
     //  io=syssize(sys)
     //  [io,ns]=syssize(sys)
@@ -36,9 +36,11 @@ function [io,s]=syssize(sys)
             [lhs,rhs]=argn(0);
             if lhs==2 then  sys=tf2ss(sys);[s,s]=size(sys("A")),end
         else
-            error(97,1)
+            msg = _("%s: Argument #%d: A system in state space or transfer matrix form expected.\n")
+            error(msprintf(msg, "syssize", 1))
         end
     else
-        error(97,1),
+        msg = _("%s: Argument #%d: A system in state space or transfer matrix form expected.\n")
+        error(msprintf(msg, "syssize", 1))
     end
 endfunction
index 25d9cb6..93987ce 100644 (file)
@@ -26,11 +26,13 @@ function mdelete(filename)
 
     rhs = argn(2);
     if rhs <> 1 then
-        error(77);
+        msg = gettext("%s: Wrong number of input arguments: %d expected.\n")
+        error(msprintf(msg, "mdelete", 1));
     end
 
     if type(filename) <> 10 | size(filename,"*") <> 1 then
-        error(msprintf(gettext("%s: Wrong type for input argument: String expected.\n"),"mdelete"));
+        msg = gettext("%s: Wrong type for input argument: String expected.\n")
+        error(msprintf(msg, "mdelete"));
     end
 
     // Handle file path
index 0732fc9..153de2f 100644 (file)
@@ -75,11 +75,15 @@ function [%ok,%1,%2,%3,%4,%5,...
     // Copyright INRIA
     [%lhs, %rhs] = argn(0)
     if %rhs < 3 then
-        error(sprintf(_("%s: Wrong number of input argument(s): %d to %d expected.\n"), "getvalue", 3, 4));
+        msg = _("%s: Wrong number of input argument(s): %d to %d expected.\n")
+        error(msprintf(msg, "getvalue", 3, 4));
     end
 
     %nn=prod(size(%labels))
-    if %lhs<>%nn+2&%lhs<>%nn+1 then error(41),end
+    if %lhs<>%nn+2 & %lhs<>%nn+1 then
+        msg = _("%s: Wrong number of output arguments: %d to %d expected.\n")
+        error(msprintf(msg, "getvalue", %nn+1, %nn+2))
+    end
     if size(%typ)<>2*%nn then
         error("%typ : list(''type'',[sizes],...)")
     end
@@ -231,18 +235,22 @@ function [%ok,%1,%2,%3,%4,%5,...
                     if %sz(2)>=0 then if %nv<>%sz(2) then %nok=%kk,break,end,end
                 end
             else
-                error(msprintf(_("%s: Type %s is not implemented.\n"),"getvalue", %typ(2*%kk-1)))
+                msg = _("%s: Type %s is not implemented.\n")
+                error(msprintf(msg, "getvalue", %typ(2*%kk-1)))
             end
             execstr("%"+string(%kk)+"=%vv")
         end
         if %nok>0 then
-            messagebox(msprintf(_("Answer given for %s \n has invalid dimension: \n waiting for dimension %s.\n"), %labels(%nok), %ssz), "modal");
+            msg = _("Answer given for %s \n has invalid dimension: \n waiting for dimension %s.\n")
+            messagebox(msprintf(msg, %labels(%nok), %ssz), "modal");
             %ini=%str
         elseif %nok<0 then
             if %ierr==0 then
-                messagebox(msprintf(_("Answer given for %s \n has incorrect type %s.\n"), %labels(-%nok), %typ(-2*%nok-1)), "modal");
+                msg = _("Answer given for %s \n has incorrect type %s.\n")
+                messagebox(msprintf(msg, %labels(-%nok), %typ(-2*%nok-1)), "modal");
             else
-                messagebox(msprintf(_("Answer given for %s \n is incorrect: %s.\n"), %labels(-%nok), lasterror()), "modal");
+                msg = _("Answer given for %s \n is incorrect: %s.\n")
+                messagebox(msprintf(msg, %labels(-%nok), lasterror()), "modal");
             end
             %ini=%str
         else
index ececd98..0ec3b92 100644 (file)
@@ -26,7 +26,10 @@ function flag = find_links(filein,fileout)
 
     flag=%f;
 
-    if rhs<>2 then error(39), end
+    if rhs<>2 then
+        msg = _("%s: Wrong number of input arguments: %d expected.\n")
+        error(msprintf(msg, "find_links", 2))
+    end
 
     sep=filesep();
 
index b0930d9..1d4653c 100644 (file)
@@ -16,20 +16,24 @@ function txt = help_skeleton(funname, path, language)
     [lhs,rhs] = argn(0);
 
     if rhs > 3 | rhs < 1 then
-        error(39);
+        msg = _("%s: Wrong number of input arguments: %d to %d expected.\n")
+        error(msprintf(msg, "help_skeleton", 1, 3));
     end
 
     if type(funname) <> 10 then
-        error(999,msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"),"help_skeleton",1));
+        msg = gettext("%s: Wrong type for input argument #%d: string expected.\n")
+        error(msprintf(msg, "help_skeleton", 1));
     end
 
     if size(funname, "*") <> 1 then
-        error(999,msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"),"help_skeleton",1));
+        msg = gettext("%s: Wrong size for input argument #%d: string expected.\n")
+        error(msprintf(msg, "help_skeleton", 1));
     end
 
     if rhs > 1 then
         if type(path) <> 10 then
-            error(55,2);
+            msg = _("%s: Argument #%d: Text(s) expected.\n")
+            error(msprintf(msg, "help_skeleton", 2));
         end
     end
 
@@ -37,7 +41,8 @@ function txt = help_skeleton(funname, path, language)
 
     if rhs == 3 then
         if type(language) <> 10 then
-            error(55,3);
+            msg = _("%s: Argument #%d: Text(s) expected.\n")
+            error(msprintf(msg, "help_skeleton", 3));
         end
         setlanguage(language);
     else
index 4ff51fb..c9502b8 100644 (file)
@@ -19,7 +19,8 @@ function r=%i_j_i(a,n)
             r=iconvert(double(a).^double(n),inttype(a))
         else
             if size(n,"*")<>1 then
-                error(43)
+                msg = _("%s: Non implemented feature.\n");
+                error(msprintf(msg, "%i_j_i"))
             else
                 n=double(n)
                 r=a
index 4fc7d68..7f97c0f 100644 (file)
@@ -19,7 +19,8 @@ function r=%i_j_s(a,n)
             r=iconvert(double(a).^n,inttype(a))
         else
             if size(n,"*")<>1 then
-                error(43)
+                msg = _("%s: Non implemented feature.\n")
+                error(msprintf(msg, "%i_j_s"))
             else
                 r=a
                 for i=2:n,r=r.*a,end
index 5e58bf1..48d1925 100644 (file)
 
 function r=%i_p_i(a,n)
     if or(n<0) then
-        r=double(a)^n
+        r = double(a)^n
     else
         if size(a,"*")==1 then
-            r=iconvert(double(a)^double(n),inttype(a))
+            r = iconvert(double(a)^double(n),inttype(a))
         else
             if size(n,"*")<>1 then
-                error(43)
+                msg = _("%s: Non implemented feature.\n")
+                error(msprintf(msg, "%i_p_i"))
             else
                 n=double(n)
                 r=a
                 if size(a,1)==size(a,2) then
                     for i=2:n,r=r*a,end
                 else
-                    mprintf(gettext("Warning: Syntax ""vector ^ scalar"" is obsolete. It will be removed in Scilab 6.0.\n  Use ""vector .^ scalar"" instead.\n"));
-                    for i=2:n,r=r.*a,end
+                    msg = _("%s: ""%s"" expected instead of ""%s"".\n")
+                    error(msprintf(msg, "%i_p_i", ".^", "^"));
                 end
             end
         end
index 1573177..cf0f183 100644 (file)
@@ -11,7 +11,7 @@
 // along with this program.
 
 
-function r=%i_p_s(a,n)
+function r = %i_p_s(a,n)
     if or(int(n)<>n)|or(n<0) then
         r=double(a)^n
     else
@@ -19,14 +19,15 @@ function r=%i_p_s(a,n)
             r=iconvert(double(a)^n,inttype(a))
         else
             if size(n,"*")<>1 then
-                error(43)
+                msg = _("%s: Non implemented feature.\n")
+                error(msprintf(msg, "%i_p_s"))
             else
                 r=a
                 if size(a,1)==size(a,2) then
                     for i=2:n,r=r*a,end
                 else
-                    mprintf(gettext("Warning: Syntax ""vector ^ scalar"" is obsolete. It will be removed in Scilab 6.0.\n  Use ""vector .^ scalar"" instead.\n"));
-                    for i=2:n,r=r.*a,end
+                    msg = _("%s: ""%s"" expected instead of ""%s"".\n")
+                    error(msprintf(msg, "%i_p_s", ".^", "^"));
                 end
             end
         end
index 2610ae4..d4f19fc 100644 (file)
@@ -20,7 +20,8 @@ function r=%s_j_i(a,n)
             r=iconvert(a.^double(n),inttype(n))
         else
             if size(n,"*")<>1 then
-                error(43)
+                msg = _("%s: Non implemented feature.\n")
+                error(msprintf(msg, "%s_j_i"))
             else
                 n=double(n)
                 r=a
index 21a89cc..01effa8 100644 (file)
@@ -20,7 +20,8 @@ function r=%s_p_i(a,n)
             r=iconvert(a^double(n),inttype(n))
         else
             if size(n,"*")<>1 then
-                error(43)
+                msg = _("%s: Non implemented feature.\n");
+                error(msprintf(msg, "%s_p_i"));
             else
                 n=double(n)
                 r=a
index b9790c9..f7b5e7a 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function [n,d]=coff(m,var)
-    //[N,d]=coff(M [,var]) computes (s*eye-M)^-1
+function [n,d] = coff(m,var)
+    //[N,d] = coff(M [,var]) computes (s*eye-M)^-1
     // N = numerator polynomial matrix
     // d = common denominator
     // var character string ('s' if omitted)
     // See also : coffg
     //!
     //
-    if type(m)<>1 then error(53,1),end
-    if m==[] then n=[];d=1;end
-    [lhs,rhs]=argn(0);if rhs==1 then var="s",end
-    d=clean(poly(m,var)); // denominator
-    [n1,n1]=size(m);
-    for k=1:n1,for l=1:n1,
-            mlk=-m(l,k);
-            if abs(mlk)<1 then mlk=1,end
-            m(l,k)=m(l,k)+mlk;
-            n(k,l)=-(poly(m,var)-d)/mlk;
-            m(l,k)=m(l,k)-mlk
-    end;end
-    if norm(imag(m),1)==0 then n=real(n);d=real(d);end
-    n=clean(n);
+    if type(m)<>1 then
+        msg = _("%s: Argument #%d: Decimal or complex number(s) expected.\n");
+        error(msprintf(msg, "coff", 1));
+    end
+    if m==[] then
+        n = [];
+        d = 1;
+    end
+    [lhs,rhs] = argn(0);
+    if rhs==1 then var="s",end
+    d = clean(poly(m,var)); // denominator
+    [n1, n1] = size(m);
+    for k = 1:n1
+        for l = 1:n1,
+            mlk = -m(l,k);
+            if abs(mlk)<1 then
+                mlk = 1
+            end
+            m(l,k) = m(l,k) + mlk;
+            n(k,l) = -(poly(m,var)-d) / mlk;
+            m(l,k) = m(l,k) - mlk
+        end
+    end
+    if norm(imag(m),1)==0 then
+        n = real(n);
+        d = real(d);
+    end
+    n = clean(n);
 endfunction
index ba5781c..e031634 100644 (file)
@@ -23,7 +23,8 @@ function[m,den]=nlev(a,z,rmax)
 
     rhs=argn(2);
     if rhs < 2 then
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d or %d expected.\n"),"nlev",2,3));
+        msg = gettext("%s: Wrong number of input arguments: %d or %d expected.\n")
+        error(msprintf(msg, "nlev", 2, 3));
     end
 
     z=poly(0,z);
@@ -36,7 +37,8 @@ function[m,den]=nlev(a,z,rmax)
 
     [m1 n1]=size(a)
     if m1<>n1 then
-        error(20,1);
+        msg = _("%s: Argument #%d: Square matrix expected.\n")
+        error(msprintf(msg, "nlev", 1))
     end
     k=1;
     m=[];
index b302563..f8c0108 100644 (file)
@@ -9,6 +9,7 @@
 // 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 f=%b_e(varargin)
     //A(i,j,k,..)
 
@@ -21,7 +22,10 @@ function f=%b_e(varargin)
         ind=varargin(k)
         if type(ind)==2|type(ind)==129 then ind=horner(ind,1),end
         if type(ind)==4 then ind=find(ind),end
-        if or(ind<>1) then error(21),end
+        if or(ind<>1) then
+            msg = _("%s: Invalid index.\n")
+            error(msprintf(msg, "%b_e"))
+        end
         n=size(ind,"*")
         dims=[dims,n]
     end
index 603f244..89f5b92 100644 (file)
@@ -9,16 +9,18 @@
 // 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=%c_b_c(varargin)
     if  size(varargin)==2 then
         if type(varargin(1))==10 & type(varargin(2))==10 then
-            r=asciimat(asciimat(varargin(1)):asciimat(varargin(2)))
+            r = asciimat(asciimat(varargin(1)):asciimat(varargin(2)))
         end
     elseif size(varargin)==3 then
         if type(varargin(1))==10 & type(varargin(2))==10 & type(varargin(3))==10 then
-            r=asciimat(asciimat(varargin(1)):asciimat(varargin(2)):asciimat(varargin(3)))
+            r = asciimat(asciimat(varargin(1)):asciimat(varargin(2)):asciimat(varargin(3)))
         end
     else
-        error(43)
+        msg = _("%s: Non implemented feature.\n");
+        error(msprintf(msg, "char:char"));
     end
 endfunction
index b6070ac..10c54b0 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%c_b_s(varargin)
+function r = %c_b_s(varargin)
     if size(varargin)==3 then
         if type(varargin(1))==10 & type(varargin(2))==1 & type(varargin(3))==10 then
             r=asciimat(asciimat(varargin(1)):varargin(2):asciimat(varargin(3)))
         end
     else
-        error(43)
+        msg = _("%s: Non implemented feature.\n");
+        error(msprintf(msg, "char:num"));
     end
 endfunction
index 9c9fd1f..5d2219a 100644 (file)
@@ -9,7 +9,8 @@
 // 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 f=%c_e(varargin)
+
+function f = %c_e(varargin)
     //A(i,j,k,..)
 
     rhs=size(varargin)
@@ -21,7 +22,10 @@ function f=%c_e(varargin)
         ind=varargin(k)
         if type(ind)==2|type(ind)==129 then ind=horner(ind,1),end
         if type(ind)==4 then ind=find(ind),end
-        if or(ind<>1) then error(21),end
+        if or(ind<>1) then
+            msg = _("%s: Invalid index.\n")
+            error(msprintf(msg, "%c_e"))
+        end
         n=size(ind,"*")
         dims=[dims,n]
     end
index 5909405..237e316 100644 (file)
@@ -14,13 +14,17 @@ function s2=%c_i_lss(i,j,s1,s2)
 
     if type(i)==10 then  // sl('dt')
         [lhs,rhs]=argn(0)
-        if rhs<>3 then  error(21),end
+        if rhs<>3 then
+            msg = _("%s: Invalid index.\n")
+            error(msprintf(msg, "%c_i_lss"))
+        end
         if i<>"dt" then
             error(msprintf(_("%s: Wrong type for input argument #%d.\n"),"%c_i_lss",1));
         end
         s2=s1;kf=7
-        if j<>"c"&j<>"d" then
-            error(msprintf(_("%s: Wrong value for input argument #%d: ''c'', ''d'' or a scalar expected.\n"),"%c_i_lss",2));
+        if j <> "c" & j <> "d" then
+            msg = _("%s: Wrong value for input argument #%d: ''c'', ''d'' or a scalar expected.\n")
+            error(msprintf(msg, "%c_i_lss", 2));
         end
         s2(kf)=j
         return
index 8ba56c2..5255848 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function s2=%c_i_r(i,j,s1,s2)
+function s2 = %c_i_r(i,j,s1,s2)
 
     if type(i)==10 then  // sl('dt')
-        [lhs,rhs]=argn(0)
-        if rhs<>3 then  error(21),end
+        [lhs,rhs] = argn(0)
+        if rhs <> 3 then
+            msg = _("%s: Invalid index.\n")
+            error(msprintf(msg, "%c_i_r"))
+        end
         if i<>"dt" then
             error(msprintf(_("%s: Wrong type for input argument #%d.\n"),"%c_i_r",1));
         end
-        s2=s1;kf=4
-        if j<>"c"&j<>"d" then
-            error(msprintf(_("%s: Wrong value for input argument #%d: ''c'', ''d'' or a scalar expected.\n"),"%c_i_r",2));
+        s2 = s1;
+        kf = 4
+        if j <> "c" & j <> "d" then
+            msg = _("%s: Wrong value for input argument #%d: ''c'', ''d'' or a scalar expected.\n")
+            error(msprintf(msg, "%c_i_r", 2));
         end
-        s2(kf)=j
-        return
+        s2(kf) = j
     end
 endfunction
index 85388cb..d4c47f1 100644 (file)
@@ -9,14 +9,18 @@
 // 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 a=%cblock_c_cblock(a,b)
-    na=length(a)
+
+function a = %cblock_c_cblock(a,b)
+    na = length(a)
     if na==1 then a=b,return,end
     if length(b)==1 then return,end
     v1=getfield(na,a)
     v2=getfield(2,b)
 
-    if size(v1,1)<>size(v2,1) then error(5),end
+    if size(v1,1)<>size(v2,1) then
+        msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+        error(msprintf(msg, "%cblock_c_cblock", 1, 2))
+    end
     if type(v1)==type(v2) then
         a=setfield(na,[v1 v2],a)
     else
index 9d370ba..c1c1748 100644 (file)
@@ -9,14 +9,18 @@
 // 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 a=%cblock_c_s(a,b)
     if b==[] then return,end
-    v=getfield($,a)
+    v = getfield($,a)
 
-    if size(v,1)<>size(b,1) then error(5),end
+    if size(v,1)<>size(b,1) then
+        msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+        error(msprintf(msg, "%cblock_c_s", 1, 2))
+    end
     if type(b)==type(v) then
-        a=setfield($,[v b],a)
+        a = setfield($,[v b],a)
     else
-        a=setfield($+1,b,a)
+        a = setfield($+1,b,a)
     end
 endfunction
index e887011..3fa3bff 100644 (file)
@@ -9,11 +9,15 @@
 // 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 a=%cblock_f_cblock(a,b)
+
+function a = %cblock_f_cblock(a,b)
     if length(a)==1 then a=b,return,end
     if length(b)==1 then return,end
 
-    if length(a)<>length(b) then error(6),end
+    if length(a)<>length(b) then
+        msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+        error(msprintf(msg, "%s_i_lss", 1, 2))
+    end
     for k=2:length(a)
         a=setfield(k,[getfield(k,a);getfield(k,b)],a)
     end
diff --git a/scilab/modules/overloading/macros/%ce_i_ce.sci b/scilab/modules/overloading/macros/%ce_i_ce.sci
deleted file mode 100644 (file)
index 8b43ed2..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA - F. Delebecque, S. Steer, V. Couvert
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 M=%ce_i_ce(varargin)
-    //insert the cell varargin($-1) into the cell varargin($)
-    //at position varargin(1), varargin(2),varargin(3),...
-    //insert the cell varargin($-1) as the field varargin(1)
-    //of the cell varargin($)
-
-    [lhs,rhs]=argn(0)
-    M=varargin($)
-    N=varargin($-1)//inserted matrix
-    dims=double(matrix(M.dims,1,-1));
-    // Dimensions modified so that convertindex works correctly
-
-    //computing the dimension of the result
-    nd=size(dims,"*")
-
-    olddims=dims
-
-    reduced_index=%f
-    if rhs-2>nd then  //more indices than M number of dims
-        dims(nd+1:rhs-2)=1;
-    elseif rhs-2<nd  then //less indices than M number of dims
-        dims=[dims(1:rhs-3) prod(dims(rhs-2:$))]
-        if size(find(dims>1),"*")>1 then reduced_index=%t,end
-    end
-    //convert N-dimensional indexes to 1-D and extend dims if necessary
-    [Ndims,I]=convertindex(list(dims,double(matrix(N.dims,1,-1))),varargin(1:$-2));
-    Ndims=matrix(Ndims,1,-1)
-    if reduced_index&or(Ndims<>dims)  then error(21),end
-    if or(Ndims>dims) then
-        //extend the destination matrix
-        I1=0
-        for k=size(Ndims,"*"):-1:1
-            ik1=(1:dims(k))';
-            if ik1<>[] then
-                if Ndims(k)>1 then
-                    if size(I1,"*")>1 then
-                        I1=(Ndims(k)*I1).*.ones(ik1)+ones(I1).*.(ik1-1);
-                    else
-                        I1=Ndims(k)*I1+ik1-1;
-                    end
-                else
-                    I1=Ndims(k)*I1+ik1-1;
-                end
-            end
-        end
-        // create the resulting matrix
-        v2=list();for k=1:prod(Ndims),v2(k)=[];end
-
-        // populate it with M entries
-        w=getfield(3,M);
-        if type(w)<>15 then w=list(w),end
-        if type(v2)<>15 then v2=list(v2);end
-        for i=1:size(I1,"*"),
-            if w<>list() then
-                v2(I1(i)+1)=w(i);
-            else
-                v2(I1(i)+1)=[];
-            end
-        end
-        R=mlist(["ce","dims","entries"],int32(Ndims),v2);
-    else //the dimension agree
-        R=M
-    end
-
-    //insert N entries into result
-    for k=1
-        kf=1
-        v2=getfield(3,R);
-        w=getfield(3,N);
-        if type(w)<>15 then w=list(w),end
-        if type(v2)<>15 then v2=list(v2);end
-        for i=1:size(I,"*"),
-            if w<>list() then
-                v2(I(i))=w(i);
-            else
-                v2(I(i))=[];
-            end
-        end
-        if length(v2)==1 then v2=v2(1);end
-        R=setfield(3,v2,R);
-    end
-
-    //remove trailing unitary dimensions
-    if reduced_index then
-        Ndims=olddims
-    else
-        while  Ndims($)==1 then Ndims($)=[],end
-        select size(Ndims,"*")
-        case 0 then
-            Ndims=[1,1]
-        case 1 then
-            k=find(olddims<>1&olddims<>0)
-            if k==[] // M was a scalar
-                if mtlb_mode() then
-                    Ndims=[1,Ndims]
-                else
-                    Ndims=[Ndims,1]
-                end
-            else // M was a vector
-                olddims(k)=Ndims
-                Ndims=olddims;
-            end
-        else
-            Ndims=matrix(Ndims,1,-1)
-        end
-    end
-    R.dims=int32(Ndims)
-    M=R
-endfunction
diff --git a/scilab/modules/overloading/macros/%hm_a_hm.sci b/scilab/modules/overloading/macros/%hm_a_hm.sci
deleted file mode 100644 (file)
index afb6ad7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 M1=%hm_a_hm(M1,M2)
-    // hypermatrix addition
-    if or(M1.dims<>M2.dims) then
-        error(8)
-    end
-    M1.entries=M1.entries+M2.entries
-endfunction
index fb31ed4..e589268 100644 (file)
@@ -9,25 +9,29 @@
 // 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 f=%hm_a_r(m,f)
+
+function f = %hm_a_r(m,f)
     //f=  m+f
     //!
 
-    [num,den]=f(["num","den"])
-    szf=size(den)
-    szm=size(m)
+    [num, den] = f(["num","den"])
+    szf = size(den)
+    szm = size(m)
 
-    if and(szf>=0)&and(szm>=0) then
-        num=num(:);den=den(:);m=m(:)
-        if prod(szf)==1&prod(szm)>1 then
-            den=den(ones(m))
+    if and(szf>=0) & and(szm>=0) then
+        num = num(:);
+        den = den(:);
+        m = m(:)
+        if prod(szf)==1 & prod(szm)>1 then
+            den = den(ones(m))
         end
-        [num,den]=simp(num+m.*den,den)
-        num=matrix(num,szf)
-        den=matrix(den,szf)
-        f=rlist(num,den,f.dt)
+        [num, den] = simp(num + m.*den, den)
+        num = matrix(num,szf)
+        den = matrix(den,szf)
+        f = rlist(num, den, f.dt)
     else
-        error(8)
+        msg = _("%s: Implicit size not supported.\n")
+        error(msprintf(msg, "%hm_a_r"))
     end
 
 endfunction
diff --git a/scilab/modules/overloading/macros/%hm_a_s.sci b/scilab/modules/overloading/macros/%hm_a_s.sci
deleted file mode 100644 (file)
index dc326e7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 M1=%hm_a_s(M1,M2)
-
-    // hypermatrix + scalar
-
-    if and(size(M2)==[1 1]) then
-        M1.entries=M1.entries+M2
-    else
-        dims1=matrix(M1.dims,-1,1)
-        dims2=size(M2)';
-        dims2(3:size(dims1,"*"))=1;
-        if and(dims1==dims2) then //should not occur
-            M1.entries=M1.entries+matrix(M2,-1,1)
-        else
-            error(8)
-        end
-    end
-endfunction
diff --git a/scilab/modules/overloading/macros/%hm_e.sci b/scilab/modules/overloading/macros/%hm_e.sci
deleted file mode 100644 (file)
index 82a301c..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 [M] = %hm_e(varargin)
-
-    // version modified by Bruno
-    // extract an sub_hypermatrix
-    [lhs,rhs]=argn(0)
-    M=varargin(rhs)
-    dims=double(M.dims)   // new hypermatrices have an int32 dims field
-    nbdims = size(dims,"*");
-    nb_index_vect = rhs-1;
-
-    if nb_index_vect > nbdims then
-        error(msprintf(_("%s: Too many subscripts.\n"),"%hm_e"));
-    elseif nb_index_vect < nbdims then
-        nbdims = nb_index_vect;
-        dims(nbdims) = prod(dims(nbdims:$))
-    end
-
-    I = 0
-    dims1 = [];
-
-    for k=nb_index_vect:-1:1
-        ik=varargin(k)
-        type_ik = type(ik)
-        if type_ik==1 then                    // usual subscript
-            if min(size(ik))<0 then
-                if rhs==2 then // subscript is : in fact
-                    M=matrix(M.entries,-1,1)
-                    return
-                end
-                ik=1:dims(k)
-            else
-                ik=round(ik)
-                if min(ik) <= 0 then, error(21), end
-                if max(ik) > dims(k) then, error(21), end
-            end
-        elseif type_ik==2 then                // poly subscript
-            ik=round(horner(ik,dims(k)))
-            if min(ik) <= 0 then, error(21), end
-            if max(ik) > dims(k) then, error(21), end
-        elseif type_ik == 129 then            // implicit poly subscript (p.e. 1:$)
-            ik=round(horner(ik(:),dims(k)))
-            if min(ik(1),ik(3)) <= 0 then, error(21), end
-            if max(ik(1),ik(3)) > dims(k) then, error(21), end
-            ik = ik(1):ik(2):ik(3)
-        elseif type_ik==4 | type_ik==6 then   // boolean and sparse boolean subscript
-            if size(ik,"*") ~= dims(k) then, error(21), end
-            ik=find(ik)
-        elseif typeof(ik) == "hypermat" then  // hm boolean subscript
-            if type(ik.entries) ~= 4 then, error(21), end
-            if size(ik,"*") ~= dims(k) then, error(21), end
-            ik=find(ik.entries)
-        else
-            error(21)
-        end
-
-        nik = size(ik, "*");
-        if (nik == 0) then, M=[], return, end
-        dims1 = [nik, dims1]
-        if nik > 1 then
-            ik=ik(:)
-            if size(I,"*") > 1 then
-                I=(dims(k)*I).*.ones(ik)+ones(I).*.(ik-1)
-            else
-                I=dims(k)*I+ik-1
-            end
-        else
-            I=dims(k)*I+ik-1
-        end
-    end
-    //
-    dims1(max(find(dims1>1))+1:$)=[]  // elimine la fin si les dims sont 1
-    // exemple dims1 = [2 4 1 6 7 1 1] alors on obtient dims1 = [2 4 1 6 7]
-    // (pour compatibilite avec Matlab)
-
-    select size(dims1,"*")
-    case 0
-        M = M.entries(I+1)
-    case 1
-        M = M.entries(I+1)
-    case 2
-        M = matrix(M.entries(I+1),dims1(1),dims1(2))
-    else
-        M = mlist(["hm","dims","entries"],int32(dims1),M.entries(I+1))
-    end
-
-endfunction
-
diff --git a/scilab/modules/overloading/macros/%hm_m_r.sci b/scilab/modules/overloading/macros/%hm_m_r.sci
deleted file mode 100644 (file)
index f50b007..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 f2=%hm_m_r(n1,f2)
-    // %s_m_r(n1,f2)
-    //operation  f2=n1*f2
-    //author Serge Steer INRIA
-    //!
-    [n2,d2]=f2(["num","den"]);
-    sz2=size(n2);
-    if prod(sz2)==0 then  f2=[],return,end
-    sz1=size(n1);
-    n1=n1(:)
-
-    if  or(sz2==-1) then
-        n2=n2+0;d2=d2+0;
-    end
-
-    //
-    if prod(sz2)==1 then
-        num=n1*n2,
-        den=d2(ones(n1))
-    else,
-        error(10)
-    end,
-
-    f2=rlist(matrix(num,sz1),matrix(den,sz1),f2.dt)
-endfunction
diff --git a/scilab/modules/overloading/macros/%hm_s_hm.sci b/scilab/modules/overloading/macros/%hm_s_hm.sci
deleted file mode 100644 (file)
index 2fa4ece..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 M1=%hm_s_hm(M1,M2)
-    // hypermatrix subtraction
-    //author Serge Steer
-    if or(M1("dims")<>M2("dims")) then
-        error(9)
-    end
-    M1("entries")=M1("entries")-M2("entries")
-endfunction
index b704afa..58a87a5 100644 (file)
@@ -9,7 +9,8 @@
 // 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 f=%hm_s_r(m,f)
+
+function f = %hm_s_r(m,f)
     //f=  m-f
     //author Serge Steer INRIA
     //!
@@ -17,7 +18,7 @@ function f=%hm_s_r(m,f)
     szf=size(den)
     szm=size(m)
 
-    if and(szf>=0)&and(szm>=0) then
+    if and(szf>=0) & and(szm>=0) then
         num=num(:);den=den(:);m=m(:)
         if prod(szf)==1&prod(szm)>1 then
             den=den(ones(m))
@@ -27,7 +28,8 @@ function f=%hm_s_r(m,f)
         den=matrix(den,szf)
         f=rlist(num,den,f.dt)
     else
-        error(9)
+        msg = "%s: Eye variable undefined in this context.\n"
+        error(msprintf(msg, "%hm_s_r"));
     end
 
 endfunction
diff --git a/scilab/modules/overloading/macros/%hm_s_s.sci b/scilab/modules/overloading/macros/%hm_s_s.sci
deleted file mode 100644 (file)
index 23a5f06..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 M1=%hm_s_s(M1,M2)
-
-    // hypermatrix - scalar
-
-    if and(size(M2)==[1 1]) then
-        M1.entries=M1.entries-M2
-    else
-        dims1=matrix(M1.dims,-1,1)
-        dims2=size(M2)';
-        dims2(3:size(dims1,"*"))=1;
-        if and(dims1==dims2) then //should not occur
-            M1.entries=M1.entries-matrix(M2,-1,1)
-        else
-            error(9)
-        end
-    end
-endfunction
diff --git a/scilab/modules/overloading/macros/%i_e.sci b/scilab/modules/overloading/macros/%i_e.sci
deleted file mode 100644 (file)
index 4c3aa4a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 f=%i_e(varargin)
-    //A(i,j,k,..)
-
-    rhs=size(varargin)
-    M=varargin(rhs)
-
-    nind=rhs-1
-    dims=[]
-    for k=3:nind
-        ind=varargin(k)
-        if type(ind)==2|type(ind)==129 then ind=horner(ind,1),end
-        if type(ind)==4 then ind=find(ind),end
-        if or(ind<>1) then error(21),end
-        n=size(ind,"*")
-        dims=[dims,n]
-    end
-    f=M(varargin(1:min(2,rhs-1)))
-    k=find(dims>1)
-    if k<>[] then
-        dims(k($)+1:$)=[]
-        N=prod(dims)
-        f=matrix(int32(ones(N,1)).*.f(:), [size(f) dims])
-    end
-endfunction
index 9c68a7c..a65be06 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%ip_a_s(ip,s)
+function r = %ip_a_s(ip,s)
     // ip+s
-    if size(s,"*")<>1 then error(10),end
-    r=(ip(1)+s):(ip(2)+s):(ip(3)+s)
+    if size(s,"*")<>1 then
+        msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+        error(msprintf(msg, "%ip_a_s", 2))
+    end
+    r = (ip(1)+s):(ip(2)+s):(ip(3)+s)
 endfunction
index 487f69c..c7319d7 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%ip_m_s(ip,s)
+function r = %ip_m_s(ip,s)
     // ip*s
-    if size(s,"*")<>1 then error(10),end
+    if size(s,"*")<>1 then
+        msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+        error(msprintf(msg, "%ip_m_s", 2))
+    end
     r=(ip(1)*s):(ip(2)*s):(ip(3)*s)
 endfunction
index 0f3f3ae..d64f269 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function [f1,f2,f3,f4,f5,f6,f7]=%lss_e(i,j,f)
+function [f1,f2,f3,f4,f5,f6,f7] = %lss_e(i,j,f)
     // f= f(i,j)
 
     if type(i)==10 then
         [lhs,rhs]=argn(0)
-        if rhs<>2 then  error(21),end
+        if rhs<>2 then
+            error(msprintf(_("%s: Invalid index.\n"), "%lss_e"))
+        end
         nams=["A","B","C","D","X0","dt"]
         for k=1:prod(size(i))
             kf=find(convstr(i(k),"u")==nams)
-            if kf==[] then error(21),end
+            if kf==[] then
+                error(msprintf(_("%s: Invalid index.\n"), "%lss_e"))
+            end
             execstr("f"+string(k)+"=j(kf+1)")
         end
         return
index e51c80a..08be15a 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function s=%lss_i_lss(i,j,s1,s2)
+function s = %lss_i_lss(i,j,s1,s2)
     //%lss_i_lss(i,j,s1,s2) <=>  s2(i,j)=s1
     //!
     if type(i)==10|type(j)==10 then
-        error(21)
+        msg = _("%s: Invalid index.\n")
+        error(msprintf(msg, "%lss_i_lss"))
     end
     [s1 s2]=sysconv(s1,s2)
     [m1,p1]=size(s1(5));[m2,p2]=size(s2(5));
index 69e750a..e71b1f7 100644 (file)
@@ -46,7 +46,7 @@ function x=%lss_inv(a)
             if min(svd(stmp(5))) > 1.d-6 then
                 x=invsyslin(stmp)*ws
             else
-                error(19)
+                error(msprintf(_("%s: The problem is singular.\n"), "%lss_inv"));
             end
         end
     elseif m>n then
@@ -58,7 +58,7 @@ function x=%lss_inv(a)
             if min(svd(stmp(5))) > 1.d-6 then
                 x=invsyslin(stmp)*ws
             else
-                error(19)
+                error(msprintf(_("%s: The problem is singular.\n"), "%lss_inv"));
             end
         end
     end
index e38d29c..8126f9d 100644 (file)
@@ -32,8 +32,8 @@ function f=%p_a_r(m,f)
         den=matrix(den,szf)
     else
         //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
-            error(8)
+        if size(szf,"*")>2 | size(szm,"*")>2 then
+            error(msprintf(_("%s: Inconsistent addition.\n"), "%p_a_r"))
         end
         if or(szf<0)&or(szm<0) then
             [num,den]=simp(num+m.*den,den)
index a16b4f7..a033cbb 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%p_e(varargin)
+function f = %p_e(varargin)
     //A(i,j,k,..)
 
     rhs=size(varargin)
@@ -23,7 +23,9 @@ function f=%p_e(varargin)
         ind=varargin(k)
         if type(ind)==2|type(ind)==129 then ind=horner(ind,1),end
         if type(ind)==4 then ind=find(ind),end
-        if or(ind<>1) then error(21),end
+        if or(ind<>1) then
+            error(msprintf(_("%s: Invalid index.\n"), "%p_e"))
+        end
         n=size(ind,"*")
         dims=[dims,n]
     end
index e778210..1a28dfd 100644 (file)
@@ -16,7 +16,9 @@ function s2=%p_i_lss(i,j,s1,s2)
 
     if type(i)==10 then  // sl('D')
         [lhs,rhs]=argn(0)
-        if rhs<>3 then  error(21),end
+        if rhs<>3 then
+            error(msprintf(_("%s: Invalid index.\n"), "%p_i_lss"))
+        end
         if i<>"D" then
             error(msprintf(_("%s: Wrong type for input argument #%d.\n"),"%p_i_lss",1));
         end
index 8de12e9..9bb9b00 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%p_j_s(p,s)
+function f = %p_j_s(p,s)
     // %p_j_s(p,s)  computes p.^s for p polynomial matrix in special cases
     //!
 
     if s==[] then f=[],return,end
-    if  or(imag(s)<>0)|or(int(s)<>s) then error(msprintf(_("%s: Wrong type for input argument #%d: An integer matrix expected.\n"),"%p_j_s",2)),end
-    [m,n]=size(p)
-    [ms,ns]=size(s)
-    if ms==1&ns==1 then
+    if  or(imag(s)<>0)|or(int(s)<>s) then
+        msg = _("%s: Wrong type for input argument #%d: An integer matrix expected.\n")
+        error(msprintf(msg, "%p_j_s", 2))
+    end
+    [m,n] = size(p)
+    [ms,ns] = size(s)
+    if ms==1 & ns==1 then
         if s<0 then
             if or(abs(coeff(p(:)))*ones(max(degree(p))+1,1)==0) then
-                error(27)
+                msg = _("%s: Division by 0...\n")
+                error(msprintf(msg, "%p_j_s"))
             end
             f=rlist(ones(p),p.^(-s),[])
         else // this case is in fact hard coded
             f=p.^s
         end
-    elseif m==1&n==1 then // Element wise exponentiation p.^s with p "scalar"
+    elseif m==1 & n==1 then // Element wise exponentiation p.^s with p "scalar"
         kp=find(s>=0)
         kn=find(s<0)
         num=ones(s)
@@ -37,7 +41,7 @@ function f=%p_j_s(p,s)
         num(kn)=p(2).^(-s(kn))
         den(kn)=p(3).^(-s(kn))
         f=rlist(num,den,[])
-    elseif ms==m&ns==n then  // Element wise exponentiation
+    elseif ms==m & ns==n then  // Element wise exponentiation
         p=p(:);s=s(:);
         kp=find(s>=0)
         kn=find(s<0)
@@ -45,13 +49,15 @@ function f=%p_j_s(p,s)
         den=ones(s)
         num(kp)=num(kp).^s(kp)
         if or(abs(coeff(p(kn)))*ones(max(degree(p(kn)))+1,1)==0) then
-            error(27)
+            msg = _("%s: Division by 0...\n")
+            error(msprintf(msg, "%p_j_s"))
         end
         num(kn)=ones(p(kn))
         den(kn)=p(kn).^(-s(kn))
         f = rlist(matrix(num,n,m),matrix(den,n,m),[])
     else
-        error(30)
+        msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+        error(msprintf(msg, "%p_j_s", 1, 2))
     end
 
 endfunction
index a00fb7f..ead17f0 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%p_s_r(m,f)
+function f = %p_s_r(m,f)
     //f=  m-f
     //author Serge Steer INRIA
     //!
@@ -32,8 +32,9 @@ function f=%p_s_r(m,f)
         den=matrix(den,szf)
     else
         //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
-            error(9)
+        if size(szf,"*")>2 | size(szm,"*")>2 then
+            msg = gettext("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, "%p_s_r"));
         end
         if or(szf<0)&or(szm<0) then
             [num,den]=simp(-num+m.*den,den)
index f1ffa8f..89e75fc 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%r_a_hm(f,m)
+function f = %r_a_hm(f,m)
     //f = f+m,
     //f: transfer matrix, m : hypermatrix
     //author Serge Steer INRIA
     //!
     [num,den]=f(["num","den"])
-    szf=size(den)
-    szm=size(m)
+    szf = size(den)
+    szm = size(m)
 
-    if and(szf>=0)&and(szm>=0) then
-        num=num(:);den=den(:);m=m(:)
-        if prod(szf)==1&prod(szm)>1 then
-            den=den(ones(m))
+    if and(szf>=0) & and(szm>=0) then
+        num = num(:);
+        den = den(:);
+        m = m(:)
+        if prod(szf)==1 & prod(szm)>1 then
+            den = den(ones(m))
         end
         [num,den]=simp(num+m.*den,den)
         num=matrix(num,szf)
         den=matrix(den,szf)
         f=rlist(num,den,f.dt)
     else
-        error(8)
+        msg = _("%s: Implicit size not supported.\n")
+        error(msprintf(msg, "%r_a_hm"))
     end
 endfunction
index 712cd39..03137e1 100644 (file)
@@ -33,8 +33,9 @@ function f=%r_a_p(f,m)
         den=matrix(den,szf)
     else
         //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
-            error(8)
+        if size(szf,"*")>2 | size(szm,"*")>2 then
+            msg = _("%s: Inconsistent addition.\n")
+            error(msprintf(msg, "%r_a_p"))
         end
         if or(szf<0)&or(szm<0) then
             [num,den]=simp(num+m.*den,den)
index 28f1b6c..c4f2550 100644 (file)
@@ -35,7 +35,8 @@ function f = %r_a_r(s1, s2)
             sz2 = sz1
         end
         if and(sz1<>sz2) then
-            error(8)
+            msg = _("%s: Inconsistent addition.\n")
+            error(msprintf(msg, "%r_a_r"))
         end
         for l = 1:prod(sz1)
             [den,fact] = lcm([den1(l); den2(l)])
@@ -46,7 +47,8 @@ function f = %r_a_r(s1, s2)
         f = rlist(matrix(num1,sz1),matrix(den1,sz1),s1.dt)
     else
         if size(sz1,"*")>2|size(sz2,"*")>2 then
-            error(8)
+            msg = _("%s: Inconsistent addition.\n")
+            error(msprintf(msg, "%r_a_r"))
         end
         if or(sz1<0) & or(sz2<0) then
             // both are eye*x
index ce6a410..c01be61 100644 (file)
@@ -40,7 +40,8 @@ function f = %r_a_s(f,m)
     else
         //at leat one matrix is eye*x
         if size(szf,"*")>2 | size(szm,"*")>2 then
-            error(8)
+            msg = _("%s: Inconsistent addition.\n")
+            error(msprintf(msg, "%r_a_s"))
         end
         if or(szf<0) & or(szm<0) then
             [num,den] = simp(num+m.*den,den)
index 2f4a1ff..9ec0019 100644 (file)
 
 function d=%r_diag(a,k)
     // %r_diag - implement diag function for  rational matrix ,..
+
+    fname = "%r_diag";
     if argn(2)<2 then
         k=0,
     else
-        if type(k)<>1 then error(53,2);end
-        if size(k,"*")<>1 then error(89,2);end
-        if ~isreal(k) then error(52,2);end
+        if type(k)<>1 then
+            msg = _("%s: Argument #%d: Decimal number(s) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
+        if size(k,"*")<>1 then
+            msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
+        if ~isreal(k) then
+            msg = _("%s: Argument #%d: Decimal number(s) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
     end
     [m,n]=size(a.num)
     if m<>1&n<>1 then
index ce5417e..9dcc3dd 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function s2=%r_i_lss(i,j,s1,s2)
+function s2 = %r_i_lss(i,j,s1,s2)
     //%r_i_lss(i,j,s1,s2) <=> s2(i,j)=s1
     //!
-    if type(i)==10|type(j)==10 then
-        error(21)
+    if type(i)==10 | type(j)==10 then
+        msg = _("%s: Invalid index.\n")
+        error(msprintf(msg, "%r_i_lss"))
     end
     [s1 s2]=sysconv(s1,s2)
     s2(i,j)=s1
index 16529ee..dfc2e8a 100644 (file)
@@ -15,7 +15,9 @@ function s1=%r_l_r(s1,s2)
     //!
     [s1,s2]=sysconv(s1,s2)
     [n,m]=size(s1("den"))
-    if n<>m then error(43),end
+    if n<>m then
+       error(msprintf(_("%s: Non implemented feature.\n"), "%r_l_r"))
+    end
     if m*n==1 then
         s1=%r_m_r(rlist(s1("den"),s1("num"),s1("dt")),s2)
     else
diff --git a/scilab/modules/overloading/macros/%r_m_hm.sci b/scilab/modules/overloading/macros/%r_m_hm.sci
deleted file mode 100644 (file)
index 363bb10..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 f1=%r_m_hm(f1,n2)
-    // %r_m_s(f1,n2)
-    //f1 =  f1*n2
-    //author Serge Steer INRIA
-    //!
-
-    [n1,d1]=f1(["num","den"]),
-    sz1=size(n1);
-    if prod(sz1)==0 then return,end
-    sz2=size(n2);
-    n2=n2(:)
-
-    if or(sz1==-1) then
-        n1=n1+0;d1=d1+0;
-    end
-    if prod(sz1)==1 then
-        num=n1*n2,
-        den=d1(ones(n2))
-    else,
-        error(10)
-    end,
-
-    f1=rlist(matrix(num,sz2),matrix(den,sz2),f1.dt)
-endfunction
-
index d5b1514..83c2755 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function s1=%r_m_r(s1,s2)
-    //s1=s1*s2
+function s1 = %r_m_r(s1,s2)
+    //s1 = s1*s2
     //!
+    fname = "%r_m_r"
 
-    [s1,s2]=sysconv(s1,s2),
-    [n1,d1]=s1(["num","den"]);
-    [n2,d2]=s2(["num","den"]);
-    sz1=size(n1)
-    sz2=size(n2)
+    [s1,s2] = sysconv(s1,s2),
+    [n1,d1] = s1(["num","den"]);
+    [n2,d2] = s2(["num","den"]);
+    sz1 = size(n1)
+    sz2 = size(n2)
 
-    indef=%f
+    indef = %f
     if or(sz1==-1) then
-        n1=n1+0;d1=d1+0;sz1=[1 1]
-        if prod(sz2)==1 then indef=%t,else error(14),end
+        n1 = n1 + 0;
+        d1 = d1 + 0;
+        sz1 = [1 1]
+        if prod(sz2)==1 then
+            indef = %t
+        else
+            msg = _("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, fname))
+        end
     end
     if or(sz2==-1) then
-        n2=n2+0;d2=d2+0;sz2=[1 1]
-        if  prod(sz1)==1 then indef=%t,else error(14),end
+        n2 = n2 + 0;
+        d2 = d2 + 0;
+        sz2 = [1 1]
+        if prod(sz1)==1 then
+            indef = %t
+        else
+            msg = _("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, fname))
+        end
     end
     if prod(sz1)==1 then
-        [num,den]=simp(n1.*n2(:),d1.*d2(:)),
-        num=matrix(num,sz2)
-        den=matrix(den,sz2)
+        [num,den] = simp(n1.*n2(:),d1.*d2(:))
+        num = matrix(num,sz2)
+        den = matrix(den,sz2)
     elseif prod(sz2)==1 then
-        [num,den]=simp(n1(:).*n2,d1(:).*d2),
-        num=matrix(num,sz1)
-        den=matrix(den,sz1)
+        [num, den] = simp(n1(:).*n2,d1(:).*d2)
+        num = matrix(num,sz1)
+        den = matrix(den,sz1)
     else
-        if size(sz1,"*")>2|size(sz2,"*")>2 then error(10),end
-        if sz1(2)<>sz2(1) then error(10),end,
-        l1=sz1(1);m1=sz1(2);m2=sz2(2);
-        for i=1:l1, pp(i)=lcm(d1(i,:)),end,
-        for j=1:m2,
-            y=lcm(d2(:,j)),
-            for i=1:l1,
-                yij=y*pp(i),
-                x=0;
-                for k=1:m1,
-                    x=x+n1(i,k)*n2(k,j)*pppdiv(y,d2(k,j))*pppdiv(pp(i),d1(i,k)),
+        if size(sz1,"*")>2 | size(sz2,"*")>2 then
+            msg = _("%s: Hypermatrix not supported.\n")
+            error(msprintf(msg, fname))
+        end
+        if sz1(2) <> sz2(1) then
+            msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+            error(msprintf(msg, fname, 1, 2))
+        end
+
+        l1 = sz1(1);
+        m1 = sz1(2);
+        m2 = sz2(2);
+        for i = 1:l1, pp(i)=lcm(d1(i,:)),end,
+        for j = 1:m2,
+            y = lcm(d2(:,j)),
+            for i = 1:l1,
+                yij = y*pp(i),
+                x = 0;
+                for k = 1:m1,
+                    x = x + n1(i,k) * n2(k,j) * pppdiv(y,d2(k,j)) * pppdiv(pp(i),d1(i,k))
                 end
                 num(i,j)=x,den(i,j)=yij,
             end
         end
-        [num,den]=simp(num,den),
+        [num,den] = simp(num,den),
     end
 
     if indef then
-        num=num*eye()
-        den=den*eye()
+        num = num*eye()
+        den = den*eye()
     end
-    s1=rlist(num,den,s1.dt)
+    s1 = rlist(num,den,s1.dt)
 endfunction
index dbaa4a6..652e13d 100644 (file)
@@ -7,51 +7,75 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 
-function f1=%r_m_s(f1,n2)
+function f1 = %r_m_s(f1,n2)
     // %r_m_s(f1,n2)
     //f1 =  f1*n2
     //author Serge Steer INRIA
     //!
 
-    [n1,d1]=f1(["num","den"]),
-    sz1=size(n1);sz2=size(n2);
-    if prod(sz1)==0|prod(sz2)==0 then f1=[];return,end
-
+    [n1,d1] = f1(["num","den"]),
+    sz1 = size(n1);
+    sz2 = size(n2);
+    if prod(sz1)==0 | prod(sz2)==0 then
+        f1 = []
+        return
+    end
 
     indef=%f
     if or(sz1==-1) then
-        n1=n1+0;d1=d1+0;sz1=[1 1];
-        if prod(sz2)==1 then indef=%t,else error(14),end
+        n1 = n1+0;
+        d1 = d1+0;
+        sz1 = [1 1];
+        if prod(sz2)==1 then
+            indef = %t
+        else
+            msg = _("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, "%r_m_s"))
+        end
     end
     if  or(sz2==-1) then
-        n2=n2+0;sz2=[1 1];
-        if prod(sz1)==1 then indef=%t,else error(14),end
+        n2 = n2+0;
+        sz2 = [1 1];
+        if prod(sz1)==1 then
+            indef = %t
+        else
+            msg = _("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, "%r_m_s"))
+        end
     end
     //
     if prod(sz1)==1 then
-        num=n1*n2,
-        den=d1(ones(n2))
+        num = n1*n2,
+        den = d1(ones(n2))
     elseif prod(sz2)==1 then
-        num=n1*n2,
-        den=d1
-    else,
-        if size(sz1,"*")>2|size(sz2,"*")>2 then error(10),end
-        if sz1(2)<>sz2(1) then error(10),end,
-        l1=sz1(1);l2=sz2(1);m2=sz2(2)
-        for i=1:l1,
-            n=n1(i,:);
-            [y,fact]=lcm(d1(i,:)),
-            den(i,1:m2)=ones(1,m2)*y,
+        num = n1*n2,
+        den = d1
+    else
+        if size(sz1,"*")>2 | size(sz2,"*")>2 then
+            msg = _("%s: Hypermatrix not supported.\n")
+            error(msprintf(msg, "%r_m_s"))
+        end
+        if sz1(2)<>sz2(1) then
+            msg = _("%s: Inconsistent multiplication.\n")
+            error(msprintf(msg, "%r_m_s"))
+        end
+        l1 = sz1(1);
+        l2 = sz2(1);
+        m2 = sz2(2)
+        for i = 1:l1,
+            n = n1(i,:);
+            [y,fact] = lcm(d1(i,:)),
+            den(i,1:m2) = ones(1,m2)*y,
             for j=1:m2,
-                num(i,j)=n*(n2(:,j).*matrix(fact,l2,1)),
-            end,
-        end,
-        [num,den]=simp(num,den),
-    end,
+                num(i,j) = n*(n2(:,j) .* matrix(fact,l2,1))
+            end
+        end
+        [num, den] = simp(num, den)
+    end
 
     if indef then
-        num=num*eye()
-        den=den*eye()
+        num = num*eye()
+        den = den*eye()
     end
-    f1=rlist(num,den,f1.dt)
+    f1 = rlist(num, den, f1.dt)
 endfunction
index c84d32c..bf96e26 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function s1=%r_r_r(s1,s2)
+function s1 = %r_r_r(s1,s2)
     // %r_r_r(s1,s2) <=> s1/s2    for rationals
     //!
 
     [s1,s2]=sysconv(s1,s2),
     [n,m]=size(s2("num"))
-    if n<>m then error(43),end
+    if n<>m then
+        msg = _("%s: Non implemented feature.\n")
+        error(msprintf(msg, "%r_r_r"))
+    end
     if n*m==1 then
         s1=%r_m_r(s1,rlist(s2("den"),s2("num"),s2("dt")) ),
     else
index b5e5aa2..7482146 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%r_s_hm(f,m)
+function f = %r_s_hm(f,m)
     //f = f-m,
     //f: transfer matrix, m : hypermatrix
     //author Serge Steer INRIA
@@ -19,7 +19,7 @@ function f=%r_s_hm(f,m)
     szf=size(den)
     szm=size(m)
 
-    if and(szf>=0)&and(szm>=0) then
+    if and(szf>=0) & and(szm>=0) then
         num=num(:);den=den(:);m=m(:)
         if prod(szf)==1&prod(szm)>1 then
             den=den(ones(m))
@@ -29,6 +29,7 @@ function f=%r_s_hm(f,m)
         den=matrix(den,szf)
         f=rlist(num,den,f.dt)
     else
-        error(9)
+        msg = gettext("%s: Eye variable undefined in this context.\n")
+        error(msprintf(msg, "%r_s_hm"));
     end
 endfunction
index 0cd7fd2..f465616 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%r_s_p(f,m)
+function f = %r_s_p(f,m)
     //f = f-m,
     //f: transfer matrix, m : scalar or scalar matrix
     //author Serge Steer INRIA
@@ -33,8 +33,9 @@ function f=%r_s_p(f,m)
         den=matrix(den,szf)
     else
         //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
-            error(9)
+        if size(szf,"*")>2 | size(szm,"*")>2 then
+            msg = gettext("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, "%r_s_p"));
         end
         if or(szf<0)&or(szm<0) then
             [num,den]=simp(num-m.*den,den)
index 92ecefd..323b2b9 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function d=%r_tril(a,k)
+function d = %r_tril(a,k)
     if argn(2)<2 then
-        k=0,
+        k=0
     else
-        if type(k)<>1 then error(53,2);end
-        if size(k,"*")<>1 then error(89,2);end
-        if ~isreal(k) then error(52,2);end
+        fname = "%r_tril";
+        if type(k)<>1 then
+            msg = _("%s: Argument #%d: Decimal number(s) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
+        if size(k,"*")<>1 then
+            msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
+        if ~isreal(k) then
+            msg = _("%s: Argument #%d: Decimal number(s) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
     end
 
-    d=rlist(tril(a.num,k),tril(a.den,k)+triu(ones(a.den),k+1),a.dt)
+    d = rlist(tril(a.num,k),tril(a.den,k)+triu(ones(a.den),k+1),a.dt)
 endfunction
index 8e9903e..774753e 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function d=%r_triu(a,k)
+function d = %r_triu(a,k)
     // r_triu - implement triu function for  rationnal matrix ,..
+
     if argn(2)<2 then
         k=0,
     else
-        if type(k)<>1 then error(53,2);end
-        if size(k,"*")<>1 then error(89,2);end
-        if ~isreal(k) then error(52,2);end
+        fname = "%r_triu";
+        if type(k)<>1 then
+            msg = _("%s: Argument #%d: Decimal number(s) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
+        if size(k,"*")<>1 then
+            msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
+        if ~isreal(k) then
+            msg = _("%s: Argument #%d: Decimal number(s) expected.\n")
+            error(msprintf(msg, fname, 2))
+        end
     end
 
-    d=rlist(triu(a.num,k),triu(a.den,k)+tril(ones(a.den),k-1),a.dt)
+    d = rlist(triu(a.num,k),triu(a.den,k)+tril(ones(a.den),k-1),a.dt)
 endfunction
diff --git a/scilab/modules/overloading/macros/%s_a_hm.sci b/scilab/modules/overloading/macros/%s_a_hm.sci
deleted file mode 100644 (file)
index d6381a8..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 M2=%s_a_hm(M1,M2)
-
-    // hypermatrix + scalar
-    if and(size(M1)==[1 1]) then
-        M2.entries=M1+M2.entries
-    else
-        dims1=size(M1)';
-        dims2=matrix(M2.dims,-1,1)
-        dims1(3:size(dims2,"*"))=1
-        if and(dims1==dims2) then //should not occur
-            M2.entries=matrix(M1,-1,1)+M2.entries
-        else
-            error(8)
-        end
-    end
-endfunction
index 5b494e2..656547f 100644 (file)
@@ -9,8 +9,12 @@
 // 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=%s_a_ip(s,ip)
+
+function r = %s_a_ip(s,ip)
     // s+ip
-    if size(s,"*")<>1 then error(10),end
+    if size(s,"*")<>1 then
+        msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+        error(msprintf(msg, "%s_a_ip", 1))
+    end
     r=(s+ip(1)):(s+ip(2)):(s+ip(3))
 endfunction
index 4405ca7..dd18ceb 100644 (file)
@@ -14,7 +14,10 @@ function b=%s_c_cblock(a,b)
     if a==[] then return,end
     v2=getfield(2,b)
 
-    if size(a,1)<>size(v2,1) then error(5),end
+    if size(a,1)<>size(v2,1) then
+        msg = _("%s: Arguments #%d and #%d: Same numbers of rows expected.\n")
+        error(msprintf(msg, "%s_c_cblock", 1, 2))
+    end
     if type(a)==type(v2) then
         b=setfield(2,[a v2],b)
     else
index 5f3d276..d846569 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%s_e(varargin)
+function f = %s_e(varargin)
     //A(i,j,k,..)
 
     rhs=size(varargin)
@@ -22,7 +22,10 @@ function f=%s_e(varargin)
         ind=varargin(k)
         if type(ind)==2|type(ind)==129 then ind=horner(ind,1),end
         if type(ind)==4 then ind=find(ind),end
-        if or(ind<>1) then error(21),end
+        if or(ind<>1) then
+            msg = _("%s: Invalid index.\n")
+            error(msprintf(msg, "%s_e"))
+        end
         n=size(ind,"*")
         dims=[dims,n]
     end
index 58852bc..0e1b795 100644 (file)
@@ -10,6 +10,9 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function b=%s_f_cblock(a,b)
-    if a<>[] then error(44,1),end
+function b = %s_f_cblock(a,b)
+    if a<>[] then
+        msg = _("%s: Wrong argument #%d.\n")
+        error(msprintf(msg, "%s_f_cblock", 1))
+    end
 endfunction
index 339ff14..3b48af0 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function M=%s_i_c(varargin)
+function M = %s_i_c(varargin)
     //insertion of a matrix of numbers in a matrix of of string
 
 
     rhs=argn(2)
+    msg = _("%s: Non implemented feature.\n")
+
     if rhs<=4 then //type conversion
-        error(43)
+        error(msprintf(msg, "%s_i_c"))
     else //hypermatrix syntax
-        if varargin($-1)<>[] then error(43),end
-        M=generic_i_hm("",varargin(:))
+        if varargin($-1)<>[] then
+            error(msprintf(msg, "%s_i_c"))
+        end
+        M = generic_i_hm("",varargin(:))
     end
 endfunction
 
index a871a1f..a60b401 100644 (file)
@@ -15,10 +15,14 @@ function s2=%s_i_lss(i,j,s1,s2)
     //!
     if type(i)==10 then  // sl('A'),sl('B'),sl('C'),sl('D'),sl('X'),sl('dt')
         [lhs,rhs]=argn(0)
-        if rhs<>3 then  error(21),end
+        if rhs<>3 then
+            error(msprintf(_("%s: Invalid index.\n"), "%s_i_lss"))
+        end
         nams=["A","B","C","D","X","dt"]
         kf=find(convstr(i,"u")==nams)
-        if kf==[] then error(21),end
+        if kf==[] then
+            error(msprintf(_("%s: Invalid index.\n"), "%s_i_lss"))
+        end
         s2=s1;kf=kf+1
         if size(s2(kf))<>size(j) then
             if kf<>7|prod(size(j))>1 then
index f684023..73198da 100644 (file)
@@ -33,7 +33,8 @@ function out=%s_i_st(varargin)
             for k=Ndims+1:nindex
                 i=varargin(k)
                 if size(i,"*")>1|(i<>1&i<>eye()) then
-                    error(msprintf(_("%s: A null assignment can have only one non-colon index.\n"),"%s_i_st"));
+                    msg = _("%s: A null assignment can have only one non-colon index.\n")
+                    error(msprintf(msg, "%s_i_st"));
                 end
             end
             nindex=Ndims
@@ -56,7 +57,8 @@ function out=%s_i_st(varargin)
                 ind=floor(ind);
                 //check if index is valid
                 if ~isreal(ind)|or(ind<=0) then
-                    error(21)
+                    msg = _("%s: Invalid index\n");
+                    error(msprintf(msg, "%s_i_st"))
                 end
                 //remove indices that exceed the associated struct dimension
                 ind(ind>dims(k))=[];
@@ -66,7 +68,8 @@ function out=%s_i_st(varargin)
                     cj=ind
                     loc=k,
                 else
-                    error(msprintf(_("%s: A null assignment can have only one non-colon index.\n"),"%s_i_st"));
+                    msg = _("%s: A null assignment can have only one non-colon index.\n")
+                    error(msprintf(msg, "%s_i_st"));
                 end
             end
         end
index 0d60552..0fabb08 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%s_m_ip(s,ip)
+function r = %s_m_ip(s,ip)
     // s*ip
-    if size(s,"*")<>1 then error(10),end
-    r=(s*ip(1)):(s*ip(2)):(s*ip(3))
+    if size(s,"*")<>1 then
+        msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+        error(msprintf(msg, "%s_m_ip", 1))
+    end
+    r = (s*ip(1)):(s*ip(2)):(s*ip(3))
 endfunction
index c311729..356733e 100644 (file)
@@ -15,46 +15,73 @@ function f2=%s_m_r(n1,f2)
     //operation  f2=n1*f2
     //author Serge Steer INRIA
     //!
-    [n2,d2]=f2(["num","den"]);
-    sz1=size(n1);sz2=size(n2);
-    if prod(sz1)==0|prod(sz2)==0 then  f2=[],return,end
+
+    fname = "%s_m_r";
+
+    [n2,d2] = f2(["num","den"]);
+    sz1 = size(n1);
+    sz2 = size(n2);
+    if prod(sz1)==0 | prod(sz2)==0 then  f2=[],return,end
 
 
     indef=%f
     if or(sz1==-1) then
-        n1=n1+0;sz1=[1 1];
-        if  prod(sz2)==1 then indef=%t,else error(14),end
+        n1 = n1+0;
+        sz1 = [1 1];
+        if prod(sz2)==1 then
+            indef = %t
+        else
+            msg = _("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, fname))
+        end
     end
+
     if  or(sz2==-1) then
-        n2=n2+0;d2=d2+0;sz2=[1 1];
-        if prod(sz1)==1 then indef=%t,else error(14),end
+        n2 = n2+0;
+        d2 = d2+0;
+        sz2 = [1 1];
+        if prod(sz1)==1 then
+            indef = %t
+        else
+            msg = _("%s: Eye variable undefined in this context.\n")
+            error(msprintf(msg, fname))
+        end
     end
 
     //
     if prod(sz1)==1 then
-        num=n1*n2,
-        den=d2
+        num = n1*n2,
+        den = d2
     elseif prod(sz2)==1 then
-        num=n1*n2,
-        den=d2(ones(n1))
-    else,
-        if size(sz1,"*")>2|size(sz2,"*")>2 then error(10),end
-        if sz1(2)<>sz2(1) then error(10),end,
-        l1=sz1(1);m1=sz1(2);m2=sz2(2);
-        for j=1:m2,
-            [y,fact]=lcm(d2(:,j)),
-            n2(:,j)=n2(:,j).*fact,
-            den(1:l1,j)=ones(l1,1)*y,
-            for i=1:l1,
-                num(i,j)=n1(i,:)*n2(:,j),
+        num = n1*n2,
+        den = d2(ones(n1))
+    else
+        if size(sz1,"*")>2 | size(sz2,"*")>2 then
+            msg = _("%s: Hypermatrix not supported.\n")
+            error(msprintf(msg, fname))
+        end
+        if sz1(2) <> sz2(1) then
+            msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+            error(msprintf(msg, fname, 1, 2))
+        end
+
+        l1 = sz1(1);
+        m1 = sz1(2);
+        m2 = sz2(2);
+        for j = 1:m2,
+            [y,fact] = lcm(d2(:,j)),
+            n2(:,j) = n2(:,j).*fact,
+            den(1:l1,j) = ones(l1,1)*y
+            for i = 1:l1
+                num(i,j) = n1(i,:)*n2(:,j)
             end,
         end,
-        [num,den]=simp(num,den),
-    end,
+        [num,den] = simp(num,den)
+    end
 
     if indef then
-        num=num*eye()
-        den=den*eye()
+        num = num*eye()
+        den = den*eye()
     end
-    f2=rlist(num,den,f2.dt)
+    f2 = rlist(num,den,f2.dt)
 endfunction
diff --git a/scilab/modules/overloading/macros/%s_s_hm.sci b/scilab/modules/overloading/macros/%s_s_hm.sci
deleted file mode 100644 (file)
index 6d8077d..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA/ENPC
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// 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 M2=%s_s_hm(M1,M2)
-
-    // scalar -hypermatrix
-    if and(size(M1)==[1 1]) then
-        M2.entries=M1-M2.entries
-    else
-        dims1=size(M1)';
-        dims2=matrix(M2.dims,-1,1)
-        dims1(3:size(dims2,"*"))=1
-        if and(dims1==dims2) then //should not occur
-            M2.entries=matrix(M1,-1,1)-M2.entries
-        else
-            error(9)
-        end
-    end
-endfunction
index bcaac74..d11193d 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%s_s_ip(s,ip)
+function r = %s_s_ip(s,ip)
     // s-ip
-    if size(s,"*")<>1 then error(10),end
-    r=(s-ip(1)):(s-ip(2)):(s-ip(3))
+    if size(s,"*")<>1 then
+        msg = _("%s: Argument #%d: Scalar (1 element) expected.\n")
+        error(msprintf(msg, "%s_s_ip", 1))
+    end
+    r = (s-ip(1)):(s-ip(2)):(s-ip(3))
 endfunction
index 4bb1f8e..20f083e 100644 (file)
@@ -1,6 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
 // Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+// Copyright (C) 2018 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // along with this program.
 
 function x = %sp_inv(a)
-    
     [ma, na] = size(a)
-    if ma<>na then 
-        error(20,1)
+    if ma<>na then
+        msg = _("%s: Argument #%d: Square matrix expected.\n")
+        error(msprintf(msg, "%sp_inv", 1))
     end
+
+    oldw = warning("query");
     warning("off")
     Lup = umf_lufact(a);
-    warning("on")
+    warning(oldw)
+
     x = sparse(umf_lusolve(Lup, eye(ma, na)));
     umf_ludel(Lup)
-
 endfunction
index 8a106e0..8ba26ff 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function x=%sp_l_s(a,b)
+function x = %sp_l_s(a,b)
     // a\b , a sparse b full
 
 
@@ -18,7 +18,10 @@ function x=%sp_l_s(a,b)
     [mb,nb]=size(b)
     if mb*nb==1 then x=a\(b*speye(na,na)),return;end
 
-    if ma<>mb then error(12),end
+    if ma<>mb then
+        msg = _("%s: Arguments #%d and #%d: Same numbers of rows expected.\n")
+        error(msprintf(msg, "%sp_l_s", 1, 2))
+    end
 
     if ma<>na then b=a'*b;a=a'*a;end
 
index 1c7d73c..9cb3ad1 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function x=%sp_l_sp(a,b)
+function x = %sp_l_sp(a,b)
     // a\b , a sparse b sparse
 
     [ma,na]=size(a)
     [mb,nb]=size(b)
-    if ma<>mb then error(12),end
+    if ma<>mb then
+        msg = _("%s: Arguments #%d and #%d: Same numbers of rows expected.\n")
+        error(msprintf(msg, "%sp_l_sp", 1, 2))
+    end
     if ma<>na then
         b=a'*b;a=a'*a
     end
index 39cda12..b0bfbaf 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%sp_q_s(a,b)
+function r = %sp_q_s(a,b)
     //r=a.\b
 
-    [ij,v,mn]=spget(a)
-    if size(v,"*")<>mn(1)*mn(2) then
-        error(27)
+    [ij,v,mn] = spget(a)
+    if size(v,"*") <> mn(1)*mn(2) then
+        msg = _("%s: Division by 0...\n")
+        error(msprintf(msg, "%sp_q_s"))
     else
         r=full(a).\b
     end
index 5cbc45c..df6d6b3 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%sp_y_sp(a,b)
+function r = %sp_y_sp(a,b)
     //  a./.b with a and b sparse
 
-    [ija,va,mna]=spget(a)
-    [ijb,vb,mnb]=spget(b)
-    if size(ijb,1)<>prod(mnb)|or(vb==0) then error(27),end
-    ia=ija(:,1);ja=ija(:,2)
-    ib=ijb(:,1);jb=ijb(:,2)
+    [ija,va,mna] = spget(a)
+    [ijb,vb,mnb] = spget(b)
+    if size(ijb,1)<>prod(mnb)|or(vb==0) then
+        msg = _("%s: Division by 0...\n")
+        error(msprintf(msg, "%sp_y_sp"))
+    end
+    ia = ija(:,1);
+    ja = ija(:,2)
+    ib = ijb(:,1);
+    jb = ijb(:,2)
 
-    ij=[((ia-ones(ia))*mnb(1)).*.ones(ib)+ones(ia).*.ib,..
-    ((ja-ones(ja))*mnb(2)).*.ones(jb)+ones(ia).*.jb]
-    r=sparse(ij,va./.vb,mna.*mnb)
+    ij = [((ia-ones(ia))*mnb(1)).*.ones(ib)+ones(ia).*.ib,..
+          ((ja-ones(ja))*mnb(2)).*.ones(jb)+ones(ia).*.jb]
+    r = sparse(ij,va./.vb,mna.*mnb)
 endfunction
index 2515169..82d01a9 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%sp_z_sp(a,b)
+function r = %sp_z_sp(a,b)
     //  a.\.b with a and b sparse
 
-    [ija,va,mna]=spget(a)
-    [ijb,vb,mnb]=spget(b)
-    if size(ija,1)<>prod(mna)|or(va==0) then error(27),end
-    ia=ija(:,1);ja=ija(:,2)
-    ib=ijb(:,1);jb=ijb(:,2)
+    [ija,va,mna] = spget(a)
+    [ijb,vb,mnb] = spget(b)
+    if size(ija,1)<>prod(mna) | or(va==0) then
+        msg = _("%s: Division by 0...\n")
+        error(msprintf(msg, "%sp_z_sp"))
+    end
+    ia = ija(:,1);
+    ja = ija(:,2)
+    ib = ijb(:,1);
+    jb = ijb(:,2)
 
-    ij=[((ia-ones(ia))*mnb(1)).*.ones(ib)+ones(ia).*.ib,..
-    ((ja-ones(ja))*mnb(2)).*.ones(jb)+ones(ia).*.jb]
-    r=sparse(ij,va.\.vb,mna.*mnb)
+    ij = [((ia-ones(ia))*mnb(1)).*.ones(ib)+ones(ia).*.ib,..
+          ((ja-ones(ja))*mnb(2)).*.ones(jb)+ones(ia).*.jb]
+    r = sparse(ij, va.\.vb, mna.*mnb)
 endfunction
index 1cc02c3..ab236a8 100644 (file)
@@ -47,7 +47,9 @@ function M=%st_i_st(varargin)
         end
         //convert N-dimensional indexes to 1-D and extend dims if necessary
         [Ndims,I]=convertindex(list(dims,double(matrix(N.dims,1,-1))),varargin(1:$-2));Ndims=matrix(Ndims,1,-1)
-        if reduced_index&or(Ndims<>dims)  then error(21),end
+        if reduced_index & or(Ndims<>dims)  then
+            error(msprintf(_("%s: Invalid index.\n"), "%st_i_ste"))
+        end
         if or(Ndims>dims) then
             //extend the destination matrix
             I1=0
index c39d7c6..c215e79 100644 (file)
@@ -10,7 +10,7 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function M=generic_i_hm(default_value,varargin)
+function M = generic_i_hm(default_value,varargin)
 
 
     //insertion of a matrix in an hypermatrix
@@ -50,10 +50,12 @@ function M=generic_i_hm(default_value,varargin)
             if or(size(dk)<>-1) then
                 dk=gsort(dk);
                 if or(dk<>(dims(k):-1:1)) then
-                    msg_index = _("Invalid index.\n");
-                    if dk(1)<1|dk($)>dims(k) then error(msg_index),end
+                    if dk(1)<1|dk($)>dims(k) then
+                        error(msprintf(_("%s: Invalid index.\n"), "generic_i_hm"))
+                    end
                     if ok<>[] then
-                        error(msprintf(_("%s: A null assignment can have only one non-colon index.\n"),"generic_i_hm"));
+                        msg = _("%s: A null assignment can have only one non-colon index.\n")
+                        error(msprintf(msg, "generic_i_hm"));
                     end
                     ok=k
                     I1=1:dims(k);I1(dk)=[]
@@ -76,13 +78,11 @@ function M=generic_i_hm(default_value,varargin)
         return
     end
 
-
     //convert N-dimensional indexes to 1-D and extend dims if necessary
     [Ndims,I]=convertindex(list(dims,size(N)),varargin(1:$-2));
     Ndims=matrix(Ndims,-1,1)
 
-
-    //if reduced_index&or(Ndims<>dims)  then error(21),end
+    //if reduced_index & or(Ndims<>dims), error(msprintf(_("%s: Invalid index.\n"), "generic_i_hm")), end
     if or(Ndims>dims) then
         //extend the destination matrix
         I1=0
index d2fbd01..68384b6 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function M=st_i_generic(varargin)
+function M = st_i_generic(varargin)
     [lhs,rhs]=argn(0)
     M=varargin(rhs)
     N=varargin(rhs-1)//inserted matrix
     index=varargin(1) //
     if M==[] then M=struct(),M(index)=N;return;end
-    if rhs==3&(type(index)==10|type(index)==15) then
+    if rhs==3 & (type(index)==10 | type(index)==15) then
         if type(index)==15 then
             M=struct()
             M(index)=N
@@ -24,7 +24,7 @@ function M=st_i_generic(varargin)
             M=createstruct(index,N)
         end
     else
-        error(1)
+        error(msprintf(_("%s: Incorrect assignment.\n"), "st_i_generic"));
     end
 
 endfunction
index 8b5ba4c..8f04dfa 100644 (file)
@@ -6,7 +6,9 @@ function scimihm(%_xmlfile)
     icpr=list();
 
     sciGUI_init()
-    if execstr("%_filename="+%_xmlfile,"errcatch")~=0 then error(44), end
+    if execstr("%_filename="+%_xmlfile,"errcatch")~=0 then
+        error(msprintf(_("%s: Wrong input argument.\n"), "scimihm"));
+    end
 
     try
         %_winId=TCL_GetVar("IHMLoc")
index d4f1486..9d2e3cb 100644 (file)
@@ -94,7 +94,10 @@ function [%ok,%1,%2,%3,%4,%5,...
     [%lhs,%rhs]=argn(0)
 
     %nn=prod(size(%labels))
-    if %lhs<>%nn+2&%lhs<>%nn+1 then error(41),end
+    if %lhs <> %nn+2 & %lhs <> %nn+1 then
+        msg = _("%s: Wrong number of output arguments: %d to %d expected.\n")
+        error(msprintf(msg, "setvalue", %nn+1, %nn+2))
+     end
     if size(%typ)<>2*%nn then
         error("typ : list(''type'',[sizes],...)")
     end
index 37bafdd..641a127 100644 (file)
@@ -80,10 +80,13 @@ function [%ok,%1,%2,%3,%4,%5,...
     // 12/02/07 -Alan- : fix (variable evaluation of %scicos_context)
     //
     // Copyright INRIA
-    [%lhs,%rhs]=argn(0)
+    [%lhs, %rhs]=argn(0)
 
     %nn=prod(size(%labels))
-    if %lhs<>%nn+2&%lhs<>%nn+1 then error(41),end
+    if %lhs <> %nn+2 & %lhs <> %nn+1 then
+        msg = _("%s: Wrong number of output arguments: %d to %d expected.\n")
+        error(msprintf(msg, "scicos_getvalue", %nn+1, %nn+2))
+    end
     if size(%typ)<>2*%nn then
         error("%typ : list(''type'',[sizes],...)")
     end
@@ -292,13 +295,16 @@ function [%ok,%1,%2,%3,%4,%5,...
             execstr("%"+string(%kk)+"=%vv")
         end
         if %nok>0 then
-            messagebox(msprintf(_("Answer given for %s \n has invalid dimension: \n waiting for dimension %s.\n"), %labels(%nok), %ssz), "modal");
+            msg = _("Answer given for %s \n has invalid dimension: \n waiting for dimension %s.\n")
+            messagebox(msprintf(msg, %labels(%nok), %ssz), "modal");
             %ini=%str
         elseif %nok<0 then
             if %ierr==0 then
-                messagebox(msprintf(_("Answer given for %s \n has incorrect type %s.\n"), %labels(-%nok), %typ(-2*%nok-1)), "modal");
+                msg = _("Answer given for %s \n has incorrect type %s.\n")
+                messagebox(msprintf(msg, %labels(-%nok), %typ(-2*%nok-1)), "modal");
             else
-                messagebox(msprintf(_("Answer given for %s \n is incorrect: %s.\n"), %labels(-%nok), lasterror()), "modal");
+                msg = _("Answer given for %s \n is incorrect: %s.\n")
+                messagebox(msprintf(msg, %labels(-%nok), lasterror()), "modal");
             end
             %ini=%str
         else
index 34cdfd7..9b7da68 100644 (file)
@@ -26,13 +26,22 @@ function [WINID] = GEDeditvar(varargin)
 
     [%_nams]=who("get");
     %_loc_type=type(varargin(1))
-    if (%_loc_type~=10) then error(42), end
+    if (%_loc_type~=10) then
+        msg = _("%s: Argument #%d: Text(s) expected.\n")
+        error(msprintf(msg, "GEDeditvar", 1))
+    end
     %_in_list=find(%_nams==varargin(1));
-    if (%_in_list==[]) then error(42), end
+    if (%_in_list==[]) then
+        msg = _("%s: Argument #%d: Variable undefined.\n")
+        error(msprintf(msg, "GEDeditvar", 1))
+    end
     execstr("%_loc_var="+varargin(1));
     %_loc_type=type(%_loc_var);
     %_allo=find([1;4;10]==%_loc_type);
-    if (%_allo==[]) then error(42), end
+    if (%_allo==[]) then
+        msg = _("%s: Argument #%d: Name of a variable of type 1, 4 or 10 expected.\n")
+        error(msprintf(msg, "GEDeditvar", 1))
+    end
 
     //disp("Please wait...");
     %_loc_nam=varargin(1);