This is not necessarily the current version of this TIP.
| TIP: | 235 |
| Title: | Exposing a C API for Ensembles |
| Version: | $Revision: 1.2 $ |
| Author: | Donal K. Fellows <donal dot k dot fellows at manchester dot ac dot uk> |
| State: | Draft |
| Type: | Project |
| Tcl-Version: | 8.5 |
| Vote: | Pending |
| Created: | Friday, 10 December 2004 |
This TIP exposes a C API for the ensembles of TIP #112.
As the Tcl core moves to make more use of ensembles, it becomes more necessary for there to be an API available to allow control over those ensembles from the C level so that it is not necessary for such manipulation to be done through the evaluation of Tcl scripts (e.g. because this interferes with the interpreter's command count and that may be limited in that particular interpreter). Given such an API, it should be exposed to code outside the Tcl core if at all possible.
This TIP proposes exposing the following functions:
Create an ensemble linked to a particular namespace.
Locate a command token for an ensemble. Has an argument that controls whether failure to find an ensemble is an error.
Test whether a command token refers to an ensemble.
Read and write the (fixed) list of subcommands of the ensemble. Equivalent to manipulating the -subcommands option.
Read and write the dictionary that maps subcommands to prefixes of implementation commands. Equivalent to manipulating the -map option.
Read and write the command prefix list that is used to implement the unknown-subcommand handler. Equivalent to manipulating the -unknown option.
Read and write the flags for the ensemble. Currently there is only one settable flag bit, TCL_ENSEMBLE_PREFIX, which is present exactly when -prefix option is true.
Reads the namespace associated with the ensemble; this value may not be altered.
The API is already in the core, but with internal naming and not exposed to anyone. Exposure is just renaming a few functions and putting them in the stubs table. No new types are exposed. All this means that a reference implementation is truly trivial.
This document has been placed in the public domain.
This is not necessarily the current version of this TIP.