* Bug 16320 fixed: typos in blocks interfaces + a few files
[scilab.git] / scilab / modules / scicos_blocks / macros / MatrixOp / MATMAGPHI.sci
1 //  Scicos
2 //
3 //  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 //
19 // See the file ../license.txt
20 //
21
22 function [x,y,typ]=MATMAGPHI(job,arg1,arg2)
23     //
24     x=[];
25     y=[];
26     typ=[];
27     select job
28     case "set" then
29         x=arg1
30         model=arg1.model;
31         graphics=arg1.graphics;
32         label=graphics.exprs
33         if size(label,"*")==14 then
34             label(9)=[],
35         end //compatiblity
36         while %t do
37             [ok,decomptyp,lab]=scicos_getvalue(..
38                 [msprintf(_("Set %s block parameters"), "MATMAGPHI");
39                  " ";
40                  _("Conversion: 1=Complex->(Mag,Phi), 2=(Mag,Phi)->Complex")],..
41                 _(["Conversion code (1|2)"]), list("vec",1), label)
42             if ~ok then
43                 break,
44             end
45             label=lab
46             if (decomptyp==1) then
47                 function_name="matz_abs";
48                 in=[-1 -2];
49                 it=2;
50                 out=[-1 -2;-1 -2];
51                 ot=[1 1];
52             elseif (decomptyp==2) then
53                 function_name="matz_absc";
54                 in=[-1 -2;-1 -2];
55                 it=[1 1];
56                 out=[-1 -2];
57                 ot=2;
58             else
59                 message(_("Unknown conversion code"));
60                 ok=%f;
61             end
62             funtyp=4;
63             if ok then
64                 [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),[],[])
65             end
66             if ok then
67                 model.sim=list(function_name,funtyp);
68                 arg1.model=model
69                 graphics.exprs=label
70                 arg1.graphics=graphics
71                 x=arg1
72                 break
73             end
74         end
75     case "define" then
76         model=scicos_model()
77         function_name="matz_abs";
78         funtyp=4;
79         model.sim=list(function_name,funtyp)
80         model.in=-1
81         model.in2=-2
82         model.intyp=2
83         model.out=[-1;-1]
84         model.out2=[-2;-2]
85         model.outtyp=[1 1]
86         model.evtin=[]
87         model.evtout=[]
88         model.state=[]
89         model.dstate=[]
90         model.rpar=[]
91         model.ipar=[]
92         model.blocktype="c"
93         model.firing=[]
94         model.dep_ut=[%t %f]
95         label=[sci2exp(1)];
96         gr_i=[]
97         x=standard_define([3 2],model,label,gr_i)
98     end
99 endfunction
100