Xcos: remove hand-crafted scicos_block mlist 59/11559/3
Clément DAVID [Wed, 22 May 2013 10:21:36 +0000 (12:21 +0200)]
This only impacts unable to maintain composite blocks.

Change-Id: I4b0cd0e82eb7f983378513abd66c31351580edfc

scilab/modules/scicos_blocks/macros/Events/freq_div.sci
scilab/modules/scicos_blocks/macros/Misc/EDGE_TRIGGER.sci
scilab/modules/scicos_blocks/macros/Misc/Extract_Activation.sci
scilab/modules/scicos_blocks/macros/Sources/STEP_FUNCTION.sci
scilab/modules/xcos/etc/Xcos-style.xml

index e7ea60b..c344cb3 100644 (file)
 //
 
 function [x,y,typ]=freq_div(job,arg1,arg2)
-x=[];y=[],typ=[]
-select job
-case 'plot' then
-  standard_draw(arg1)
-case 'getinputs' then
-  [x,y,typ]=standard_inputs(arg1)
-case 'getoutputs' then
-  [x,y,typ]=standard_outputs(arg1)
-case 'getorigin' then
-  [x,y]=standard_origin(arg1)
-case 'set' then
-  // look for the modulo block
-  for i=1:length(arg1.model.rpar.objs) do
-    o = arg1.model.rpar.objs(i);
-    if typeof(o) == "Block" & o.gui == "Modulo_Count" then
-      path = i;
-      break;
+    x=[];y=[],typ=[]
+    select job
+    case "plot" then
+        standard_draw(arg1)
+    case "getinputs" then
+        [x,y,typ]=standard_inputs(arg1)
+    case "getoutputs" then
+        [x,y,typ]=standard_outputs(arg1)
+    case "getorigin" then
+        [x,y]=standard_origin(arg1)
+    case "set" then
+        // look for the modulo block
+        for i=1:length(arg1.model.rpar.objs) do
+            o = arg1.model.rpar.objs(i);
+            if typeof(o) == "Block" & o.gui == "Modulo_Count" then
+                path = i;
+                break;
+            end
+        end
+
+        // paths to updatable parameters or states
+        newpar=list();
+        y=0;
+        spath=list()
+        spath($+1)="model"
+        spath($+1)="rpar"
+        spath($+1)="objs"
+        spath($+1)=path
+
+        xx=arg1(spath)// get the block
+        //execstr('xxn='+xx.gui+'(''set'',xx)')
+        xxn=xx;
+        graphics=xx.graphics;exprs=graphics.exprs
+        model=xx.model;
+        while %t do
+            [ok,%ph,%df,exprs]=scicos_getvalue..
+            ("Set frequency division block parameters",..
+            ["Phase (0 to division factor -1)";"Division factor"],..
+            list("vec",1,"vec",1),exprs)
+            if ~ok then break,end
+            if ok then
+                if %df<1 then %df=1,end
+                %ph=abs(%ph)
+                if %ph>%df-1 then %ph=%df-1,end
+                graphics.exprs=exprs
+                model.ipar=%df;
+                model.dstate=%ph;
+                xxn.graphics=graphics;xxn.model=model
+                break
+            end
+        end
+
+
+        if diffobjs(xxn,xx) then
+            model=xx.model
+            model_n=xxn.model
+            if ~is_modelica_block(xx) then
+                modified=or(model.sim<>model_n.sim)|..
+                ~isequal(model.state,model_n.state)|..
+                ~isequal(model.dstate,model_n.dstate)|..
+                ~isequal(model.rpar,model_n.rpar)|..
+                ~isequal(model.ipar,model_n.ipar)|..
+                ~isequal(model.label,model_n.label)
+                if or(model.in<>model_n.in)|or(model.out<>model_n.out) then
+                    needcompile=1
+                end
+                if or(model.firing<>model_n.firing)  then
+                    needcompile=2
+                end
+                if model.sim=="input"|model.sim=="output" then
+                    if model.ipar<>model_n.ipar then
+                        needcompile=4
+                    end
+                end
+                if or(model.blocktype<>model_n.blocktype)|..
+                    or(model.dep_ut<>model_n.dep_ut)  then
+                    needcompile=4
+                end
+                if (model.nzcross<>model_n.nzcross)|(model.nmode<>model_n.nmode) then
+                    needcompile=4
+                end
+                if prod(size(model_n.sim))>1 then
+                    if model_n.sim(2)>1000 then
+                        if model.sim(1)<>model_n.sim(1) then
+                            needcompile=4
+                        end
+                    end
+                end
+            else
+                modified=or(model_n<>model)
+                eq=model.equations;eqn=model_n.equations;
+                if or(eq.model<>eqn.model)|or(eq.inputs<>eqn.inputs)|..
+                    or(eq.outputs<>eqn.outputs) then
+                    needcompile=4
+                end
+            end
+            // parameter or states changed
+            arg1(spath)=xxn// Update
+            newpar(size(newpar)+1)=1// Notify modification
+            y=max(y,needcompile)
+        end
+        x=arg1
+        typ=newpar
+    case "define" then
+        scs_m_1=scicos_diagram();
+        scs_m_1.objs(1) = Modulo_Count("define");
+        scs_m_1.objs(2) = CLKINV_f("define");
+        scs_m_1.objs(3) = CLKOUTV_f("define");
+        scs_m_1.objs(4) = IFTHEL_f("define");
+        scs_m_1.objs(5) = CLKSPLIT_f("define");
+        scs_m_1.objs(6) = scicos_link();
+        scs_m_1.objs(7) = scicos_link();
+        scs_m_1.objs(8) = scicos_link();
+        scs_m_1.objs(9) = scicos_link();
+        scs_m_1.objs(10) = scicos_link();
+
+        // Modulo_Count
+        blk = scs_m_1.objs(1);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [0 -100];
+        graphics.sz = [60 40];
+
+        graphics.exprs = ["0";"3"];
+        model.dstate = 3;
+        model.ipar = 3;
+
+        graphics.pout = 7;
+        graphics.pein = 10;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(1) = blk;
+
+        // CLKINV_f
+        blk = scs_m_1.objs(2);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [120 0];
+        graphics.sz = [20 20];
+
+        graphics.exprs = ["1"];
+        model.ipar = 1;
+
+        graphics.peout = 6;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(2) = blk;
+
+        // CLKOUTV_f
+        blk = scs_m_1.objs(3);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [130 -160];
+        graphics.sz = [20 20];
+
+        graphics.exprs = ["1"];
+        model.ipar = 1;
+
+        graphics.pein = 8;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(3) = blk;
+
+        // IFTHEL_f
+        blk = scs_m_1.objs(4);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [100 -100];
+        graphics.sz = [60 40];
+
+        graphics.exprs = ["1";"0"];
+        model.ipar = 1;
+
+        graphics.pin = 7;
+        graphics.pein = 9;
+        graphics.peout = [0;8];
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(4) = blk;
+
+        // CLKSPLIT_f
+        blk = scs_m_1.objs(5);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [127 -33];
+        graphics.sz = [7 7];
+
+        graphics.pein = 6;
+        graphics.peout = [9;10];
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(5) = blk;
+
+        // CLKINV_f -> CLKSPLIT_f
+        lnk = scs_m_1.objs(6);
+
+        lnk.ct = [5 -1];
+        lnk.from = [2 1 0];
+        lnk.to = [5 1 1];
+
+        scs_m_1.objs(6) = lnk;
+
+        // Modulo_Count -> IFTHEL_f
+        lnk = scs_m_1.objs(7);
+
+        lnk.from = [1 1 0];
+        lnk.to = [4 1 1];
+
+        scs_m_1.objs(7) = lnk;
+
+        // IFTHEL_f -> CLKOUTV_f
+        lnk = scs_m_1.objs(8);
+
+        lnk.ct = [5 -1];
+        lnk.from = [4 2 0];
+        lnk.to = [3 1 1];
+
+        scs_m_1.objs(8) = lnk;
+
+        // CLKSPLIT_f -> IFTHEL_f
+        lnk = scs_m_1.objs(9);
+
+        lnk.ct = [5 -1];
+        lnk.from = [5 1 0];
+        lnk.to = [4 1 1];
+
+        scs_m_1.objs(9) = lnk;
+
+        // CLKSPLIT_f -> Modulo_Count
+        lnk = scs_m_1.objs(10);
+
+        lnk.xx = [0 30 1];
+        lnk.yy = [0 -30 1];
+
+        lnk.ct = [5 -1];
+        lnk.from = [5 2 0];
+        lnk.to = [1 1 1];
+
+        scs_m_1.objs(10) = lnk;
+
+        clear blk lnk
+
+        model=scicos_model();
+        model.sim = "csuper";
+        model.evtin = 1;
+        model.evtout = 1;
+        model.rpar = scs_m_1;
+
+        gr_i="xstringb(orig(1),orig(2),''freq_div'',sz(1),sz(2),''fill'')";
+        x=standard_define([3 2],model,[],gr_i)
     end
