function result = sltpda_verify_model(mdlfile)

% SLTPDA_VERIFY_MODEL verifies that the given model file only contains
% sLTPDA compatible blocks.
% 
% usage: result = sltpda_verify_model(mdlfile)
% 
% result: 0 = failed, 1 = passed
% 
% M Hewitson 28-03-07
% 
% $Id: sltpda_verify_model.m,v 1.2 2007/04/25 09:06:08 hewitson Exp $
% 


banner = sprintf('===========     verifying ''%s''      ===========', mdlfile);
disp(banner);
disp(' ');

result = 1;

% load the model into memory
load_system(mdlfile);

% get list of blocks
sys      = get_param(mdlfile, 'Handle');
blocks   = find_system(sys, 'FindAll', 'on', 'type', 'block');
bcmds    = getBlockCommands(blocks);

% check each block
for j=1:length(bcmds)
  if ~isValidBlock(bcmds(j).fcn)
    result = 0;
  end
end

if result == 0
  error(['### model ' mdlfile ' contains invalid blocks.']); 
end
bannerEnd = [];
while length(bannerEnd) < length(banner)
  bannerEnd = [bannerEnd '='];
end
disp(' ');
disp(bannerEnd);

disp(' ')



% END