File: whos.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 (51 lines) | stat: -rw-r--r-- 1,058 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
function whos()
// Copyright INRIA
[nams,vol]=who('get');
//display defined variable in a long form
typnames=['constant matrix';
    'polynomial'
    ' '
    'boolean'
    'sparse'
    'boolean sparse'
    ' '
    ' '
    ' '
    'string'
    'function'
    ' '
    'compiled function'
    'library'
    'list'
    'tlist']


n=size(nams,1)
write(%io(2),part('Name',1:25)+part('Type',1:20)+part('Size',1:20)+part('Bytes',1:13))
write(%io(2),' ')
for k=1:n
  sz=' '
  execstr('typ=type('+nams(k)+')')
  if typ<=10 then execstr('sz=size('+nams(k)+');'),end
  if typ<=16 then
    typn=typnames(typ)
    if typ==16 then
      execstr('tt='+nams(k)+'(1)')
      select tt(1)
      case 'r' then 
	typn='rational';
	execstr('sz=size('+nams(k)+'(2)+)')
      case 'lss' then 
	typn='state-space'
	execstr('sz=size('+nams(k)+'(''D'')+)')
      else 
	typn=tt
	execstr('sz=size('+nams(k)+')')
      end
    end
  else
    typn='?'
  end
  siz=strcat(string(sz),' by ')
  write(%io(2),part(nams(k),1:25)+part(typn,1:20)+part(siz,1:20)+part(string(vol(k)*8),1:13))
end