File: build_scs_tree.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 (41 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (2)
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
function [xx,yy,lp,larg]=build_scs_tree(scs_m,flag)
[lhs,rhs]=argn(0) 
if rhs<2 then
  flag='super'
end
xx=[];yy=[];
lp=list()
n=size(scs_m)
blks=[]
if flag=='super' then
  for k=2:n
    if scs_m(k)(1)=='Block' then 
      if scs_m(k)(3)(1)=='super' then blks=[blks,k],end
    end
  end
else
  for k=2:n
    if scs_m(k)(1)=='Block' then blks=[blks,k],end
  end
end
//
nl=size(blks,2)
xlk=x0
for k=blks
  path=[path k];
  xx=[xx,[x0;xlk]];yy=[yy,[y0;y0-1]]
//  xsegs([x0;xlk],[y0;y0-1],1)
  larg=maxi(xlk,larg)
  lp($+1)=path
  if scs_m(k)(3)(1)=='super' then
    y0s=y0;x0s=x0;x0=xlk;y0=y0-1
    largs=larg;
    [xxl,yyl,lpl,larg]=build_scs_tree(scs_m(k)(3)(8))
    xx=[xx,xxl];yy=[yy,yyl]
    lp=lstcat(lp,lpl)

    xlk=xlk+(larg-largs)+1/(nl*(1+abs(y0)))
    y0=y0s;x0=x0s
  end
  path($)=[]
end