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

Data Structures

struct  DetlefText
 
struct  DetlefSlice
 
struct  DetlefNamed
 
struct  DetlefSpan
 

Typedefs

typedef struct DetlefRuntime DetlefRuntime
 
typedef struct DetlefAccess DetlefAccess
 
typedef struct DetlefFunctionAccess DetlefFunctionAccess
 
typedef struct DetlefText DetlefText
 
typedef struct DetlefSlice DetlefSlice
 
typedef uint64_t DetlefHandle
 
typedef struct DetlefNamed DetlefNamed
 
typedef struct DetlefSpan DetlefSpan
 
typedef DetlefStatus(* DetlefAccessCallback) (void *user_data, DetlefAccess *access)
 
typedef DetlefStatus(* DetlefCallback) (void *user_data, DetlefAccess *access, DetlefHandle *result)
 
typedef DetlefStatus(* DetlefFunctionCallback) (void *user_data, DetlefFunctionAccess *access, DetlefHandle *result)
 
typedef void(* DetlefOutput) (void *user_data, const uint8_t *text, size_t len)
 
typedef DetlefStatus(* DetlefLineInput) (void *user_data, DetlefSlice *line, DetlefBool *present)
 

Enumerations

enum  DetlefStatus {
  DETLEF_OK = 0 , DETLEF_ERROR = 1 , DETLEF_INVALID_ARGUMENT = 2 , DETLEF_PANIC = 3 ,
  DETLEF_BUSY = 4
}
 
enum  DetlefHandleKind {
  DETLEF_VOID = 0 , DETLEF_NONE = 1 , DETLEF_INTEGER = 2 , DETLEF_FLOAT = 3 ,
  DETLEF_BOOLEAN = 4 , DETLEF_STRING = 5 , DETLEF_OBJECT = 6 , DETLEF_TYPE = 7 ,
  DETLEF_PARAMETER = 8 , DETLEF_VARARG = 9 , DETLEF_FIELD = 10 , DETLEF_EXPRESSION = 11 ,
  DETLEF_ENVIRONMENT = 12 , DETLEF_PACKAGE = 13 , DETLEF_TYPE_REF = 14
}
 
enum  DetlefDescriptorKind { DETLEF_DESCRIPTOR_PARAMETER = DETLEF_PARAMETER , DETLEF_DESCRIPTOR_VARARG = DETLEF_VARARG , DETLEF_DESCRIPTOR_FIELD = DETLEF_FIELD }
 
enum  DetlefBool { DETLEF_FALSE = 0 , DETLEF_TRUE = 1 }
 
enum  DetlefTypeKind {
  DETLEF_TYPE_PRIMITIVE = 0 , DETLEF_TYPE_NONE = 1 , DETLEF_TYPE_OPTIONAL = 2 , DETLEF_TYPE_ARRAY = 3 ,
  DETLEF_TYPE_RECORD_UNDEFINED = 4 , DETLEF_TYPE_RECORD_DEFINED = 5
}
 
enum  DetlefPackageSection { DETLEF_PACKAGE_RECORDS = 0 , DETLEF_PACKAGE_BINDINGS = 1 , DETLEF_PACKAGE_FUNCTIONS = 2 , DETLEF_PACKAGE_CONTROLS = 3 }
 
enum  DetlefExpressionKind {
  DETLEF_EXPR_INTEGER = 0 , DETLEF_EXPR_FLOAT = 1 , DETLEF_EXPR_STRING = 2 , DETLEF_EXPR_IDENTIFIER = 3 ,
  DETLEF_EXPR_CALL = 4 , DETLEF_EXPR_BLOCK = 5
}
 
enum  DetlefTypeRefKind { DETLEF_REF_NAMED = 0 , DETLEF_REF_ARRAY = 1 , DETLEF_REF_OPTIONAL = 2 }
 

Detailed Description

Typedef Documentation

◆ DetlefAccess

typedef struct DetlefAccess DetlefAccess

This pointer must not be freed or saved. Valid only during its callback.

Definition at line 41 of file detlef.h.

◆ DetlefAccessCallback

