1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
"""
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
|