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

Functions

DetlefStatus detlef_with_protected_values (DetlefAccess *a, const DetlefHandle *handles, size_t count, DetlefAccessCallback callback, void *data)
 
DetlefStatus detlef_variable_declare (DetlefAccess *a, DetlefSlice input, DetlefHandle type_handle, DetlefHandle initial)
 
DetlefStatus detlef_variable_set (DetlefAccess *a, DetlefSlice input, DetlefHandle handle)
 
DetlefStatus detlef_variable_unset (DetlefAccess *a, DetlefSlice input)
 
DetlefStatus detlef_variable_get (DetlefAccess *a, DetlefSlice input, DetlefHandle *out)
 

Detailed Description

Function Documentation

◆ detlef_variable_declare()

DetlefStatus detlef_variable_declare ( DetlefAccess *  a,
DetlefSlice  input,
DetlefHandle  type_handle,
DetlefHandle  initial 
)

Declare a mutable variable with a resolved type. A zero initial handle leaves the variable uninitialized.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
inputBorrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call.
type_handleBorrowed resolved type descriptor for the variable's declared type. Not consumed.
initialBorrowed initial value handle, or zero to leave the variable uninitialized.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_variable_get()

DetlefStatus detlef_variable_get ( DetlefAccess *  a,
DetlefSlice  input,
DetlefHandle *  out 
)

Read the current value of a mutable variable. Unknown and uninitialized variables fail.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
inputBorrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call.
[out]outOn success, receives an owned runtime value handle for the variable's current value. Release with detlef_handle_release() unless transferred as a callback result.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_variable_set()

DetlefStatus detlef_variable_set ( DetlefAccess *  a,
DetlefSlice  input,
DetlefHandle  handle 
)

Assign an existing mutable variable. Its declared type is checked and the input handle is not consumed.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
inputBorrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call.
handleBorrowed runtime value handle to assign. Not consumed.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_variable_unset()

DetlefStatus detlef_variable_unset ( DetlefAccess *  a,
DetlefSlice  input 
)

Mark an existing variable uninitialized without removing its declaration.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
inputBorrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_with_protected_values()

DetlefStatus detlef_with_protected_values ( DetlefAccess *  a,
const DetlefHandle *  handles,
size_t  count,
DetlefAccessCallback  callback,
void *  data 
)

Invoke a setup callback with the supplied object values protected from garbage collection for the duration of that callback. Existing handles are not consumed.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handlesBorrowed array of runtime value handles. Object values are protected during the callback; handles are not consumed.
countNumber of entries in the supplied array.
callbackSetup callback invoked synchronously with a fresh access pointer. It is not saved after this call.
dataCaller-owned data passed to callback. Must remain valid until the callback returns; DETLEF does not free it.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.