(t: TypeDecl)
| 22 | } |
| 23 | |
| 24 | def format_type(t: TypeDecl): |
| 25 | if isinstance(t, PtrDecl) or isinstance(t, Struct): |
| 26 | return 'ffi.CData' |
| 27 | if isinstance(t, Enum): |
| 28 | return 'int' |
| 29 | if isinstance(t, TypeDecl): |
| 30 | return format_type(t.type) |
| 31 | if isinstance(t, IdentifierType): |
| 32 | assert len(t.names) == 1, f'Expected a single name, got {t.names}' |
| 33 | return __c_type_to_python_type.get(t.names[0]) or 'ffi.CData' |
| 34 | return t.name |
| 35 | |
| 36 | class PythonStubFuncDeclVisitor(c_ast.NodeVisitor): |
| 37 | def __init__(self): |