% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [ output_args ] = check_system(system)
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
blocks = find_system(system,'MaskDescription','Table Block');
msg = [];
for i = 1:size(blocks,1)
    if ~strncmp(blocks(i),'TableLibrary',12)
        block_data = get_param(char(blocks(i)),'UserData');
        if ~isempty(block_data)
            PVS = PVS_checker(block_data);
            [check,result] = PVS.pvs_check;
            if (check == 1)
                msg = [msg char(blocks(i)) ' is valid' sprintf('\n')];
                
            else
                msg = [msg char(blocks(i)) ' is not valid' sprintf('\n')];
            end
            block_data.checked = check;
            TableBlock.set_block_display(char(blocks(i)),block_data.checked);
            
        end
    end
end
msgbox(msg);

end

