function [stat,post] = blkgenwave(path,prop,bstr,bint,bflt,parent,name,catalog,ws,node)
%BLKGENWAVE Defines signal source whose value is linearly interpolated from
%           a set of break-points.
%
% See also BLKPULSE, BLKSTEP, BLKSQWAVE, BLKLIMRAMP, BLKSINEGEN, BLKURAND, BLKNORMAL.
%

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

   stat = 0;			   		   % Error flag
   nInputs = bint(5);
   nOutputs = bint(6);
   %
   % Add mux and demux blocks if necessary
   %
   channels = 0;
   [post,rect] = blkio('port',channels,nOutputs,prop,path);
   %
   % Get relative start time, pulse magnitude, pulse width and frequency parameters
   %
   indInt = bint(15)+1;
   indStr = bint(17)+1;
   mode = bint(indInt);
   npar = 3;					   % Number of parameters
   symInd = zeros(1,npar);
   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
   %
   % Get the block parameter variables
   %
   [symInd,str] = mgetscope(symInd,str,catalog,ws,node);
   indInt = bint(18)+1;
   indInt = bint(indInt)+indInt;
   indFlt = bint(19);
   npts = bint(indInt);
   rDims = [1;npts;npts];
   cDims = [nOutputs;1;nOutputs];
   ub = cumsum(rDims.*cDims);
   lb = [0;ub(1:end-1)]+1;
   for (k = find(~symInd))
      params = zeros(rDims(k),cDims(k));
      bRange = lb(k):ub(k);
      params(:) = bflt(indFlt+bRange);
      str{k} = mat2char(params);
   end
   %
   % General waveform block
   %
   bh = add_block('libsb2sl/SNG/GenWaveform',path,...
		  'ForegroundColor',prop.fgColor,...
		  'BackgroundColor',prop.bgColor,...
		  'Orientation',prop.orientation,...
		  'DropShadow',prop.border,...
		  'Position',rect,...
		  'T0',str{1},...
		  'TAC',str{2},...
		  'SAC',str{3});
   %
   % Connect the current block with the mux and demux blocks (if any)
   %
   blkio('line',channels,nOutputs,post,parent,name);
   return					   % Last card of BLKGENWAVE
