function [stat,post] = blklninterp(path,prop,bstr,bint,bflt,parent,name,catalog,ws,node)
%BLKLNINTERP Given sets of input and output breakpoints, this block performs multilinear
%     interpolation on input variables.
%
% See also BLKC1INTERP, BLKL1INTERP, BLKS1INTERP, BLKS2INTERP.

% Initial coding by A S Bozin, 22-05-98
% Copyright 1997-2000 The MathWorks, Inc.
% $Revision: 1.5 $ $Date: 2000/06/14 16:09:48 $

   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 input and output breakpoints
   %
   indFlt = bint(16);
   indStr = bint(17)+1;
   indInt = bint(18);
   indInt = bint(indInt+1)+indInt;		   % Skip icon data
   inpInd = 1:nInputs;
   inpDims = bint(indInt+inpInd);
   indInt = bint(15)+1;
   npar = nInputs+2;				   % Number of parameters
   symInd = zeros(1,npar);
   if (bitand(bint(indInt),16))
      indVar = indInt+2;
      vRange = 1:bint(indVar);
      symInd(bint(indVar+vRange)) = 1;
   end
   mapInd = [3:npar,1:2];			   % Reorder the parameters
   symInd(:) = symInd(mapInd);
   str = cell(npar,1);
   for (k = find(symInd))
      ind = mfindstr(bstr,indStr,'|');
      str{k} = bstr(indStr:ind-1);
      indStr = ind+1;
   end
   pLen = [inpDims,prod(inpDims),nInputs];
   ub = cumsum(pLen);
   lb = [0,ub(1:end-1)]+1;
   %
   % Get the block parameter variables
   %
   [symInd,str] = mgetscope(symInd,str,catalog,ws,node);
   for (k = find(~symInd))
      points = zeros(1,pLen(k));
      bRange = lb(k):ub(k);
      points(:) = bflt(indFlt+bRange);
      str{k} = mat2char(points');
   end
   %
   % Multilinear interpolation block.
   %
   bh = add_block('libsb2sl/NTP/MultiLinearInterp',path,...
		  'ForegroundColor',prop.fgColor,...
		  'BackgroundColor',prop.bgColor,...
		  'Orientation',prop.orientation,...
		  'DropShadow',prop.border,...
		  'Position',rect,...
		  'NINP',mat2char(nInputs),...
		  'in1BrkPoints',str{1},...
		  'in2BrkPoints',str{2},...
		  'outBrkPoints',str{npar-1});
   switch (nInputs)
   case 3
      set_param(bh,'in3BrkPoints',str{3});
   case 4
      set_param(bh,'in3BrkPoints',str{3},...
		   'in4BrkPoints',str{4});
   case 5
      set_param(bh,'in3BrkPoints',str{3},...
		   'in4BrkPoints',str{4},...
		   'in5BrkPoints',str{5});
   case 6
      set_param(bh,'in3BrkPoints',str{3},...
		   'in4BrkPoints',str{4},...
		   'in5BrkPoints',str{5},...
		   'in6BrkPoints',str{6});
   case 7
      set_param(bh,'in3BrkPoints',str{3},...
		   'in4BrkPoints',str{4},...
		   'in5BrkPoints',str{5},...
		   'in6BrkPoints',str{6},...
		   'in7BrkPoints',str{7});
   case 8
      set_param(bh,'in3BrkPoints',str{3},...
		   'in4BrkPoints',str{4},...
		   'in5BrkPoints',str{5},...
		   'in6BrkPoints',str{6},...
		   'in7BrkPoints',str{7},...
		   'in8BrkPoints',str{8});
   otherwise
   end
   %
   % Connect the current bilinear interpolation block with the mux and demux blocks
   %
   blkio('line',nInputs,nOutputs,post,parent,name);
   return					   % Last card of BLKLNINTERP
