def run(self): SIXMOZ_logger.print_info("Stage */6: Managing Typedef's") local_classes = [] chunk_size = 50 if (chunk_size > len(self.classes)): chunk_size = int(len(self.classes) / SIXMOZ_options.workers) if (chunk_size == 0): chunk_size = 1 listes = list(chunks(self.classes, int(len(self.classes) / chunk_size))) #depends on issue #19 need to reduce memory usage workers = SIXMOZ_options.workers if (workers > 1): workers = 2 with concurrent.futures.ProcessPoolExecutor(max_workers=workers) as executor: future_task = {executor.submit(manage_typedefs, self.classes, liste): liste for liste in listes} for future in concurrent.futures.as_completed(future_task): try: local_classes.extend(future.result()) except Exception as exc: print('Worker generated an exception: %s' % (exc)) continue self.classes = local_classes self.good_classes = [ elem for elem in self.classes if elem.filename in SIXMOZ_files.get_files() ] print("") self.writer = SIXMOZ_writer(self.classes) self.add_full_heritage() self.find_override() self.writer.run()
def add_moz_override(self): SIXMOZ_logger.print_info("Stage 5/6: Adding " + SIXMOZ_rules.get_conf('to_add') + " to files") for cppclass in self.classes: for classOmeths in cppclass.Omeths: modify_file(cppclass.filename, cppclass.name, classOmeths[3], classOmeths[2]) for classOfuncs in cppclass.Ofuncs: modify_file(cppclass.filename, cppclass.name, classOfuncs[3], classOfuncs[2])
def modify_file(filename, classname, line, orig): if (SIXMOZ_options.path not in filename or filename not in SIXMOZ_files.get_files()): return if orig.find(SIXMOZ_rules.get_conf('to_add')) != -1 or orig.find(SIXMOZ_rules.get_conf('to_find')) != -1: SIXMOZ_stats.overrided.append(classname + "::" + orig) return liste = open(filename, "r").readlines() i = 0 content = "" modified = 0 while i < len(liste): mod = "" mod = liste[i] if ((i + 1) == line): SIXMOZ_logger.print_debug("Before: [" + str(line) + "] " + str(liste[i])) if (liste[i].find(SIXMOZ_rules.get_conf('to_add')) == -1): i, mod, content, found = find_meth(liste, i, content) if (found == 1): SIXMOZ_stats.overrided.append(classname + "::" + orig) SIXMOZ_stats.real_overrided.append(classname + "::" + orig) modified = 1 if (filename not in SIXMOZ_stats.mod_files): SIXMOZ_stats.mod_files.append(filename) else: content += mod i += 1 elif (len(mod) > 0): content += mod i += 1 else: content += liste[i] i += 1 if (modified == 1): SIXMOZ_logger.dryrun(filename, content)
def __find_files(): SIXMOZ_logger.print_info("Stage 1/6: Getting files to parse: %s" % SIXMOZ_options.path) files = subprocess.check_output("find " + SIXMOZ_options.path + " -type f -readable " + SIXMOZ_rules.get_conf('extensions') + " -or -name \"*.cpp\" | sort", shell=True).decode().split("\n") return (files)
def add_moz_override(self): SIXMOZ_logger.print_info("Stage 5/6: Adding " + SIXMOZ_rules.get_conf('to_add') + " to files") for cppclass in self.classes: for classOmeths in cppclass.Omeths: modify_file(cppclass.filename, cppclass.name, classOmeths[3], classOmeths[2]) for classOfuncs in cppclass.Ofuncs: modify_file(cppclass.filename, cppclass.name, classOfuncs[3], classOfuncs[2])
def check_ret_namespace(bar): res = "" start = bar.rfind("::") if (start == -1): return (bar) end = bar.rfind(" ", 0, start) if (end == -1): res = "" res = bar[:end + 1] res += bar[start + 2:] SIXMOZ_logger.print_debug("Ret: " + bar + " => " + res) return (res)
def add_it(line, it): SIXMOZ_logger.print_debug("Error: " + line) added = 0 l = get_good_pos(line, it) mod = line[:l] if ((len(line[:l]) - 1) >= 0 and line[:l][len(line[:l]) - 1] != ' '): mod += " " mod += SIXMOZ_rules.get_conf('to_add') if (len(line[l:]) > 0 and line[l:][0] != ';' and line[l:][0] != ' ' and line[l:][0] != '\n'): mod += " " mod += line[l:] SIXMOZ_stats.modified_meths += 1 added = 1 return (mod, added)
def manage_typedefs(all_classes, liste): global class_cpt global typedefs for name in typedefs: for cppclass in liste: for inh in cppclass.inherits: if inh == name[0] and name[1] not in cppclass.inherits and name[1] != cppclass.name: cppclass.inherits.append(name[1]) SIXMOZ_logger.print_debug(cppclass.name + " typedef inherits: " + name[1]) break class_cpt.value += len(liste) SIXMOZ_logger.foo_print("[%d%%]"% int(class_cpt.value * 100 / len(all_classes))) return (liste)
def add_it(line, it): SIXMOZ_logger.print_debug("Error: " + line) added = 0 l = get_good_pos(line, it) mod = line[:l] if ((len(line[:l]) - 1) >= 0 and line[:l][len(line[:l]) - 1] != ' '): mod += " " mod += SIXMOZ_rules.get_conf('to_add') if (len(line[l:]) > 0 and line[l:][0] != ';' and line[l:][0] != ' ' and line[l:][0] != '\n'): mod += " " mod += line[l:] SIXMOZ_stats.modified_meths += 1 added = 1 return (mod, added)
def __find_idl_files(): idl_files = [] if (SIXMOZ_options.idl_folder != ""): if (not os.path.exists(SIXMOZ_options.idl_folder)): print("Options -I %s doesn't not exist" % SIXMOZ_options.idl_folder) sys.exit(1) SIXMOZ_logger.print_info("Getting Files from idl_folder: " + SIXMOZ_options.idl_folder) idl_files = subprocess.check_output( "find " + SIXMOZ_options.idl_folder + " -type f -readable \( " + SIXMOZ_rules.get_conf('extensions') + " \) -and -not -path \"" + SIXMOZ_options.path + "*\" | sort", shell=True).decode().split("\n") return (idl_files)
def add_attributes(): SIXMOZ_logger.print_info("Stage 6/6: Adding Attributes.h") for filename in SIXMOZ_stats.mod_files: if (filename[-4:] != ".cpp"): liste = open(filename, "r").readlines() first = 0 for li in liste: if (li.find("Attributes.h") != -1 and li.find("#include ") != -1): first = 1 content = "" if (first == 0): for li in liste: if (li.find("#include") != -1 and first == 0): content += '#include "mozilla/Attributes.h"\n' first = 1 content += li SIXMOZ_logger.dryrun(filename, content)
def add_attributes(): SIXMOZ_logger.print_info("Stage 6/6: Adding Attributes.h") for filename in SIXMOZ_stats.mod_files: if (filename[-4:] != ".cpp"): liste = open(filename, "r").readlines() first = 0 for li in liste: if (li.find("Attributes.h") != -1 and li.find("#include ") != -1): first = 1 content = "" if (first == 0): for li in liste: if (li.find("#include") != -1 and first == 0): content += '#include "mozilla/Attributes.h"\n' first = 1 content += li SIXMOZ_logger.dryrun(filename, content)
def parse_header_files(self): SIXMOZ_logger.print_info("Stage 2/6: Parsing Header Files") nb_files = len(self.files) + len(self.idl_files) files = self.files + self.idl_files self.classes = [] saveout = sys.stdout chunk_size = 50 if (chunk_size > len(files)): chunk_size = int(len(files) / SIXMOZ_options.workers) if (chunk_size == 0): chunk_size = 1 listes = list(chunks(files, int(len(files) / chunk_size))) with concurrent.futures.ProcessPoolExecutor(max_workers=SIXMOZ_options.workers) as executor: future_task = {executor.submit(do_parse, liste, len(files)): liste for liste in listes} for future in concurrent.futures.as_completed(future_task): try: self.classes.extend(future.result()) except Exception as exc: sys.stdout = saveout print('Worker generated an exception: %s' % (exc)) continue sys.stdout = saveout
def build_meth(typeid_func): SIXMOZ_logger.print_debug("meth name: " + typeid_func["name"]) SIXMOZ_logger.print_debug("meth ret: " + typeid_func["rtnType"] \ + " => " + builder_func.check_ret(typeid_func["rtnType"])) SIXMOZ_logger.print_debug(typeid_func) meths = builder_func.check_ret(typeid_func["rtnType"]) if (len(meths)): meths += " " meths += typeid_func["name"] + " (" params = "" for param in range(len(typeid_func["parameters"])): SIXMOZ_logger.print_debug("meth params: " + typeid_func["parameters"][param]["type"]) real_param = typeid_func["parameters"][param]["type"].split("::") params += real_param[len(real_param) - 1:][0] SIXMOZ_logger.print_debug("Param: " + typeid_func["parameters"][param]["type"] \ + " => " + real_param[len(real_param) - 1:][0]) params += " " if (params != "void "): meths += params meths += ")" if (typeid_func['const']): meths += " const" return (meths)
def modify_file(filename, classname, line, orig): if (SIXMOZ_options.path not in filename or filename not in SIXMOZ_files.get_files()): return if orig.find(SIXMOZ_rules.get_conf('to_add')) != -1 or orig.find( SIXMOZ_rules.get_conf('to_find')) != -1: SIXMOZ_stats.overrided.append(classname + "::" + orig) return liste = open(filename, "r").readlines() i = 0 content = "" modified = 0 while i < len(liste): mod = "" mod = liste[i] if ((i + 1) == line): SIXMOZ_logger.print_debug("Before: [" + str(line) + "] " + str(liste[i])) if (liste[i].find(SIXMOZ_rules.get_conf('to_add')) == -1): i, mod, content, found = find_meth(liste, i, content) if (found == 1): SIXMOZ_stats.overrided.append(classname + "::" + orig) SIXMOZ_stats.real_overrided.append(classname + "::" + orig) modified = 1 if (filename not in SIXMOZ_stats.mod_files): SIXMOZ_stats.mod_files.append(filename) else: content += mod i += 1 elif (len(mod) > 0): content += mod i += 1 else: content += liste[i] i += 1 if (modified == 1): SIXMOZ_logger.dryrun(filename, content)
def check_options(): if (len(sys.argv) < 2 or len(sys.argv[1]) <= 0 or not os.path.exists(sys.argv[1])): usage() sys.exit(1) idl_folder = "" achtung = 0 workers = 1 try: opts, args = getopt.getopt(sys.argv[2:], "hdvWJ:I:", ["help", "dryrun"]) except getopt.GetoptError as err: print("GetOpt Error: %s" % str(err)) usage() sys.exit(2) except: print("Unknown opt Error") sys.exit(2) if (len(args)): print("Unhandled Option") sys.exit(1) for o, a in opts: if o == "-v": print("[Running Verbose Mode]") SIXMOZ_logger.set_verbose() elif o in ("-d"): print("[Running Debug Mode]") SIXMOZ_logger.set_debug() elif o in ("-W"): print("[Running UNSAFE Mode]") achtung = 1 elif o in ("-I"): print("[Using Idl Folder] %s" % a) idl_folder = a elif o in ("-J"): if (int(a) <= 0): usage() sys.exit(1) print("[Using %d Workers]" % int(a)) workers = int(a) elif o in ("-h", "--help"): _help() sys.exit(0) elif o in ("--dryrun"): print("[Running DryRun Mode]") SIXMOZ_logger.set_dryrun() else: print("Unhandled Option") sys.exit(1) return (sys.argv[1], idl_folder, achtung, workers)
def check_options(): if (len(sys.argv) < 2 or len(sys.argv[1]) <= 0 or not os.path.exists(sys.argv[1])): usage() sys.exit(1) idl_folder = "" achtung = 0 workers = 1 try: opts, args = getopt.getopt(sys.argv[2:], "hdvWJ:I:", ["help", "dryrun"]) except getopt.GetoptError as err: print("GetOpt Error: %s"% str(err)) usage() sys.exit(2) except: print("Unknown opt Error") sys.exit(2) if (len(args)): print("Unhandled Option") sys.exit(1) for o, a in opts: if o == "-v": print("[Running Verbose Mode]") SIXMOZ_logger.set_verbose() elif o in ("-d"): print("[Running Debug Mode]") SIXMOZ_logger.set_debug() elif o in ("-W"): print("[Running UNSAFE Mode]") achtung = 1 elif o in ("-I"): print("[Using Idl Folder] %s"% a) idl_folder = a elif o in ("-J"): if (int(a) <= 0): usage() sys.exit(1) print("[Using %d Workers]"% int(a)) workers = int(a) elif o in ("-h", "--help"): _help() sys.exit(0) elif o in ("--dryrun"): print("[Running DryRun Mode]") SIXMOZ_logger.set_dryrun() else: print("Unhandled Option") sys.exit(1) return (sys.argv[1], idl_folder, achtung, workers)
def gen_class(filename, cppHeader, HeaderClass): global typedefs accessType_tab = [ "public", "private", "protected" ] headerclass = cppHeader.classes[HeaderClass] cppclass = CppClass(filename) cppclass.set_name(headerclass) cppclass.set_inherits(headerclass) for accessType in accessType_tab: for typeid_func in headerclass["methods"][accessType]: meths = build_meth(typeid_func) if (typeid_func.show().find("virtual") != -1) \ or (typeid_func.show().find("NS_IMETHOD") != -1) \ or (typeid_func.show().find("NS_IMETHOD_") != -1): if SIXMOZ_options.achtung and ((typeid_func.show().find("NS_IMETHOD") != -1) \ or (typeid_func.show().find("NS_IMETHOD_") != -1)) \ and ("= 0 ;" not in typeid_func["debug"]): cppclass.append_ometh([builder_func.over_meth(meths), \ builder_func.over_meth(typeid_func["debug"]), \ typeid_func["debug"], \ typeid_func["line_number"], \ typeid_func["name"]]) SIXMOZ_logger.print_debug("Meths: " + meths) cppclass.append_meth([builder_func.over_meth(meths), \ builder_func.over_meth(typeid_func["debug"]), \ typeid_func["debug"], \ typeid_func["line_number"], \ typeid_func["name"]]) else: SIXMOZ_logger.print_debug("Funcs: " + meths) cppclass.append_func([builder_func.over_meth(meths), \ builder_func.over_meth(typeid_func["debug"]), \ typeid_func["debug"], \ typeid_func["line_number"], \ typeid_func["name"]]) SIXMOZ_logger.print_debug("%s: Funcs(%d) Meths(%d)"% (cppclass.name, len(cppclass.funcs), len(cppclass.meths))) #Only for debug #stats.display_class(cppclass) typedefs.extend(cppHeader.typedefs.items()) #don't think we should bother # typedefs.extend(headerclass._public_typedefs.items()) return (cppclass)
def add_full_heritage(self): SIXMOZ_logger.print_info("Stage 3/6: Creating Heritage Tree") change = 1 while (change == 1): change = 0 for cppclass in self.good_classes: for simple_inherits in cppclass.inherits: test_inh = self.is_a_class(str(cppclass.namespace + simple_inherits)) if (test_inh and not self.is_a_class(simple_inherits)): simple_inherits = test_inh else: simple_inherits = self.is_a_class(simple_inherits) if (simple_inherits): for hidden_inherits in simple_inherits.inherits: if (self.is_a_class(hidden_inherits) and hidden_inherits not in cppclass.inherits and hidden_inherits != cppclass.name): SIXMOZ_logger.print_debug("Class: " + cppclass.name + " inherits " + hidden_inherits) cppclass.inherits.append(hidden_inherits) change = 1 else: SIXMOZ_logger.print_debug("OTHER: " + cppclass.name + " inherits " + hidden_inherits)
def display_base(self, classes, files, idl_files): tot_meths = 0 tot_mems = 0 for cppclass in classes: tot_meths += len(cppclass.funcs) tot_mems += len(cppclass.meths) print("") SIXMOZ_logger.print_verbose("Got %d File Issues" % len(SIXMOZ_logger.file_issue)) for f in SIXMOZ_logger.file_issue: SIXMOZ_logger.print_debug(" -> %s" % f) SIXMOZ_logger.print_verbose("Found %d files to check" % len(files)) SIXMOZ_logger.print_verbose("Found %d header files" % len(idl_files)) SIXMOZ_logger.print_verbose("Found %d classes" % len(classes)) SIXMOZ_logger.print_verbose("Found %d member functions" % tot_mems) SIXMOZ_logger.print_verbose("Found %d methods" % tot_meths)
def find_override(self): SIXMOZ_logger.print_info("Stage 4/6: Finding methods to override") for cppclass in self.good_classes: for inherit in cppclass.inherits: inhname = inherit inherit = self.is_a_class(inherit) if (inherit): SIXMOZ_logger.print_debug(cppclass.name + " inherits " + inherit.name) for inhmeths in inherit.meths: SIXMOZ_logger.print_debug("1: " + inherit.name + "::" + inhmeths[0]) for classfuncs in cppclass.funcs: SIXMOZ_logger.print_debug("2: " + inherit.name + "::" + inhmeths[0] \ + " " + cppclass.name + "::" + classfuncs[0]) if inhmeths[0] == classfuncs[0]: cppclass.Ofuncs.append(classfuncs + [ inherit.name ]) SIXMOZ_logger.print_debug("OVERRIDE2: " + inherit.name + "::" + inhmeths[2] \ + " and " + cppclass.name + "::" + classfuncs[2]) break for classmeths in cppclass.meths: SIXMOZ_logger.print_debug("3: " + inherit.name + "::" + inhmeths[0] \ + " " + cppclass.name + "::" + classmeths[0]) if inhmeths[0] == classmeths[0]: cppclass.Omeths.append(classmeths + [ inherit.name ]) SIXMOZ_logger.print_debug("OVERRIDE3: " + inherit.name + "::" + inhmeths[2] \ + " line [" + str(inhmeths[3]) + "]" \ + " and " + cppclass.name + "::" + classmeths[2] + " line [" + str(classmeths[3]) + "]") break else: SIXMOZ_logger.print_debug("Inherit Error: " + inhname + " not found for " + cppclass.name)
def display_class(classe): SIXMOZ_logger.print_debug("File: " + classe.filename) SIXMOZ_logger.print_debug("Class: " + classe.name) for inherit in classe.inherits: SIXMOZ_logger.print_debug("From: " + inherit) SIXMOZ_logger.print_debug("Func: %d" % len(classe.funcs)) for classfuncs in classe.funcs: SIXMOZ_logger.print_debug(classe.name + ": " + classfuncs[0] + " | " + classfuncs[2]) SIXMOZ_logger.print_debug("Meths: %d" % len(classe.meths)) for classmeths in classe.meths: SIXMOZ_logger.print_debug(classe.name + ": " + classmeths[0] + " | " + classmeths[2]) SIXMOZ_logger.print_debug("Overrided Func: %d" % len(classe.Ofuncs)) for classOfuncs in classe.Ofuncs: SIXMOZ_logger.print_debug(classe.name + ": " + classOfuncs[0] + " from: " + classOfuncs[5]) SIXMOZ_logger.print_debug("Overrided Meths: %d" % len(classe.Omeths)) for classOmeths in classe.Omeths: SIXMOZ_logger.print_debug(classe.name + ": " + classOmeths[0] + " from: " + classOmeths[5]) SIXMOZ_logger.print_debug("")
def do_parse(files, nb_files): global file_cpt classes = [] saveout = sys.stdout dev_null = open("/dev/null", 'w') for filename in files: file_cpt.value += 1 try: sys.stdout = dev_null cppHeader = CppHeaderParser.CppHeader(filename) sys.stdout = saveout except CppHeaderParser.CppParseError as e: sys.stdout = saveout SIXMOZ_logger.print_error(str(e), filename) continue except Exception as e: sys.stdout = saveout SIXMOZ_logger.print_error(str(e), filename) continue except: sys.stdout = saveout SIXMOZ_logger.print_error("Unknown", filename) continue SIXMOZ_logger.print_debug("NB CLASSES: " + str(len(cppHeader.classes))) SIXMOZ_logger.print_debug(cppHeader.classes) for HeaderClass in cppHeader.classes: classes.append(gen_class(filename, cppHeader, HeaderClass)) SIXMOZ_logger.foo_print("[%d%%]"% int(file_cpt.value * 100 / nb_files)) dev_null.close() return (classes)
def display_base(self, classes, files, idl_files): tot_meths = 0 tot_mems = 0 for cppclass in classes: tot_meths += len(cppclass.funcs) tot_mems += len(cppclass.meths) print("") SIXMOZ_logger.print_verbose("Got %d File Issues" % len(SIXMOZ_logger.file_issue)) for f in SIXMOZ_logger.file_issue: SIXMOZ_logger.print_debug(" -> %s"% f) SIXMOZ_logger.print_verbose("Found %d files to check" % len(files)) SIXMOZ_logger.print_verbose("Found %d header files" % len(idl_files)) SIXMOZ_logger.print_verbose("Found %d classes" % len(classes)) SIXMOZ_logger.print_verbose("Found %d member functions" % tot_mems) SIXMOZ_logger.print_verbose("Found %d methods" % tot_meths)
def display(self, classes, files, idl_files): virt_missed = 0 meth_missed = 0 firstprint = 0 SIXMOZ_logger.print_verbose("") SIXMOZ_logger.print_verbose("Statistics") for cppclass in classes: for classOmeths in cppclass.Omeths: tmp = cppclass.name + "::" + classOmeths[2] if tmp not in self.overrided: if firstprint == 0: firstprint = 1 SIXMOZ_logger.print_verbose("NOT OVERRIDED!!!:") virt_missed += 1 SIXMOZ_logger.print_verbose(cppclass.filename + "\t" \ + "M " + tmp + "\t%d" % classOmeths[3]) for classOfuncs in cppclass.Ofuncs: tmp = cppclass.name + "::" + classOfuncs[2] if tmp not in self.overrided: if firstprint == 0: firstprint = 1 SIXMOZ_logger.print_verbose("NOT OVERRIDED!!!:") meth_missed += 1 SIXMOZ_logger.print_verbose(cppclass.filename + "\t" \ + "F " + tmp + "\t%d" % classOfuncs[3]) self.display_base(classes, files, idl_files) SIXMOZ_logger.print_verbose("Methods " + SIXMOZ_rules.get_conf('to_add') + " @Begin: " + self.begin) SIXMOZ_logger.print_info("Overrided %d methods" % len(set(self.real_overrided))) SIXMOZ_logger.print_verbose("Final Modified Meths: %d" % self.modified_meths) SIXMOZ_logger.print_verbose("Still Missing %d methods" % virt_missed) SIXMOZ_logger.print_verbose("Still Missing %d member functions" % meth_missed) output = subprocess.check_output("find " + SIXMOZ_options.path + " -type f -readable " + SIXMOZ_rules.get_conf('extensions') + " -or -name \"*.cpp\" | xargs grep " + SIXMOZ_rules.get_conf('to_add') + " | wc -l", shell=True).decode() SIXMOZ_logger.print_info(SIXMOZ_rules.get_conf('to_add') + " Methods in Code: " + output)
def set_inherits(self, classe): for inherit in classe["inherits"]: if (inherit['class'] != self.name): self.inherits.append(inherit['class']) SIXMOZ_logger.print_debug("Inherits: %s"% inherit['class'])
def set_name(self, classe): if len(classe["namespace"]): self.namespace = classe["namespace"].strip("::") + "::" self.name = self.namespace self.name += classe["name"] SIXMOZ_logger.print_debug("Class: " + self.name)
def display_class(classe): SIXMOZ_logger.print_debug("File: " + classe.filename) SIXMOZ_logger.print_debug("Class: " + classe.name) for inherit in classe.inherits: SIXMOZ_logger.print_debug("From: " + inherit) SIXMOZ_logger.print_debug("Func: %d"% len(classe.funcs)) for classfuncs in classe.funcs: SIXMOZ_logger.print_debug(classe.name + ": " + classfuncs[0] + " | " + classfuncs[2]) SIXMOZ_logger.print_debug("Meths: %d"% len(classe.meths)) for classmeths in classe.meths: SIXMOZ_logger.print_debug(classe.name + ": " + classmeths[0] + " | " + classmeths[2]) SIXMOZ_logger.print_debug("Overrided Func: %d"% len(classe.Ofuncs)) for classOfuncs in classe.Ofuncs: SIXMOZ_logger.print_debug(classe.name + ": " + classOfuncs[0] + " from: "+ classOfuncs[5]) SIXMOZ_logger.print_debug("Overrided Meths: %d"% len(classe.Omeths)) for classOmeths in classe.Omeths: SIXMOZ_logger.print_debug(classe.name + ": " + classOmeths[0] + " from: "+ classOmeths[5]) SIXMOZ_logger.print_debug("")
def display(self, classes, files, idl_files): virt_missed = 0 meth_missed = 0 firstprint = 0 SIXMOZ_logger.print_verbose("") SIXMOZ_logger.print_verbose("Statistics") for cppclass in classes: for classOmeths in cppclass.Omeths: tmp = cppclass.name + "::" + classOmeths[2] if tmp not in self.overrided: if firstprint == 0: firstprint = 1 SIXMOZ_logger.print_verbose("NOT OVERRIDED!!!:") virt_missed += 1 SIXMOZ_logger.print_verbose(cppclass.filename + "\t" \ + "M " + tmp + "\t%d" % classOmeths[3]) for classOfuncs in cppclass.Ofuncs: tmp = cppclass.name + "::" + classOfuncs[2] if tmp not in self.overrided: if firstprint == 0: firstprint = 1 SIXMOZ_logger.print_verbose("NOT OVERRIDED!!!:") meth_missed += 1 SIXMOZ_logger.print_verbose(cppclass.filename + "\t" \ + "F " + tmp + "\t%d" % classOfuncs[3]) self.display_base(classes, files, idl_files) SIXMOZ_logger.print_verbose("Methods " + SIXMOZ_rules.get_conf('to_add') + " @Begin: " + self.begin) SIXMOZ_logger.print_info("Overrided %d methods" % len(set(self.real_overrided))) SIXMOZ_logger.print_verbose("Final Modified Meths: %d" % self.modified_meths) SIXMOZ_logger.print_verbose("Still Missing %d methods" % virt_missed) SIXMOZ_logger.print_verbose("Still Missing %d member functions" % meth_missed) output = subprocess.check_output( "find " + SIXMOZ_options.path + " -type f -readable " + SIXMOZ_rules.get_conf('extensions') + " -or -name \"*.cpp\" | xargs grep " + SIXMOZ_rules.get_conf('to_add') + " | wc -l", shell=True).decode() SIXMOZ_logger.print_info( SIXMOZ_rules.get_conf('to_add') + " Methods in Code: " + output)