if not os.path.isfile(os.path.join(cpath,args.cfile)):
        print(UP.cfile_not_found_err_msg(cpath,args.cfile))
        exit(1)

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

    if not cfile.has_function_by_name(args.cfunction):
        print(UP.cfunction_not_found_err_sg(cpath,args.cfile,args.cfunction))
        exit(1)

    cfunction = cfile.get_function_by_name(args.cfunction)

    if args.open:
        print(RP.function_code_open_tostring(cfunction))
    elif args.violations:
        print(RP.function_code_violation_tostring(cfunction))
    elif args.predicate:
        print(RP.function_code_predicate_tostring(cfunction,args.predicate))
    else:
        print(RP.function_code_tostring(cfunction))

    print(RP.function_proofobligation_stats_tostring(cfunction))

Example #2
0
        lines.append(('Function ' + args.cfunction + ' not found in file '
                          + cfile.name + '; function names available:'))
        lines.append('-' * 80)
        for n in cfile.functionnames:
            lines.append('  ' + n)
        lines.append('*' * 80)
        print('\n'.join(lines))
        exit(0)

    cfunction = cfile.get_function_by_name(args.cfunction)

    try:

        if args.open:
            print(RP.function_code_open_tostring(cfunction))
        elif args.predicate:
            print(RP.function_code_predicate_tostring(cfunction,args.predicate,showinvs=args.showinvs))
        else:
            print(RP.function_code_tostring(cfunction,showinvs=args.showinvs))

        print(RP.function_proofobligation_stats_tostring(cfunction))

    except IndexedTableError as e:
        print(
            '\n' + ('*' * 80) + '\nThe analysis results format has changed'
            + '\nYou may have to re-run the analysis first: '
            + '\n' + e.msg
            + '\n' + ('*' * 80))