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

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/CLOCK_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]=CLOCK_f(job,arg1,arg2)
2
 
// Copyright INRIA
3
 
x=[];y=[],typ=[]
4
 
select job
5
 
case 'plot' then
6
 
  standard_draw(arg1)
7
 
case 'getinputs' then
8
 
  [x,y,typ]=standard_inputs(arg1)
9
 
case 'getoutputs' then
10
 
  [x,y,typ]=standard_outputs(arg1)
11
 
case 'getorigin' then
12
 
  [x,y]=standard_origin(arg1)
13
 
case 'set' then
14
 
  path = 3
15
 
  newpar=list();
16
 
  xx=arg1(3)(8)(path)// get the evtdly block
17
 
  label=xx(2)(4)
18
 
  model=xx(3);
19
 
  t0_old=model(11)
20
 
  dt_old= model(8)
21
 
  model_n=model
22
 
  while %t do
23
 
    [ok,dt,t0,label]=getvalue('Set Clock  block parameters',..
24
 
        ['Period';'Init time'],list('vec',1,'vec',1),label)
25
 
    if ~ok then break,end
26
 
    if dt<=0 then
27
 
      message('period must be positive')
28
 
      ok=%f
29
 
    end
30
 
    if ok then
31
 
      xx(2)(4)=label
32
 
      model(8)=dt
33
 
      model(11)=t0
34
 
      xx(3)=model
35
 
      arg1(3)(8)(path)=xx// Update
36
 
      break
37
 
    end
38
 
  end
39
 
  if ~and([t0_old dt_old]==[t0 dt]) then 
40
 
    // parameter  changed
41
 
    newpar(size(newpar)+1)=path// Notify modification
42
 
  end
43
 
  if t0_old<>t0 then needcompile=2,else needcompile=0,end
44
 
  x=arg1
45
 
  y=needcompile
46
 
  typ=newpar
47
 
case 'define' then
48
 
x = list('Block',..
49
 
list([0,0],[2,2],%t,[],[],[],[],0,..
50
 
list(..
51
 
['wd=xget(''wdim'').*[1.016,1.12];';
52
 
'thick=xget(''thickness'');xset(''thickness'',2);';
53
 
'p=wd(2)/wd(1);p=1;';
54
 
'rx=sz(1)*p/2;ry=sz(2)/2;';
55
 
'xarcs([orig(1)+0.05*sz(1);';
56
 
'orig(2)+0.95*sz(2);';
57
 
'   0.9*sz(1)*p;';
58
 
'   0.9*sz(2);';
59
 
'   0;';
60
 
'   360*64],scs_color(5));';
61
 
'xset(''thickness'',1);';
62
 
'xx=[orig(1)+rx    orig(1)+rx;';
63
 
'    orig(1)+rx    orig(1)+rx+0.6*rx*cos(%pi/6)];';
64
 
'yy=[orig(2)+ry    orig(2)+ry ;';
65
 
'  orig(2)+1.8*ry  orig(2)+ry+0.6*ry*sin(%pi/6)];';
66
 
'xsegs(xx,yy,scs_color(10));';
67
 
'xset(''thickness'',thick);'],[])),..
68
 
list('csuper',[],[],[],1,[],' ',..
69
 
list(list([600,400,0,0],'foo',[],[]),..
70
 
list('Block',list([399,162],[20,20],%t,'1',[],[],6,[],[]),..
71
 
list('output',[],[],1,[],[],[],[],1,'d',[],[%f,%f],' ',list()),' ','CLKOUT_f'),..
72
 
list('Block',list([320,232],[40,40],%t,['0.1';'0.1'],[],[],7,4,..
73
 
['dt=model(8);';
74
 
'txt=[''Delay'';string(dt)];';
75
 
'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']),..
76
 
list('evtdly',[],[],1,1,[],[],0.1,[],'d',0.1,[%f,%f],' ',list()),' ','EVTDLY_f'),..
77
 
list('Link',[340;340;380.71066],[226.28571;172;172],'drawlink',' ',[0,0],[5,-1],[3,1],..
78
 
[5,1]),..
79
 
list('Block',list([380.71066;172],[1,1],%t,' ',[],[],4,[6;7]),..
80
 
list('lsplit',[],[],1,[1;1],[],[],[],[],'d',[-1,-1],[%t,%f],' ',list()),' ','CLKSPLIT_f'),..
81
 
list('Link',[380.71066;399],[172;172],'drawlink',' ',[0,0],[5,-1],[5,1],[2,1]),..
82
 
list('Link',[380.71066;380.71066;340;340],[172;301.9943;301.9943;277.71429],'drawlink',' ',..
83
 
[0,0],[5,-1],[5,2],[3,1])),[],'h',[],[%f,%f]),' ','CLOCK_f')
84
 
end