DETLEF C SDK
Native embedding and package authoring
Loading...
Searching...
No Matches
Primitive Values

Functions

static DetlefSdkStatus detlef_sdk_integer (DetlefSdkCall *call, int64_t value, DetlefSdkValue *out)
 
static DetlefSdkStatus detlef_sdk_float (DetlefSdkCall *call, double value, DetlefSdkValue *out)
 
static DetlefSdkStatus detlef_sdk_boolean (DetlefSdkCall *call, DetlefSdkBool value, DetlefSdkValue *out)
 
static DetlefSdkStatus detlef_sdk_string (DetlefSdkCall *call, const char *text, size_t length, DetlefSdkValue *out)
 
static DetlefSdkStatus detlef_sdk_none (DetlefSdkCall *call, DetlefSdkValue *out)
 
static DetlefSdkStatus detlef_sdk_get_integer (DetlefSdkCall *call, DetlefSdkValue value, int64_t *out)
 
static DetlefSdkStatus detlef_sdk_get_float (DetlefSdkCall *call, DetlefSdkValue value, double *out)
 
static DetlefSdkStatus detlef_sdk_get_boolean (DetlefSdkCall *call, DetlefSdkValue value, DetlefSdkBool *out)
 
static DetlefSdkStatus detlef_sdk_format (DetlefSdkCall *call, DetlefSdkValue value, char *output, size_t capacity, size_t *length)
 

Detailed Description

Function Documentation

◆ detlef_sdk_boolean()

static DetlefSdkStatus detlef_sdk_boolean ( DetlefSdkCall *  call,
DetlefSdkBool  value,
DetlefSdkValue *  out 
)
inlinestatic

Create a boolean from DETLEF_SDK_FALSE (0) or DETLEF_SDK_TRUE (1).

Parameters
callBorrowed callback access. Must not be saved or freed.
valueDETLEF_SDK_FALSE (0) or DETLEF_SDK_TRUE (1).
[out]outReceives a callback-local handle, released automatically at callback exit. Must be retained before being saved beyond the callback.
Returns
DETLEF_SDK_OK on success; a native failure returns a status and a Wasm host failure aborts the callback with an exception.

◆ detlef_sdk_float()

static DetlefSdkStatus detlef_sdk_float ( DetlefSdkCall *  call,
double  value,
DetlefSdkValue *  out 
)
inlinestatic

Create a float from a C double.

Parameters
callBorrowed callback access. Must not be saved or freed.
valueFloat to store.
[out]outReceives a callback-local handle, released automatically at callback exit. Must be retained before being saved beyond the callback.
Returns
DETLEF_SDK_OK on success; a native failure returns a status and a Wasm host failure aborts the callback with an exception.

◆ detlef_sdk_format()

static DetlefSdkStatus detlef_sdk_format ( DetlefSdkCall *  call,
DetlefSdkValue  value,
char *  output,
size_t  capacity,
size_t *  length 
)
inlinestatic

Format a value into caller-supplied UTF-8 storage. Strings yield their contents; arrays and records use JSON. The complete byte length is returned even when the output is truncated. No trailing NUL is written.

Parameters
callBorrowed callback access. Must not be saved or freed.
valueBorrowed runtime value handle to format. Not consumed.
[out]outputBorrowed writable buffer. Never freed by the SDK.
capacityAvailable bytes in output.
[out]lengthReceives the full required byte length. No cleanup is required.
Returns
DETLEF_SDK_OK on success; a native failure returns a status and a Wasm host failure aborts the callback with an exception.

◆ detlef_sdk_get_boolean()

static DetlefSdkStatus detlef_sdk_get_boolean ( DetlefSdkCall *  call,
DetlefSdkValue  value,
DetlefSdkBool *  out 
)
inlinestatic

Read a boolean as zero or one without converting another value type.

Parameters
callBorrowed callback access. Must not be saved or freed.
valueBorrowed boolean value handle. Not consumed.
[out]outReceives zero or one. No cleanup is required.
Returns
DETLEF_SDK_OK on success; a native failure returns a status and a Wasm host failure aborts the callback with an exception.

◆ detlef_sdk_get_float()

static DetlefSdkStatus detlef_sdk_get_float ( DetlefSdkCall *  call,
DetlefSdkValue  value,
double *  out 
)
inlinestatic

Read a float without converting another value type.

Parameters
callBorrowed callback access. Must not be saved or freed.
valueBorrowed float value handle. Not consumed.
[out]outReceives a C double. No cleanup is required.
Returns
DETLEF_SDK_OK on success; a native failure returns a status and a Wasm host failure aborts the callback with an exception.

◆ detlef_sdk_get_integer()

static DetlefSdkStatus detlef_sdk_get_integer ( DetlefSdkCall *  call,
DetlefSdkValue  value,
int64_t *  out 
)
inlinestatic

Read a signed 64-bit integer without converting other value types.

Parameters
callBorrowed callback access. Must not be saved or freed.
valueBorrowed integer handle. Its ownership is unchanged.
[out]outReceives the integer. No cleanup is required.
Returns
DETLEF_SDK_OK on success. A non-integer value returns a native failure status or aborts the Wasm callback with an exception.

◆ detlef_sdk_integer()

static DetlefSdkStatus detlef_sdk_integer ( DetlefSdkCall *  call,
int64_t  value,
DetlefSdkValue *  out 
)
inlinestatic

Create a signed 64-bit integer value.

Parameters
callBorrowed callback access. Must not be saved or freed.
valueInteger to store.
[out]outReceives a callback-local handle. Released automatically at callback exit; it may also be supplied as the callback result.
Returns
DETLEF_SDK_OK on success, otherwise a native failure status or Wasm exception.
See also
Reading an integer.

◆ detlef_sdk_none()

static DetlefSdkStatus detlef_sdk_none ( DetlefSdkCall *  call,
DetlefSdkValue *  out 
)
inlinestatic

Create the language value none, which is distinct from a zero result handle.

Parameters
callBorrowed callback access. Must not be saved or freed.
[out]outReceives a callback-local handle, released automatically at callback exit. Must be retained before being saved beyond the callback.
Returns
DETLEF_SDK_OK on success; a native failure returns a status and a Wasm host failure aborts the callback with an exception.

◆ detlef_sdk_string()

static DetlefSdkStatus detlef_sdk_string ( DetlefSdkCall *  call,
const char *  text,
size_t  length,
DetlefSdkValue *  out 
)
inlinestatic

Create a string by copying UTF-8 bytes. Embedded NUL bytes are supported.

Parameters
callBorrowed callback access. Must not be saved or freed.
textBorrowed bytes, valid through this call.
lengthByte length, excluding any trailing NUL.
[out]outReceives a callback-local handle, released automatically at callback exit. Must be retained before being saved beyond the callback.
Returns
DETLEF_SDK_OK on success; a native failure returns a status and a Wasm host failure aborts the callback with an exception.