summaryrefslogtreecommitdiff
path: root/python/platform.py
diff options
context:
space:
mode:
authorRyan Snyder <ryan@vector35.com>2021-08-04 11:17:40 -0400
committerRyan Snyder <ryan@vector35.com>2021-08-20 04:34:14 -0400
commitcc1e85a4a8b2001f9fd6cf91b93fb39abef3a0e2 (patch)
tree45fdf52d2bdb8e09f57fc76079a3a91b6528f4a1 /python/platform.py
parentc1e526ea39d97c4c374de4cf8c211dc39ebbb538 (diff)
platforms: specify platform types and add bvt platform callbacks
Diffstat (limited to 'python/platform.py')
-rw-r--r--python/platform.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/python/platform.py b/python/platform.py
index 4983adff..5039f1ca 100644
--- a/python/platform.py
+++ b/python/platform.py
@@ -94,6 +94,8 @@ class Platform(with_metaclass(_PlatformMetaClass, object)):
calling conventions used.
"""
name = None
+ type_file_path = None # path to platform types file
+ type_include_dirs = [] # list of directories available to #include from type_file_path
def __init__(self, arch = None, handle = None):
if handle is None:
@@ -101,7 +103,13 @@ class Platform(with_metaclass(_PlatformMetaClass, object)):
self.handle = None
raise ValueError("platform must have an associated architecture")
self._arch = arch
- self.handle = core.BNCreatePlatform(arch.handle, self.__class__.name)
+ if self.__class__.type_file_path is None:
+ self.handle = core.BNCreatePlatform(arch.handle, self.__class__.name)
+ else:
+ dir_buf = (ctypes.c_char_p * len(self.__class__.type_include_dirs))()
+ for (i, dir) in enumerate(self.__class__.type_include_dirs):
+ dir_buf[i] = dir.encode('charmap')
+ self.handle = core.BNCreatePlatformWithTypes(arch.handle, self.__class__.name, self.__class__.type_file_path, dir_buf, len(self.__class__.type_include_dirs))
else:
self.handle = handle
self.__dict__["name"] = core.BNGetPlatformName(self.handle)