lines.append("*" * 80)
        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))
コード例 #2
0
    sempath = os.path.join(args.path, 'semantics')

    cfapp = CApplication(sempath, args.cfile)
    cfile = cfapp.get_cfile()

    try:
        cfunction = cfile.get_function_by_name(args.cfunction)
    except UF.CHError as e:
        print(str(e.wrap()))
        exit(1)

    if args.open and args.violations:

        def pofilter(po):
            return not po.is_closed() or po.is_violated()
    elif args.open:

        def pofilter(po):
            return not po.is_closed()
    elif args.violations:

        def pofilter(po):
            return po.is_violated()
    else:

        def pofilter(po):
            return True

    print(RP.function_code_tostring(cfunction, pofilter=pofilter))