mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-02-09 22:08:43 -06:00
Added Python API function to create structs and unions
This commit is contained in:
BIN
python_libs/lib/imhex_python/__pycache__/types.cpython-38.pyc
Normal file
BIN
python_libs/lib/imhex_python/__pycache__/types.cpython-38.pyc
Normal file
Binary file not shown.
44
python_libs/lib/imhex_python/types.py
Normal file
44
python_libs/lib/imhex_python/types.py
Normal file
@@ -0,0 +1,44 @@
|
||||
class ImHexTypeMeta(type):
|
||||
def __new__(cls, name, bases, dct):
|
||||
return super().__new__(cls, name, bases, dct)
|
||||
|
||||
def __getitem__(self, value):
|
||||
return array(self, value)
|
||||
|
||||
class ImHexType(metaclass=ImHexTypeMeta):
|
||||
pass
|
||||
|
||||
class u8(ImHexType):
|
||||
pass
|
||||
class u16(ImHexType):
|
||||
pass
|
||||
class u32(ImHexType):
|
||||
pass
|
||||
class u64(ImHexType):
|
||||
pass
|
||||
class u128(ImHexType):
|
||||
pass
|
||||
|
||||
class s8(ImHexType):
|
||||
pass
|
||||
class s16(ImHexType):
|
||||
pass
|
||||
class s32(ImHexType):
|
||||
pass
|
||||
class s64(ImHexType):
|
||||
pass
|
||||
class s128(ImHexType):
|
||||
pass
|
||||
|
||||
class float(ImHexType):
|
||||
pass
|
||||
class double(ImHexType):
|
||||
pass
|
||||
|
||||
class array(ImHexType):
|
||||
def __init__(self, array_type, size):
|
||||
self.array_type = array_type()
|
||||
self.size = size
|
||||
|
||||
array_type : type
|
||||
size : int
|
||||
Reference in New Issue
Block a user