|
DETLEF C SDK
Native embedding and package authoring
|
| DetlefStatus detlef_function_access_error | ( | DetlefFunctionAccess * | a, |
| DetlefText * | out, | ||
| DetlefSpan * | span, | ||
| DetlefBool * | has_span | ||
| ) |
Copy the last diagnostic associated with this access, including an optional source span. Reading it does not clear the error. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| [out] | out | Receives owned UTF-8 text without a trailing NUL. Must be freed once with detlef_text_free(). |
| [out] | span | Receives a half-open source range in UTF-8 byte offsets. No cleanup is required. |
| [out] | has_span | Receives one when a diagnostic includes a span, otherwise zero. No cleanup is required. |
| DetlefStatus detlef_function_argument_boolean | ( | DetlefFunctionAccess * | a, |
| size_t | index, | ||
| DetlefBool * | out | ||
| ) |
Read an argument as a boolean, evaluating it in a Control. Non-boolean values are rejected. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| index | Zero-based argument index. | |
| [out] | out | Receives DETLEF_FALSE or DETLEF_TRUE. |
| DetlefStatus detlef_function_argument_count | ( | DetlefFunctionAccess * | a, |
| size_t * | out | ||
| ) |
Read the number of arguments supplied to the current callable. A setup access has no callable arguments. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| [out] | out | Receives the number of arguments in the current callback. |
| DetlefStatus detlef_function_argument_value | ( | DetlefFunctionAccess * | a, |
| size_t | index, | ||
| DetlefHandle * | out | ||
| ) |
Obtain a runtime value from an argument, evaluating it in a Control. Void and descriptor results are rejected. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| index | Zero-based argument index. | |
| [out] | out | On success, receives an owned runtime value handle for the argument. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_array_create | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | type_handle, | ||
| const DetlefHandle * | items, | ||
| size_t | count, | ||
| DetlefHandle * | out | ||
| ) |
Create an array using a resolved array type and borrowed element handles. Input values are copied and their types are checked. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| type_handle | Borrowed resolved array type descriptor from detlef_function_type_array(), not its element type. Not consumed. | |
| items | Borrowed array of runtime value handles in element order. Values are copied into the array; handles are not consumed. | |
| count | Number of entries in the supplied array. | |
| [out] | out | On success, receives an owned array value handle. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_array_get | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| size_t | index, | ||
| DetlefHandle * | out | ||
| ) |
Read one array element by zero-based index. The returned handle must be released separately from the array handle. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed array value handle. Not consumed. | |
| index | Zero-based element index. | |
| [out] | out | On success, receives an owned value handle for the selected array element. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_array_length | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| size_t * | out | ||
| ) |
Read the number of elements in an array object. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed array value handle. Not consumed. | |
| [out] | out | Receives the number of elements in the array. |
| DetlefStatus detlef_function_array_push | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefHandle | new_value | ||
| ) |
Append a value to an array after checking its element type. The input handle is not consumed. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. |
| handle | Borrowed array value handle. Not consumed. |
| new_value | Borrowed value handle to append; its type must match the array's element type. Not consumed. |
| DetlefStatus detlef_function_array_remove | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| size_t | index, | ||
| DetlefHandle * | out | ||
| ) |
Remove and return an array element by zero-based index. The array is mutated and the removed value receives a new owned handle. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed array value handle. Not consumed. | |
| index | Zero-based element index. | |
| [out] | out | On success, receives an owned value handle for the removed array element. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_array_set | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| size_t | index, | ||
| DetlefHandle | new_value | ||
| ) |
Replace one array element. The array element type is checked; the supplied value handle is not consumed. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. |
| handle | Borrowed array value handle. Not consumed. |
| index | Zero-based element index. |
| new_value | Borrowed replacement value handle; its type must match the array's element type. Not consumed. |
| DetlefStatus detlef_function_callback_error | ( | DetlefFunctionAccess * | a, |
| DetlefSlice | message, | ||
| DetlefSpan | span, | ||
| DetlefBool | has_span | ||
| ) |
Set a callback diagnostic and return DETLEF_ERROR. The message is copied. Set has_span to one to attach a source range. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. |
| message | Borrowed UTF-8 diagnostic text, copied during this call. |
| span | Half-open source range in UTF-8 byte offsets. |
| has_span | One attaches a source span; zero omits it. |
| DetlefStatus detlef_function_handle_clone | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefHandle * | out | ||
| ) |
Create a separately owned handle to the same value or descriptor. Objects remain shared; no deep copy is made. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed handle to clone; zero produces a zero output. Not consumed. | |
| [out] | out | On success, receives an owned handle to the same item, or zero when the input is zero. Release with detlef_function_handle_release(). |
| DetlefStatus detlef_function_handle_kind | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefHandleKind * | out | ||
| ) |
Read the handle category, such as DETLEF_INTEGER, DETLEF_OBJECT, or DETLEF_TYPE. Zero has kind DETLEF_VOID. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed handle to inspect; zero reports DETLEF_VOID. Not consumed. | |
| [out] | out | Receives the DetlefHandleKind constant for the handle. |
| DetlefStatus detlef_function_handle_release | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle | ||
| ) |
Release one owned handle. The handle must not be used or released again; zero is a no-op. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. |
| handle | Owned handle to release. Must not be used afterwards; zero has no effect. |
| DetlefStatus detlef_function_record_create | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | type_handle, | ||
| const DetlefHandle * | items, | ||
| size_t | count, | ||
| DetlefHandle * | out | ||
| ) |
Create a record instance using a resolved record type and field values in declaration order. Inputs are copied and type-checked. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| type_handle | Borrowed defined record type descriptor. Not consumed. | |
| items | Borrowed array of runtime value handles in field declaration order. Values are copied into the record; handles are not consumed. | |
| count | Number of entries in the supplied array. | |
| [out] | out | On success, receives an owned record value handle. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_record_get | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefSlice | input, | ||
| DetlefHandle * | out | ||
| ) |
Read a named field from a record instance. The input record handle is not consumed. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed record value handle. Not consumed. | |
| input | Borrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call. | |
| [out] | out | On success, receives an owned value handle for the selected record field. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_record_set | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefSlice | input, | ||
| DetlefHandle | new_value | ||
| ) |
Replace a named record field after checking its declared type. Neither input handle is consumed. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. |
| handle | Borrowed record value handle. Not consumed. |
| input | Borrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call. |
| new_value | Borrowed replacement value handle; its type must match the named field's type. Not consumed. |
| DetlefStatus detlef_function_record_type_field | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| size_t | index, | ||
| DetlefText * | name_out, | ||
| DetlefHandle * | type_out | ||
| ) |
Inspect one field of a defined record by zero-based index. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed defined record type descriptor. Not consumed. | |
| index | Zero-based field index in declaration order. | |
| [out] | name_out | Receives owned UTF-8 text without a trailing NUL. Must be freed once with detlef_text_free(). |
| [out] | type_out | On success, receives an owned resolved type descriptor for the field. Release with detlef_function_handle_release(). |
| DetlefStatus detlef_function_record_type_field_count | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| size_t * | out | ||
| ) |
Read the field count of a defined record type. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed defined record type descriptor. Not consumed. | |
| [out] | out | Receives the number of fields in the record type. |
| DetlefStatus detlef_function_type_array | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | inner, | ||
| DetlefHandle * | out | ||
| ) |
Create or look up an array type whose element type is the supplied resolved type. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| inner | Borrowed resolved type descriptor for the array's elements. Not consumed. | |
| [out] | out | On success, receives an owned resolved array type descriptor. Release with detlef_function_handle_release(). |
| DetlefStatus detlef_function_type_inner | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefHandle * | out | ||
| ) |
Obtain the inner resolved type of an array or optional type. Other type kinds are rejected. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed resolved array or optional type descriptor. Not consumed. | |
| [out] | out | On success, receives an owned resolved element or inner type descriptor. Release with detlef_function_handle_release(). |
| DetlefStatus detlef_function_type_kind | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefTypeKind * | out | ||
| ) |
Read the resolved type category using DETLEF_TYPE_* constants. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed resolved type descriptor. Not consumed. | |
| [out] | out | Receives the descriptor's DetlefTypeKind constant. |
| DetlefStatus detlef_function_type_lookup | ( | DetlefFunctionAccess * | a, |
| DetlefSlice | input, | ||
| DetlefHandle * | out | ||
| ) |
Look up an existing named type and return a resolved type descriptor. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| input | Borrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call. | |
| [out] | out | On success, receives an owned resolved type descriptor. Release with detlef_function_handle_release(). |
| DetlefStatus detlef_function_type_name | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefText * | out | ||
| ) |
Copy the name of a resolved type. Anonymous types have an empty name. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed resolved type descriptor. Not consumed. | |
| [out] | out | Receives owned UTF-8 text without a trailing NUL. Must be freed once with detlef_text_free(). |
| DetlefStatus detlef_function_type_of | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefHandle * | out | ||
| ) |
Obtain the resolved type descriptor of a runtime value. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed runtime value handle whose type is requested. Not consumed. | |
| [out] | out | On success, receives an owned resolved type descriptor. Release with detlef_function_handle_release(). |
| DetlefStatus detlef_function_type_optional | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | inner, | ||
| DetlefHandle * | out | ||
| ) |
Create or look up an optional type whose inner type is the supplied resolved type. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| inner | Borrowed resolved type descriptor for the optional type's non- none values. Not consumed. | |
| [out] | out | On success, receives an owned resolved optional type descriptor. Release with detlef_function_handle_release(). |
| DetlefStatus detlef_function_value_boolean | ( | DetlefFunctionAccess * | a, |
| DetlefBool | value, | ||
| DetlefHandle * | out | ||
| ) |
Create a boolean value from DETLEF_FALSE (0) or DETLEF_TRUE (1). Other inputs are rejected. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| value | DETLEF_FALSE (0) or DETLEF_TRUE (1). Other values are rejected. | |
| [out] | out | On success, receives an owned boolean value handle. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_value_float | ( | DetlefFunctionAccess * | a, |
| double | value, | ||
| DetlefHandle * | out | ||
| ) |
Create a floating-point value from a C double. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| value | Floating-point number to store. | |
| [out] | out | On success, receives an owned float value handle. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_value_get_boolean | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefBool * | out | ||
| ) |
Read a boolean as zero or one. Other value types are rejected. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed boolean value handle. Not consumed. | |
| [out] | out | Receives DETLEF_FALSE or DETLEF_TRUE. |
| DetlefStatus detlef_function_value_get_float | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| double * | out | ||
| ) |
Read a float value. Other value types are rejected rather than converted. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed float value handle. Not consumed. | |
| [out] | out | Receives the floating-point value. |
| DetlefStatus detlef_function_value_get_integer | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| int64_t * | out | ||
| ) |
Read an integer value. Other value types are rejected rather than converted. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed integer value handle. Not consumed. | |
| [out] | out | Receives the signed 64-bit integer. |
| DetlefStatus detlef_function_value_get_string | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefText * | out | ||
| ) |
Copy a string value into owned UTF-8 text. Other value types are rejected. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed string value handle. Not consumed. | |
| [out] | out | Receives owned UTF-8 text without a trailing NUL. Must be freed once with detlef_text_free(). |
| DetlefStatus detlef_function_value_integer | ( | DetlefFunctionAccess * | a, |
| int64_t | value, | ||
| DetlefHandle * | out | ||
| ) |
Create a signed 64-bit integer value. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| value | Signed 64-bit integer to store. | |
| [out] | out | On success, receives an owned integer value handle. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_value_none | ( | DetlefFunctionAccess * | a, |
| DetlefHandle * | out | ||
| ) |
Create the language value none. Its handle is distinct from zero, which means no result. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| [out] | out | On success, receives an owned handle to the language value none. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_value_string | ( | DetlefFunctionAccess * | a, |
| DetlefSlice | input, | ||
| DetlefHandle * | out | ||
| ) |
Create a string by copying the supplied UTF-8 bytes. Embedded NUL bytes are permitted. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| input | Borrowed UTF-8 bytes to copy. Storage may be released after the call. | |
| [out] | out | On success, receives an owned string value handle. Release with detlef_function_handle_release() unless transferred as a callback result. |
| DetlefStatus detlef_function_value_to_string | ( | DetlefFunctionAccess * | a, |
| DetlefHandle | handle, | ||
| DetlefText * | out | ||
| ) |
Format a value as text. Strings are returned as their contents; arrays and records use JSON representation. Available through limited Function access.
| a | Borrowed callback access. Must not be freed, saved, or used outside its current callback. | |
| handle | Borrowed runtime value handle to format. Not consumed. | |
| [out] | out | Receives owned UTF-8 text without a trailing NUL. Must be freed once with detlef_text_free(). |