Package com.dylibso.chicory.wasm.types
Class NameCustomSection
- java.lang.Object
-
- com.dylibso.chicory.wasm.types.Section
-
- com.dylibso.chicory.wasm.types.CustomSection
-
- com.dylibso.chicory.wasm.types.NameCustomSection
-
public class NameCustomSection extends CustomSection
The "name" custom section.
-
-
Constructor Summary
Constructors Constructor Description NameCustomSection(String moduleName, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> funcNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.ListEntry<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry>> localNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.ListEntry<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry>> labelNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> tableNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> memoryNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> globalNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> elementNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> dataNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> tagNames)Construct a section instance from the specified contents.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddDataName(int dataIdx, String name)Add a data segment name to this section.StringaddElementName(int elementIdx, String name)Add an element name to this section.StringaddFunctionName(int functionIdx, String name)Add a function name to this section.StringaddGlobalName(int globalIdx, String name)Add a global name to this section.StringaddLabelName(int functionIdx, int labelIdx, String name)Add a label name to this section.StringaddLocalName(int functionIdx, int localIdx, String name)Add a local name to this section.StringaddMemoryName(int memoryIdx, String name)Add a memory name to this section.StringaddTableName(int tableIdx, String name)Add a table name to this section.StringaddTagName(int tagIdx, String name)Add a tag name to this section.intfunctionNameCount()StringmoduleName()Stringname()StringnameOfData(int dataIdx)StringnameOfElement(int elementIdx)StringnameOfFunction(int functionIdx)StringnameOfGlobal(int globalIdx)StringnameOfLabel(int functionIdx, int labelIdx)StringnameOfLocal(int functionIdx, int localIdx)StringnameOfMemory(int memoryIdx)StringnameOfTable(int tableIdx)StringnameOfTag(int tagIdx)static NameCustomSectionparse(byte[] bytes)Parse a new instance from a byte array.
-
-
-
Constructor Detail
-
NameCustomSection
public NameCustomSection(String moduleName, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> funcNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.ListEntry<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry>> localNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.ListEntry<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry>> labelNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> tableNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> memoryNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> globalNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> elementNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> dataNames, List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> tagNames)
Construct a section instance from the specified contents.
-
-
Method Detail
-
parse
public static NameCustomSection parse(byte[] bytes)
Parse a new instance from a byte array.- Parameters:
bytes- the byte content of the section
-
name
public String name()
- Specified by:
namein classCustomSection
-
moduleName
public String moduleName()
- Returns:
- the module name, or
nullif none is set
-
nameOfFunction
public String nameOfFunction(int functionIdx)
- Returns:
- the name of the function with the given index, or
nullif none is set
-
functionNameCount
public int functionNameCount()
- Returns:
- the number of function names in this section This value does not have any relationship to the function index of any particular entry; it merely reflects the number of function names in this section. Used for testing.
-
nameOfLocal
public String nameOfLocal(int functionIdx, int localIdx)
- Returns:
- the name of the local with the given index within the function with the given index, or
nullif none is set
-
nameOfLabel
public String nameOfLabel(int functionIdx, int labelIdx)
- Returns:
- the name of the local with the given index within the function with the given index, or
nullif none is set
-
nameOfTable
public String nameOfTable(int tableIdx)
- Returns:
- the name of the table with the given index, or
nullif none is set
-
nameOfMemory
public String nameOfMemory(int memoryIdx)
- Returns:
- the name of the memory with the given index, or
nullif none is set
-
nameOfGlobal
public String nameOfGlobal(int globalIdx)
- Returns:
- the name of the global with the given index, or
nullif none is set
-
nameOfElement
public String nameOfElement(int elementIdx)
- Returns:
- the name of the element with the given index, or
nullif none is set
-
nameOfData
public String nameOfData(int dataIdx)
- Returns:
- the name of the data segment with the given index, or
nullif none is set
-
nameOfTag
public String nameOfTag(int tagIdx)
- Returns:
- the name of the tag with the given index, or
nullif none is set
-
addFunctionName
public String addFunctionName(int functionIdx, String name)
Add a function name to this section.- Parameters:
functionIdx- the index of the function to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
addLocalName
public String addLocalName(int functionIdx, int localIdx, String name)
Add a local name to this section.- Parameters:
functionIdx- the index of the function containing the locallocalIdx- the index of the local to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
addLabelName
public String addLabelName(int functionIdx, int labelIdx, String name)
Add a label name to this section.- Parameters:
functionIdx- the index of the function containing the labellabelIdx- the index of the label to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
addTableName
public String addTableName(int tableIdx, String name)
Add a table name to this section.- Parameters:
tableIdx- the index of the table to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
addMemoryName
public String addMemoryName(int memoryIdx, String name)
Add a memory name to this section.- Parameters:
memoryIdx- the index of the memory to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
addGlobalName
public String addGlobalName(int globalIdx, String name)
Add a global name to this section.- Parameters:
globalIdx- the index of the global to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
addElementName
public String addElementName(int elementIdx, String name)
Add an element name to this section.- Parameters:
elementIdx- the index of the element to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
addDataName
public String addDataName(int dataIdx, String name)
Add a data segment name to this section.- Parameters:
dataIdx- the index of the data segment to namename- the new name (must not benull)- Returns:
- the previously set name, or
nullif there was none
-
-