function [x,y,typ] = adc_dac_interf(job,arg1,arg2)
//zd&kc scicos-hdl 
x=[];y=[];typ=[];

select job
  
  case 'plot' then
      block_name=arg1.model.opar(1)
      standard_draw(arg1)
  case 'getinputs' then
      [x,y,typ]=standard_inputs(arg1)
     //    message('getinputs')
  case 'getoutputs' then
      [x,y,typ]=standard_outputs(arg1)
    //  message('getoutputs')
  case 'getorigin' then
      [x,y]=standard_origin(arg1)
      message('getorigin')
  case 'set' then
    
      global kczd_scicos_hdl_set ;    
      if  kczd_scicos_hdl_set ==0 then
          x = arg1;
          return;
      end
    
      x = arg1;
      graphics  = arg1.graphics 
      exprs1    = graphics.exprs
      model     = arg1.model

      while %t do
    //message('++')       
           [ok,exprs1] = getvalue('Set Parameters ','Parameters:', list('str',-1), exprs1)          
           //list('interf_name','sim_name',1,2); //2   
           if ~ok then
              break ; //** exit point 
           end
           //message(exprs1)
          // pause
           Parameters_BLOCK = list();
  
           execstr("Parameters_BLOCK=list("+exprs1+")");
          // message("!!")
          // pause
           //message(Parameters_BLOCK(1)+Parameters_BLOCK(2)+string(Parameters_BLOCK(3))+string(Parameters_BLOCK(4)))     
           
           nin=-ones(Parameters_BLOCK(3),1)             
           out=-ones(Parameters_BLOCK(4),1);         
               
           [model, graphics, ok] = check_io(model, graphics, nin, out, [], [])
           //message('~')
           if ~ok then
              break;
           end

           //xx1//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
           //1,['000'],3,1,8,"Selector2_1",['S';'D1';'D2'],['Y']
           //list('interf_name','sim_name',1,2); //2 
           if ok then                    
               IN_LONG=1
               KKKK_IN = ["[x,y,typ]=standard_inputs(o)"];         
               WORDHH ="1";              
               for ii=1:Parameters_BLOCK(3)
                    KKKK_IN_ii = "xstring(orig(1)+2,y("+ string(ii) +")-4 ,["""+  'in_'+string(ii)  +"""]);"           
                    KKKK_IN =[ KKKK_IN;KKKK_IN_ii;"e=gce();e.font_foreground=11;e.font_style=0;e.background=4;"]
          
                    if IN_LONG < length('in_'+string(ii)) then
                       IN_LONG = length('in_'+string(ii))
                    end
              end
       
              OUT_LONG = 1
              KKKK_OUT = ["[x,y,typ]=standard_outputs(o) "];
              for ii=1:Parameters_BLOCK(4)        
                  KKKK_OUT_ii = "xstring(orig(1)+sz(1)-5-"+ string(length('out_'+string(ii))*4 )  +",y("+ string(ii) +")-4 ,["""+ 'out_'+string(ii)   +"""]);"                             
                  KKKK_OUT =[ KKKK_OUT;KKKK_OUT_ii;"e=gce();e.font_foreground=11;e.font_style=0;e.background=4;"]        
                  if OUT_LONG < length('out_'+string(ii)) then
                     OUT_LONG = length('out_'+string(ii))
                 end         
              end                                  
             
               gr_i=[KKKK_IN ;KKKK_OUT]         
               graphics.gr_i =  gr_i
             
               if( Parameters_BLOCK(3)> Parameters_BLOCK(4)) then
                   graphics.sz(2)=12 * Parameters_BLOCK(3)+6 ;
               else
                   graphics.sz(2)=12 * Parameters_BLOCK(4)+6;
               end                           
               graphics.sz(1)= 5 * (OUT_LONG+ IN_LONG )+10 ;
                    
               if(graphics.sz(1)<30) then 
                  graphics.sz(1) =30
               end 
               
               model.sim=list(Parameters_BLOCK(2),5)
               model.opar=Parameters_BLOCK;
               graphics.exprs = exprs1 ;   
               graphics.id    = Parameters_BLOCK(1);
               x.graphics     = graphics;         
               x.model        = model; 
               //xx2///////////////////////////////////////////////////////////////////////////////////////////////////////////////////            
             break ; //** exit point 
         end 
   
      end //** of while input loop 
 
      case 'define' then
        block_name="ADC";
        exprs1=ascii(39)+'ADC_0_255'+ascii(39)+','+ascii(39)+'adc_0_255'+ascii(39)+',1,2';
        model = scicos_model();
        model.sim=list('adc_0_255',5) ; //** computational function type 5 (Scilab)
        model.in  = -1 ; //** default 2 inputs
        model.out =  [-1;-1;-1;-1;-1;-1;-1;-1] ; //** default one output      
        model.blocktype = 'c' ; //** continous block type 
        model.dep_ut = [%t %f] ;  
        model.opar =list('interf_name','sim_name',1,2)      
        exprs = exprs1   ;                 
                                          
         gr_i=['dx=10;dy=10;';
              'w=sz(1)-2*dx;h=sz(2)-2*dy;';
              'txt=block_name;'
              'xstringb(orig(1)+dx,orig(2)+dy,txt,w,h,''fill'');']
       
        x = standard_define([2 4], model, exprs, gr_i)
        
       // x.model.label = "IN=" + string(2) ; //** x.graphics.id ??

end //** of select 

endfunction