typedef DetlefStatus(* DetlefAccessCallback) (void *user_data, DetlefAccess *access)

Callbacks are synchronous. Access expires on return. Registered callback code/user_data must remain valid while callable.

Definition at line 350 of file detlef.h.

◆ DetlefCallback

typedef DetlefStatus(* DetlefCallback) (void *user_data, DetlefAccess *access, DetlefHandle *result)

Controls receive expressions and full context access. A handle written to *result must not be released by the callback: DETLEF consumes it on return, even on failure. Clone to keep the original handle. Do not free access, result, or user_data; user_data stays with its supplier. Zero returns no value.

Definition at line 363 of file detlef.h.

◆ DetlefFunctionAccess

Limited value/object access for eager Functions. This pointer must not be freed or saved; it is valid only during its callback.

Definition at line 47 of file detlef.h.

◆ DetlefFunctionCallback

typedef DetlefStatus(* DetlefFunctionCallback) (void *user_data, DetlefFunctionAccess *access, DetlefHandle *result)

Functions receive evaluated arguments and limited value/object access. A handle written to *result must not be released by the callback; DETLEF consumes it on return, even on failure. Clone to keep the original handle. Do not free access or result. DETLEF never frees user_data. Zero means no value.

Definition at line 376 of file detlef.h.

◆ DetlefHandle

typedef uint64_t DetlefHandle

Returned handles must be released once with detlef_handle_release() (detlef_function_handle_release() in Functions), unless transferred as a callback result. Never use C free(). Input handles remain the caller's. Copying an ID creates no new handle; cloning creates a separate release duty. Zero means no result or an omitted argument, not the language value none.

Definition at line 114 of file detlef.h.

◆ DetlefLineInput

typedef DetlefStatus(* DetlefLineInput) (void *user_data, DetlefSlice *line, DetlefBool *present)

present=1 supplies caller-allocated UTF-8; present=0 means EOF. DETLEF copies the bytes and never frees them. The line and present pointers must not be freed. Bytes must remain valid until DETLEF copies them immediately after callback return.

Definition at line 399 of file detlef.h.

◆ DetlefNamed

typedef struct DetlefNamed DetlefNamed

A borrowed name paired with a handle. Direct registration uses resolved type handles; package signatures use TypeRefs. Storage and handles are not consumed.

◆ DetlefOutput

typedef void(* DetlefOutput) (void *user_data, const uint8_t *text, size_t len)

Text must not be freed. Its bytes are valid only during this callback; copy to keep them. DETLEF never frees user_data.

Definition at line 387 of file detlef.h.

◆ DetlefRuntime

typedef struct DetlefRuntime DetlefRuntime

Must be destroyed with detlef_runtime_free(), never C free(). Use only on its creating thread.

Definition at line 35 of file detlef.h.

◆ DetlefSlice

typedef struct DetlefSlice DetlefSlice

Borrowed UTF-8 bytes. DETLEF never frees this storage. It must remain valid through the consuming operation; input callback storage must remain valid until copied immediately after callback return.

◆ DetlefSpan

typedef struct DetlefSpan DetlefSpan

A half-open source range in UTF-8 byte offsets, not Unicode characters or JavaScript UTF-16 offsets.

◆ DetlefText

typedef struct DetlefText DetlefText

Owned UTF-8 bytes without a trailing NUL. Must be freed once with detlef_text_free(), never C free(). Copying the struct does not duplicate ownership.

Enumeration Type Documentation

◆ DetlefBool

enum DetlefBool

Boolean values and flags, stored as uint32_t at the ABI boundary. Boolean constructors and line-input callbacks require zero or one. The require_value and has_span input flags also accept any nonzero value as true. API outputs are always zero or one.

Enumerator
DETLEF_FALSE 

False or absent.

DETLEF_TRUE 

True or present.

Definition at line 231 of file detlef.h.

◆ DetlefDescriptorKind

Named descriptors accepted by detlef_descriptor_create(). Stored as uint32_t; values also identify the corresponding handle kinds.

Enumerator
DETLEF_DESCRIPTOR_PARAMETER 

