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))
args = parse() cpath = UF.get_juliet_testpath(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) try: cfapp = CApplication(sempath, args.cfile) cfile = cfapp.get_cfile() except CFileNotFoundException as e: print(str(e)) exit(1) dc = ['deadcode'] if args.showcode: if args.open: print( RP.file_code_open_tostring(cfile, showinvs=args.showinvariants)) else: print(RP.file_code_tostring(cfile, showinvs=args.showinvariants)) print(RP.file_proofobligation_stats_tostring(cfile, extradsmethods=dc))