Property define_proc -- Use a fragment of Tcl code to output additional data to
configuration header files.
Synopsis
cdl_option <name> {
define_proc <Tcl script>
…
}
Description
For most configuration options it is sufficient to have an entry in
the configuration header file of the form:
#define <name> <value>
In some cases it is desirable to perform some more complicated
processing when generating a configuration header file. There are a
number of CDL properties for this, including define_format and
if_define. The most flexible is define_proc: this allows the
component writer to specify a Tcl script that gets invoked whenever
the configuration system generates the header file for the owning
package. The script can output anything to the header file, for
example it could generate a C data structure based on various
configuration values.
At the point that the define_proc script is invoked there will be
two channels to open files, accessible via Tcl variables:
cdl_header is a channel to the current package's
own header file for example
pkgconf/kernel.h;
cdl_system_header is a channel to the global
configuration file
pkgconf/system.h. A typical
define_proc script will use the puts command to
output data to one of these channels.
define_proc properties only take effect if the current option is
active and enabled. The default behavior of the configuration system
for an option with the bool flavor corresponds to
the following define_proc:
In the current implementation it is not possible for a define_proc
property to examine the current values of various configuration
options and adapt accordingly. This is a major limitation, and will be
addressed in future versions of the configuration tools.