Typed dispatch C reference
See Typed command dispatch for table lifetime, argument counts and callback boundaries. These are private implementation interfaces.
-
struct Rbc_OpSpecHeader
Common first member of persistent typed operation-table entries.
Terminate a table with a NULL name. Bounds count the complete command word vector; maxArgs <= 0 is unbounded. The enclosing entry supplies its own correctly typed callback, and its sizeof is the lookup stride.
-
int Rbc_GetOpIndexFromObj(Tcl_Interp *interp, const void *specArr, Tcl_Size specSize, Tcl_Size operPos, Tcl_Size objc, Tcl_Obj *const objv[], int *indexPtr)
Select a typed operation-table entry and validate total argument count.
Require a persistent NULL-name-terminated table whose entries start with Rbc_OpSpecHeader and have byte stride specSize. Tcl lookup accepts unique abbreviations and caches the table in the operation object. On success assign indexPtr, not a function pointer; the caller dispatches through its typed table. minArgs/maxArgs count all objc words; maxArgs <= 0 means unbounded. Leave the output unchanged on error and set an interpreter diagnostic.
- Parameters:
interp – [inout] Borrowed result interpreter; see Interpreter arguments.
specArr – [in] Persistent NULL-name-terminated table with Rbc_OpSpecHeader as the first field of each entry; Tcl may cache this address.
specSize – [in] Byte stride of one complete typed entry, at least sizeof(Rbc_OpSpecHeader).
operPos – [in] Nonnegative index of the operation word in the full command array.
objc – [in] Number of objects in objv; counts every word when validating operation arity.
objv – [in] Borrowed full command array; see Tcl command arguments.
indexPtr – [out] Required output receiving the selected table index only on success.