-  end
-
- // paths to updatable parameters or states
- newpar=list();
- y=0;
- spath=list()
- spath($+1)='model'
- spath($+1)='rpar'
- spath($+1)='objs'
- spath($+1)=path
-
- xx=arg1(spath)// get the block
-              //execstr('xxn='+xx.gui+'(''set'',xx)')
- xxn=xx;
- graphics=xx.graphics;exprs=graphics.exprs
- model=xx.model;
- while %t do
-   [ok,%ph,%df,exprs]=scicos_getvalue..
-       ('Set frequency division block parameters',..
-       ['Phase (0 to division factor -1)';'Division factor'],..
-       list('vec',1,'vec',1),exprs)
-   if ~ok then break,end
-   if ok then
-     if %df<1 then %df=1,end
-     %ph=abs(%ph)
-     if %ph>%df-1 then %ph=%df-1,end
-     graphics.exprs=exprs
-     model.ipar=%df;
-     model.dstate=%ph;
-     xxn.graphics=graphics;xxn.model=model
-     break
-   end
- end
- if diffobjs(xxn,xx) then 
-   model=xx.model
-   model_n=xxn.model
-   if ~is_modelica_block(xx) then
-     modified=or(model.sim<>model_n.sim)|..
-             ~isequal(model.state,model_n.state)|..
-             ~isequal(model.dstate,model_n.dstate)|..
-             ~isequal(model.rpar,model_n.rpar)|..
-             ~isequal(model.ipar,model_n.ipar)|..
-             ~isequal(model.label,model_n.label)
-     if or(model.in<>model_n.in)|or(model.out<>model_n.out) then  
-       needcompile=1
-     end
-     if or(model.firing<>model_n.firing)  then 
-       needcompile=2
-     end
-     if model.sim=='input'|model.sim=='output' then
-       if model.ipar<>model_n.ipar then
-        needcompile=4
-       end
-     end
-     if or(model.blocktype<>model_n.blocktype)|..
-          or(model.dep_ut<>model_n.dep_ut)  then 
-       needcompile=4
-     end
-     if (model.nzcross<>model_n.nzcross)|(model.nmode<>model_n.nmode) then 
-       needcompile=4
-     end
-     if prod(size(model_n.sim))>1 then
-       if model_n.sim(2)>1000 then 
-        if model.sim(1)<>model_n.sim(1) then
-          needcompile=4
-        end
-       end
-     end
-   else 
-     modified=or(model_n<>model)
-     eq=model.equations;eqn=model_n.equations;
-     if or(eq.model<>eqn.model)|or(eq.inputs<>eqn.inputs)|..
-          or(eq.outputs<>eqn.outputs) then  
-       needcompile=4
-     end
-   end
-   // parameter or states changed
-   arg1(spath)=xxn// Update
-   newpar(size(newpar)+1)=1// Notify modification
-   y=max(y,needcompile)
- end
- x=arg1
- typ=newpar
- case 'define' then
-  scs_m_1=scicos_diagram()
-  scs_m_1.props=tlist(..
-["params","wpar","title","tol","tf","context","void1","options","void2","void3",..
-"doc"],[600,450,0,0,600,450],"freq_div",[0.0001,1.000E-06,1.000E-10,100001,0,0],100000," ",[],..
-tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
-list([5,1],[4,1]),[0.8,0.8,0.8]),[],[],list())
-scs_m_1.objs(1)=mlist(["Block","graphics","model","gui","doc"],..
-mlist(["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-"peout","gr_i","id","in_implicit","out_implicit"],..
-[60.518363,178.33333],[60,40],%t,0,["0";"3"],[],7,10,[],..
-             list(..
-        "xstringb(orig(1),orig(2),[''  Counter'';''Modulo ''+string(base)],sz(1),sz(2),''fill'');",..
-                8),"",[],"E"),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],list("modulo_count",4),[],[],1,1,[],1,1,[],[],0,list(),..
-                [],3,list(),..
-                "c",[],[%f,%f],"",0,0,list()),"Modulo_Count",list())
-scs_m_1.objs(2)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [215.37648,299.81481],[20,30],%t,0,"1",[],[],[],6,..
-                list(..
-                ["xo=orig(1);yo=orig(2)+sz(2)/3";
-                "xstringb(xo,yo,string(prt),sz(1),sz(2)/1.5)"],8),"",[],[]),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],"input",[],[],1,[],[],1,[],1,[],[],list(),[],1,..
-                list(),"d",-1,..
-                [%f,%f],"",0,0,list()),"CLKINV_f",list())
-scs_m_1.objs(3)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [221.30407,86.481481],[20,30],%t,0,"1",[],[],5,[],list(" ",8),"",..
-                [],[]),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],"output",[],[],1,[],[],1,1,[],[],[],list(),[],1,list(),"d",[],..
-                [%f,%f],"",0,0,list()),"CLKOUTV_f",list())
-scs_m_1.objs(4)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [193.14804,168.7037],[60,60],%t,0,["1";"0"],7,[],9,[0;5],..
-                list(..
-                ["txt=[''If in>0'';'' '';'' then    else''];";
-                "xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');"],8),"","E",..
-                []),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],list("ifthel",-1),1,[],1,[],[],1,1,[1;1],[],[],list(),..
-                [],[],list(),..
-                "l",[-1,-1],[%t,%f],"",0,0,list()),"IFTHEL_f",list())
-scs_m_1.objs(5)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [233.14804;231.30407],[162.98942;116.48148],"drawlink",[0,0],..
-                [5,-1],[4,2,0],[3,1,1])
-scs_m_1.objs(6)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [225.37648;224.29194],[299.81481;267.98739],"drawlink",[0,0],..
-                [5,-1],[2,1,0],[8,1,1])
-scs_m_1.objs(7)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [129.08979;184.57662],[198.33333;198.7037],"drawlink",[0,0],..
-                [1,1],[1,1,0],[4,1,1])
-scs_m_1.objs(8)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [224.29194;267.98739],[0.3333333,0.3333333],%t,0,[],[],[],6,[9;10],..
-                list([],8),"",[],[]),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],"split",[],[],1,[],[],1,1,[1;1],[],[],list(),..
-                [],[],list(),"d",..
-                [%f,%f,%f],[%f,%f],"",0,0,list()),"CLKSPLIT_f",list())
-scs_m_1.objs(9)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [224.29194;223.14804],[267.98739;234.41799],"drawlink",[0,0],..
-                [5,-1],[8,1,0],[4,1,1])
-scs_m_1.objs(10)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                 [224.29194;90.518363;90.518363],[267.98739;267.98739;224.04762],..
-                 "drawlink",[0,0],[5,-1],[8,2,0],[1,1,1])
-model = mlist(..
-["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-"state","dstate","odstate","rpar","ipar","opar","blocktype",..
-"firing","dep_ut","label","nzcross","nmode","equations"],"csuper",[],[],1,[],[],1,1,1,[],[],list(),..
-scs_m_1,[],list(),"h",[],[%f,%f],"",0,0,list())
-  gr_i='xstringb(orig(1),orig(2),''freq_div'',sz(1),sz(2),''fill'')';
-  x=standard_define([3 2],model,[],gr_i)
-end
 endfunction
