~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_files/sci_colordef.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [tree]=sci_colordef(tree)
 
2
// Copyright INRIA
 
3
// M2SCI function
 
4
// Conversion function for Matlab colordef()
 
5
// Input: tree = Matlab funcall tree
 
6
// Ouput: tree = Scilab equivalent for tree
 
7
// V.C.
 
8
 
 
9
if tree.lhs(1).name=="ans" then
 
10
  f=gettempvar()
 
11
else  
 
12
  f=tree.lhs(1)
 
13
end
 
14
 
 
15
// colordef color_option
 
16
if rhs==1 then
 
17
  if typeof(tree.rhs(1))=="cste" then
 
18
    if or(tree.rhs(1).value==["black","none"]) then
 
19
      insert(Equal(list(f),Funcall("gcf",1,list(),list())))
 
20
      LHS=Operation("ins",list(f,Cste("background")),list())
 
21
      insert(Equal(list(LHS),Cste(-1)))
 
22
      tree=list()
 
23
    elseif tree.rhs(1).value=="white" then
 
24
      insert(Equal(list(f),Funcall("gcf",1,list(),list())))
 
25
      LHS=Operation("ins",list(f,Cste("background")),list())
 
26
      insert(Equal(list(LHS),Cste(-2)))
 
27
      tree=list()
 
28
    else
 
29
      no_equiv(expression2code(tree))
 
30
    end
 
31
  else
 
32
    tree.name="mtlb_colordef"
 
33
  end
 
34
else
 
35
  // colordef('new',color_opt)
 
36
  if tree.rhs(1).vtype==String then
 
37
    winsid_funcall=Funcall("winsid",1,list(),list())
 
38
    max_funcall=Funcall("max",1,list(winsid_funcall),list())
 
39
    addition=Operation("+",list(max_funcall,Cste(1)),list())
 
40
    scf_funcall=Funcall("scf",1,list(addition),list())
 
41
    insert(Equal(list(f),scf_funcall))
 
42
    if or(tree.rhs(2).value==["black","none"]) then
 
43
      LHS=Operation("ins",list(f,Cste("background")),list())
 
44
      insert(Equal(list(LHS),Cste(-1)))
 
45
      tree=list()
 
46
    elseif tree.rhs(2).value=="white" then
 
47
      LHS=Operation("ins",list(f,Cste("background")),list())
 
48
      insert(Equal(list(LHS),Cste(-2)))
 
49
      tree=list()
 
50
    else
 
51
      no_equiv(expression2code(tree))
 
52
    end
 
53
    
 
54
// colordef(fig,color_opt)
 
55
elseif tree.rhs(1).vtype==Handle then
 
56
    f=tree.rhs(1)
 
57
    if or(tree.rhs(2).value==["black","none"]) then
 
58
      LHS=Operation("ins",list(f,Cste("background")),list())
 
59
      insert(Equal(list(LHS),Cste(-1)))
 
60
      if tree.lhs(1).name<>"ans" then
 
61
        insert(Equal(list(tree.lhs(1)),f))
 
62
      end
 
63
      tree=list()
 
64
    elseif tree.rhs(2).value=="white" then
 
65
      LHS=Operation("ins",list(f,Cste("background")),list())
 
66
      insert(Equal(list(LHS),Cste(-2)))
 
67
      if tree.lhs(1).name<>"ans" then
 
68
        insert(Equal(list(tree.lhs(1)),f))
 
69
      end
 
70
      tree=list()
 
71
    else
 
72
      no_equiv(expression2code(tree))
 
73
    end
 
74
  else
 
75
    tree.name="mtlb_colordef"
 
76
  end
 
77
end
 
78
 
 
79
endfunction