File: clickin.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (86 lines) | stat: -rw-r--r-- 2,496 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
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
function [o,modified,newparameters,needcompile,edited]=clickin(o)
//  o             : structure of clicked object, may be modified
//  modified      : boolean, indicates if simulation time parameters
//                  have been changed
//  newparameters : only defined for super blocks, gives pointers to
//                  sub-blocks for which parameters or states have been changed
//  needcompile   : indicates if modification implies a new compilation
//!
// Copyright INRIA
modified=%f;newparameters=list();needcompile=0;
if o(1)=='Block' then
  model=o(3)
  if model(1)=='super' then
    lastwin=curwin
    curwin=get_new_window(windows)
    xset('window',curwin)
    execstr('scs_m_'+string(slevel)+'=scs_m')
    execstr('[o_n,needcompile,newparameters]='+o(5)+'(''set'',o)')
    //edited variable is returned by SUPER_f
    modified=prod(size(newparameters))>0
    curwin=lastwin
    xset('window',curwin)
    xselect()
  elseif model(1)=='csuper' then
    execstr('[o_n,needcompile,newparameters]='+o(5)+'(''set'',o)')
    modified=prod(size(newparameters))>0
    edited=modified
  else
    execstr('o_n='+o(5)+'(''set'',o)')
    edited=or(o<>o_n)
    model=o(3)
    model_n=o_n(3)
    modified=or(model(6)<>model_n(6))|..
	     or(model(7)<>model_n(7))|..
	     or(model(8)<>model_n(8))|..
	     or(model(9)<>model_n(9))

    if or(model(2)<>model_n(2))|or(model(3)<>model_n(3)) then  
      // input or output port sizes changed
      needcompile=1
    end
    if or(model(11)<>model_n(11))  then 
      // initexe changed
      needcompile=2
    end
    if model(1)=='input'|model(1)=='output' then
      if model(9)<>model_n(9) then
	needcompile=4
      end
    end
    if or(model(10)<>model_n(10))|or(model(12)<>model_n(12))  then 
      // type 'c','d','z','l' or dep_ut changed
      needcompile=4
    end
    if prod(size(model_n(1)))>1 then
      if model_n(1)(2)>1000 then  // Fortran or C Block
	if model(1)(1)<>model_n(1)(1) then  //function name has changed
	  needcompile=4
	end
      end
    end
  end
  o=o_n
elseif o(1)=='Link' then
  [nam,pos,ct]=o(5:7)
  Thick=pos(1)
  Type=pos(2)
  [ok,nam,Thick,Type]=getvalue('Link parameters',..
      ['Identification';
      'Thickness';
      'Type'],..
      list('str','1','vec','1','vec',1),[nam;string(Thick);string(Type)])
  if ok then
    edited=(o(5)<>nam)|(o(6)<>[Thick,Type]);
    o(5)=nam;o(6)=[Thick,Type];
  end
elseif o(1)=='Text' then
  execstr('o_n='+o(5)+'(''set'',o)')
  edited=or(o<>o_n)
  o=o_n
end