From 26f49b7e27076e689541b9e13a1b54f60a4ee5c2 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 11 Jul 2024 02:57:23 +0900 Subject: feat: organize namespaces --- src/WebAssembly/Structure/Modules/Data.php | 17 +++++++++++ src/WebAssembly/Structure/Modules/DataMode.php | 25 ++++++++++++++++ .../Structure/Modules/DataModes/Active.php | 20 +++++++++++++ .../Structure/Modules/DataModes/Passive.php | 14 +++++++++ src/WebAssembly/Structure/Modules/Elem.php | 21 +++++++++++++ src/WebAssembly/Structure/Modules/ElemMode.php | 30 +++++++++++++++++++ .../Structure/Modules/ElemModes/Active.php | 20 +++++++++++++ .../Structure/Modules/ElemModes/Declarative.php | 14 +++++++++ .../Structure/Modules/ElemModes/Passive.php | 14 +++++++++ src/WebAssembly/Structure/Modules/Export.php | 17 +++++++++++ src/WebAssembly/Structure/Modules/ExportDesc.php | 28 +++++++++++++++++ .../Structure/Modules/ExportDescs/Func.php | 15 ++++++++++ .../Structure/Modules/ExportDescs/Global_.php | 15 ++++++++++ .../Structure/Modules/ExportDescs/Mem.php | 15 ++++++++++ .../Structure/Modules/ExportDescs/Table.php | 15 ++++++++++ src/WebAssembly/Structure/Modules/Func.php | 21 +++++++++++++ src/WebAssembly/Structure/Modules/Global_.php | 20 +++++++++++++ src/WebAssembly/Structure/Modules/Import.php | 19 ++++++++++++ src/WebAssembly/Structure/Modules/ImportDesc.php | 32 ++++++++++++++++++++ .../Structure/Modules/ImportDescs/Func.php | 15 ++++++++++ .../Structure/Modules/ImportDescs/Global_.php | 16 ++++++++++ .../Structure/Modules/ImportDescs/Mem.php | 16 ++++++++++ .../Structure/Modules/ImportDescs/Table.php | 16 ++++++++++ src/WebAssembly/Structure/Modules/Local.php | 15 ++++++++++ src/WebAssembly/Structure/Modules/Mem.php | 15 ++++++++++ src/WebAssembly/Structure/Modules/Module.php | 35 ++++++++++++++++++++++ src/WebAssembly/Structure/Modules/Start.php | 13 ++++++++ src/WebAssembly/Structure/Modules/Table.php | 15 ++++++++++ 28 files changed, 528 insertions(+) create mode 100644 src/WebAssembly/Structure/Modules/Data.php create mode 100644 src/WebAssembly/Structure/Modules/DataMode.php create mode 100644 src/WebAssembly/Structure/Modules/DataModes/Active.php create mode 100644 src/WebAssembly/Structure/Modules/DataModes/Passive.php create mode 100644 src/WebAssembly/Structure/Modules/Elem.php create mode 100644 src/WebAssembly/Structure/Modules/ElemMode.php create mode 100644 src/WebAssembly/Structure/Modules/ElemModes/Active.php create mode 100644 src/WebAssembly/Structure/Modules/ElemModes/Declarative.php create mode 100644 src/WebAssembly/Structure/Modules/ElemModes/Passive.php create mode 100644 src/WebAssembly/Structure/Modules/Export.php create mode 100644 src/WebAssembly/Structure/Modules/ExportDesc.php create mode 100644 src/WebAssembly/Structure/Modules/ExportDescs/Func.php create mode 100644 src/WebAssembly/Structure/Modules/ExportDescs/Global_.php create mode 100644 src/WebAssembly/Structure/Modules/ExportDescs/Mem.php create mode 100644 src/WebAssembly/Structure/Modules/ExportDescs/Table.php create mode 100644 src/WebAssembly/Structure/Modules/Func.php create mode 100644 src/WebAssembly/Structure/Modules/Global_.php create mode 100644 src/WebAssembly/Structure/Modules/Import.php create mode 100644 src/WebAssembly/Structure/Modules/ImportDesc.php create mode 100644 src/WebAssembly/Structure/Modules/ImportDescs/Func.php create mode 100644 src/WebAssembly/Structure/Modules/ImportDescs/Global_.php create mode 100644 src/WebAssembly/Structure/Modules/ImportDescs/Mem.php create mode 100644 src/WebAssembly/Structure/Modules/ImportDescs/Table.php create mode 100644 src/WebAssembly/Structure/Modules/Local.php create mode 100644 src/WebAssembly/Structure/Modules/Mem.php create mode 100644 src/WebAssembly/Structure/Modules/Module.php create mode 100644 src/WebAssembly/Structure/Modules/Start.php create mode 100644 src/WebAssembly/Structure/Modules/Table.php (limited to 'src/WebAssembly/Structure/Modules') diff --git a/src/WebAssembly/Structure/Modules/Data.php b/src/WebAssembly/Structure/Modules/Data.php new file mode 100644 index 0000000..3994a01 --- /dev/null +++ b/src/WebAssembly/Structure/Modules/Data.php @@ -0,0 +1,17 @@ + $init + */ + public function __construct( + public array $init, + public DataMode $mode, + ) { + } +} diff --git a/src/WebAssembly/Structure/Modules/DataMode.php b/src/WebAssembly/Structure/Modules/DataMode.php new file mode 100644 index 0000000..37205bc --- /dev/null +++ b/src/WebAssembly/Structure/Modules/DataMode.php @@ -0,0 +1,25 @@ + $offset + */ + final public static function Active( + int $memory, + array $offset, + ): DataModes\Active { + return new DataModes\Active($memory, $offset); + } +} diff --git a/src/WebAssembly/Structure/Modules/DataModes/Active.php b/src/WebAssembly/Structure/Modules/DataModes/Active.php new file mode 100644 index 0000000..41cc9c7 --- /dev/null +++ b/src/WebAssembly/Structure/Modules/DataModes/Active.php @@ -0,0 +1,20 @@ + $offset + */ + protected function __construct( + public int $memory, + public array $offset, + ) { + } +} diff --git a/src/WebAssembly/Structure/Modules/DataModes/Passive.php b/src/WebAssembly/Structure/Modules/DataModes/Passive.php new file mode 100644 index 0000000..6ef6ba9 --- /dev/null +++ b/src/WebAssembly/Structure/Modules/DataModes/Passive.php @@ -0,0 +1,14 @@ +> $init + */ + public function __construct( + public RefType $type, + public array $init, + public ElemMode $mode, + ) { + } +} diff --git a/src/WebAssembly/Structure/Modules/ElemMode.php b/src/WebAssembly/Structure/Modules/ElemMode.php new file mode 100644 index 0000000..0777bd4 --- /dev/null +++ b/src/WebAssembly/Structure/Modules/ElemMode.php @@ -0,0 +1,30 @@ + $offset + */ + final public static function Active( + int $table, + array $offset, + ): ElemModes\Active { + return new ElemModes\Active($table, $offset); + } + + final public static function Declarative(): ElemModes\Declarative + { + return new ElemModes\Declarative(); + } +} diff --git a/src/WebAssembly/Structure/Modules/ElemModes/Active.php b/src/WebAssembly/Structure/Modules/ElemModes/Active.php new file mode 100644 index 0000000..e66e080 --- /dev/null +++ b/src/WebAssembly/Structure/Modules/ElemModes/Active.php @@ -0,0 +1,20 @@ + $offset + */ + protected function __construct( + public int $table, + public array $offset, + ) { + } +} diff --git a/src/WebAssembly/Structure/Modules/ElemModes/Declarative.php b/src/WebAssembly/Structure/Modules/ElemModes/Declarative.php new file mode 100644 index 0000000..28f917a --- /dev/null +++ b/src/WebAssembly/Structure/Modules/ElemModes/Declarative.php @@ -0,0 +1,14 @@ + $locals + * @param list $body + */ + public function __construct( + public int $type, + public array $locals, + public array $body, + ) { + } +} diff --git a/src/WebAssembly/Structure/Modules/Global_.php b/src/WebAssembly/Structure/Modules/Global_.php new file mode 100644 index 0000000..04ffbc6 --- /dev/null +++ b/src/WebAssembly/Structure/Modules/Global_.php @@ -0,0 +1,20 @@ + $init + */ + public function __construct( + public GlobalType $type, + public array $init, + ) { + } +} diff --git a/src/WebAssembly/Structure/Modules/Import.php b/src/WebAssembly/Structure/Modules/Import.php new file mode 100644 index 0000000..e764fcb --- /dev/null +++ b/src/WebAssembly/Structure/Modules/Import.php @@ -0,0 +1,19 @@ + $types + * @param list $funcs + * @param list $tables + * @param list $mems + * @param list $globals + * @param list $elems + * @param list $datas + * @param list $imports + * @param list $exports + */ + public function __construct( + public array $types, + public array $funcs, + public array $tables, + public array $mems, + public array $globals, + public array $elems, + public array $datas, + public ?Start $start, + public array $imports, + public array $exports, + ) { + } +} diff --git a/src/WebAssembly/Structure/Modules/Start.php b/src/WebAssembly/Structure/Modules/Start.php new file mode 100644 index 0000000..6659929 --- /dev/null +++ b/src/WebAssembly/Structure/Modules/Start.php @@ -0,0 +1,13 @@ +