Artifact 6c080b4eaf31ae9d8c08b1edf222bc6230cc725b19ca9adb02e4bc3614000fbc:
- File doc/dev/opspec.md — part of check-in [21a88ce37d] at 2024-07-28 20:27:14 on branch trunk — chore: bringing the operator DSL docs out of the internal docs into the developer docs. note: incomplete. tweak: image pipeline data structures, moved to separate file. (user: aku size: 4490)

| Project ↗ | Documentation ↗ | Developer Index ↗ |
Operator Specifications DSL
Overview
AKTIVE uses a Tcl-based domain-specific language to simplify the specification of image processing operators.
The implementation of the DSL translates the specifications into the
- Boilerplate C code embedding and linking the operator into AKTIVE's runtime framework.
- Operator documentation in Markdown, including examples (and underlying example Tcl code).
Implementation
Files:
Main commands
| Command | Description |
|---|---|
| def | Define a sharable text block. Global or local to an operator |
| import | Import definitions from the specified file, fail for a mising file |
| import? | See above. However, ignore a missing file |
| nyi | Disable the command it is a prefix of |
| operator | Define a (set of) operators |
| type | Define a type for use in parameter and results |
| vector | Declare for which types we need vector/slice support |
def
| Syntax |
|---|
def NAME TEXT [(KEY VALUE)...] |
This command creates a named sharable block of text, at either global level or
local to an operator specification. The created block is usable wherever
templating is performed.
The command further creates a Tcl variable of the same name in the calling scope
also containing the text.
Note that this command applies templating to the text before it is saved. In
other words, the definition of a block can reference blocks defined before it.
Furthermore the optional set of key and value arguments serves as map of
ultra-local placeholders to handle.
import, import?
| Syntax |
|---|
import PATH |
import? PATH |
Both commands read the referenced file and execute the commands in the context of the import. This can be global or within an operator specification.
The import? variant ignores a missing PATH, whereas import will throw an
error in that case.
nyi
| Syntax |
|---|
nyi [WORD...] |
nyi is a prefix command whose use disables the command it is made a prefix of.
The name stands for not yet implemented.
operator
| Syntax |
|---|
operator NAME SPEC |
operator NAMELIST SPEC |
operator VARLIST OPLIST SPEC |
This command names and specifies one or more (related) image processing
operators, using a suite of subordinate commands within its spec.
Given the complexity it has its own page containing the full details.
type
| Syntax |
|---|
type ID CRITCL C CONVERTER |
The command declares a type the DSL can use for operator parameter and results. Note that types have to be declared before their use.
The core types needed by AKTIVE's runtime framework itself are declared in
Arguments:
| Name | Description |
|---|---|
ID |
Name the type is identified by when used in vector and operator commands |
CRITCL |
The associated Critcl type. - defaults to the ID |
C |
The associated C type. - defaults to the CRITCL name |
CONVERTER |
C code fragment to convert a C value of the type into a Tcl_Obj |
Converter notes:
- The fragment has to return a
Tcl_Obj*value. - The fragment expects to have access to a C variable
valueholding a pointer to the C value to convert
vector
| Syntax |
|---|
vector [ID...] |
The command declares that we need vector/slice support for the types named in its arguments.
In other words, it arranges for the generator to emit C code that provides the types and functions for the management of dynamic arrays for values of this type.