+
index 34c55a0..ecaa05f 100644 (file)
 //
 
 function [x,y,typ]=EDGE_TRIGGER(job,arg1,arg2)
-x=[];y=[],typ=[]
-select job
-case 'plot' then
-  standard_draw(arg1)
-case 'getinputs' then
-  [x,y,typ]=standard_inputs(arg1)
-case 'getoutputs' then
-  [x,y,typ]=standard_outputs(arg1)
-case 'getorigin' then
-  [x,y]=standard_origin(arg1)
-case 'set' then
-  // look for the internal edge trigger block
-  for i=1:length(arg1.model.rpar.objs) do
-    o = arg1.model.rpar.objs(i);
-    if typeof(o) == "Block" & o.gui == "EDGETRIGGER" then
-      ppath = list(i);
-      break;
-    end
-  end
-  newpar=list();
-  y=0;
-  for path=ppath do
-    np=size(path,'*')
-    spath=list()
-    for k=1:np
-      spath($+1)='model'
-      spath($+1)='rpar'
-      spath($+1)='objs'
-      spath($+1)=path(k)
-    end
-    xx=arg1(spath)// get the block
-    execstr('xxn='+xx.gui+'(''set'',xx)')
-    if diffobjs(xxn,xx) then 
-       model=xx.model
-        model_n=xxn.model
-        if ~is_modelica_block(xx) then
-             modified=or(model.sim<>model_n.sim)|..
-            ~isequal(model.state,model_n.state)|..
-            ~isequal(model.dstate,model_n.dstate)|..
-            ~isequal(model.rpar,model_n.rpar)|..
-            ~isequal(model.ipar,model_n.ipar)|..
-            ~isequal(model.label,model_n.label)
-      if or(model.in<>model_n.in)|or(model.out<>model_n.out) then  
-         needcompile=1
-       end
-       if or(model.firing<>model_n.firing)  then 
-         needcompile=2
-       end
-       if (size(model.in,'*')<>size(model_n.in,'*'))|..
-        (size(model.out,'*')<>size(model_n.out,'*')) then  
-         needcompile=4  
-       end  
-       if model.sim=='input'|model.sim=='output' then
-         if model.ipar<>model_n.ipar then
-           needcompile=4
-         end
-       end
-       if or(model.blocktype<>model_n.blocktype)|..
-             or(model.dep_ut<>model_n.dep_ut)  then 
-         needcompile=4
-       end
-       if (model.nzcross<>model_n.nzcross)|(model.nmode<>model_n.nmode) then 
-         needcompile=4
-       end
-       if prod(size(model_n.sim))>1 then
-         if model_n.sim(2)>1000 then 
-           if model.sim(1)<>model_n.sim(1) then
-             needcompile=4
-           end
-         end
-       end
-      else 
-       modified=or(model_n<>model)
-       eq=model.equations;eqn=model_n.equations;
-       if or(eq.model<>eqn.model)|or(eq.inputs<>eqn.inputs)|..
-                                     or(eq.outputs<>eqn.outputs) then  
-         needcompile=4
-       end
-      end
-      // parameter or states changed
-      arg1(spath)=xxn// Update
-      newpar(size(newpar)+1)=path// Notify modification
-      y=max(y,needcompile)
+    x=[];y=[],typ=[]
+    select job
+    case "plot" then
+        standard_draw(arg1)
+    case "getinputs" then
+        [x,y,typ]=standard_inputs(arg1)
+    case "getoutputs" then
+        [x,y,typ]=standard_outputs(arg1)
+    case "getorigin" then
+        [x,y]=standard_origin(arg1)
+    case "set" then
+        // look for the internal edge trigger block
+        for i=1:length(arg1.model.rpar.objs) do
+            o = arg1.model.rpar.objs(i);
+            if typeof(o) == "Block" & o.gui == "EDGETRIGGER" then
+                ppath = list(i);
+                break;
+            end
+        end
+        newpar=list();
+        y=0;
+        for path=ppath do
+            np=size(path,"*")
+            spath=list()
+            for k=1:np
+                spath($+1)="model"
+                spath($+1)="rpar"
+                spath($+1)="objs"
+                spath($+1)=path(k)
+            end
+            xx=arg1(spath)// get the block
+            execstr("xxn="+xx.gui+"(''set'',xx)")
+            if diffobjs(xxn,xx) then
+                model=xx.model
+                model_n=xxn.model
+                if ~is_modelica_block(xx) then
+                    modified=or(model.sim<>model_n.sim)|..
+                    ~isequal(model.state,model_n.state)|..
+                    ~isequal(model.dstate,model_n.dstate)|..
+                    ~isequal(model.rpar,model_n.rpar)|..
+                    ~isequal(model.ipar,model_n.ipar)|..
+                    ~isequal(model.label,model_n.label)
+                    if or(model.in<>model_n.in)|or(model.out<>model_n.out) then
+                        needcompile=1
+                    end
+                    if or(model.firing<>model_n.firing)  then
+                        needcompile=2
+                    end
+                    if (size(model.in,"*")<>size(model_n.in,"*"))|..
+                        (size(model.out,"*")<>size(model_n.out,"*")) then
+                        needcompile=4
+                    end
+                    if model.sim=="input"|model.sim=="output" then
+                        if model.ipar<>model_n.ipar then
+                            needcompile=4
+                        end
+                    end
+                    if or(model.blocktype<>model_n.blocktype)|..
+                        or(model.dep_ut<>model_n.dep_ut)  then
+                        needcompile=4
+                    end
+                    if (model.nzcross<>model_n.nzcross)|(model.nmode<>model_n.nmode) then
+                        needcompile=4
+                    end
+                    if prod(size(model_n.sim))>1 then
+                        if model_n.sim(2)>1000 then
+                            if model.sim(1)<>model_n.sim(1) then
+                                needcompile=4
+                            end
+                        end
+                    end
+                else
+                    modified=or(model_n<>model)
+                    eq=model.equations;eqn=model_n.equations;
+                    if or(eq.model<>eqn.model)|or(eq.inputs<>eqn.inputs)|..
+                        or(eq.outputs<>eqn.outputs) then
+                        needcompile=4
+                    end
+                end
+                // parameter or states changed
+                arg1(spath)=xxn// Update
+                newpar(size(newpar)+1)=path// Notify modification
+                y=max(y,needcompile)
+            end
+        end
+        x=arg1
+        typ=newpar
+    case "define" then
+        scs_m_1=scicos_diagram();
+        scs_m_1.objs(1) = EDGETRIGGER("define");
+        scs_m_1.objs(2) = IFTHEL_f("define");
+        scs_m_1.objs(3) = IN_f("define");
+        scs_m_1.objs(4) = CLKOUTV_f("define");
+        scs_m_1.objs(5) = scicos_link();
+        scs_m_1.objs(6) = scicos_link();
+        scs_m_1.objs(7) = scicos_link();
+
+        // EDGETRIGGER
+        blk = scs_m_1.objs(1);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [60 0];
+        graphics.sz = [60 40];
+
+        graphics.exprs = "0";
+        model.ipar = 0;
+
+        graphics.pin = 5;
+        graphics.pout = 6;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(1) = blk;
+
+        // IFTHEL_f
+        blk = scs_m_1.objs(2);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [160 0];
+        graphics.sz = [60 40];
+
+        graphics.exprs = ["0";"0"];
+        model.evtin = [];
+        model.nzcross = 0;
+        model.nmode = 0;
+
+        graphics.pin = 6;
+        graphics.peout = [7;0];
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(2) = blk;
+
+        // IN_f
+        blk = scs_m_1.objs(3);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [0 10];
+        graphics.sz = [20 20];
+
+        graphics.exprs = ["1"];
+        model.ipar = 1;
+
+        graphics.pout = 5;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(3) = blk;
+
+        // CLKOUTV_f
+        blk = scs_m_1.objs(4);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [170 -60];
+        graphics.sz = [20 20];
+
+        graphics.exprs = ["1"];
+        model.ipar = 1;
+
+        graphics.pein = 7;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(4) = blk;
+
+        // IN_f -> EDGETRIGGER
+        lnk = scs_m_1.objs(5);
+
+        lnk.from = [3 1 0];
+        lnk.to = [1 1 1];
+
+        scs_m_1.objs(5) = lnk;
+
+        // EDGETRIGGER -> IFTHEL_f
+        lnk = scs_m_1.objs(6);
+
+        lnk.from = [1 1 0];
+        lnk.to = [2 1 1];
+
+        scs_m_1.objs(6) = lnk;
+
+        // IFTHEL_f -> CLKOUTV_f
+        lnk = scs_m_1.objs(7);
+
+        lnk.ct = [5 -1];
+        lnk.from = [2 1 0];
+        lnk.to = [4 1 1];
+
+        scs_m_1.objs(7) = lnk;
+
+        clear blk lnk
+
+        model=scicos_model();
+        model.sim = "csuper";
+        model.in = 1;
+        model.evtout = 1;
+        model.rpar = scs_m_1;
+
+        gr_i="xstringb(orig(1),orig(2),[''EDGE'';''TRIGGER''],sz(1),sz(2),''fill'')";
+        x=standard_define([3 2],model,[],gr_i)
     end
