Skip to content

Commit

Permalink
capi: Use doxygen links where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Jan 18, 2021
1 parent 7f15861 commit 5a1eed3
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions include/fizzy/fizzy.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ typedef struct FizzyInstance FizzyInstance;

/// The data type representing numeric values.
///
/// i64 member is used to represent values of both i32 and i64 type.
/// The #i64 member is used to represent values of both i32 and i64 type.
typedef union FizzyValue
{
/// Integer value.
uint64_t i64;
/// 32-bit floating-point value.
float f32;
/// 64-bit floating-point value.
double f64;
} FizzyValue;

Expand All @@ -35,10 +38,10 @@ typedef struct FizzyExecutionResult
/// Whether execution ended with a trap.
bool trapped;
/// Whether function returned a value.
/// Equals false if trapped equals true.
/// Equals false if #trapped equals true.
bool has_value;
/// Value returned from a function.
/// Valid only if has_value equals true.
/// Valid only if #has_value equals true.
FizzyValue value;
} FizzyExecutionResult;

Expand All @@ -65,7 +68,7 @@ static const FizzyValueType FizzyValueTypeVoid = 0;
/// Function type.
typedef struct FizzyFunctionType
{
/// Output type, equals to FizzyValueTypeVoid iff function has no output.
/// Output type, equals to ::FizzyValueTypeVoid iff function has no output.
FizzyValueType output;
/// Pointer to input types array.
const FizzyValueType* inputs;
Expand Down Expand Up @@ -100,7 +103,7 @@ typedef struct FizzyLimits
/// Minimum value.
uint32_t min;
/// Maximum value.
/// Valid only if has_max equals true.
/// Valid only if #has_max equals true.
uint32_t max;
/// Whether limits has maximum value.
bool has_max;
Expand Down Expand Up @@ -166,7 +169,7 @@ const FizzyModule* fizzy_parse(const uint8_t* wasm_binary, size_t wasm_binary_si
/// @param module Pointer to module. If NULL is passed, function has no effect.
///
/// @note
/// Should be called unless @p module was passed to fizzy_instantiate.
/// Should be called unless @p module was passed to fizzy_instantiate().
void fizzy_free_module(const FizzyModule* module);

/// Make a copy of a module.
Expand Down Expand Up @@ -251,11 +254,11 @@ bool fizzy_module_has_start_function(const FizzyModule* module);

/// Instantiate a module.
///
/// The instance takes ownership of the module, i.e. fizzy_free_module must not be called on the
/// The instance takes ownership of the module, i.e. fizzy_free_module() must not be called on the
/// module after this call.
/// For simplicity a module cannot be shared among several instances (calling fizzy_instatiate more
/// than once with the same module results in undefined behaviour), but after fizzy_instantiate
/// functions querying module info can still be called with @p module.
/// For simplicity a module cannot be shared among several instances (calling fizzy_instatiate()
/// more than once with the same module results in undefined behaviour), but after
/// fizzy_instantiate() functions querying module info can still be called with @p module.
///
/// @param module Pointer to module. Cannot be NULL.
/// @param imported_functions Pointer to the imported function array. Can be NULL iff
Expand Down Expand Up @@ -291,11 +294,12 @@ FizzyInstance* fizzy_instantiate(const FizzyModule* module,

/// Instantiate a module resolving imported functions.
///
/// The instance takes ownership of the module, i.e. fizzy_free_module must not be called on the
/// The instance takes ownership of the module, i.e. fizzy_free_module() must not be called on the
/// module after this call.
/// For simplicity a module cannot be shared among several instances (calling fizzy_instatiate more
/// than once with the same module results in undefined behaviour), but after fizzy_instantiate
/// functions querying module info can still be called with @p module.
/// For simplicity a module cannot be shared among several instances (calling
/// fizzy_resolve_instatiate() more than once with the same module results in undefined behaviour),
/// but after fizzy_resolve_instantiate() functions querying module info can still be called with
/// @p module.
///
/// @param module Pointer to module. Cannot be NULL.
/// @param imported_functions Pointer to the imported function array. Can be NULL iff
Expand All @@ -316,7 +320,8 @@ FizzyInstance* fizzy_instantiate(const FizzyModule* module,
/// @note
/// Functions in @p imported_functions are allowed to be in any order and allowed to include some
/// functions not required by the module.
/// Functions are matched to module's imports based on their module and name strings.
/// Functions are matched to module's imports based on their FizzyImportedFunction::module and
/// FizzyImportedFunction::name strings.
///
/// @note
/// Function expects @p imported_globals to be in the order of imports defined in the module.
Expand All @@ -339,7 +344,7 @@ void fizzy_free_instance(FizzyInstance* instance);
/// @return Pointer to a module.
///
/// @note The returned pointer represents non-owning, "view"-access to the module and must not be
/// passed to fizzy_free_module.
/// passed to fizzy_free_module().
const FizzyModule* fizzy_get_instance_module(FizzyInstance* instance);

/// Get pointer to memory of an instance.
Expand All @@ -365,20 +370,20 @@ size_t fizzy_get_instance_memory_size(FizzyInstance* instance);
/// @param out_function Pointer to output struct to store the found function. Cannot be NULL.
/// If function is found, associated context is allocated, which must exist
/// as long as the function can be called by some other instance, and should
/// be destroyed with fizzy_free_exported_function afterwards.
/// be destroyed with fizzy_free_exported_function() afterwards.
/// When function is not found (false returned), this @p out_function is not
/// modified, and fizzy_free_exported_function must not be called.
/// modified, and fizzy_free_exported_function() must not be called.
/// @return true if function was found, false otherwise.
bool fizzy_find_exported_function(
FizzyInstance* instance, const char* name, FizzyExternalFunction* out_function);

/// Free resources associated with exported function.
///
/// @param external_function Pointer to external function struct filled by
/// fizzy_find_exported_function. Cannot be NULL.
/// fizzy_find_exported_function(). Cannot be NULL.
///
/// @note This function may not be called with external function, which was not returned from
/// fizzy_find_exported_function.
/// fizzy_find_exported_function().
void fizzy_free_exported_function(FizzyExternalFunction* external_function);

/// Find exported table by name.
Expand Down

0 comments on commit 5a1eed3

Please sign in to comment.