def METHOD_NAME(argv=[]):
    lang = argv[1]
    file_name = argv[2]
    preamble = argv[3]
    utf8 = (argv[4] == "true")
    js_map = {}
    for i in range(5, len(argv), 2):
        js_map[argv[i]] = argv[i + 1]
    with open(file_name, "w") as out:
        if "cc" == lang:
            generate_cc_source(out, js_map, utf8)
        elif "hdecl" == lang:
            generate_header(file_name, out, js_map, True, utf8)
        elif "hh" == lang:
            generate_header(file_name, out, js_map, False, utf8)
        elif "java" == lang:
            generate_java_source(file_name, out, preamble, js_map)
        else:
            raise RuntimeError("Unknown lang: %s" % lang)