-  end
-  x=arg1
-  typ=newpar
-case 'define' then
-scs_m_1=scicos_diagram()
-scs_m_1.props=tlist(..
-["params","wpar","title","tol","tf","context","void1","options","void2","void3",..
-"doc"],[600,450,0,0,600,450],["EDGE_TRIGGER","./"],..
-[0.0001;1.000E-06;1.000E-10;100001;0;0;0],30," ",[],..
-tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
-list([5,1],[4,1]),[0.8,0.8,0.8]),[],[],list())
-scs_m_1.objs(1)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [288.58631,257.1131],[60,40],%t,0,"0",5,3,[],[],..
-                list(..
-                "xstringb(orig(1),orig(2),[''Edge'';''trigger''],sz(1),sz(2),''fill'');",..
-                8),"","E","E"),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],list("edgetrig",4),1,[],1,1,[],1,[],[],[],0,list(),..
-                [],0,list(),"c",..
-                [],[%t,%f],"",1,0,list()),"EDGETRIGGER",list())
-scs_m_1.objs(2)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [388.28869,247.1131],[60,60],%t,0,["0";"0"],3,[],[],[7;0],..
-                list(..
-                ["txt=[''If in>0'';'' '';'' then    else''];";
-                "xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');"],8),"","E",..
-                []),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],list("ifthel",-1),1,[],1,[],1,[],[],[1;1],[],[],list(),..
-                [],[],list(),"l",[-1,-1],[%t,%f],"",0,0,list()),"IFTHEL_f",list())
-scs_m_1.objs(3)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [357.15774;362.99107;379.71726],[277.1131;277.1131;277.1131],..
-                "drawlink",[0,0],[1,1],[1,1,0],[2,1,1])
-scs_m_1.objs(4)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [240.01488,267.1131],[20,20],%t,0,"1",[],5,[],[],list(" ",8),"",[],..
-                "E"),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],"input",[],[],1,-1,[],1,[],[],[],[],list(),[],1,list(),"c",[],..
-                [%f,%f],"",0,0,list()),"IN_f",list())
-scs_m_1.objs(5)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [260.01488;280.01488],[277.1131;277.1131],"drawlink",[0,0],[1,1],..
-                [4,1,0],[1,1,1])
-scs_m_1.objs(6)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [398.28869,181.39881],[20,30],%t,0,"1",[],[],7,[],list(" ",8),"",..
-                [],[]),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate",..
-                "rpar","ipar","opar","blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],"output",[],[],1,[],[],1,1,[],[],[],list(),[],1,list(),"d",[],..
-                [%f,%f],"",0,0,list()),"CLKOUTV_f",list())
-scs_m_1.objs(7)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [408.28869;408.28869],[241.39881;211.39881],"drawlink",[0,0],..
-                [5,-1],[2,1,0],[6,1,1])
-model = mlist(..
-["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-"state","dstate","odstate","rpar","ipar","opar","blocktype",..
-"firing","dep_ut","label","nzcross","nmode","equations"],"csuper",-1,[],1,[],[],1,[],1,[],[],list(),..
-scs_m_1,[],list(),"h",[],[%f,%f],"",0,0,list())
-  gr_i='xstringb(orig(1),orig(2),[''EDGE'';''TRIGGER''],sz(1),sz(2),''fill'')';
-  x=standard_define([3 2],model,[],gr_i)
-end
 endfunction
