Exemplo n.º 1
0
def parse():
    parser = argparse.ArgumentParser()
    parser.add_argument('cfilename',
                        help='name of kendra c file (e.g., id115.c)')
    parser.add_argument('--show_invariants',
                        help='show invariants in addition to diagnostic',
                        action='store_true')
    args = parser.parse_args()
    return args


if __name__ == '__main__':

    args = parse()
    cfilename = args.cfilename
    cpath = UF.get_kendra_cpath(cfilename)

    if cpath is None:
        print('*' * 80)
        print('Unable to find the test set for file ' + cfilename)
        print('*' * 80)
        exit(1)

    sempath = os.path.join(cpath, 'semantics')
    cfapp = CApplication(sempath, cfilename)
    cfile = cfapp.get_cfile()

    print(RP.file_code_tostring(cfile, showinvs=args.show_invariants))
    print(RP.file_proofobligation_stats_tostring(cfile))
Exemplo n.º 2
0
    args = parse()
    cpath = os.path.abspath(args.path)

    if not os.path.isdir(cpath):
        print(UP.cpath_not_found_err_msg(cpath))
        exit(1)
    
    sempath = os.path.join(cpath,'semantics')

    if not os.path.isdir(sempath):
        print(UP.semantics_not_found_err_msg(cpath))
        exit(1)
    
    capp = CApplication(sempath,args.cfile)
    cfile = capp.get_cfile()

    pofilter = lambda(p):True
    if args.predicates:
        pofilter = lambda(p):p.get_predicate_tag() in args.predicates

    openppos = cfile.get_open_ppos()
    violations = cfile.get_violations()
    delegated = cfile.get_delegated()

    print(UP.reportheader('Summary of open, delegated and violated proof obligations for ' + args.cfile))

    if len(openppos) > 0:
        print('Open proof obligations:\n' + ('=' * 80))
        print(RP.tag_file_function_pos_tostring(openppos,pofilter=pofilter))
    else: