Beispiel #1
0
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)
Beispiel #2
0
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)