+
index b47c491..849f68c 100644 (file)
 //
 
 function [x,y,typ]=Extract_Activation(job,arg1,arg2)
-x=[];y=[],typ=[]
-select job
-case 'plot' then
-  standard_draw(arg1)
-case 'getinputs' then
-  [x,y,typ]=standard_inputs(arg1)
-case 'getoutputs' then
-  [x,y,typ]=standard_outputs(arg1)
-case 'getorigin' then
-  [x,y]=standard_origin(arg1)
-case 'set' then
- x=arg1
-case 'define' then
-scs_m_1=scicos_diagram()
-scs_m_1.props=tlist(..
-["params","wpar","title","tol","tf","context","void1","options","void2","void3",..
-"doc"],[600,450,0,0,600,450],["Extract_Activation","./"],..
-[0.0001;1.000E-06;1.000E-10;100001;0;0;0],30," ",[],..
-tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
-list([5,1],[4,1]),[0.8,0.8,0.8]),[],[],list())
-scs_m_1.objs(1)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [150.65045,143.82208],[60,60],%t,["0";"0"],6,[],[],[3;4],..
-                list(..
-                ["txt=[''If in>0'';'' '';'' then    else''];";
-                "xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');"],8),"","E",..
-                []),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate","rpar","ipar","opar",..
-                "blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],list("ifthel",-1),1,[],1,[],[],1,[],[1;1],[],[],..
-                list(),[],[],list(),..
-                "l",[-1,-1],[%t,%f],"",0,0,list()),"IFTHEL_f",list())
-scs_m_1.objs(2)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [169.82143,96.146231],[16.666667,16.666667],%t,[],[],[],[3;4;0],..
-                8,..
-                list(..
-                ["rx=sz(1)*p/2;ry=sz(2)/2";
-                "xsegs(orig(1)+rx*[1/2.3 1;2-1/2.3 1],orig(2)+ry*[1 2-1/2.3;1,1/2.3],0)"],..
-                8),"",[],[]),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate","rpar","ipar","opar",..
-                "blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],"sum",[],[],1,[],[],1,[1;1;1],1,[],[],list(),[],[],..
-                list(),"d",-1,..
-                [%f,%f],"",0,0,list()),"CLKSOMV_f",list())
-scs_m_1.objs(3)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [170.65045;170.65045;150.04302;150.04302;169.82143],..
-                [138.10779;128.235;128.235;104.47956;104.47956],"drawlink",[0,0],..
-                [5,-1],[1,1,0],[2,1,1])
-scs_m_1.objs(4)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [190.65045;190.65045;178.15476],[138.10779;111.55729;112.8129],..
-                "drawlink",[0,0],[5,-1],[1,2,0],[2,2,1])
-scs_m_1.objs(5)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [102.07902,163.82208],[20,20],%t,"1",[],6,[],[],list(" ",8),"",..
-                [],"E"),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate","rpar","ipar","opar",..
-                "blocktype","firing","dep_ut","label","nzcross",..
-                "nmode","equations"],"input",[],[],1,-1,[],1,[],[],[],[],list(),[],1,list(),..
-                "c",[],..
-                [%f,%f],"",0,0,list()),"IN_f",list())
-scs_m_1.objs(6)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [122.07902;142.07902],[173.82208;173.82208],"drawlink",[0,0],..
-                [1,1],[5,1,0],[1,1,1])
-scs_m_1.objs(7)=mlist(["Block","graphics","model","gui","doc"],..
-                mlist(..
-                ["graphics","orig","sz","flip","exprs","pin","pout","pein",..
-                "peout","gr_i","id","in_implicit","out_implicit"],..
-                [168.15476,38.527183],[20,30],%t,"1",[],[],8,[],list(" ",8),"",..
-                [],[]),..
-                mlist(..
-                ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-                "state","dstate","odstate","rpar","ipar","opar","blocktype","firing",..
-                "dep_ut","label","nzcross",..
-                "nmode","equations"],"output",[],[],1,[],[],1,1,[],[],[],list(),[],1,list(),"d",[],..
-                [%f,%f],"",0,0,list()),"CLKOUTV_f",list())
-scs_m_1.objs(8)=mlist(["Link","xx","yy","id","thick","ct","from","to"],..
-                [178.15476;178.15476],[98.527183;68.527183],"drawlink",[0,0],..
-                [5,-1],[2,1,0],[7,1,1])
-model = mlist(..
-["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout",..
-"state","dstate","odstate","rpar","ipar","opar","blocktype",..
-"firing","dep_ut","label","nzcross","nmode","equations"],"csuper",-1,[],1,[],[],1,[],1,[],[],list(),..
-scs_m_1,[],list(),"h",[],[%f,%f],"",0,0,list())
-  gr_i='xstringb(orig(1),orig(2),[''Extract'';''Activation''],sz(1),sz(2),''fill'')';
-  x=standard_define([3 2],model,[],gr_i)
-end
-endfunction
\ No newline at end of file
+    x=[];y=[],typ=[]
+    select job
+    case "plot" then
+        standard_draw(arg1)
+    case "getinputs" then
+        [x,y,typ]=standard_inputs(arg1)
+    case "getoutputs" then
+        [x,y,typ]=standard_outputs(arg1)
+    case "getorigin" then
+        [x,y]=standard_origin(arg1)
+    case "set" then
+        x=arg1
+    case "define" then
+        scs_m_1=scicos_diagram();
+        scs_m_1.objs(1) = IFTHEL_f("define");
+        scs_m_1.objs(2) = CLKSOMV_f("define");
+        scs_m_1.objs(3) = IN_f("define");
+        scs_m_1.objs(4) = CLKOUTV_f("define");
+        scs_m_1.objs(5) = scicos_link();
+        scs_m_1.objs(6) = scicos_link();
+        scs_m_1.objs(7) = scicos_link();
+        scs_m_1.objs(8) = scicos_link();
+
+        // IFTHEL_f
+        blk = scs_m_1.objs(1);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [80 0];
+        graphics.sz = [60 40];
+
+        graphics.exprs = ["0";"0"];
+        model.evtin = [];
+        model.nzcross = 0;
+        model.nmode = 0;
+
+        graphics.pin = 7;
+        graphics.peout = [5;6];
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(1) = blk;
+
+        // CLKSOMV_f
+        blk = scs_m_1.objs(2);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [80 -80];
+        graphics.sz = [80 40];
+
+        graphics.pein = [5;6];
+        graphics.peout = 8;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(2) = blk;
+
+        // IN_f
+        blk = scs_m_1.objs(3);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [0 10];
+        graphics.sz = [20 20];
+
+        graphics.exprs = ["1"];
+        model.ipar = 1;
+
+        graphics.pout = 7;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(3) = blk;
+
+        // CLKOUTV_f
+        blk = scs_m_1.objs(4);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [110 -140];
+        graphics.sz = [20 20];
+
+        graphics.exprs = ["1"];
+        model.ipar = 1;
+
+        graphics.pein = 8;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(4) = blk;
+
+        // IFTHEL_f -> CLKSOMV_f
+        lnk = scs_m_1.objs(5);
+
+        lnk.ct = [5 -1];
+        lnk.from = [1 1 0];
+        lnk.to = [2 1 1];
+
+        scs_m_1.objs(5) = lnk;
+
+        // IFTHEL_f -> CLKSOMV_f
+        lnk = scs_m_1.objs(6);
+
+        lnk.ct = [5 -1];
+        lnk.from = [1 2 0];
+        lnk.to = [2 2 1];
+
+        scs_m_1.objs(6) = lnk;
+
+        // IN_f -> IFTHEL_f
+        lnk = scs_m_1.objs(7);
+
+        lnk.from = [3 1 0];
+        lnk.to = [1 1 1];
+
+        scs_m_1.objs(7) = lnk;
+
+        // CLKSOMV_f -> CLKOUTV_f
+        lnk = scs_m_1.objs(8);
+
+        lnk.ct = [5 -1];
+        lnk.from = [2 1 0];
+        lnk.to = [4 1 1];
+
+        scs_m_1.objs(8) = lnk;
+
+        clear blk lnk
+
+        model=scicos_model();
+        model.sim = "csuper";
+        model.evtin = 1;
+        model.evtout = 1;
+        model.rpar = scs_m_1;
+
+        gr_i="xstringb(orig(1),orig(2),[''Extract'';''Activation''],sz(1),sz(2),''fill'')";
+        x=standard_define([3 2],model,[],gr_i)
+    end
+endfunction
+
index 5ee28f4..d38c287 100644 (file)
 //
 
 function [x,y,typ]=STEP_FUNCTION(job,arg1,arg2)
