Skip to content

Commit

Permalink
capi: Add a note about error code and returned value correspondence
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Apr 12, 2021
1 parent 90548db commit 1423ffb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/fizzy/fizzy.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ typedef struct FizzyImportedGlobal
/// @param error Pointer to store detailed error information at. Can be NULL if error
/// information is not required.
/// @return true if module is valid, false otherwise.
///
/// @note FizzyError::code must be ::FizzySuccess if function returns `true` and must not be
/// ::FizzySuccess otherwise.
bool fizzy_validate(
const uint8_t* wasm_binary, size_t wasm_binary_size, FizzyError* error) FIZZY_NOEXCEPT;

Expand All @@ -265,6 +268,9 @@ bool fizzy_validate(
/// @param error Pointer to store detailed error information at. Can be NULL if error
/// information is not required.
/// @return non-NULL pointer to module in case of success, NULL otherwise.
///
/// @note FizzyError::code must be ::FizzySuccess if function returns non-NULL
/// pointer and must not be ::FizzySuccess otherwise.
const FizzyModule* fizzy_parse(
const uint8_t* wasm_binary, size_t wasm_binary_size, FizzyError* error) FIZZY_NOEXCEPT;

Expand Down Expand Up @@ -431,6 +437,10 @@ bool fizzy_module_has_start_function(const FizzyModule* module) FIZZY_NOEXCEPT;
/// No validation is done on the number of globals passed in, nor on their order.
/// When number of passed globals or their order is different from the one defined by the
/// module, behaviour is undefined.
///
/// @note
/// FizzyError::code must be ::FizzySuccess if function returns non-NULL pointer and must not be
/// ::FizzySuccess otherwise.
FizzyInstance* fizzy_instantiate(const FizzyModule* module,
const FizzyExternalFunction* imported_functions, size_t imported_functions_size,
const FizzyExternalTable* imported_table, const FizzyExternalMemory* imported_memory,
Expand Down Expand Up @@ -479,6 +489,10 @@ FizzyInstance* fizzy_instantiate(const FizzyModule* module,
/// FizzyImportedFunction::module, FizzyImportedFunction::name, FizzyImportedGlobal::module,
/// FizzyImportedGlobal::name strings need to be valid only until fizzy_resolve_instantiate()
/// returns.
///
/// @note
/// FizzyError::code must be ::FizzySuccess if function returns non-NULL pointer and must not be
/// ::FizzySuccess otherwise.
FizzyInstance* fizzy_resolve_instantiate(const FizzyModule* module,
const FizzyImportedFunction* imported_functions, size_t imported_functions_size,
const FizzyExternalTable* imported_table, const FizzyExternalMemory* imported_memory,
Expand Down

0 comments on commit 1423ffb

Please sign in to comment.