""" interface_definition.py """ def __read_license(path): """read and starrify a license""" license_text = "" with open(path, encoding="utf-8") as license_file: license_text = "".join( [ f" * { line.rstrip().ljust(72)[:72] } * \n" for line in license_file.readlines() ] ).rstrip() return license_text def parse(args): """return a mock interface definition""" interface_dict = { "name": "kstdio", "license": __read_license(args.license), "system_includes": ["stdarg.h"], "types": [ { "name": "File", "members": [ "int fd", "int (*putc)(const struct kstdio_File*, const char)", "int (*puts)(const struct kstdio_File*, const char*)", ], }, ], "functions": [ { "name": "printf", "return": "int", "arguments": ["const char* format"], "argument_names": ["format"], }, ], } return interface_dict