Required function parameter, equivalent to parameter(name, type).

DETLEF_DESCRIPTOR_VARARG 

Trailing variadic parameter; type describes each argument.

DETLEF_DESCRIPTOR_FIELD 

Record field, equivalent to field(name, type).

Definition at line 208 of file detlef.h.

◆ DetlefExpressionKind

Expression node categories. Stored as uint32_t.

Enumerator
DETLEF_EXPR_INTEGER 

Integer literal.

DETLEF_EXPR_FLOAT 

Floating-point literal.

DETLEF_EXPR_STRING 

String literal.

DETLEF_EXPR_IDENTIFIER 

Identifier resolved when the expression is evaluated.

DETLEF_EXPR_CALL 

Call with a callee expression and argument expressions.

DETLEF_EXPR_BLOCK 

Block of expressions evaluated in order.

Definition at line 300 of file detlef.h.

◆ DetlefHandleKind

Handle categories returned by detlef_handle_kind() and detlef_function_handle_kind(). Stored as uint32_t at the ABI boundary.

Enumerator
DETLEF_VOID 

No evaluation result.

DETLEF_NONE 

The language value none.

DETLEF_INTEGER 

Signed 64-bit integer value.

DETLEF_FLOAT 

Double-precision floating-point value.

DETLEF_BOOLEAN 

Boolean runtime value.

DETLEF_STRING 

UTF-8 string value.

DETLEF_OBJECT 

Array or record object.

DETLEF_TYPE 

Resolved type descriptor.

DETLEF_PARAMETER 

Named required-parameter descriptor.

DETLEF_VARARG 

Named variadic-parameter descriptor with an element type.

DETLEF_FIELD 

Named record-field descriptor.

DETLEF_EXPRESSION 

Unevaluated expression tree.

DETLEF_ENVIRONMENT 

Captured lexical environment.

DETLEF_PACKAGE 

Package builder containing registrations and bindings.

DETLEF_TYPE_REF 

Unresolved type specification used in package registrations.

Definition at line 151 of file detlef.h.

◆ DetlefPackageSection

Package sections selected by package inspection operations. Stored as uint32_t.

Enumerator
DETLEF_PACKAGE_RECORDS 

Record type definitions and their field specifications.

DETLEF_PACKAGE_BINDINGS 

Named runtime value bindings.

DETLEF_PACKAGE_FUNCTIONS 

Eager Functions and their parameter specifications.

DETLEF_PACKAGE_CONTROLS 

Lazy Controls and their callbacks.

Definition at line 277 of file detlef.h.

◆ DetlefStatus

Operation status codes, stored as int32_t at the ABI boundary.

Enumerator
DETLEF_OK 

Success.

DETLEF_ERROR 

Parse, runtime, registration, or handle error.

DETLEF_INVALID_ARGUMENT 

Invalid lifecycle argument.

DETLEF_PANIC 

Caught Rust panic; the runtime must be destroyed.

DETLEF_BUSY 

Runtime or access is already executing an operation.

Definition at line 55 of file detlef.h.

◆ DetlefTypeKind

Resolved type categories. Stored as uint32_t.

Enumerator
DETLEF_TYPE_PRIMITIVE 

Built-in integer, float, boolean, or string type.

DETLEF_TYPE_NONE 

Type of the language value none.

DETLEF_TYPE_OPTIONAL 

Type accepting none or a value of its inner type.

DETLEF_TYPE_ARRAY 

Array type with a resolved element type.

DETLEF_TYPE_RECORD_UNDEFINED 

Record type declared but not yet defined.

DETLEF_TYPE_RECORD_DEFINED 

Record type with defined fields in declaration order.

Definition at line 248 of file detlef.h.

◆ DetlefTypeRefKind

Unresolved TypeRef categories. Stored as uint32_t.

Enumerator
DETLEF_REF_NAMED 

Named type to resolve against the runtime's registered types.

DETLEF_REF_ARRAY 

Array specification containing an element TypeRef.

DETLEF_REF_OPTIONAL 

Optional specification containing an inner TypeRef.

Definition at line 329 of file detlef.h.