aboutsummaryrefslogtreecommitdiffstats
path: root/section_structs.py
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-02-14 19:22:31 +0000
committerterminaldweller <thabogre@gmail.com>2022-02-14 19:22:31 +0000
commitbddd10b1dab1cb88905489f93a77b5a8c465650b (patch)
treed33e31e4da2b4da846969c4ab21fe45712cdf853 /section_structs.py
parentlistened to lgtm... (diff)
downloaddwasm-bddd10b1dab1cb88905489f93a77b5a8c465650b.tar.gz
dwasm-bddd10b1dab1cb88905489f93a77b5a8c465650b.zip
just style fixesHEADmaster
Diffstat (limited to 'section_structs.py')
-rw-r--r--section_structs.py149
1 files changed, 103 insertions, 46 deletions
diff --git a/section_structs.py b/section_structs.py
index 219f7ea..f5e2998 100644
--- a/section_structs.py
+++ b/section_structs.py
@@ -9,24 +9,28 @@ class WASM_SECTION(object):
self.name = str()
self.payload_data = bytes()
-class WASM_SEGMENT_INFO():
+
+class WASM_SEGMENT_INFO:
def __int__(self):
self.count = int()
self.segments = []
-class WASM_SEGMENT_INFO_SEGMENT():
+
+class WASM_SEGMENT_INFO_SEGMENT:
def __init__(self):
self.name_len = int()
self.name_data = str()
self.alignment = int()
self.flags = int()
-class WASM_COMDAT_INFO_SUB():
+
+class WASM_COMDAT_INFO_SUB:
def __init__(self):
self.count = int()
self.comdats = []
-class COMDAT():
+
+class COMDAT:
def __init(self):
self.name_len = int()
self.name_str = str()
@@ -34,52 +38,60 @@ class COMDAT():
self.count = int()
self.comdat_syms = []
-class COMDAT_SYM():
+
+class COMDAT_SYM:
def __init(self):
self.kind = int()
self.index = int()
-class WASM_COMDAT_KIND():
+
+class WASM_COMDAT_KIND:
WASM_COMDAT_DATA = 0
WASM_COMDAT_FUNCTION = 1
WASM_COMDAT_GLOBAL = 2
-class WASM_INIT_FUNCS():
+
+class WASM_INIT_FUNCS:
def __init__(self):
self.count = int()
self.functions = []
-class WASM_SYMBOL_TABLE():
+
+class WASM_SYMBOL_TABLE:
def __init__(self):
self.count = int()
self.syminfo = []
-class SYM_INFO():
+
+class SYM_INFO:
def __init__(self):
self.kind = int()
self.flags = int()
-class SYM_INFO_FLAGS():
+
+class SYM_INFO_FLAGS:
WASM_SYM_BINDING_WEAK = 1
WASM_SYM_BINDING_LOCAL = 2
WASM_SYM_VISIBILITY_HIDDEN = 4
WASM_SYM_UNDEFINED = 16
-class Rel_Entry():
+class Rel_Entry:
def __int__(self):
self.type = int()
self.offset = int()
self.index = int()
-class RelA_Entry():
+
+class RelA_Entry:
def __int__(self):
self.type = int()
self.offset = int()
self.index = int()
self.addend = int()
-class Relocation_Section():
+
+class Relocation_Section:
def __int__(self):
self.section_id = int()
self.name_length = int()
@@ -87,7 +99,8 @@ class Relocation_Section():
self.count = int()
self.entries = int()
-class Func_Type():
+
+class Func_Type:
def __init__(self):
self.form = int()
self.param_cnt = int()
@@ -95,43 +108,51 @@ class Func_Type():
self.return_cnt = int()
self.return_type = []
-class Global_Type():
+
+class Global_Type:
def __init__(self):
self.content_type = int()
self.mutability = int()
-class Resizable_Limits():
+
+class Resizable_Limits:
def __init__(self):
self.flags = int()
self.initial = int()
self.maximum = int()
-class Table_Type():
+
+class Table_Type:
def __init__(self):
self.element_type = int()
self.limit = Resizable_Limits()
-class External_Kind():
+
+class External_Kind:
def __init__(self):
self.Function = 0
self.Table = 1
self.Memory = 2
self.Global = 3
-class Memory_Type():
+
+class Memory_Type:
def __init__(self):
self.limits = [Resizable_Limits()]
+
# @DEVI-FIXME-
-class Init_Expr():
+class Init_Expr:
pass
-class Type_Section():
+
+class Type_Section:
def __init__(self):
self.count = []
self.func_types = []
-class Import_Entry():
+
+class Import_Entry:
def __init__(self):
self.module_len = int()
self.module_str = []
@@ -140,80 +161,94 @@ class Import_Entry():
self.kind = int()
self.type = int()
-class Import_Section():
+
+class Import_Section:
def __init__(self):
self.count = []
self.import_entry = []
-class Function_Section():
+
+class Function_Section:
def __init__(self):
self.count = []
self.type_section_index = [int()]
-class Table_Section():
+
+class Table_Section:
def __init__(self):
self.count = []
self.table_types = []
-class Memory_Section():
+
+class Memory_Section:
def __init__(self):
self.count = []
# Resizable_Limits
self.memory_types = []
-class Global_Variable():
+
+class Global_Variable:
def __init__(self):
self.global_type = Global_Type()
self.init_expr = []
-class Global_Section():
+
+class Global_Section:
def __init__(self):
self.count = []
# Global_Variable
self.global_variables = []
-class Export_Entry():
+
+class Export_Entry:
def __init__(self):
self.field_len = int()
self.field_str = []
self.kind = int()
self.index = int()
-class Export_Section():
+
+class Export_Section:
def __init__(self):
self.count = []
# Export_Entry
self.export_entries = []
-class Start_Section():
+
+class Start_Section:
def __init__(self):
self.function_section_index = []
-class Elem_Segment():
+
+class Elem_Segment:
def __init__(self):
self.index = int()
self.offset = []
self.num_elem = int()
self.elems = []
-class Element_Section():
+
+class Element_Section:
def __init__(self):
self.count = []
# Elem_Segment
self.elem_segments = []
-class Local_Entry():
+
+class Local_Entry:
def __init__(self):
self.count = int()
self.type = int()
-class WASM_Ins():
+
+class WASM_Ins:
def __init__(self):
self.opcode = str()
self.opcodeint = int()
self.operands = []
-class Func_Body():
+
+class Func_Body:
def __init__(self):
self.body_size = int()
self.local_count = int()
@@ -223,63 +258,84 @@ class Func_Body():
self.code = []
self.end = int()
-class Code_Section():
+
+class Code_Section:
def __init__(self):
self.count = []
# Func_Body
self.func_bodies = []
-class Data_Segment():
+
+class Data_Segment:
def __init__(self):
self.index = int()
self.offset = []
self.size = int()
self.data = []
-class Data_Section():
+
+class Data_Section:
def __init__(self):
self.count = []
# Data_Segment
self.data_segments = []
-class Name_Type():
+
+class Name_Type:
Module = 0
Function = 1
Local = 2
+
class Name_Section_Entry(object):
def __init__(self, name_type, name_payload_len, name_payload_data):
self.name_type = name_type
self.name_payload_len = name_payload_len
self.name_payload_data = name_payload_data
+
class Name_Section(object):
def __init__(self, name_section_entry):
self.name_section_entry = []
self.name_section_entry = name_section_entry
+
class Module_Name(object):
def __init__(self, name_len, name_str):
self.name_len = name_len
self.name_str = name_str
+
class Naming(object):
def __init__(self, index, name_len, name_str):
self.index = index
self.name_len = name_len
self.name_str = name_str
+
class Name_Map(object):
def __init__(self, count, naming):
self.count = count
self.naming = []
self.naming = naming
+
# the module class
-class Module():
- def __init__(self, type_section, import_section, function_section,
- table_section, memory_section, global_section, export_section,
- start_section, element_section, code_section, data_section):
+class Module:
+ def __init__(
+ self,
+ type_section,
+ import_section,
+ function_section,
+ table_section,
+ memory_section,
+ global_section,
+ export_section,
+ start_section,
+ element_section,
+ code_section,
+ data_section,
+ ):
self.type_section = type_section
self.import_section = import_section
self.function_section = function_section
@@ -292,10 +348,11 @@ class Module():
self.code_section = code_section
self.data_section = data_section
-'''
+
+"""
class RT_INS_CELL(object):
def __init__(self):
label : str
mnemonic : str
ops : list
-'''
+"""