-x=[];y=[],typ=[]
-select job
-case 'plot' then
-  standard_draw(arg1)
-case 'getinputs' then
-  [x,y,typ]=standard_inputs(arg1)
-case 'getoutputs' then
-  [x,y,typ]=standard_outputs(arg1)
-case 'getorigin' then
-  [x,y]=standard_origin(arg1)
-case 'set' then
-  // look for the internal edge trigger block
-  for i=1:length(arg1.model.rpar.objs) do
-    o = arg1.model.rpar.objs(i);
-    if typeof(o) == "Block" & o.gui == "STEP" then
-      ppath = list(i);
-      break;
-    end
-  end
-  newpar=list();
-  for path=ppath do
-    np=size(path,'*')
-    spath=list()
-    for k=1:np
-      spath($+1)='model'
-      spath($+1)='rpar'
-      spath($+1)='objs'
-      spath($+1)=path(k)
-    end
-    xx=arg1(spath)// get the block
-    execstr('xxn='+xx.gui+'(''set'',xx)')
-
-    if diffobjs(xxn,xx) then 
-      model=xx.model
-      model_n=xxn.model
-      if ~is_modelica_block(xx) then
-       modified=or(model.sim<>model_n.sim)|..
-                ~isequal(model.state,model_n.state)|..
-                ~isequal(model.dstate,model_n.dstate)|..
-                ~isequal(model.rpar,model_n.rpar)|..
-                ~isequal(model.ipar,model_n.ipar)|..
-                ~isequal(model.label,model_n.label)
-       if or(model.in<>model_n.in)|or(model.out<>model_n.out) then  
-         // input or output port sizes changed
-         needcompile=1
-       end
-       if or(model.firing<>model_n.firing)  then 
-         // initexe changed
-         needcompile=2
-       end
-       if model.sim=='input'|model.sim=='output' then
-         if model.ipar<>model_n.ipar then
-           needcompile=4
-         end
-       end
-       if or(model.blocktype<>model_n.blocktype)|..
-             or(model.dep_ut<>model_n.dep_ut)  then 
-         // type 'c','d','z','l' or dep_ut changed
-         needcompile=4
-       end
-       if (model.nzcross<>model_n.nzcross)|(model.nmode<>model_n.nmode) then 
-         // size of zero cross changed
-         needcompile=4
-       end
-       if prod(size(model_n.sim))>1 then
-         if model_n.sim(2)>1000 then  // Fortran or C Block
-           if model.sim(1)<>model_n.sim(1) then  //function name has changed
-             needcompile=4
-           end
-         end
-       end
-      else //implicit block
-       //force compilation if an implicit block has been edited
-       modified=or(model_n<>model)
-       eq=model.equations;eqn=model_n.equations;
-       if or(eq.model<>eqn.model)|or(eq.inputs<>eqn.inputs)|..
-                                     or(eq.outputs<>eqn.outputs) then  
-         needcompile=4
-       end
-      end
-      
-      // parameter or states changed
-      arg1(spath)=xxn// Update
-      newpar(size(newpar)+1)=path// Notify modification
+    x=[];y=[],typ=[]
+    select job
+    case "plot" then
+        standard_draw(arg1)
+    case "getinputs" then
+        [x,y,typ]=standard_inputs(arg1)
+    case "getoutputs" then
+        [x,y,typ]=standard_outputs(arg1)
+    case "getorigin" then
+        [x,y]=standard_origin(arg1)
+    case "set" then
+        // look for the internal edge trigger block
+        for i=1:length(arg1.model.rpar.objs) do
+            o = arg1.model.rpar.objs(i);
+            if typeof(o) == "Block" & o.gui == "STEP" then
+                ppath = list(i);
+                break;
+            end
+        end
+        newpar=list();
+        for path=ppath do
+            np=size(path,"*")
+            spath=list()
+            for k=1:np
+                spath($+1)="model"
+                spath($+1)="rpar"
+                spath($+1)="objs"
+                spath($+1)=path(k)
+            end
+            xx=arg1(spath)// get the block
+            execstr("xxn="+xx.gui+"(''set'',xx)")
+
+            if diffobjs(xxn,xx) then
+                model=xx.model
+                model_n=xxn.model
+                if ~is_modelica_block(xx) then
+                    modified=or(model.sim<>model_n.sim)|..
+                    ~isequal(model.state,model_n.state)|..
+                    ~isequal(model.dstate,model_n.dstate)|..
+                    ~isequal(model.rpar,model_n.rpar)|..
+                    ~isequal(model.ipar,model_n.ipar)|..
+                    ~isequal(model.label,model_n.label)
+                    if or(model.in<>model_n.in)|or(model.out<>model_n.out) then
+                        // input or output port sizes changed
+                        needcompile=1
+                    end
+                    if or(model.firing<>model_n.firing)  then
+                        // initexe changed
+                        needcompile=2
+                    end
+                    if model.sim=="input"|model.sim=="output" then
+                        if model.ipar<>model_n.ipar then
+                            needcompile=4
+                        end
+                    end
+                    if or(model.blocktype<>model_n.blocktype)|..
+                        or(model.dep_ut<>model_n.dep_ut)  then
+                        // type 'c','d','z','l' or dep_ut changed
+                        needcompile=4
+                    end
+                    if (model.nzcross<>model_n.nzcross)|(model.nmode<>model_n.nmode) then
+                        // size of zero cross changed
+                        needcompile=4
+                    end
+                    if prod(size(model_n.sim))>1 then
+                        if model_n.sim(2)>1000 then  // Fortran or C Block
+                            if model.sim(1)<>model_n.sim(1) then  //function name has changed
+                                needcompile=4
+                            end
+                        end
+                    end
+                else //implicit block
+                    //force compilation if an implicit block has been edited
+                    modified=or(model_n<>model)
+                    eq=model.equations;eqn=model_n.equations;
+                    if or(eq.model<>eqn.model)|or(eq.inputs<>eqn.inputs)|..
+                        or(eq.outputs<>eqn.outputs) then
+                        needcompile=4
+                    end
+                end
+
+                // parameter or states changed
+                arg1(spath)=xxn// Update
+                newpar(size(newpar)+1)=path// Notify modification
+            end
+        end
+        x=arg1
+        y=needcompile
+        typ=newpar
+    case "define" then
+        scs_m_1=scicos_diagram();
+        scs_m_1.objs(1) = STEP("define");
+        scs_m_1.objs(2) = OUT_f("define");
+        scs_m_1.objs(3) = scicos_link();
+        scs_m_1.objs(4) = scicos_link();
+
+        // STEP
+        blk = scs_m_1.objs(1);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [0 0];
+        graphics.sz = [40 40];
+
+        graphics.pein = 4;
+        graphics.peout = 4;
+        graphics.pout = 3;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(1) = blk;
+
+        // OUT_f
+        blk = scs_m_1.objs(2);
+        graphics = blk.graphics;
+        model = blk.model;
+
+        graphics.orig = [80 10];
+        graphics.sz = [20 20];
+
+        graphics.exprs = ["1"];
+        model.ipar = 1;
+
+        graphics.pin = 3;
+
+        blk.graphics = graphics;
+        blk.model = model;
+        scs_m_1.objs(2) = blk;
+
+        // STEP -> OUT_f
+        lnk = scs_m_1.objs(3);
+
+        lnk.from = [1 1 0];
+        lnk.to = [2 1 1];
+
+        scs_m_1.objs(3) = lnk;
+
+        // STEP -> STEP
+        lnk = scs_m_1.objs(4);
+
+        lnk.xx = [0 20  -20 -20 20 1];
+        lnk.yy = [0 -20 -20  60 60 1];
+
+        lnk.ct = [5 -1];
+        lnk.from = [1 1 0];
+        lnk.to = [1 1 1];
+
+        scs_m_1.objs(4) = lnk;
+
+        clear blk lnk
+
+        model=scicos_model();
+        model.sim = "csuper";
+        model.in = 1;
+        model.evtout = 1;
+        model.rpar = scs_m_1;
+
+        gr_i=[  "thick=xget(''thickness'')"
+        "pat=xget(''pattern'')"
+        "fnt=xget(''font'')"
+        "xpoly(orig(1)+[0.071;0.413;0.413;0.773]*sz(1),orig(2)+[0.195;0.195;0.635;0.635]*sz(2),'"lines"')";
+        "xset(''thickness'',thick)"
+        "xset(''pattern'',pat)"
+        "xset(''font'',fnt(1),fnt(2))"]
+        x=standard_define([2 2],model,[],gr_i)
     end
