function [stat,post] = blkquant(path,prop,bstr,bint,bflt,parent,name,catalog,ws,node)
%BLKQUANT This block quantizes input according to a given resolution and type of quantization.
%
% See also BLKPRELOAD.

% Initial coding by A S Bozin, 7-1-97
% Copyright 1997-2000 The MathWorks, Inc.
% $Revision: 1.8 $ $Date: 2000/06/14 16:10:34 $

   stat = 0;			   		   % Error flag
   nInputs = bint(5);
   nOutputs = bint(6);
   %
   % Add mux and demux blocks if necessary
   %
   [post,rect] = blkio('port',nInputs,nOutputs,prop,path);
   %
   % Get the quantization block parameters
   %
   indStr = bint(17)+1;
   indInt = bint(15)+1;
   npar = 1;
   symInd = zeros(1,npar);
   mode = bint(indInt);
   if (bitand(mode,16))
      indInt = indInt+2;
      iRange = 1:bint(indInt);
      symInd(bint(indInt+iRange)) = 1;
   end
   str = cell(npar,1);
   for (k = find(symInd))
      ind = mfindstr(bstr,indStr,'|');
      str{k} = bstr(indStr:ind-1);
      indStr = ind+1;
   end
   indInt = bint(18)+1;
   indInt = bint(indInt)+indInt;		   % Skip icon data
   indTyp = bint(indInt);
   typ = {'round';'truncate';'floor';'ceil'};
   %
   % Get the block parameter variables
   %
   [symInd,str] = mgetscope(symInd,str,catalog,ws,node);
   indFlt = bint(19);
   pLen = zeros(npar,1)+nInputs;
   ub = cumsum(pLen);
   lb = [0;ub(1:end-1)]+1;
   for (k = find(~symInd))
      params = zeros(1,pLen(k));
      bRange = lb(k):ub(k);
      params(:) = bflt(indFlt+bRange);
      str{k} = mat2char(params);
   end
   %
   % Quantization block
   %
   bh = add_block('libsb2sl/PWL/Quantization',path,...
		  'ForegroundColor',prop.fgColor,...
		  'BackgroundColor',prop.bgColor,...
		  'Orientation',prop.orientation,...
		  'DropShadow',prop.border,...
		  'Position',rect,...
		  'RES',str{1},...
		  'OPER',typ{indTyp});
   %
   % Connect the current block with the mux and demux blocks
   %
   blkio('line',nInputs,nOutputs,post,parent,name);
   return					   % Last card of BLKQUANT
