예제 #1
0
def read_method_of_c_datatype(datatype):
    if datatype == "char *":
        return "readString"
    if (datatype[-1] == "*") or (datatype == "caddr_t"):
        return None
    try:
        datasize = datasize_of_datatype(datatype)
    except KeyError:
        return None
    return { 32: "readInteger", 64: "readLong" }[datasize]
예제 #2
0
def build_syscall_results(g, syscalls):
    stmts = []
    for syscall in syscalls:
        if syscall.name in g.manually_defined_syscalls:
            continue
        if len(syscall.output_args) == 0:
            continue
        name = drop_prefix(syscall.name).capitalize()
        size = datasize_of_datatype(syscall.rettype)
        base = "Generic{size}".format(**locals())
        members = build_members_of_result(syscall)

        stmts.append("""public static class {name} extends {base} {{

        {members};
    }}""".format(**locals()))

    return "\n\n    ".join(stmts)
예제 #3
0
def rettype_class_of_syscall(syscall):
    if len(syscall.output_args) == 0:
        fmt = "Generic{size}"
        return fmt.format(size=datasize_of_datatype(syscall.rettype))
    return drop_prefix(syscall.name).capitalize()