File: cos2cosf.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 (44 lines) | stat: -rw-r--r-- 1,084 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
function t=cos2cosf(u,scs_m,count)
//write scilab instructions whose evaluation 
//returns the  value of scicos data structure scs_m.
// in the opened file associated with logical unit u
// Copyright INRIA
[lhs,rhs]=argn(0)
if rhs<3 then 
  count=0,
  lname='scs_m'
else
  count=count+1
  lname='scs_m_'+string(count)
end
bl='   '
lmax=80-3*count
t=lname+'=list()'
t1=sci2exp(scs_m(1),lmax);
t=[t;lname+'(1)='+t1(1);t1(2:$)]
write(u,t,'(a)')

for k=2:size(scs_m)
  t=[];
  o=scs_m(k)
  if o(1)=='Block' then
    model=o(3)
    if model(1)=='super'| model(1)=='csuper' then
      t1=cos2txt(o,count)
      t=[t;bl(ones(t1))+t1;lname+'('+string(k)+')='+'scs_m_'+string(count+1)]
    else
      lhs=lname+'('+string(k)+')='
      t1=sci2exp(o,lmax-length(lhs))
      bl1=' ';bl1=part(bl1,1:length(lhs))
      n1=size(t1,1)
      t=[t;lhs+t1(1);bl1(ones(n1-1,1))+t1(2:$)]
    end
  else
    lhs=lname+'('+string(k)+')='
    t1=sci2exp(o,lmax-length(lhs))
    bl1=' ';bl1=part(bl1,1:length(lhs))
    n1=size(t1,1)
    t=[t;lhs+t1(1);bl1(ones(n1-1,1))+t1(2:$)]
  end
  write(u,t,'(a)')
end