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

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/IN_f.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 [x,y,typ]=IN_f(job,arg1,arg2)
2
 
// Copyright INRIA
3
 
x=[];y=[];typ=[]
4
 
select job
5
 
case 'plot' then
6
 
  graphics=arg1(2); [orig,sz,orient]=graphics(1:3)
7
 
  model=arg1(3);prt=model(9)
8
 
  pat=xget('pattern');xset('pattern',default_color(1))
9
 
  thick=xget('thickness');xset('thickness',2)
10
 
  if orient then
11
 
    x=orig(1)+sz(1)*[-1/6;-1/6;1/1.5;1;1/1.5]
12
 
    y=orig(2)+sz(2)*[0;1;1; 1/2;0]
13
 
    xo=orig(1);yo=orig(2)
14
 
  else
15
 
    x=orig(1)+sz(1)*[0;1/3;7/6;7/6;1/3]
16
 
    y=orig(2)+sz(2)*[1/2;1;1;0;0]
17
 
    xo=orig(1)+sz(1)/3;yo=orig(2)
18
 
  end
19
 
  gr_i=arg1(2)(9);
20
 
  if type(gr_i)==15 then 
21
 
    coli=gr_i(2);pcoli=xget('pattern')
22
 
    xfpolys(x,y,coli);
23
 
    xset('pattern',coli)
24
 
    xstringb(xo,yo,string(prt),sz(1)/1.5,sz(2))
25
 
    xset('pattern',pcoli)
26
 
    xstringb(xo,yo,string(prt),sz(1)/1.5,sz(2))
27
 
  else
28
 
    xstringb(xo,yo,string(prt),sz(1)/1.5,sz(2))
29
 
    xpoly(x,y,'lines',1)
30
 
  end
31
 
  xset('thickness',thick)
32
 
  xset('pattern',pat)
33
 
  
34
 
  if size(arg1(3)) >= 15 then
35
 
    ident = arg1(3)(15)
36
 
  else
37
 
    ident = []
38
 
  end
39
 
  if ident <> [] then
40
 
    font=xget('font')
41
 
    xset('font', options('ID')(1)(1), options('ID')(1)(2))
42
 
    rectangle = xstringl(orig(1)+3/2*sz(1), orig(2), ident)
43
 
    w = rectangle(3)
44
 
    h = rectangle(4)
45
 
    xstringb(orig(1) - sz(1) /2 - w, orig(2) + sz(2) * 0.5 , ident , w, h)
46
 
    xset('font', font(1), font(2))
47
 
  end
48
 
  x=[];y=[]
49
 
case 'getinputs' then
50
 
  x=[];y=[];typ=[]
51
 
case 'getoutputs' then
52
 
  graphics=arg1(2)
53
 
  [orig,sz,orient]=graphics(1:3)
54
 
  if orient then
55
 
    x=orig(1)+sz(1)
56
 
    y=orig(2)+sz(2)/2
57
 
  else
58
 
    x=orig(1)
59
 
    y=orig(2)+sz(2)/2
60
 
  end
61
 
  typ=ones(x)
62
 
case 'getorigin' then
63
 
  [x,y]=standard_origin(arg1)
64
 
case 'set' then
65
 
  x=arg1;
66
 
  [graphics,model]=arg1(2:3);
67
 
  label=graphics(4);
68
 
  if size(label,'*')==2 then label=label(1),end //compatibility
69
 
  while %t do
70
 
    [ok,prt,label]=getvalue('Set Input block parameters',..
71
 
        'Port number',list('vec',1),label)
72
 
    if ~ok then break,end
73
 
    prt=int(prt)
74
 
    if prt<=0 then
75
 
      message('Port number must be a positive integer')
76
 
    else
77
 
      if model(9)<>prt then needcompile=4;y=needcompile,end
78
 
      model(9)=prt
79
 
      model(11)=[];model(3)=-1//compatibility
80
 
      graphics(4)=label
81
 
      x(2)=graphics
82
 
      x(3)=model
83
 
      break
84
 
    end
85
 
  end
86
 
case 'define' then
87
 
  in=-1
88
 
  prt=1
89
 
  model=list('input',[],-1,[],[],[],[],[],[1],'c',[],[%f %f],' ',list())
90
 
  label='1'
91
 
  gr_i=' '
92
 
  x=standard_define([1 1],model,label,gr_i)
93
 
end
94
 
 
95