Skip to content

Commit

Permalink
Class documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtonmeuser committed Sep 2, 2023
1 parent abba1ac commit aa010b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
16 changes: 8 additions & 8 deletions doc_classes/Wasm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Wasm" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<class name="Wasm" inherits="Reference" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
An instance of a Wasm module.
Before being able to be used, the module must be compiled and instantiated.
Expand All @@ -13,16 +13,16 @@
<methods>
<method name="compile">
<return type="int" enum="Error" />
<param index="0" name="bytecode" type="PackedByteArray" />
<argument index="0" name="bytecode" type="PoolByteArray" />
<description>
Compile the Wasm module provided Wasm binary [code]bytecode[/code].
This must be called before instantiating the module. Alternatively, the module can be compiled and instantiated in a single step with [method load].
</description>
</method>
<method name="function">
<return type="Variant" />
<param index="0" name="name" type="String" />
<param index="1" name="args" type="Array" />
<argument index="0" name="name" type="String" />
<argument index="1" name="args" type="Array" />
<description>
Call an exported function of the instantiated Wasm module.
The [code]args[/code] argument array must be provided even if no arguments are required.
Expand All @@ -31,7 +31,7 @@
</method>
<method name="global">
<return type="Variant" />
<param index="0" name="name" type="String" />
<argument index="0" name="name" type="String" />
<description>
Access an exported global of the instantiated Wasm module.
Returns either a single float or integer.
Expand All @@ -46,7 +46,7 @@
</method>
<method name="instantiate">
<return type="int" enum="Error" />
<param index="0" name="import_map" type="Dictionary" />
<argument index="0" name="import_map" type="Dictionary" />
<description>
Instantiate a compiled Wasm module.
Before this can be called, the module must be compiled via [method compile].
Expand All @@ -57,8 +57,8 @@
</method>
<method name="load">
<return type="int" enum="Error" />
<param index="0" name="bytecode" type="PackedByteArray" />
<param index="1" name="import_map" type="Dictionary" />
<argument index="0" name="bytecode" type="PoolByteArray" />
<argument index="1" name="import_map" type="Dictionary" />
<description>
Compile and instantiate a Wasm module in a single step.
Equivalent to calling [method compile] and [method instantiate].
Expand Down
21 changes: 2 additions & 19 deletions doc_classes/WasmMemory.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="WasmMemory" inherits="StreamPeer" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<class name="WasmMemory" inherits="StreamPeer" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
A [StreamPeer] interface for interacting with the memory of an instantiated Wasm module.
</brief_description>
Expand All @@ -16,26 +16,9 @@
Can be set using [method seek].
</description>
</method>
<method name="inspect">
<return type="Dictionary" />
<description>
Inspect the minimum, maximum, and current memory sizes.
</description>
</method>
<method name="grow">
<return type="int" enum="Error" />
<param index="0" name="pages" type="int" />
<description>
Grow the memory by a number of pages.
Per WebAssembly specifications, each memory page is 65536 bytes.
Memory can be created by an instantiated Wasm module or created externally to be used as a module import.
External memory must be grown before being used as a module import.
Allocated memory can not be decreased i.e. grown by a negative number of pages.
</description>
</method>
<method name="seek">
<return type="WasmMemory" />
<param index="0" name="p_pos" type="int" />
<argument index="0" name="p_pos" type="int" />
<description>
Set the memory offset of the [StreamPeer].
Values will be read from and written to this position.
Expand Down

0 comments on commit aa010b2

Please sign in to comment.