File: default_trad.sci

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (95 lines) | stat: -rw-r--r-- 2,516 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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
function tree=default_trad(tree)
// Copyright INRIA
// M2SCI function
// Create a default translation function
// V.C.

global("mtlbref_fun") //contains the matlab reference functions which not yet converted 
global("mtlbtool_fun")//contains the matlab  toolboxes functions  
global("not_mtlb_fun") // contains the not matlab functions

if ~exists('mtlbref_fun') then
  mtlb_fun=[]
end
if ~exists('mtlbtool_fun') then
  mtlbtool_fun=[]
end
if ~exists('not_mtlb_fun') then
  not_mtlb_fun=[]
end

name=tree.name

ispriminame=%f; 
//true if the name function is the name of scilab function primitive
if funptr(tree.name)<>0 then
  name1="%"+tree.name
  tree.name=name1
  ispriminame=%t;   
end  
//ismtlbfun is true if the the function is in a matlab toolboxe, mtlbpath is the path where is the function
[mtlbpath,ismtlbtoolfun]=mtlbtoolfun(name)
//Matlab reference functions
if or(name==not_yet_converted()) then
  set_infos("Matlab function "+name+" not yet converted, original calling sequence used",2)
  if ~or(name==mtlbref_fun(:,1)) then
    mtlbref_fun($+1,1)=name
    if ispriminame then
      mtlbref_fun($,2)=" (Warning name conflict: function name changed from "+name+" to "+name1+")"
    else
      mtlbref_fun($,2)=""
    end
  end   
  //Matlab toolboxes functions 
elseif ismtlbtoolfun then
  set_infos("Matlab toolbox(es) function "+name+" not converted, original calling sequence used",2)
  if ~or(name==mtlbtool_fun(:,1)) then
    mtlbtool_fun($+1,1)=name
    if ispriminame then
      mtlbtool_fun($,2)="(Warning Name conflict: function name changed from "+name+" to "+name1+", find this function in matlab/"+mtlbpath+")" 
    else
      mtlbtool_fun($,2)="(Find this function in "+"matlab/"+ mtlbpath+")"  
    end
  end 
elseif isdefinedvar(Variable(tree.name,Infer())) then
  operands=list()
  operands(1)=Variable(tree.name,Infer())
  for krhs=1:lstsize(tree.rhs)
    operands($+1)=tree.rhs(krhs)
  end
  tree=Operation("ext",operands,tree.lhs)
  tree=operation2sci(tree)

  //Not matlbb function
else 
  set_infos("Unknown function "+name+" not converted, original calling sequence used",2)  
  if ~or(name==not_mtlb_fun(:,1)) then
    not_mtlb_fun($+1,1)=name
    if ispriminame then 
      not_mtlb_fun($,2)="(Warning Name conflict: function name changed from "+name+" to "+name1+")"
    else
      not_mtlb_fun($,2)=""
    end
  end
end
if ispriminame then
  set_infos("Name conflict: function name changed from "+name+" to "+name1,0)
end
[tree]=sci_generic(tree)
endfunction