function [stat,post] = blkdf(path,prop,bstr,bint,bflt,parent,name,catalog,ws,node,sbSample)
%BLKDF Defines a system specified in terms of damping ratios and natural frequencies.
%
% See also BLKSS, BLKTF, BLKZP.

% Initial coding by A S Bozin, 6-30-97
% Copyright 1997-2000 The MathWorks, Inc.
% $Revision: 1.6 $ $Date: 2000/06/14 16:09:03 $

   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 damping-frequency coefficients as well as the initial output value
   %
   indStr = bint(17)+1;
   indInt = bint(15)+1;
   npar = 6;					   % Number of parameters
   symInd = zeros(1,npar);
   str = cell(npar,1);
   mode = bint(indInt);
   indInt = indInt+1;
   nCoeffs = bint(indInt);
   if (bitand(mode,8))
      ind = mfindstr(bstr,indStr,'|');
      symInd(npar) = 1;
      str{npar} = bstr(indStr:ind-1);
      indStr = ind+1;
   end
   indInt = indInt+2*nCoeffs;
   indInt = indInt+1;
   if (bitand(mode,16))
      iRange = 1:bint(indInt);
      kRange = bint(indInt+iRange);
      symInd(kRange) = 1;
      for (k = kRange)
	 ind = mfindstr(bstr,indStr,'|');
	 str{k} = bstr(indStr:ind-1);
	 indStr = ind+1;
      end
   end
   %
   % Get the block parameter variables
   %
   [symInd,str] = mgetscope(symInd,str,catalog,ws,node);
   if (symInd(npar) == 0)
      y0 = 0;
      if (nCoeffs ~= 0)
	 indFlt = bint(16);
	 cRange = 1:nCoeffs;
	 y0(cRange) = bflt(indFlt+cRange);
      end
      str{6} = mat2char(y0);
   end
   indInt = bint(18)+1;
   indInt = bint(indInt)+indInt;		   % Skip icon data
   indFlt = bint(19);
   nPole = bint(indInt);
   nZero = bint(indInt+1);
   rDims = ones(npar-1,1);
   cDims = [1;nPole;nPole;nZero;nZero];
   ub = cumsum(rDims.*cDims);
   lb = [0;ub(1:end-1)]+1;
   ub([2 4]) = ub([3 5])-1;
   lb([3 5]) = lb([2 4])+1;
   for (k = find(~symInd(1:npar-1)))
      coeffs = zeros(rDims(k),cDims(k));
      if (~isempty(coeffs))
	 cRange = lb(k):2:ub(k);
	 coeffs(:) = bflt(indFlt+cRange);
      end
      str{k} = mat2char(coeffs);
   end
   %
   % Damping-frequency block (can be continuous or discrete)
   %
   if (any(sbSample))
      bh = add_block('libsb2sl/DYN/DGainDampsFreqs',path,...
		     'ForegroundColor',prop.fgColor,...
		     'BackgroundColor',prop.bgColor,...
		     'Orientation',prop.orientation,...
		     'DropShadow',prop.border,...
		     'Position',rect,...
		     'G',str{1},...
		     'Xz',str{4},...
		     'Wz',str{5},...
		     'Xp',str{2},...
		     'Wp',str{3},...
		     'Y0',str{6},...
		     'TS',mat2char(sbSample));
   else
      bh = add_block('libsb2sl/DYN/CGainDampsFreqs',path,...
		     'ForegroundColor',prop.fgColor,...
		     'BackgroundColor',prop.bgColor,...
		     'Orientation',prop.orientation,...
		     'DropShadow',prop.border,...
		     'Position',rect,...
		     'G',str{1},...
		     'Xz',str{4},...
		     'Wz',str{5},...
		     'Xp',str{2},...
		     'Wp',str{3},...
		     'Y0',str{6});
   end
   %
   % Connect the current damping-frequency block with the mux and demux blocks
   %
   blkio('line',nInputs,nOutputs,post,parent,name);
   return					   % Last card of BLKDF