-  end
-  x=arg1
-  y=needcompile
-  typ=newpar
-case 'define' then
-scs_m=scicos_diagram(..
-);
-  model = mlist(..
-  ['model','sim','in','in2','intyp','out','out2','outtyp','evtin','evtout','state','dstate',..
-  'odstate','rpar','ipar','opar','blocktype','firing','dep_ut','label','nzcross','nmode','equations'],..
-  'csuper',[],[],1,-1,[],1,[],[],[],[],list(),..
-  mlist(['diagram','props','objs'],..
-  tlist(..
-  ['params','wpar','title','tol','tf','context','void1','options','void2','void3','doc'],..
-  [600,450,0,0,600,450],['STEP_FUNCTION','./'],[0.0001;1.000E-06;1.000E-10;100001;0;0],14,..
-  ' ',[],..
-  tlist(['scsopt','3D','Background','Link','ID','Cmap'],list(%t,33),[8,1],[1,5],..
-  list([5,0],[4,0]),[0.8,0.8,0.8]),[],[],list()),..
-  list(..
-  mlist(['Block','graphics','model','gui','doc'],..
-  mlist(..
-  ['graphics','orig','sz','flip','theta','exprs','pin','pout','pein','peout','gr_i','id',..
-  'in_implicit','out_implicit'],[82.230597,652.6813],[40,40],%t,0,['1';'0';'1'],[],4,2,2,..
-  list(['txt=[''Step''];';'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');'],8),..
-  emptystr(),[],[]),..
-  mlist(..
-  ['model','sim','in','in2','intyp','out','out2','outtyp','evtin','evtout','state','dstate',..
-  'odstate','rpar','ipar','opar','blocktype','firing','dep_ut','label','nzcross','nmode','equations'],..
-  list('step_func',4),[],[],1,1,[],1,1,1,[],..
-  [],list(),[0;1],[],list(),'c',1,[%f,%t],emptystr(),0,0,list()),'STEP',list()),..
-  mlist(['Link','xx','yy','id','thick','ct','from','to'],..
-  [102.2306;102.2306;63.708992;63.708992;102.2306;102.2306],..
-  [646.96701;622.2884;622.2884;711.98452;711.98452;698.39559],'drawlink',[0,0],[5,-1],..
-  [1,1,0],[1,1,1]),..
-  mlist(['Block','graphics','model','gui','doc'],..
-  mlist(..
-  ['graphics','orig','sz','flip','theta','exprs','pin','pout','pein','peout','gr_i','id',..
-  'in_implicit','out_implicit'],[150.80203,662.6813],[20,20],%t,0,'1',4,[],[],[],list(' ',8),..
-  emptystr(),[],[]),..
-  mlist(..
-  ['model','sim','in','in2','intyp','out','out2','outtyp','evtin','evtout','state','dstate',..
-  'odstate','rpar','ipar','opar','blocktype','firing','dep_ut','label','nzcross','nmode','equations'],..
-  'output',-1,[],1,[],[],1,[],[],[],[],list(),[],1,list(),..
-  'c',[],[%f,%f],emptystr(),0,0,list()),'OUT_f',list()),..
-  mlist(['Link','xx','yy','id','thick','ct','from','to'],[130.80203;150.80203],..
-  [672.6813;672.6813],'drawlink',[0,0],[1,1],[1,1,0],[3,1,1]))),[],list(),'h',[],[%f,%f],emptystr(),..
-  0,0,list())
-  gr_i=[  'thick=xget(''thickness'')'
-         'pat=xget(''pattern'')'
-         'fnt=xget(''font'')'
-         'xpoly(orig(1)+[0.071;0.413;0.413;0.773]*sz(1),orig(2)+[0.195;0.195;0.635;0.635]*sz(2),'"lines"')';
-         'xset(''thickness'',thick)'
-         'xset(''pattern'',pat)'
-         'xset(''font'',fnt(1),fnt(2))']
-  x=standard_define([2 2],model,[],gr_i)
-end
 endfunction
+
index 9082084..28c3421 100644 (file)
     <add as="STEP_FUNCTION" extend="Icon">
         <add as="image" value="$SCILAB/modules/xcos/images/blocks/STEP_FUNCTION.svg"/>
     </add>
+    <add as="STEP" extend="Icon">
+        <add as="image" value="$SCILAB/modules/xcos/images/blocks/STEP_FUNCTION.svg"/>
+    </add>
     <add as="PULSE_SC" extend="Icon">
         <add as="image" value="$SCILAB/modules/xcos/images/blocks/PULSE_SC.svg"/>
     </add>