Capture function pointer declarations in structs

- Update geninterop.py to visit function pointers
- Support running on Windows 10
- Update interop38.cs
This commit is contained in:
Jeff17Robbins 2019-11-27 20:57:19 -05:00 коммит произвёл Benedikt Reinartz
Родитель 5f2e2e2f81
Коммит 627cac0cb9
3 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -34,6 +34,7 @@
- Ivan Cronyn ([@cronan](https://github.com/cronan))
- Jan Krivanek ([@jakrivan](https://github.com/jakrivan))
- Jeff Reback ([@jreback](https://github.com/jreback))
- Jeff Robbins ([@jeff17robbins](https://github.com/jeff17robbins))
- Joe Frayne ([@jfrayne](https://github.com/jfrayne))
- Joe Lidbetter ([@jmlidbetter](https://github.com/jmlidbetter))
- Joe Savage ([@s4v4g3](https://github.com/s4v4g3))

Просмотреть файл

@ -1,6 +1,6 @@
// Auto-generated by geninterop.py.
// DO NOT MODIFIY BY HAND.
// DO NOT MODIFY BY HAND.
#if PYTHON38
@ -84,6 +84,7 @@ namespace Python.Runtime
public static int tp_version_tag = 0;
public static int tp_finalize = 0;
public static int tp_vectorcall = 0;
public static int tp_print = 0;
public static int am_await = 0;
public static int am_aiter = 0;
public static int am_anext = 0;
@ -149,4 +150,3 @@ namespace Python.Runtime
}
#endif

Просмотреть файл

@ -76,6 +76,8 @@ class AstParser(object):
self.visit_struct(node)
elif isinstance(node, c_ast.Decl):
self.visit_decl(node)
elif isinstance(node, c_ast.FuncDecl):
self.visit_funcdecl(node)
elif isinstance(node, c_ast.PtrDecl):
self.visit_ptrdecl(node)
elif isinstance(node, c_ast.IdentifierType):
@ -110,6 +112,9 @@ class AstParser(object):
def visit_decl(self, decl):
self.visit(decl.type)
def visit_funcdecl(self, funcdecl):
self.visit(funcdecl.type)
def visit_ptrdecl(self, ptrdecl):
self.__ptr_decl_depth += 1
self.visit(ptrdecl.type)
@ -177,6 +182,13 @@ def preprocess_python_headers():
"-D", "_POSIX_THREADS"
]
if os.name == 'nt':
defines.extend([
"-D", "__inline=inline",
"-D", "__ptr32=",
"-D", "__declspec(x)=",
])
if hasattr(sys, "abiflags"):
if "d" in sys.abiflags:
defines.extend(("-D", "PYTHON_WITH_PYDEBUG"))
@ -216,7 +228,7 @@ def gen_interop_code(members):
defines_str = " && ".join(defines)
class_definition = """
// Auto-generated by %s.
// DO NOT MODIFIY BY HAND.
// DO NOT MODIFY BY HAND.
#if %s