Interfacing function
eng


LCMODULO_f

File content


//LCMODULO_f Scicos left shift circulate
//integer modulo function block
//Classical interface function ver1.0 - scilab-2.7
//18 décembre 2003 - IRCOM GROUP - Author : A.Layec
function [x,y,typ]=LCMODULO_f(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;
   graphics=arg1.graphics;model=arg1.model;
   exprs=graphics.exprs;

   while %t do

      [ok,nbit,N,exprs]=getvalue(['Scicos Left Shift Circulate';...
      'Integer Modulo function block'],...
      ['Number of bit';'Number of shift'],...
      list('vec',-1,'vec',-1),exprs)

      if ~ok then break,end;

      if (size(nbit)==size(N)) then
        Nu=size(nbit,'*'); if Nu==0 then Nu=[],end

        if ok then
            graphics.exprs=exprs
            nbit=int(nbit(:))
            N=int(N(:))
            model.ipar=[nbit;N]
            model.in=Nu;model.out=Nu
            x.graphics=graphics;x.model=model
            break;
        end
      else
        message('All parameters must have the same size');
      end
   end

case 'define' then
  Nu=1
  nbit=4
  N=1

  model=scicos_model()
  model.sim=list('lcmodulo',2)
  model.in=Nu
  model.out=Nu
  model.evtin=[]
  model.evtout=[]
  model.dstate=[]
  model.rpar=[]
  model.ipar=[nbit;N]
  model.blocktype='d'
  model.firing=[]
  model.dep_ut=[%t %f]

  gr_i=['thick=xget(''thickness'')'
        'pat=xget(''pattern'')'
        'fnt=xget(''font'')'
        'xarrows(orig(1)+[0.496;0.497]*sz(1),orig(2)+[0.021;0.967]*sz(2),4,-1)'
        'xarrows(orig(1)+[0.015;0.99]*sz(1),orig(2)+[0.482;0.482]*sz(2),4,-1)'
        'xpoly(orig(1)+[0.021;0.065;0.065;0.374;0.374;0.621;0.621;0.911;0.911;0.958]*sz(1),orig(2)+[0.594;0.704;0.065;0.885;0.188;0.704;0.065;0.885;0.188;0.385]*sz(2),"'lines"')'
        'txt=''LCMODULO'';'
        'style=5;'
        'rectstr=stringbox(txt,orig(1),orig(2),0,style,1);'
        'w=(rectstr(1,3)-rectstr(1,2))*%zoom;'
        'h=(rectstr(2,2)-rectstr(2,4))*%zoom;'
        'xstringb(orig(1)+sz(1)/2-w/2,orig(2)-h-4,txt,w,h,''fill'');'
        'e=gce();'
        'e.font_style=style;'
        'xset(''thickness'',thick)'
        'xset(''pattern'',pat)'
        'xset(''font'',fnt(1),fnt(2))']
  exprs=[string(nbit);string(N)]
  x=standard_define([2 2],model,exprs,gr_i)
//   x.graphics.id="LCMODULO"
end
endfunction