-/* A single transformation. */
-struct transformation
- {
- /* Offset to add to EXECUTE's return value, if it returns a
- transformation index. Normally 0 but set to the starting
- index of a spliced chain after splicing. */
- int idx_ofs;
- trns_finalize_func *finalize; /* Finalize proc. */
- trns_proc_func *execute; /* Executes the transformation. */
- trns_free_func *free; /* Garbage collector proc. */
- void *aux; /* Auxiliary data. */
- };
-
-/* A chain of transformations. */
-struct trns_chain
- {
- struct transformation *trns; /* Array of transformations. */
- size_t trns_cnt; /* Number of transformations. */
- size_t trns_cap; /* Allocated capacity. */
- bool finalized; /* Finalize functions called? */
- };
-
-/* Allocates and returns a new transformation chain. */
-struct trns_chain *
-trns_chain_create (void)
-{
- struct trns_chain *chain = xmalloc (sizeof *chain);
- chain->trns = NULL;
- chain->trns_cnt = 0;
- chain->trns_cap = 0;
- chain->finalized = false;
- return chain;
-}
-
-/* Finalizes all the transformations in CHAIN.
- A chain is only finalized once; afterward, calling this
- function is a no-op.
- Finalizers may add transformations to CHAIN, but after
- finalization the chain's contents are fixed, so that no more
- transformations may be added afterward. */