Exemplo n.º 1
0
def parse_source(src, filename):
    "parse .c source file"
    dep = kbuildparser.list_dep(filename)
    srcparser.unwind_include(filename)
    for scanner in lkddb.scanners:
        for block in scanner.regex.findall(src):
	    block = srcparser.expand_block(block, filename)
	    for conf, sblock in ifdef_re.findall(block):
		sdep = dep.copy().add(conf)
		for line in scanner.splitter(sblock):
		    lkddb.parse_struct(scanner, scanner.fields, line, sdep, filename)
	    block = ifdef_re.sub(" ", block)
	    for line in scanner.splitter(block):
		lkddb.parse_struct(scanner, scanner.fields, line, dep, filename)
Exemplo n.º 2
0
def platform_printer(dict, dep, filename):
    if not dict.has_key("driver"):
        return
    block = dict["driver"]
    line = lkddb.split_structs(block)[0]
    driver_dict = lkddb.parse_struct(None,
                                     device_driver_fields,
                                     line,
                                     None,
                                     filename,
                                     ret=True)
    v0 = strings("name", driver_dict, '""')
    lkddb.lkddb_add("platform %s %s # %s" % (v0, dep, filename))
Exemplo n.º 3
0
def pcmcia_printer(dict, dep, filename):
    match = value("match_flags", dict)
    if not match:
        return
    v0 = "...."
    v1 = "...."
    v2 = ".."
    v3 = ".."
    v4 = ".."
    if match & PCMCIA_DEV_ID_MATCH_MANF_ID:
        v0 = str_value(value("manf_id", dict), -1, 4)
    if match & PCMCIA_DEV_ID_MATCH_CARD_ID:
        v1 = str_value(value("card_id", dict), -1, 4)
    if match & PCMCIA_DEV_ID_MATCH_FUNC_ID:
        v2 = str_value(value("func_id", dict), -1, 2)
    if match & PCMCIA_DEV_ID_MATCH_FUNCTION:
        v3 = str_value(value("function", dict), -1, 2)
    if match & PCMCIA_DEV_ID_MATCH_DEVICE_NO:
        v4 = str_value(value("device_no", dict), -1, 2)
    s1 = '""'
    s2 = '""'
    s3 = '""'
    s4 = '""'
    if match & (PCMCIA_DEV_ID_MATCH_PROD_ID1 | PCMCIA_DEV_ID_MATCH_PROD_ID2
                | PCMCIA_DEV_ID_MATCH_PROD_ID3 | PCMCIA_DEV_ID_MATCH_PROD_ID4):
        prods = lkddb.nullstring_re.sub('""', dict["prod_id"])
        line = lkddb.split_structs(prods)[0]
        dict_prod = lkddb.parse_struct(None,
                                       lkddb.unwind_array,
                                       line,
                                       None,
                                       filename,
                                       ret=True)
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID1:
            s1 = strings("n1", dict_prod, '""')
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID2:
            s2 = strings("n2", dict_prod, '""')
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID3:
            s3 = strings("n3", dict_prod, '""')
        if match | PCMCIA_DEV_ID_MATCH_PROD_ID4:
            s4 = strings("n4", dict_prod, '""')
    lkddb.lkddb_add("pcmcia '%s %s %s %s %s' %s %s %s %s %s # %s" %
                    (v0, v1, v2, v3, v4, s1, s2, s3, s4, dep, filename))
Exemplo n.º 4
0
def pnp_card_printer(dict, dep, filename):
    v0 = strings("id", dict, '""')
    if v0 == '""':
        return
    s = [
        '""',
    ] * 8
    prods = lkddb.nullstring_re.sub('""', dict["devs"])
    line = lkddb.split_structs(prods)[0]
    dict_prod = lkddb.parse_struct(None,
                                   lkddb.unwind_array,
                                   line,
                                   None,
                                   filename,
                                   ret=True)
    for i in range(8):
        s[i] = strings("n%u" % (i + 1), dict_prod, '""')
    lkddb.lkddb_add(
        "pnp_card %s %s %s %s %s %s %s %s %s %s # %s" %
        (v0, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], dep, filename))