File: get_unknown.sci

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (58 lines) | stat: -rw-r--r-- 1,333 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
function [vnms,vtps,stk,txt]=get_unknown(nam)
// handle case where nam appear in an expression while it is not known.

// nam is unknown here, it may be:
// - variable created in an other clause part
// - an m-file called without args 
// - a variable created by an eval

vnms;vtps;stk;txt;   

// check clause
if level(1)>1 then // in a clause
  k_n=find(vnms_n(:,2)==nam)
  if k_n<>[] // variable has been defined in an other clause part
    stk(top)=list(nam,'0',vtps_n(k_n)(2),vtps_n(k_n)(3),vtps_n(k_n)(1))
    vnms=[vnms;[nam,nam]]
    vtps($+1)=vtps_n(k_n)
    return
  end
end

// check for following assignments [x,..]=nam
lhs=0
il=ilst+1
nlst=size(lst)
while il<=nlst
  if lst(il)(1)<>'1' then break,end
  lhs=lhs+1
  il=il+1
end


// check if instruction is simply "nam" (nam=nam)
if lhs<>0 then
  if lhs==1 then
    if lst(ilst+1)(2)==nam then 
      // instruction is simply "nam". suppose it is an m-file call
      stk(top)=list()
      return
    end
  else
   // at least two lhs --> a m_file call
   stk(top)=list()
   return
  end
end
if or(nam==known_untranslated()) then
   stk(top)=list()
   return
end

//I am not able to determine what is nam
set_infos('mtlb('+nam+') can be replaced by '+nam+'() or '+nam+' whether '+nam+..
    ' is an m-file or not',1)

    
stk(top)=list('mtlb('+nam+')','0','?','?','?')