%% check_status
%   checks the status of a pvs_checker object by generating a
%   status script running it a checking the results to ensure that
%   all the theories are proved.
% inputs:
%   object:PVS_checker - PVS_checker object
% outputs:
%   status:boolean - 0 if pvs file has been checked, 1 if it has
%   not
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function status = check_status(object)
script_name = object.generate_pvs_status_script(object.data.function_name );
[status, result] = system(['pvs -batch -v 3 -l ' script_name]);
parsed = object.parse_status(result);
pass = 1;
if (size(parsed,2) == 0)
    pass = 0;
end
for i=1:2:size(parsed,2)-1
    if ~strncmp(parsed(i+1),'proved',6)
        pass = 0;
    end
end

status = pass;
delete(script_name)

end

