File: genmac.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (67 lines) | stat: -rw-r--r-- 1,336 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function mac=genmac(tt,nin,nout)
// Copyright INRIA
[txt1,txt2,txt2_1,txt3,txt4,txt5,txt6]=tt(1:7)
mac=null()
//    [y,  x,  z,  tvec,xd]=func(flag,nevprt,t,x,z,rpar,ipar,u)
blank='  '
if txt2_1<>' ' then
  txt2=[txt2;
      'if n_evi<>0 then'
         blank(ones(txt2_1))+txt2_1
      'end']
end
semi=';'


txt1=blank(ones(txt1))+txt1+semi(ones(txt1))
txt2=blank(ones(txt2))+txt2+semi(ones(txt2))
txt3=blank(ones(txt3))+txt3+semi(ones(txt3))
txt4=blank(ones(txt4))+txt4+semi(ones(txt4))
txt5=blank(ones(txt5))+txt5+semi(ones(txt5))
txt6=blank(ones(txt6))+txt6+semi(ones(txt6))

u='u'
if nin>0 then
  get_u=blank+'['+strcat(u(ones(1,nin))+string(1:nin),',')+']=u(:)'
else
  get_u=[]
end
y='y'
set_y=blank+'y=list('+strcat(y(ones(1,nout))+string(1:nout),',')+')'
mac_txt=[
    get_u
    'select %_flag';
    'case 1 then';
       txt1
    '  t_evo=[]';
    '  xd=[]';
       set_y
    'case 2 then';
       txt2
    '  y=list()';
    '  t_evo=[]';
    'case 3 then';
       txt3
    '  xd=[]';
    '  y=list()';
    'case 4 then';
       txt4
    '  y=list()';
    '  t_evo=[]';
    '  xd=[]';
    'case 5 then';
       txt5
    '  y=list()';
    '  t_evo=[]';
    '  xd=[]';
    'case 6 then';
       txt6
    '  t_evo=[]';
    '  xd=[]';
       set_y
    'end']

deff('[y,x,z,t_evo,xd]=mac(%_flag,n_evi,t,x,z,rpar,ipar,u)',mac_txt)