aboutsummaryrefslogtreecommitdiff
path: root/tools/interface_generator/bin/interface_definition.py
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2024-08-18 15:08:13 +0300
committeraqua <aqua@iserlohn-fortress.net>2024-08-18 15:08:13 +0300
commitff0286195eeb4dc659863af4afbdf9ddd4d53a1b (patch)
tree94b06a2efdf8b349f7822dd79f5a6de5780bcbe3 /tools/interface_generator/bin/interface_definition.py
parentMoved pytest to private (diff)
downloadkernel-ff0286195eeb4dc659863af4afbdf9ddd4d53a1b.tar.xz
Moved interface_generator script to bin
Diffstat (limited to 'tools/interface_generator/bin/interface_definition.py')
-rw-r--r--tools/interface_generator/bin/interface_definition.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/interface_generator/bin/interface_definition.py b/tools/interface_generator/bin/interface_definition.py
new file mode 100644
index 0000000..3b9c4a3
--- /dev/null
+++ b/tools/interface_generator/bin/interface_definition.py
@@ -0,0 +1,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