OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [cdl-guide/] [language.values.html] - Diff between revs 28 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
<HTML
><HEAD
><HEAD
><TITLE
><TITLE
>Values and Expressions</TITLE
>Values and Expressions</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
<META
NAME="GENERATOR"
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
"><LINK
REL="HOME"
REL="HOME"
TITLE="The eCos Component Writer's Guide"
TITLE="The eCos Component Writer's Guide"
HREF="cdl-guide.html"><LINK
HREF="cdl-guide.html"><LINK
REL="UP"
REL="UP"
TITLE="The CDL Language"
TITLE="The CDL Language"
HREF="language.html"><LINK
HREF="language.html"><LINK
REL="PREVIOUS"
REL="PREVIOUS"
TITLE="An Introduction to Tcl"
TITLE="An Introduction to Tcl"
HREF="language.tcl.html"><LINK
HREF="language.tcl.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE="Interfaces"
TITLE="Interfaces"
HREF="language.interface.html"></HEAD
HREF="language.interface.html"></HEAD
><BODY
><BODY
CLASS="SECT1"
CLASS="SECT1"
BGCOLOR="#FFFFFF"
BGCOLOR="#FFFFFF"
TEXT="#000000"
TEXT="#000000"
LINK="#0000FF"
LINK="#0000FF"
VLINK="#840084"
VLINK="#840084"
ALINK="#0000FF"
ALINK="#0000FF"
><DIV
><DIV
CLASS="NAVHEADER"
CLASS="NAVHEADER"
><TABLE
><TABLE
SUMMARY="Header navigation table"
SUMMARY="Header navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TH
><TH
COLSPAN="3"
COLSPAN="3"
ALIGN="center"
ALIGN="center"
>The <SPAN
>The <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>eCos</SPAN
>eCos</SPAN
> Component Writer's Guide</TH
> Component Writer's Guide</TH
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="left"
ALIGN="left"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="language.tcl.html"
HREF="language.tcl.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="80%"
WIDTH="80%"
ALIGN="center"
ALIGN="center"
VALIGN="bottom"
VALIGN="bottom"
>Chapter 3. The CDL Language</TD
>Chapter 3. The CDL Language</TD
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="right"
ALIGN="right"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="language.interface.html"
HREF="language.interface.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"></DIV
WIDTH="100%"></DIV
><DIV
><DIV
CLASS="SECT1"
CLASS="SECT1"
><H1
><H1
CLASS="SECT1"
CLASS="SECT1"
><A
><A
NAME="LANGUAGE.VALUES">Values and Expressions</H1
NAME="LANGUAGE.VALUES">Values and Expressions</H1
><P
><P
>It is fairly reasonable to expect that enabling or disabling a
>It is fairly reasonable to expect that enabling or disabling a
configuration option such as
configuration option such as
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGVAR_KERNEL_THREADS_DATA</TT
>CYGVAR_KERNEL_THREADS_DATA</TT
> in some way affects its
> in some way affects its
<SPAN
<SPAN
CLASS="emphasis"
CLASS="emphasis"
><I
><I
CLASS="EMPHASIS"
CLASS="EMPHASIS"
>value</I
>value</I
></SPAN
></SPAN
>. This will have an effect on any
>. This will have an effect on any
expressions that reference this option such as
expressions that reference this option such as
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>requires&nbsp;CYGVAR_KERNEL_THREADS_DATA</TT
>requires&nbsp;CYGVAR_KERNEL_THREADS_DATA</TT
>. It will
>. It will
also affect the consequences of that option: how it affects the build
also affect the consequences of that option: how it affects the build
process and what happens to any constraints that
process and what happens to any constraints that
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGVAR_KERNEL_THREADS_DATA</TT
>CYGVAR_KERNEL_THREADS_DATA</TT
> may impose (as opposed
> may impose (as opposed
to constraints on this option imposed by others).</P
to constraints on this option imposed by others).</P
><P
><P
>In a language like C the handling of variables is relatively
>In a language like C the handling of variables is relatively
straightforward. If a variable <TT
straightforward. If a variable <TT
CLASS="VARNAME"
CLASS="VARNAME"
>x</TT
>x</TT
> gets referenced in
> gets referenced in
an expression such as <TT
an expression such as <TT
CLASS="LITERAL"
CLASS="LITERAL"
>if&nbsp;(x&nbsp;!=&nbsp;0)</TT
>if&nbsp;(x&nbsp;!=&nbsp;0)</TT
>,
>,
and that variable is not defined anywhere, then the code will fail to
and that variable is not defined anywhere, then the code will fail to
build, typically with an unresolved error at link-time. Also in C
build, typically with an unresolved error at link-time. Also in C
a variable <TT
a variable <TT
CLASS="VARNAME"
CLASS="VARNAME"
>x</TT
>x</TT
> does not live in any hierarchy, so its
> does not live in any hierarchy, so its
value for the purposes of expression evaluation is not affected by
value for the purposes of expression evaluation is not affected by
anything else. C variables also have a clear type such as
anything else. C variables also have a clear type such as
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>int</TT
>int</TT
> or <TT
> or <TT
CLASS="LITERAL"
CLASS="LITERAL"
>long&nbsp;double</TT
>long&nbsp;double</TT
>. </P
>. </P
><P
><P
>In <SPAN
>In <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> things are not so straightforward.</P
> things are not so straightforward.</P
><DIV
><DIV
CLASS="SECT2"
CLASS="SECT2"
><H2
><H2
CLASS="SECT2"
CLASS="SECT2"
><A
><A
NAME="LANGUAGE.VALUES.VALUE">Option Values</H2
NAME="LANGUAGE.VALUES.VALUE">Option Values</H2
><P
><P
>There are four factors which go into an option's value:</P
>There are four factors which go into an option's value:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>An option may or may not be loaded.</P
>An option may or may not be loaded.</P
></LI
></LI
><LI
><LI
><P
><P
>If the option is loaded, it may or may not be active.</P
>If the option is loaded, it may or may not be active.</P
></LI
></LI
><LI
><LI
><P
><P
>Even if the option is active, it may or may not be enabled.</P
>Even if the option is active, it may or may not be enabled.</P
></LI
></LI
><LI
><LI
><P
><P
>If the option is loaded, active and enabled then it will have some
>If the option is loaded, active and enabled then it will have some
associated data which constitutes its value.</P
associated data which constitutes its value.</P
></LI
></LI
></OL
></OL
><DIV
><DIV
CLASS="SECT3"
CLASS="SECT3"
><H3
><H3
CLASS="SECT3"
CLASS="SECT3"
><A
><A
NAME="LANGUAGE.VALUES.VALUE.LOADED">Is the Option Loaded?</H3
NAME="LANGUAGE.VALUES.VALUE.LOADED">Is the Option Loaded?</H3
><P
><P
>At any one time a configuration will contain only a subset of all
>At any one time a configuration will contain only a subset of all
possible packages. In fact it is impossible to combine certain
possible packages. In fact it is impossible to combine certain
packages in a single configuration. For example architectural HAL
packages in a single configuration. For example architectural HAL
packages should contain a set of options defining endianness, the
packages should contain a set of options defining endianness, the
sizes of basic data types and so on (many of which will of course be
sizes of basic data types and so on (many of which will of course be
constant for any given architecture). Any attempt to load two
constant for any given architecture). Any attempt to load two
architectural HAL packages into a configuration will fail because of
architectural HAL packages into a configuration will fail because of
the resulting name clash. Since <SPAN
the resulting name clash. Since <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expressions can reference
> expressions can reference
options in other packages, and often need to do so, it is essential to
options in other packages, and often need to do so, it is essential to
define the resulting behavior.</P
define the resulting behavior.</P
><P
><P
>One complication is that the component framework does not know about
>One complication is that the component framework does not know about
every single option in every single package. Obviously it cannot know
every single option in every single package. Obviously it cannot know
about packages from arbitrary third parties which have not been
about packages from arbitrary third parties which have not been
installed. Even for packages which have been installed, the current
installed. Even for packages which have been installed, the current
repository database does not hold details of every option, only of the
repository database does not hold details of every option, only of the
packages themselves. If a <SPAN
packages themselves. If a <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expression contains a reference to
> expression contains a reference to
some option <TT
some option <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_KERNEL_SCHED_TIMESLICE</TT
>CYGSEM_KERNEL_SCHED_TIMESLICE</TT
> then the
> then the
component framework will only know about this option if the kernel
component framework will only know about this option if the kernel
package is actually loaded into the current configuration. If the
package is actually loaded into the current configuration. If the
package is not loaded then theoretically the framework might guess
package is not loaded then theoretically the framework might guess
that the option is somehow related to the kernel by examining the
that the option is somehow related to the kernel by examining the
option name but this would not be robust: the option could easily be
option name but this would not be robust: the option could easily be
part of some other package that violates the naming convention.</P
part of some other package that violates the naming convention.</P
><P
><P
>Assume that the user is building a minimal configuration which does
>Assume that the user is building a minimal configuration which does
not contain the kernel package, but does have other packages which
not contain the kernel package, but does have other packages which
contain the following constraints:</P
contain the following constraints:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires CYGPKG_KERNEL
>    requires CYGPKG_KERNEL
    requires CYGPKG_KERNEL_THREADS_DATA
    requires CYGPKG_KERNEL_THREADS_DATA
    requires !CYGSEM_KERNEL_SCHED_TIMESLICE</PRE
    requires !CYGSEM_KERNEL_SCHED_TIMESLICE</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Clearly the first constraint is not satisfied because the kernel is
>Clearly the first constraint is not satisfied because the kernel is
not loaded. The second constraint is also not satisfied. The third
not loaded. The second constraint is also not satisfied. The third
constraint is trivially satisfied: if there is no kernel then the
constraint is trivially satisfied: if there is no kernel then the
kernel's timeslicing support cannot possibly be enabled. </P
kernel's timeslicing support cannot possibly be enabled. </P
><P
><P
>Any options which are not in the current configuration are handled as
>Any options which are not in the current configuration are handled as
follows: </P
follows: </P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>Any references to that option will evaluate to <TT
>Any references to that option will evaluate to <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
>,
>,
so <TT
so <TT
CLASS="LITERAL"
CLASS="LITERAL"
>requires&nbsp;!CYGSEM_KERNEL_SCHED_TIMESLICE</TT
>requires&nbsp;!CYGSEM_KERNEL_SCHED_TIMESLICE</TT
> will
> will
be satisfied but
be satisfied but
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>requires&nbsp;CYGSEM_KERNEL_THREADS_DATA</TT
>requires&nbsp;CYGSEM_KERNEL_THREADS_DATA</TT
> will not
> will not
be satisfied.</P
be satisfied.</P
></LI
></LI
><LI
><LI
><P
><P
>An option that is not loaded has no consequences on the build process.
>An option that is not loaded has no consequences on the build process.
It cannot directly result in any <TT
It cannot directly result in any <TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define's</TT
>#define's</TT
> in a
> in a
configuration header file, nor in any files being compiled. This is
configuration header file, nor in any files being compiled. This is
only reasonable: if the option is not loaded then the component
only reasonable: if the option is not loaded then the component
framework has no way of knowing about any <SPAN
framework has no way of knowing about any <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>compile</SPAN
>compile</SPAN
> or similar
> or similar
properties. An option that is not loaded can have indirect
properties. An option that is not loaded can have indirect
consequences by being referenced in <SPAN
consequences by being referenced in <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expressions.</P
> expressions.</P
></LI
></LI
><LI
><LI
><P
><P
>An option that is not loaded cannot impose any constraints on the rest
>An option that is not loaded cannot impose any constraints on the rest
of the configuration. Again this is the only reasonable behavior: if
of the configuration. Again this is the only reasonable behavior: if
the option is not loaded then any associated <SPAN
the option is not loaded then any associated <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
> or
> or
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> properties will not be known.</P
> properties will not be known.</P
></LI
></LI
></OL
></OL
></DIV
></DIV
><DIV
><DIV
CLASS="SECT3"
CLASS="SECT3"
><H3
><H3
CLASS="SECT3"
CLASS="SECT3"
><A
><A
NAME="LANGUAGE.VALUES.VALUE.ACTIVE">Is the Option Active</H3
NAME="LANGUAGE.VALUES.VALUE.ACTIVE">Is the Option Active</H3
><P
><P
>The next issue to consider is whether or not a particular option is
>The next issue to consider is whether or not a particular option is
active. Configuration options are organized in a hierarchy of
active. Configuration options are organized in a hierarchy of
components and sub-components. For example the C library package
components and sub-components. For example the C library package
contains a component <TT
contains a component <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBC_STDIO</TT
>CYGPKG_LIBC_STDIO</TT
> containing
> containing
all the options related to standard I/O. If a user disables the
all the options related to standard I/O. If a user disables the
component as a whole then all the options below it become inactive: it
component as a whole then all the options below it become inactive: it
makes no sense to disable all stdio functionality and then manipulate
makes no sense to disable all stdio functionality and then manipulate
the buffer sizes.</P
the buffer sizes.</P
><P
><P
>Inactive is not quite the same as disabled, although the effects are
>Inactive is not quite the same as disabled, although the effects are
similar. The value of an inactive option is preserved. If the user
similar. The value of an inactive option is preserved. If the user
modifies a buffer size option, then disables the whole stdio
modifies a buffer size option, then disables the whole stdio
component, the buffer size value remains in case the stdio component
component, the buffer size value remains in case the stdio component
is re-enabled later on. Some tools such as the graphical configuration
is re-enabled later on. Some tools such as the graphical configuration
tool will treat inactive options specially, for example such options
tool will treat inactive options specially, for example such options
may be grayed out.</P
may be grayed out.</P
><P
><P
>The active or inactive state of an option may affect other packages.
>The active or inactive state of an option may affect other packages.
For example a package may use the <TT
For example a package may use the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>sprintf</TT
>sprintf</TT
>
>
function and require support for floating point conversions, a
function and require support for floating point conversions, a
constraint that is not satisfied if the relevant option is inactive.
constraint that is not satisfied if the relevant option is inactive.
It is necessary to define exactly what it means for an option to be
It is necessary to define exactly what it means for an option to be
inactive:</P
inactive:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>An option is inactive if its parent is either inactive or disabled.
>An option is inactive if its parent is either inactive or disabled.
For example if <TT
For example if <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBC_STDIO</TT
>CYGPKG_LIBC_STDIO</TT
> is disabled then
> is disabled then
all the options and sub-components become inactive; since
all the options and sub-components become inactive; since
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBC_STDIO_FLOATING_POINT</TT
>CYGPKG_LIBC_STDIO_FLOATING_POINT</TT
> is now inactive,
> is now inactive,
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT</TT
>CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT</TT
> is inactive
> is inactive
as well.</P
as well.</P
></LI
></LI
><LI
><LI
><P
><P
>Options may also be inactive as a result of an <SPAN
>Options may also be inactive as a result of an <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>active_if</SPAN
>active_if</SPAN
> property.
> property.
This is useful if a particular option is only relevant if two or more
This is useful if a particular option is only relevant if two or more
disjoint sets of conditions need to be satisfied, since the
disjoint sets of conditions need to be satisfied, since the
hierarchical structure can only cope with at most one such set.</P
hierarchical structure can only cope with at most one such set.</P
></LI
></LI
><LI
><LI
><P
><P
>If an option is inactive then any references to that option in <SPAN
>If an option is inactive then any references to that option in <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
>
>
expressions will evaluate to <TT
expressions will evaluate to <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
>. Hence a constraint
>. Hence a constraint
of the form
of the form
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>requires&nbsp;CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT</TT
>requires&nbsp;CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT</TT
>
>
is not satisfied if the entire stdio component is disabled.</P
is not satisfied if the entire stdio component is disabled.</P
></LI
></LI
><LI
><LI
><P
><P
>An option that is inactive has no consequences on the build process.
>An option that is inactive has no consequences on the build process.
No <TT
No <TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define</TT
>#define</TT
> will be generated. Any <SPAN
> will be generated. Any <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>compile</SPAN
>compile</SPAN
> or
> or
similar properties will be ignored.</P
similar properties will be ignored.</P
></LI
></LI
><LI
><LI
><P
><P
>An option that is inactive cannot impose any constraints on the rest
>An option that is inactive cannot impose any constraints on the rest
of the configuration. For example
of the configuration. For example
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT</TT
>CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT</TT
> has a
> has a
dependency <TT
dependency <TT
CLASS="LITERAL"
CLASS="LITERAL"
>requires&nbsp;CYGPKG_LIBM</TT
>requires&nbsp;CYGPKG_LIBM</TT
>, but if all of
>, but if all of
the stdio functionality is disabled then this constraint is ignored
the stdio functionality is disabled then this constraint is ignored
(although of course there may be other packages which have a
(although of course there may be other packages which have a
dependency on <TT
dependency on <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBM</TT
>CYGPKG_LIBM</TT
>.</P
>.</P
></LI
></LI
></OL
></OL
></DIV
></DIV
><DIV
><DIV
CLASS="SECT3"
CLASS="SECT3"
><H3
><H3
CLASS="SECT3"
CLASS="SECT3"
><A
><A
NAME="LANGUAGE.VALUES.VALUE.ENABLED">Is the Option Enabled? What is the Data?</H3
NAME="LANGUAGE.VALUES.VALUE.ENABLED">Is the Option Enabled? What is the Data?</H3
><P
><P
>The majority of configuration options are boolean in nature, so the
>The majority of configuration options are boolean in nature, so the
user can either enable or disable some functionality. Some options are
user can either enable or disable some functionality. Some options are
different. For example <TT
different. For example <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_STDIO_BUFSIZE</TT
>CYGNUM_LIBC_STDIO_BUFSIZE</TT
> is
> is
a number, and <TT
a number, and <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE</TT
>CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE</TT
> is
> is
a string corresponding to a device name. A few options like
a string corresponding to a device name. A few options like
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGDAT_UITRON_TASK_EXTERNS</TT
>CYGDAT_UITRON_TASK_EXTERNS</TT
> can get very
> can get very
complicated. <SPAN
complicated. <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> has to cope with this variety, and define the exact
> has to cope with this variety, and define the exact
behavior of the system in terms of constraints and build-time
behavior of the system in terms of constraints and build-time
consequences. </P
consequences. </P
><P
><P
>In <SPAN
>In <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> the value of an option consists of two parts. There is a
> the value of an option consists of two parts. There is a
boolean part, controlling whether or not the option is enabled. There
boolean part, controlling whether or not the option is enabled. There
is also a data part, providing additional information. For most
is also a data part, providing additional information. For most
options one of these parts is fixed, as controlled by the option's
options one of these parts is fixed, as controlled by the option's
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>flavor</SPAN
>flavor</SPAN
> property:</P
> property:</P
><DIV
><DIV
CLASS="INFORMALTABLE"
CLASS="INFORMALTABLE"
><A
><A
NAME="AEN1413"><P
NAME="AEN1413"><P
></P
></P
><TABLE
><TABLE
BORDER="1"
BORDER="1"
CLASS="CALSTABLE"
CLASS="CALSTABLE"
><THEAD
><THEAD
><TR
><TR
><TH
><TH
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>Flavor</TH
>Flavor</TH
><TH
><TH
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>Enabled</TH
>Enabled</TH
><TH
><TH
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>Data</TH
>Data</TH
></TR
></TR
></THEAD
></THEAD
><TBODY
><TBODY
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>none</TT
>none</TT
></TD
></TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>Always enabled</TD
>Always enabled</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
>, not modifiable</TD
>, not modifiable</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
></TD
></TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>User-modifiable</TD
>User-modifiable</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
>, not modifiable</TD
>, not modifiable</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
></TD
></TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>Always enabled</TD
>Always enabled</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>User-modifiable</TD
>User-modifiable</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>booldata</TT
>booldata</TT
></TD
></TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>User-modifiable</TD
>User-modifiable</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>User-modifiable</TD
>User-modifiable</TD
></TR
></TR
></TBODY
></TBODY
></TABLE
></TABLE
><P
><P
></P
></P
></DIV
></DIV
><P
><P
>The effects of the boolean and data parts are as follows:</P
>The effects of the boolean and data parts are as follows:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>If an option is disabled, in other words if the boolean part is false,
>If an option is disabled, in other words if the boolean part is false,
then any references to that option in <SPAN
then any references to that option in <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expressions will evaluate
> expressions will evaluate
to <TT
to <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
>. This is the same behavior as for inactive
>. This is the same behavior as for inactive
options. The data part is not relevant. The <TT
options. The data part is not relevant. The <TT
CLASS="LITERAL"
CLASS="LITERAL"
>none</TT
>none</TT
>
>
and <TT
and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
> flavors specify that the option is always
> flavors specify that the option is always
enabled, in which case this rule is not applicable.</P
enabled, in which case this rule is not applicable.</P
></LI
></LI
><LI
><LI
><P
><P
>If an option is enabled then any references to that option in <SPAN
>If an option is enabled then any references to that option in <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
>
>
expressions will evaluate to the option's data part. For two of the
expressions will evaluate to the option's data part. For two of the
flavors, <TT
flavors, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>none</TT
>none</TT
> and <TT
> and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
>, this
>, this
data part is fixed to the constant <TT
data part is fixed to the constant <TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
> which
> which
generally has the expected result.</P
generally has the expected result.</P
></LI
></LI
><LI
><LI
><P
><P
>If a component or package is disabled then all sub-components and
>If a component or package is disabled then all sub-components and
options immediately below it in the hierarchy are inactive. By a
options immediately below it in the hierarchy are inactive. By a
process of recursion this will affect all the nodes in the subtree.</P
process of recursion this will affect all the nodes in the subtree.</P
></LI
></LI
><LI
><LI
><P
><P
>If an option is disabled then it can impose no constraints on the rest
>If an option is disabled then it can impose no constraints on the rest
of the configuration, in particular <SPAN
of the configuration, in particular <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
> and <SPAN
> and <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
>
>
properties will be ignored. If an option is enabled then its
properties will be ignored. If an option is enabled then its
constraints should be satisfied, or the component framework will
constraints should be satisfied, or the component framework will
report various conflicts. Note that the <SPAN
report various conflicts. Note that the <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> constraint only
> constraint only
applies to the data part of the option's value, so it is only useful
applies to the data part of the option's value, so it is only useful
with the <TT
with the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
> and <TT
> and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>booldata</TT
>booldata</TT
>
>
flavors. Options with the <TT
flavors. Options with the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>none</TT
>none</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
> flavors are always enabled so their
> flavors are always enabled so their
constraints always have to be satisfied (assuming the option is
constraints always have to be satisfied (assuming the option is
active). </P
active). </P
></LI
></LI
><LI
><LI
><P
><P
>If an option is disabled then it has no direct consequences at
>If an option is disabled then it has no direct consequences at
build-time: no <TT
build-time: no <TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define</TT
>#define</TT
> will be generated, no files
> will be generated, no files
will get compiled, and so on. If an option is active and enabled then
will get compiled, and so on. If an option is active and enabled then
all the consequences take effect. The option name and data part are
all the consequences take effect. The option name and data part are
used to generate the <TT
used to generate the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define</TT
>#define</TT
> in the appropriate
> in the appropriate
configuration header file, subject to various properties such as
configuration header file, subject to various properties such as
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>no_define</SPAN
>no_define</SPAN
>, but the data part has no other effects on the build
>, but the data part has no other effects on the build
system. </P
system. </P
></LI
></LI
></OL
></OL
><P
><P
>By default all options and components have the <TT
>By default all options and components have the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
>
>
flavor: most options are boolean in nature, so making this the default
flavor: most options are boolean in nature, so making this the default
allows for slightly more compact <SPAN
allows for slightly more compact <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> scripts. Packages have the
> scripts. Packages have the
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>booldata</TT
>booldata</TT
> flavor, where the data part always
> flavor, where the data part always
corresponds to the version of the package that is loaded into the
corresponds to the version of the package that is loaded into the
configuration: changing this value corresponds to unloading the old
configuration: changing this value corresponds to unloading the old
version and loading in a different one.</P
version and loading in a different one.</P
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
><SPAN
><SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> Flavors: </B
> Flavors: </B
>The concept of <SPAN
>The concept of <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> flavors tends to result in various discussions
> flavors tends to result in various discussions
about why it is unnecessarily complicated, and would it not have been
about why it is unnecessarily complicated, and would it not have been
easier to do&nbsp;&#8230; However there are very good reasons why CDL
easier to do&nbsp;&#8230; However there are very good reasons why CDL
works the way it does.</P
works the way it does.</P
><P
><P
>The first common suggestion is that there is no need to have separate
>The first common suggestion is that there is no need to have separate
flavors <TT
flavors <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
>, and so on. A
>, and so on. A
boolean option could just be handled as a data option with legal
boolean option could just be handled as a data option with legal
values <TT
values <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> and <TT
> and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
>. The counter
>. The counter
arguments are as follows:</P
arguments are as follows:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>It would actually make <SPAN
>It would actually make <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> scripts more verbose. By default all
> scripts more verbose. By default all
options and components have the <TT
options and components have the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
> flavor, since
> flavor, since
most options are boolean in nature. Without a <TT
most options are boolean in nature. Without a <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
>
>
flavor it would be necessary to indicate explicitly what the legal
flavor it would be necessary to indicate explicitly what the legal
values are somehow, e.g. with a <SPAN
values are somehow, e.g. with a <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> property.</P
> property.</P
></LI
></LI
><LI
><LI
><P
><P
>The boolean part of an option's value has a very different effect from
>The boolean part of an option's value has a very different effect from
the data part. If an option is disabled then it has no consequences at
the data part. If an option is disabled then it has no consequences at
build time, and can impose no constraints. A <TT
build time, and can impose no constraints. A <TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
>
>
option always has consequences and can impose constraints. To get the
option always has consequences and can impose constraints. To get the
desired effect it would be necessary to add <SPAN
desired effect it would be necessary to add <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> data indicating that
> data indicating that
a value of <TT
a value of <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> should be treated specially. Arguably
> should be treated specially. Arguably
this could be made built-in default behavior, although that would
this could be made built-in default behavior, although that would
complicate options where <TT
complicate options where <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> is a perfectly legal
> is a perfectly legal
number, for example
number, for example
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_TIME_STD_DEFAULT_OFFSET</TT
>CYGNUM_LIBC_TIME_STD_DEFAULT_OFFSET</TT
>. </P
>. </P
></LI
></LI
><LI
><LI
><P
><P
>There would no replacement for a <TT
>There would no replacement for a <TT
CLASS="LITERAL"
CLASS="LITERAL"
>booldata</TT
>booldata</TT
> option
> option
for which <TT
for which <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> is a valid value. Again some additional
> is a valid value. Again some additional
<SPAN
<SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> syntax would be needed to express such a concept.</P
> syntax would be needed to express such a concept.</P
></LI
></LI
></OL
></OL
><P
><P
>Although initially it may seem confusing that an option's value has
>Although initially it may seem confusing that an option's value has
both a boolean and a data part, it is an accurate reflection of how
both a boolean and a data part, it is an accurate reflection of how
configuration options actually work. The various alternatives would
configuration options actually work. The various alternatives would
all make it harder to write <SPAN
all make it harder to write <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> scripts.</P
> scripts.</P
><P
><P
>The next common suggestion is that the data part of a value should be
>The next common suggestion is that the data part of a value should be
typed in much the same way as C or C++ data types. For example it
typed in much the same way as C or C++ data types. For example it
should be possible to describe
should be possible to describe
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_STDIO_BUFSIZE</TT
>CYGNUM_LIBC_STDIO_BUFSIZE</TT
> as an integer value,
> as an integer value,
rather than imposing <SPAN
rather than imposing <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> constraints. Again there are very
> constraints. Again there are very
good reasons why this approach was not taken:</P
good reasons why this approach was not taken:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>The possible legal values for an integer are rarely correct for a
>The possible legal values for an integer are rarely correct for a
<SPAN
<SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> option. A constraint such as
> option. A constraint such as
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>1&nbsp;to&nbsp;0x7fffffff</TT
>1&nbsp;to&nbsp;0x7fffffff</TT
> is a bit more accurate,
> is a bit more accurate,
although if this option indicates a buffer size it is still not
although if this option indicates a buffer size it is still not
particularly good&nbsp;&#8212; very few targets will have enough
particularly good&nbsp;&#8212; very few targets will have enough
memory for such a buffer. Forcing <SPAN
memory for such a buffer. Forcing <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> writers to list the
> writers to list the
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> constraints explicitly should make them think a bit
> constraints explicitly should make them think a bit
more about what values are actually sensible. For example
more about what values are actually sensible. For example
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET</TT
>CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET</TT
> has legal
> has legal
values in the range <TT
values in the range <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-90000&nbsp;to&nbsp;90000</TT
>-90000&nbsp;to&nbsp;90000</TT
>,
>,
which helps the user to set a sensible value.</P
which helps the user to set a sensible value.</P
></LI
></LI
><LI
><LI
><P
><P
>Not all options correspond to simple data types such as integers.
>Not all options correspond to simple data types such as integers.
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE</TT
>CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE</TT
> is a C string,
> is a C string,
and would have to be expressed using something like
and would have to be expressed using something like
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>char&nbsp;[]</TT
>char&nbsp;[]</TT
>. This introduces plenty of
>. This introduces plenty of
opportunities for confusion, especially since square brackets may get
opportunities for confusion, especially since square brackets may get
processed by the <SPAN
processed by the <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
> interpreter for command substitution.</P
> interpreter for command substitution.</P
></LI
></LI
><LI
><LI
><P
><P
>Some configuration options can get very complicated indeed, for
>Some configuration options can get very complicated indeed, for
example the default value of
example the default value of
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGDAT_UITRON_TASK_INITIALIZERS</TT
>CYGDAT_UITRON_TASK_INITIALIZERS</TT
> is:</P
> is:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>CYG_UIT_TASK( "t1", 1, task1, &amp;stack1, CYGNUM_UITRON_STACK_SIZE ), \
>CYG_UIT_TASK( "t1", 1, task1, &amp;stack1, CYGNUM_UITRON_STACK_SIZE ), \
CYG_UIT_TASK( "t2", 2, task2, &amp;stack2, CYGNUM_UITRON_STACK_SIZE ), \
CYG_UIT_TASK( "t2", 2, task2, &amp;stack2, CYGNUM_UITRON_STACK_SIZE ), \
CYG_UIT_TASK( "t3", 3, task3, &amp;stack3, CYGNUM_UITRON_STACK_SIZE ), \
CYG_UIT_TASK( "t3", 3, task3, &amp;stack3, CYGNUM_UITRON_STACK_SIZE ), \
CYG_UIT_TASK( "t4", 4, task4, &amp;stack4, CYGNUM_UITRON_STACK_SIZE )</PRE
CYG_UIT_TASK( "t4", 4, task4, &amp;stack4, CYGNUM_UITRON_STACK_SIZE )</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This would require <SPAN
>This would require <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> knowing about C macros, structures, arrays,
> knowing about C macros, structures, arrays,
static initializers, and so on. Adding such detailed knowledge about
static initializers, and so on. Adding such detailed knowledge about
the C language to the component framework is inappropriate.</P
the C language to the component framework is inappropriate.</P
></LI
></LI
><LI
><LI
><P
><P
><SPAN
><SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> needs to be usable with languages other than C. At present this
> needs to be usable with languages other than C. At present this
includes C++, in future it may include languages such as Java. Each
includes C++, in future it may include languages such as Java. Each
language adds new data types and related complications, for example
language adds new data types and related complications, for example
C++ classes and inheritance. Making <SPAN
C++ classes and inheritance. Making <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> support a union of all data
> support a union of all data
types in all possible languages is not sensible.</P
types in all possible languages is not sensible.</P
></LI
></LI
></OL
></OL
><P
><P
>The <SPAN
>The <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> approach of treating all data as a sequence of characters,
> approach of treating all data as a sequence of characters,
possibly constrained by a <SPAN
possibly constrained by a <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> property or other means, has
> property or other means, has
the great advantage of simplicity. It also fits in with the <SPAN
the great advantage of simplicity. It also fits in with the <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
>
>
language that underlies <SPAN
language that underlies <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
>.</P
>.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="SECT3"
CLASS="SECT3"
><H3
><H3
CLASS="SECT3"
CLASS="SECT3"
><A
><A
NAME="LANGUAGE.VALUES.VALUE.EXAMPLES">Some Examples</H3
NAME="LANGUAGE.VALUES.VALUE.EXAMPLES">Some Examples</H3
><P
><P
>The following excerpt from the C library's <SPAN
>The following excerpt from the C library's <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> scripts can be used
> scripts can be used
to illustrate how values and flavors work in practice:</P
to illustrate how values and flavors work in practice:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>cdl_component CYGPKG_LIBC_RAND {
>cdl_component CYGPKG_LIBC_RAND {
    flavor        none
    flavor        none
    compile       stdlib/rand.cxx
    compile       stdlib/rand.cxx
 
 
    cdl_option CYGSEM_LIBC_PER_THREAD_RAND {
    cdl_option CYGSEM_LIBC_PER_THREAD_RAND {
        requires      CYGVAR_KERNEL_THREADS_DATA
        requires      CYGVAR_KERNEL_THREADS_DATA
        default_value 0
        default_value 0
    }
    }
 
 
    cdl_option CYGNUM_LIBC_RAND_SEED {
    cdl_option CYGNUM_LIBC_RAND_SEED {
        flavor        data
        flavor        data
        legal_values  0 to 0x7fffffff
        legal_values  0 to 0x7fffffff
        default_value 1
        default_value 1
    }
    }
 
 
    cdl_option CYGNUM_LIBC_RAND_TRACE_LEVEL {
    cdl_option CYGNUM_LIBC_RAND_TRACE_LEVEL {
        flavor        data
        flavor        data
        legal_values  0 to 1
        legal_values  0 to 1
        default_value 0
        default_value 0
    }
    }
}</PRE
}</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>If the application does not require any C library functionality then
>If the application does not require any C library functionality then
it is possible to have a configuration where the C library is not
it is possible to have a configuration where the C library is not
loaded. This can be achieved by starting with the minimal template, or
loaded. This can be achieved by starting with the minimal template, or
by starting with another template such as the default one and then
by starting with another template such as the default one and then
explicitly unloading the C library package. If this package is not
explicitly unloading the C library package. If this package is not
loaded then any references to the <TT
loaded then any references to the <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBC_RAND</TT
>CYGPKG_LIBC_RAND</TT
>
>
component or any of its options will have a value of
component or any of its options will have a value of
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> for the purposes of expression evaluation. No
> for the purposes of expression evaluation. No
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define's</TT
>#define's</TT
> will be generated for the component or
> will be generated for the component or
any of its options, and the file <TT
any of its options, and the file <TT
CLASS="FILENAME"
CLASS="FILENAME"
>stdlib/rand.cxx</TT
>stdlib/rand.cxx</TT
>
>
will not get compiled. There is nothing special about the C library
will not get compiled. There is nothing special about the C library
here, exactly the same would apply for say a device driver that does
here, exactly the same would apply for say a device driver that does
not correspond to any of the devices on the target hardware.</P
not correspond to any of the devices on the target hardware.</P
><P
><P
>Assuming the C library is loaded, the next thing to consider is
>Assuming the C library is loaded, the next thing to consider is
whether or not the component and its options are active. The component
whether or not the component and its options are active. The component
is layered immediately below the C library package itself, so if the
is layered immediately below the C library package itself, so if the
package is loaded then it is safe to assume that the package is also
package is loaded then it is safe to assume that the package is also
enabled. Therefore the parent of <TT
enabled. Therefore the parent of <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBC_RAND</TT
>CYGPKG_LIBC_RAND</TT
>
>
is active and enabled, and in the absence of any <SPAN
is active and enabled, and in the absence of any <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>active_if</SPAN
>active_if</SPAN
>
>
properties <TT
properties <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBC_RAND</TT
>CYGPKG_LIBC_RAND</TT
> will be active as well.</P
> will be active as well.</P
><P
><P
>The component <TT
>The component <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGPKG_LIBC_RAND</TT
>CYGPKG_LIBC_RAND</TT
> has the flavor
> has the flavor
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>none</TT
>none</TT
>. This means the component cannot be disabled.
>. This means the component cannot be disabled.
Therefore all the options in this component have an active and enabled
Therefore all the options in this component have an active and enabled
parent, and in the absence of any <SPAN
parent, and in the absence of any <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>active_if</SPAN
>active_if</SPAN
> properties they are all
> properties they are all
active as well.</P
active as well.</P
><P
><P
>The component's flavor <TT
>The component's flavor <TT
CLASS="LITERAL"
CLASS="LITERAL"
>none</TT
>none</TT
> serves to group
> serves to group
together all of the configuration options related to random number
together all of the configuration options related to random number
generation. This is particularly useful in the context of the
generation. This is particularly useful in the context of the
graphical configuration tool, but it also helps when it comes to
graphical configuration tool, but it also helps when it comes to
naming the options: all of the options begin with
naming the options: all of the options begin with
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGxxx_LIBC_RAND</TT
>CYGxxx_LIBC_RAND</TT
>, giving a clear hint about both
>, giving a clear hint about both
the package and the component within that package. The flavor means
the package and the component within that package. The flavor means
that the component is always enabled and has the value
that the component is always enabled and has the value
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
> for the purposes of expression evaluation. There
> for the purposes of expression evaluation. There
will always be a single <TT
will always be a single <TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define</TT
>#define</TT
> of the form:</P
> of the form:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>#define CYGPKG_LIBC_RAND 1</PRE
>#define CYGPKG_LIBC_RAND 1</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>In addition the file <TT
>In addition the file <TT
CLASS="FILENAME"
CLASS="FILENAME"
>stdlib/rand.cxx</TT
>stdlib/rand.cxx</TT
> will always
> will always
get built. If the component had the default <TT
get built. If the component had the default <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
>
>
flavor then users would be able to disable the whole component,
flavor then users would be able to disable the whole component,
and one less file would need to be built. However random number
and one less file would need to be built. However random number
generation is relatively simple, so the impact on eCos build times are
generation is relatively simple, so the impact on eCos build times are
small. Furthermore by default the code has no dependencies on other
small. Furthermore by default the code has no dependencies on other
parts of the system, so compiling the code has no unexpected side
parts of the system, so compiling the code has no unexpected side
effects. Even if it was possible to disable the component, the
effects. Even if it was possible to disable the component, the
sensible default for most applications would still leave it enabled.
sensible default for most applications would still leave it enabled.
The net result is that the flavor <TT
The net result is that the flavor <TT
CLASS="LITERAL"
CLASS="LITERAL"
>none</TT
>none</TT
> is probably
> is probably
the most sensible one for this component. For other components the
the most sensible one for this component. For other components the
default <TT
default <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
> flavor or one of the other flavors
> flavor or one of the other flavors
might be more appropriate.</P
might be more appropriate.</P
><P
><P
>Next consider option <TT
>Next consider option <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_LIBC_PER_THREAD_RAND</TT
>CYGSEM_LIBC_PER_THREAD_RAND</TT
>
>
which can be used to get a per-thread random number seed, possibly
which can be used to get a per-thread random number seed, possibly
useful if the application needs a consistent sequence of random
useful if the application needs a consistent sequence of random
numbers. In the absence of a <SPAN
numbers. In the absence of a <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>flavor</SPAN
>flavor</SPAN
> property this option will be
> property this option will be
boolean, and the <SPAN
boolean, and the <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>default_value</SPAN
>default_value</SPAN
> property means that it is disabled by
> property means that it is disabled by
default&nbsp;&#8212; reasonable since few applications need this
default&nbsp;&#8212; reasonable since few applications need this
particular functionality, and it does impose a constraint on the rest
particular functionality, and it does impose a constraint on the rest
of the system. If the option is left disabled then no
of the system. If the option is left disabled then no
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define</TT
>#define</TT
> will be generated, and if there were any
> will be generated, and if there were any
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>compile</SPAN
>compile</SPAN
> or similar properties these would not take effect. If the
> or similar properties these would not take effect. If the
option is enabled then a <TT
option is enabled then a <TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define</TT
>#define</TT
> will be generated,
> will be generated,
using the option's data part which is fixed at <TT
using the option's data part which is fixed at <TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
>:</P
>:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>#define CYGSEM_LIBC_PER_THREAD_RAND 1</PRE
>#define CYGSEM_LIBC_PER_THREAD_RAND 1</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The <TT
>The <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGSEM_LIBC_PER_THREAD_RAND</TT
>CYGSEM_LIBC_PER_THREAD_RAND</TT
> option has a
> option has a
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
> constraint on
> constraint on
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGVAR_KERNEL_THREADS_DATA</TT
>CYGVAR_KERNEL_THREADS_DATA</TT
>. If the C library option
>. If the C library option
is enabled then the constraint should be satisfied, or else the
is enabled then the constraint should be satisfied, or else the
configuration contains a conflict. If the configuration does not
configuration contains a conflict. If the configuration does not
include the kernel package then
include the kernel package then
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGVAR_KERNEL_THREADS_DATA</TT
>CYGVAR_KERNEL_THREADS_DATA</TT
> will evaluate to
> will evaluate to
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> and the constraint is not satisfied. Similarly if
> and the constraint is not satisfied. Similarly if
the option is inactive or disabled the constraint will not be
the option is inactive or disabled the constraint will not be
satisfied.</P
satisfied.</P
><P
><P
><TT
><TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_RAND_SEED</TT
>CYGNUM_LIBC_RAND_SEED</TT
> and
> and
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_RAND_TRACE_LEVEL</TT
>CYGNUM_LIBC_RAND_TRACE_LEVEL</TT
> both have the
> both have the
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>data</TT
>data</TT
> flavor, so they are always enabled and the
> flavor, so they are always enabled and the
component framework will generate appropriate
component framework will generate appropriate
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>#define's</TT
>#define's</TT
>:</P
>:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>#define CYGNUM_LIBC_RAND_SEED 1
>#define CYGNUM_LIBC_RAND_SEED 1
#define CYGNUM_LIBC_RAND_SEED_1
#define CYGNUM_LIBC_RAND_SEED_1
#define CYGNUM_LIBC_RAND_TRACE_LEVEL 0
#define CYGNUM_LIBC_RAND_TRACE_LEVEL 0
#define CYGNUM_LIBC_RAND_TRACE_LEVEL_0</PRE
#define CYGNUM_LIBC_RAND_TRACE_LEVEL_0</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Neither option has a <SPAN
>Neither option has a <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>compile</SPAN
>compile</SPAN
> or similar property, but any such
> or similar property, but any such
properties would take effect. Any references to these options in <SPAN
properties would take effect. Any references to these options in <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
>
>
expressions would evaluate to the data part, so a hypothetical
expressions would evaluate to the data part, so a hypothetical
constraint of the form
constraint of the form
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>{&nbsp;requires&nbsp;CYGNUM_LIBC_RAND_SEED&nbsp;&gt;&nbsp;42&nbsp;}</TT
>{&nbsp;requires&nbsp;CYGNUM_LIBC_RAND_SEED&nbsp;&gt;&nbsp;42&nbsp;}</TT
>
>
would not be satisfied with the default values. Both options use a
would not be satisfied with the default values. Both options use a
simple constant for the <SPAN
simple constant for the <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>default_value</SPAN
>default_value</SPAN
> expression. It would be
> expression. It would be
possible to use a more complicated expression, for example the default
possible to use a more complicated expression, for example the default
for <TT
for <TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_RAND_TRACE_LEVEL</TT
>CYGNUM_LIBC_RAND_TRACE_LEVEL</TT
> could be
> could be
determined from some global debugging option or from a debugging
determined from some global debugging option or from a debugging
option that applies to the C library as a whole. Both options also
option that applies to the C library as a whole. Both options also
have a <SPAN
have a <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> constraint, which must be satisfied since the
> constraint, which must be satisfied since the
options are active and enabled. </P
options are active and enabled. </P
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>The value <TT
>The value <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> is legal for both
> is legal for both
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_RAND_SEED</TT
>CYGNUM_LIBC_RAND_SEED</TT
> and
> and
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGNUM_LIBC_RAND_TRACE_LEVEL</TT
>CYGNUM_LIBC_RAND_TRACE_LEVEL</TT
>, so in a <SPAN
>, so in a <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
>
>
expression there is no easy way of distinguishing between the options
expression there is no easy way of distinguishing between the options
being absent or having that particular value. This will be addressed
being absent or having that particular value. This will be addressed
by future enhancements to the expression syntax.</P
by future enhancements to the expression syntax.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="SECT2"
CLASS="SECT2"
><H2
><H2
CLASS="SECT2"
CLASS="SECT2"
><A
><A
NAME="LANGUAGE.EXPRESSION">Ordinary Expressions</H2
NAME="LANGUAGE.EXPRESSION">Ordinary Expressions</H2
><P
><P
>Expressions in <SPAN
>Expressions in <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> follow a conventional syntax, for example:</P
> follow a conventional syntax, for example:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    default_value CYGGLO_CODESIZE &gt; CYGGLO_SPEED
>    default_value CYGGLO_CODESIZE &gt; CYGGLO_SPEED
    default_value { (CYG_HAL_STARTUP == "RAM" &#38;&#38;
    default_value { (CYG_HAL_STARTUP == "RAM" &#38;&#38;
                     !CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS &#38;&#38;
                     !CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS &#38;&#38;
                     !CYGINT_HAL_USE_ROM_MONITOR_UNSUPPORTED &#38;&#38;
                     !CYGINT_HAL_USE_ROM_MONITOR_UNSUPPORTED &#38;&#38;
                     !CYGSEM_HAL_POWERPC_COPY_VECTORS) ? 1 : 0 }
                     !CYGSEM_HAL_POWERPC_COPY_VECTORS) ? 1 : 0 }
    default_value { "\"/dev/ser0\"" }</PRE
    default_value { "\"/dev/ser0\"" }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>However there is a complication in that the various arguments to a
>However there is a complication in that the various arguments to a
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>default_value</SPAN
>default_value</SPAN
> property will first get processed by a <SPAN
> property will first get processed by a <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
>
>
interpreter, so special characters like quotes and square brackets may
interpreter, so special characters like quotes and square brackets may
get processed. Such problems can be avoided by enclosing non-trivial
get processed. Such problems can be avoided by enclosing non-trivial
expressions in braces, as in the second example above. The way
expressions in braces, as in the second example above. The way
expression parsing actually works is as follows:</P
expression parsing actually works is as follows:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>The <SPAN
>The <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
> interpreter splits the line or lines into a command and its
> interpreter splits the line or lines into a command and its
arguments. In the first <SPAN
arguments. In the first <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>default_value</SPAN
>default_value</SPAN
> expression above the command
> expression above the command
is <TT
is <TT
CLASS="LITERAL"
CLASS="LITERAL"
>default_value</TT
>default_value</TT
> and there are three arguments,
> and there are three arguments,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGGLO_CODESIZE</TT
>CYGGLO_CODESIZE</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;</TT
>&gt;</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGGLO_SPEED</TT
>CYGGLO_SPEED</TT
>. In the second and third examples
>. In the second and third examples
there is just one argument, courtesy of the braces.</P
there is just one argument, courtesy of the braces.</P
></LI
></LI
><LI
><LI
><P
><P
>Next option processing takes place, so any initial arguments that
>Next option processing takes place, so any initial arguments that
begin with a hyphen will be interpreted as options. This can cause
begin with a hyphen will be interpreted as options. This can cause
problems if the expression involves a negative number, so the
problems if the expression involves a negative number, so the
special argument <TT
special argument <TT
CLASS="LITERAL"
CLASS="LITERAL"
>--</TT
>--</TT
> can be used to prevent option
> can be used to prevent option
processing on the subsequent arguments.</P
processing on the subsequent arguments.</P
></LI
></LI
><LI
><LI
><P
><P
>All of the arguments are now concatenated, with a single space in
>All of the arguments are now concatenated, with a single space in
between each one. Hence the following two expressions are equivalent,
between each one. Hence the following two expressions are equivalent,
even though they will have been processed differently up to this point.</P
even though they will have been processed differently up to this point.</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    default_value CYGGLO_CODESIZE &gt; CYGGLO_SPEED
>    default_value CYGGLO_CODESIZE &gt; CYGGLO_SPEED
    default_value {CYGGLO_CODESIZE &gt; CYGGLO_SPEED}</PRE
    default_value {CYGGLO_CODESIZE &gt; CYGGLO_SPEED}</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
></LI
></LI
><LI
><LI
><P
><P
>The expression parsing code now has a single string to process.</P
>The expression parsing code now has a single string to process.</P
></LI
></LI
></OL
></OL
><P
><P
><SPAN
><SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expressions consist of four types of element: references to
> expressions consist of four types of element: references to
configuration options, constant strings, integers, and floating point
configuration options, constant strings, integers, and floating point
numbers. These are combined using a conventional set of operators: the
numbers. These are combined using a conventional set of operators: the
unary operators <TT
unary operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-</TT
>-</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>~</TT
>~</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>!</TT
>!</TT
>; the arithmetic operators <TT
>; the arithmetic operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>+</TT
>+</TT
>,
>,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>-</TT
>-</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>*</TT
>*</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>/</TT
>/</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>%</TT
>%</TT
>; the shift operators <TT
>; the shift operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;&lt;</TT
>&lt;&lt;</TT
>
>
and <TT
and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;&gt;</TT
>&gt;&gt;</TT
>; the comparison operators
>; the comparison operators
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>==</TT
>==</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>!=</TT
>!=</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;</TT
>&lt;</TT
>,
>,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;=</TT
>&lt;=</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;</TT
>&gt;</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;=</TT
>&gt;=</TT
>; the bitwise operators
>; the bitwise operators
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>&amp;</TT
>&amp;</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>^</TT
>^</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>|</TT
>|</TT
>; the logical operators <TT
>; the logical operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&#38;&#38;</TT
>&#38;&#38;</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>||</TT
>||</TT
>; the string concatenation operator
>; the string concatenation operator
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>.</TT
>.</TT
>; and the ternary conditional operator
>; and the ternary conditional operator
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>A&nbsp;?&nbsp;B&nbsp;:&nbsp;C</TT
>A&nbsp;?&nbsp;B&nbsp;:&nbsp;C</TT
>. There is also support for
>. There is also support for
some less widely available operators for logical equivalence and
some less widely available operators for logical equivalence and
implication, and for a set of function-style operations. Bracketed
implication, and for a set of function-style operations. Bracketed
sub-expressions are supported, and the operators have the usual
sub-expressions are supported, and the operators have the usual
precedence:</P
precedence:</P
><DIV
><DIV
CLASS="INFORMALTABLE"
CLASS="INFORMALTABLE"
><A
><A
NAME="AEN1653"><P
NAME="AEN1653"><P
></P
></P
><TABLE
><TABLE
BORDER="1"
BORDER="1"
CLASS="CALSTABLE"
CLASS="CALSTABLE"
><THEAD
><THEAD
><TR
><TR
><TH
><TH
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>Priority</TH
>Priority</TH
><TH
><TH
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>Operators</TH
>Operators</TH
><TH
><TH
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>Category</TH
>Category</TH
></TR
></TR
></THEAD
></THEAD
><TBODY
><TBODY
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>16</TD
>16</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>references, constants</TD
>references, constants</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>basic elements</TD
>basic elements</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>15</TD
>15</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>f(a, b, c)</TT
>f(a, b, c)</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>function calls</TD
>function calls</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>14</TD
>14</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>~</TT
>~</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>bitwise not</TD
>bitwise not</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>14</TD
>14</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>!</TT
>!</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>logical not</TD
>logical not</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>14</TD
>14</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>-</TT
>-</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>arithmetic negation</TD
>arithmetic negation</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>13</TD
>13</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>* / %</TT
>* / %</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>multiplicative arithmetic</TD
>multiplicative arithmetic</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>12</TD
>12</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>+ - .</TT
>+ - .</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>additive arithmetic and string concatenation</TD
>additive arithmetic and string concatenation</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>11</TD
>11</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;&lt; &gt;&gt;</TT
>&lt;&lt; &gt;&gt;</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>bitwise shifts</TD
>bitwise shifts</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>10</TD
>10</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;= &lt; &gt; &gt;=</TT
>&lt;= &lt; &gt; &gt;=</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>inequality</TD
>inequality</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>9</TD
>9</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>== !=</TT
>== !=</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>comparison</TD
>comparison</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>8</TD
>8</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>&#38;</TT
>&#38;</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>bitwise and</TD
>bitwise and</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>7</TD
>7</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>^</TT
>^</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>bitwise xor</TD
>bitwise xor</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>6</TD
>6</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>|</TT
>|</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>bitwise or</TD
>bitwise or</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>5</TD
>5</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>&#38;&#38;</TT
>&#38;&#38;</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>logical and</TD
>logical and</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>4</TD
>4</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>||</TT
>||</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>logical or</TD
>logical or</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>3</TD
>3</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>xor, eqv</TT
>xor, eqv</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>logical equivalance</TD
>logical equivalance</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>2</TD
>2</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>implies</TT
>implies</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>logical implication</TD
>logical implication</TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>1</TD
>1</TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>? :</TT
>? :</TT
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="CENTER"
ALIGN="CENTER"
VALIGN="TOP"
VALIGN="TOP"
>conditional</TD
>conditional</TD
></TR
></TR
></TBODY
></TBODY
></TABLE
></TABLE
><P
><P
></P
></P
></DIV
></DIV
><P
><P
>Function calls have the usual format of a name, an opening bracket,
>Function calls have the usual format of a name, an opening bracket,
one or more arguments separated by commas, and a closing bracket. For
one or more arguments separated by commas, and a closing bracket. For
example:</P
example:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { !is_substr(CYGBLD_GLOBAL_CFLAGS, " -fno-rtti") }</PRE
>    requires { !is_substr(CYGBLD_GLOBAL_CFLAGS, " -fno-rtti") }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Functions will differ in the number of arguments and may impose
>Functions will differ in the number of arguments and may impose
restrictions on some or all of their arguments. For example it may be
restrictions on some or all of their arguments. For example it may be
necessary for the first argument to be a reference to a configuration
necessary for the first argument to be a reference to a configuration
option. The available functions are described in <A
option. The available functions are described in <A
HREF="language.values.html#LANGUAGE.FUNCTIONS"
HREF="language.values.html#LANGUAGE.FUNCTIONS"
>the Section called <I
>the Section called <I
>Functions</I
>Functions</I
></A
></A
>. </P
>. </P
><P
><P
>The logical <TT
>The logical <TT
CLASS="LITERAL"
CLASS="LITERAL"
>xor</TT
>xor</TT
> operator evaluates to true if
> operator evaluates to true if
either the left hand side or the right hand side but not both evaluate
either the left hand side or the right hand side but not both evaluate
to true The logical <TT
to true The logical <TT
CLASS="LITERAL"
CLASS="LITERAL"
>eqv</TT
>eqv</TT
> operator evaluates to true
> operator evaluates to true
if both the left and right hand sides evaluate to true, or if both
if both the left and right hand sides evaluate to true, or if both
evaluate to false. The <TT
evaluate to false. The <TT
CLASS="LITERAL"
CLASS="LITERAL"
>implies</TT
>implies</TT
> operator evaluates
> operator evaluates
to true either if the left hand side is false or if the right hand
to true either if the left hand side is false or if the right hand
side is true, in other words <TT
side is true, in other words <TT
CLASS="LITERAL"
CLASS="LITERAL"
>A&nbsp;implies&nbsp;B</TT
>A&nbsp;implies&nbsp;B</TT
>
>
has the same meaning as <TT
has the same meaning as <TT
CLASS="LITERAL"
CLASS="LITERAL"
>!A&nbsp;||&nbsp;B</TT
>!A&nbsp;||&nbsp;B</TT
>. An
>. An
example use would be:</P
example use would be:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { is_active(CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE) implies
>    requires { is_active(CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE) implies
                   (CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE &#62;= (16 * 1024)) }</PRE
                   (CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE &#62;= (16 * 1024)) }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This constraint would be satisfied if either the support for a main
>This constraint would be satisfied if either the support for a main
stack size is disabled, or if that stack is at least 16K. However if
stack size is disabled, or if that stack is at least 16K. However if
such a stack were in use but was too small, a conflict would be raised.</P
such a stack were in use but was too small, a conflict would be raised.</P
><P
><P
>A valid <SPAN
>A valid <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> identifier in an expression, for example
> identifier in an expression, for example
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGGLO_SPEED</TT
>CYGGLO_SPEED</TT
>, will be interpreted as a reference to
>, will be interpreted as a reference to
a configuration option by that name. The option does not have to be
a configuration option by that name. The option does not have to be
loaded into the current configuration. When the component framework
loaded into the current configuration. When the component framework
evaluates the expression it will substitute in a suitable value that
evaluates the expression it will substitute in a suitable value that
depends on whether or not the option is loaded, active, and enabled.
depends on whether or not the option is loaded, active, and enabled.
The exact rules are described in <A
The exact rules are described in <A
HREF="language.values.html#LANGUAGE.VALUES.VALUE"
HREF="language.values.html#LANGUAGE.VALUES.VALUE"
>the Section called <I
>the Section called <I
>Option Values</I
>Option Values</I
></A
></A
>.</P
>.</P
><P
><P
>A constant string is any sequence of characters enclosed in quotes.
>A constant string is any sequence of characters enclosed in quotes.
Care has to be taken that these quotes are not stripped off by the
Care has to be taken that these quotes are not stripped off by the
<SPAN
<SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
> interpreter before the <SPAN
> interpreter before the <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expression parser sees them.
> expression parser sees them.
Consider the following:</P
Consider the following:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    default_value "RAM"</PRE
>    default_value "RAM"</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The quote marks will be stripped before the <SPAN
>The quote marks will be stripped before the <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expression parser
> expression parser
sees the data, so the expression will be interpreted as a reference to
sees the data, so the expression will be interpreted as a reference to
a configuration option <TT
a configuration option <TT
CLASS="VARNAME"
CLASS="VARNAME"
>RAM</TT
>RAM</TT
>. There is unlikely to be
>. There is unlikely to be
such an option, so the actual default value will be
such an option, so the actual default value will be
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
>. Careful use of braces or other <SPAN
>. Careful use of braces or other <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
> quoting
> quoting
mechanisms can be used to avoid such problems.</P
mechanisms can be used to avoid such problems.</P
><P
><P
>
>
String constants consist of the data inside the quotes. If the data
String constants consist of the data inside the quotes. If the data
itself needs to contain quote characters then appropriate quoting is
itself needs to contain quote characters then appropriate quoting is
again necessary, for example:</P
again necessary, for example:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    default_value { "\"/dev/ser0\"" }</PRE
>    default_value { "\"/dev/ser0\"" }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>An integer constant consists of a sequence of digits, optionally
>An integer constant consists of a sequence of digits, optionally
preceeded with the unary <TT
preceeded with the unary <TT
CLASS="LITERAL"
CLASS="LITERAL"
>+</TT
>+</TT
> or <TT
> or <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-</TT
>-</TT
>
>
operators. As usual the sequence <TT
operators. As usual the sequence <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0x</TT
>0x</TT
> or
> or
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>0X</TT
>0X</TT
> can be used for hexadecimal data, and a leading
> can be used for hexadecimal data, and a leading
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> indicates octal data. Internally the component
> indicates octal data. Internally the component
framework uses 64-bit arithmetic for integer data. If a constant is
framework uses 64-bit arithmetic for integer data. If a constant is
too large then double precision arithmetic will be used instead.
too large then double precision arithmetic will be used instead.
Traditional syntax is also used for double precision numbers, for
Traditional syntax is also used for double precision numbers, for
example <TT
example <TT
CLASS="LITERAL"
CLASS="LITERAL"
>3.141592</TT
>3.141592</TT
> or <TT
> or <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-3E6</TT
>-3E6</TT
>. </P
>. </P
><P
><P
>Of course this is not completely accurate: <SPAN
>Of course this is not completely accurate: <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> is not a typed
> is not a typed
language, all data is treated as if it were a string. For example the
language, all data is treated as if it were a string. For example the
following two lines are equivalent:</P
following two lines are equivalent:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires CYGNUM_UITRON_SEMAS &#62; 10
>    requires CYGNUM_UITRON_SEMAS &#62; 10
    requires { CYGNUM_UITRON_SEMAS &#62; "10" }</PRE
    requires { CYGNUM_UITRON_SEMAS &#62; "10" }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>When an expression gets evaluated the operators will attempt
>When an expression gets evaluated the operators will attempt
appropriate conversions. The <TT
appropriate conversions. The <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;</TT
>&gt;</TT
> comparison
> comparison
operator can be used on either integer or double precision numbers, so
operator can be used on either integer or double precision numbers, so
it will begin by attempting a string to integer conversion of both
it will begin by attempting a string to integer conversion of both
operands. If that fails it will attempt string to double conversions.
operands. If that fails it will attempt string to double conversions.
If that fails as well then the component framework will report a
If that fails as well then the component framework will report a
conflict, an evaluation exception. If the conversions from string to
conflict, an evaluation exception. If the conversions from string to
integer are successful then the result will be either the string
integer are successful then the result will be either the string
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> or the string <TT
> or the string <TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
>, both of which
>, both of which
can be converted to integers or doubles as required.</P
can be converted to integers or doubles as required.</P
><P
><P
>It is worth noting that the expression
>It is worth noting that the expression
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGNUM_UITRON_SEMAS&nbsp;&gt;10</TT
>CYGNUM_UITRON_SEMAS&nbsp;&gt;10</TT
> is not ambiguous.
> is not ambiguous.
<SPAN
<SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> identifiers can never begin with a digit, so it is not possible
> identifiers can never begin with a digit, so it is not possible
for <TT
for <TT
CLASS="LITERAL"
CLASS="LITERAL"
>10</TT
>10</TT
> to be misinterpreted as a reference to an
> to be misinterpreted as a reference to an
identifier instead of as a string.</P
identifier instead of as a string.</P
><P
><P
>Of course the implementation is slightly different again. The <SPAN
>Of course the implementation is slightly different again. The <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
>
>
language definition is such that all data is treated as if it were a
language definition is such that all data is treated as if it were a
string, with conversions to integer, double or boolean as and when
string, with conversions to integer, double or boolean as and when
required. The implementation is allowed to avoid conversions until
required. The implementation is allowed to avoid conversions until
they are necessary. For example, given
they are necessary. For example, given
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>CYGNUM_UITRON_SEMAS&nbsp;&gt;&nbsp;10</TT
>CYGNUM_UITRON_SEMAS&nbsp;&gt;&nbsp;10</TT
> the
> the
expression parsing code will perform an immediate conversion from
expression parsing code will perform an immediate conversion from
string to integer, storing the integer representation, and there is no
string to integer, storing the integer representation, and there is no
need for a conversion by the comparison operator when the expression
need for a conversion by the comparison operator when the expression
gets evaluated. Given
gets evaluated. Given
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>{&nbsp;CYGNUM_UITRON_SEMAS&nbsp;&gt;&nbsp;"10"&nbsp;}</TT
>{&nbsp;CYGNUM_UITRON_SEMAS&nbsp;&gt;&nbsp;"10"&nbsp;}</TT
>
>
the parsing code will store the string representation and a conversion
the parsing code will store the string representation and a conversion
happens the first time the expression is evaluated. All of this is an
happens the first time the expression is evaluated. All of this is an
implementation detail, and does not affect the semantics of the
implementation detail, and does not affect the semantics of the
language. </P
language. </P
><P
><P
>Different operators have different requirements, for example the
>Different operators have different requirements, for example the
bitwise or operator only makes sense if both operands have an integer
bitwise or operator only makes sense if both operands have an integer
representation. For operators which can work with either integer or
representation. For operators which can work with either integer or
double precision numbers, integer arithmetic will be preferred.</P
double precision numbers, integer arithmetic will be preferred.</P
><P
><P
>The following operators only accept integer operands:
>The following operators only accept integer operands:
unary <TT
unary <TT
CLASS="LITERAL"
CLASS="LITERAL"
>~</TT
>~</TT
> (bitwise not), the shift operators
> (bitwise not), the shift operators
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;&lt;</TT
>&lt;&lt;</TT
> and <TT
> and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;&gt;</TT
>&gt;&gt;</TT
>, and the
>, and the
bitwise operators <TT
bitwise operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&#38;</TT
>&#38;</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>|</TT
>|</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>^</TT
>^</TT
>.</P
>.</P
><P
><P
>The following operators will attempt integer arithmetic first, then
>The following operators will attempt integer arithmetic first, then
double precision arithmetic: unary <TT
double precision arithmetic: unary <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-</TT
>-</TT
>,
>,
the arithmetic operators <TT
the arithmetic operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>+</TT
>+</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-</TT
>-</TT
>,
>,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>*</TT
>*</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>/</TT
>/</TT
>, and <TT
>, and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>%</TT
>%</TT
>;
>;
and the comparision operators <TT
and the comparision operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;</TT
>&lt;</TT
>,
>,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>&lt;=</TT
>&lt;=</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;</TT
>&gt;</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>&gt;=</TT
>&gt;=</TT
>. </P
>. </P
><P
><P
>The equality <TT
>The equality <TT
CLASS="LITERAL"
CLASS="LITERAL"
>==</TT
>==</TT
> and inequality
> and inequality
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>!=</TT
>!=</TT
> operators will first attempt integer conversion
> operators will first attempt integer conversion
and comparison. If that fails then double precision will be attempted
and comparison. If that fails then double precision will be attempted
(although arguably using these operators on double precision data is
(although arguably using these operators on double precision data is
not sensible). As a last resort string comparison will be used.</P
not sensible). As a last resort string comparison will be used.</P
><P
><P
>The operators <TT
>The operators <TT
CLASS="LITERAL"
CLASS="LITERAL"
>!</TT
>!</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>&#38;&#38;</TT
>&#38;&#38;</TT
> and
> and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>||</TT
>||</TT
> all work with boolean data. Any string that can
> all work with boolean data. Any string that can
be converted to the integer <TT
be converted to the integer <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> or the double
> or the double
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>0.0</TT
>0.0</TT
> is treated as false, as is the empty string or
> is treated as false, as is the empty string or
the constant string <TT
the constant string <TT
CLASS="LITERAL"
CLASS="LITERAL"
>false</TT
>false</TT
>. Anything else is
>. Anything else is
interpreted as true. The result is either <TT
interpreted as true. The result is either <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
> or
> or
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
>.</P
>.</P
><P
><P
>The conditional operator <TT
>The conditional operator <TT
CLASS="LITERAL"
CLASS="LITERAL"
>?&nbsp;:</TT
>?&nbsp;:</TT
> will interpret
> will interpret
its first operand as a boolean. It does not perform any processing on
its first operand as a boolean. It does not perform any processing on
the second or third operands.</P
the second or third operands.</P
><P
><P
>In practice it is rarely necessary to worry about any of these
>In practice it is rarely necessary to worry about any of these
details. In nearly every case <SPAN
details. In nearly every case <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expressions just work as expected,
> expressions just work as expected,
and there is no need to understand the full details.</P
and there is no need to understand the full details.</P
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>The current expression syntax does not meet all the needs of component
>The current expression syntax does not meet all the needs of component
writers. Some future enhancements will definitely be made, others are
writers. Some future enhancements will definitely be made, others are
more controversial. The list includes the following:</P
more controversial. The list includes the following:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>An option's value is determined by several different factors: whether
>An option's value is determined by several different factors: whether
or not it is loaded, whether or not it is active, whether or not it is
or not it is loaded, whether or not it is active, whether or not it is
enabled, and the data part. Currently there is no way of querying
enabled, and the data part. Currently there is no way of querying
these individually. This is very significant in the context of options
these individually. This is very significant in the context of options
with the <TT
with the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>bool</TT
>bool</TT
> or <TT
> or <TT
CLASS="LITERAL"
CLASS="LITERAL"
>booldata</TT
>booldata</TT
>
>
flavors, because there is no way of distinguishing between the option
flavors, because there is no way of distinguishing between the option
being absent/inactive/disabled or it being enabled with a data field
being absent/inactive/disabled or it being enabled with a data field
of <TT
of <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
>. There should be unary operators that allow
>. There should be unary operators that allow
any of the factors to be checked.</P
any of the factors to be checked.</P
></LI
></LI
><LI
><LI
><P
><P
>Only the <TT
>Only the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>==</TT
>==</TT
> and <TT
> and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>!=</TT
>!=</TT
> operators can
> operators can
be used for string data. More string-related facilities are needed.</P
be used for string data. More string-related facilities are needed.</P
></LI
></LI
><LI
><LI
><P
><P
>An implies operator would be useful for many goal expression, where
>An implies operator would be useful for many goal expression, where
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>A&nbsp;implies&nbsp;B</TT
>A&nbsp;implies&nbsp;B</TT
> is equivalent to
> is equivalent to
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>!A&nbsp;||B</TT
>!A&nbsp;||B</TT
>.</P
>.</P
></LI
></LI
><LI
><LI
><P
><P
>Similarly there is inadequate support for lists. On occasion it would
>Similarly there is inadequate support for lists. On occasion it would
be useful to write expressions involving say the list of implementors
be useful to write expressions involving say the list of implementors
of a given CDL interface, for example a sensible default value could
of a given CDL interface, for example a sensible default value could
be the first implementor. Associated with this is a need for an
be the first implementor. Associated with this is a need for an
indirection operator.</P
indirection operator.</P
></LI
></LI
><LI
><LI
><P
><P
>Arguably extending the basic <SPAN
>Arguably extending the basic <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>CDL</SPAN
>CDL</SPAN
> expression syntax with lots of new
> expression syntax with lots of new
operators is unnecessary, instead expressions should just support
operators is unnecessary, instead expressions should just support
<SPAN
<SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
> command substitution and then component writers could escape
> command substitution and then component writers could escape
into <SPAN
into <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
> scripts for complicated operations. This has some major
> scripts for complicated operations. This has some major
disadvantages. First, the inference engine would no longer have any
disadvantages. First, the inference engine would no longer have any
sensible way of interpreting an expression to resolve a conflict.
sensible way of interpreting an expression to resolve a conflict.
Second, the component framework's value propagation code keeps track
Second, the component framework's value propagation code keeps track
of which options get referenced in which expressions and avoids
of which options get referenced in which expressions and avoids
unnecessary re-evaluation of expressions; if expressions can involve
unnecessary re-evaluation of expressions; if expressions can involve
arbitrary <SPAN
arbitrary <SPAN
CLASS="APPLICATION"
CLASS="APPLICATION"
>Tcl</SPAN
>Tcl</SPAN
> code then there is no simple way to eliminate
> code then there is no simple way to eliminate
unnecessary recalculations, with a potentially major impact on
unnecessary recalculations, with a potentially major impact on
performance.</P
performance.</P
></LI
></LI
></OL
></OL
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>The current implementation of the component framework uses 64 bit
>The current implementation of the component framework uses 64 bit
arithmetic on all host platforms. Although this is adequate for
arithmetic on all host platforms. Although this is adequate for
current target architectures, it may cause problems in future. At some
current target architectures, it may cause problems in future. At some
stage it is likely that an arbitrary precision integer arithmetic
stage it is likely that an arbitrary precision integer arithmetic
package will be used instead.</P
package will be used instead.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="SECT2"
CLASS="SECT2"
><H2
><H2
CLASS="SECT2"
CLASS="SECT2"
><A
><A
NAME="LANGUAGE.FUNCTIONS">Functions</H2
NAME="LANGUAGE.FUNCTIONS">Functions</H2
><P
><P
>CDL expressions can contain calls to a set of built-in functions
>CDL expressions can contain calls to a set of built-in functions
using the usual syntax, for example;</P
using the usual syntax, for example;</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { !is_substr(CYGBLD_GLOBAL_CFLAGS, "-fno-rtti") }</PRE
>    requires { !is_substr(CYGBLD_GLOBAL_CFLAGS, "-fno-rtti") }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The available function calls are as follows:</P
>The available function calls are as follows:</P
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>get_data(option)</TT
>get_data(option)</TT
></DT
></DT
><DD
><DD
><P
><P
>This function can be used to obtain just the data part of a loaded
>This function can be used to obtain just the data part of a loaded
configuration option, ignoring other factors such as whether or not
configuration option, ignoring other factors such as whether or not
the option is active and enabled. It takes a single argument which
the option is active and enabled. It takes a single argument which
should be the name of a configuration option. If the specified option
should be the name of a configuration option. If the specified option
is not loaded in the current configuration then the function returns
is not loaded in the current configuration then the function returns
0, otherwise it returns the data part. Typically this function will
0, otherwise it returns the data part. Typically this function will
only be used in conjunction with <TT
only be used in conjunction with <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_active</TT
>is_active</TT
> and
> and
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_enabled</TT
>is_enabled</TT
> for fine-grained control over the
> for fine-grained control over the
various factors that make up an option's value.</P
various factors that make up an option's value.</P
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>is_active(option)</TT
>is_active(option)</TT
></DT
></DT
><DD
><DD
><P
><P
>This function can be used to determine whether or not a particular
>This function can be used to determine whether or not a particular
configuration option is active. It takes a single argument which
configuration option is active. It takes a single argument which
should be the name of an option, and returns a boolean. If the
should be the name of an option, and returns a boolean. If the
specified option is not loaded then the function will return false.
specified option is not loaded then the function will return false.
Otherwise it will consider the state of the option's parents and
Otherwise it will consider the state of the option's parents and
evaluate any <SPAN
evaluate any <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>active_if</SPAN
>active_if</SPAN
> properties, and return the option's current
> properties, and return the option's current
active state. A typical use might be:</P
active state. A typical use might be:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { is_active(CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE) implies
>    requires { is_active(CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE) implies
                   (CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE &#62;= (16 * 1024)) }</PRE
                   (CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE &#62;= (16 * 1024)) }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>In other words either the specified configuration option must be
>In other words either the specified configuration option must be
inactive, for example because the current application does not use
inactive, for example because the current application does not use
any related C library or POSIX functionality, or the stack size must
any related C library or POSIX functionality, or the stack size must
be at least 16K.</P
be at least 16K.</P
><P
><P
>The configuration system's inference engine can attempt to satisfy
>The configuration system's inference engine can attempt to satisfy
constraints involving <TT
constraints involving <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_active</TT
>is_active</TT
> in various
> in various
different ways, for example by enabling or disabling parent
different ways, for example by enabling or disabling parent
components, or by examining <SPAN
components, or by examining <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>active_if</SPAN
>active_if</SPAN
> properties and manipulating
> properties and manipulating
terms in the associated expressions.</P
terms in the associated expressions.</P
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>is_enabled(option)</TT
>is_enabled(option)</TT
></DT
></DT
><DD
><DD
><P
><P
>This function can be used to determine whether or not a particular
>This function can be used to determine whether or not a particular
configuration option is enabled. It takes a single argument which
configuration option is enabled. It takes a single argument which
should be the name of an option, and returns a boolean. If the
should be the name of an option, and returns a boolean. If the
specified option is not loaded then the function will return false.
specified option is not loaded then the function will return false.
Otherwise it will return the current boolean part of the option's
Otherwise it will return the current boolean part of the option's
value. The option's active or inactive state is ignored. Typically
value. The option's active or inactive state is ignored. Typically
this function will be used in conjunction with
this function will be used in conjunction with
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_active</TT
>is_active</TT
> and possibly
> and possibly
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>get_data</TT
>get_data</TT
> to provide fine-grained control over the
> to provide fine-grained control over the
various factors that make up an option's value.</P
various factors that make up an option's value.</P
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>is_loaded(option)</TT
>is_loaded(option)</TT
></DT
></DT
><DD
><DD
><P
><P
>This function can be used to determine whether or not a particular
>This function can be used to determine whether or not a particular
configuration option is loaded. It takes a single argument which
configuration option is loaded. It takes a single argument which
should be the name of an option, and returns a boolean. If the
should be the name of an option, and returns a boolean. If the
argument is a package then the <TT
argument is a package then the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_loaded</TT
>is_loaded</TT
> function
> function
provides little or no extra information, for example the following two
provides little or no extra information, for example the following two
constraints are usually equivalent:</P
constraints are usually equivalent:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { CYGPKG_KERNEL }
>    requires { CYGPKG_KERNEL }
    requires { is_loaded(CYGPKG_KERNEL) }</PRE
    requires { is_loaded(CYGPKG_KERNEL) }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>However if the specified package is loaded but re-parented below a
>However if the specified package is loaded but re-parented below a
disabled component, or inactive as a result of an <SPAN
disabled component, or inactive as a result of an <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>active_if</SPAN
>active_if</SPAN
>
>
property, then the first constraint would not be satisfied but the
property, then the first constraint would not be satisfied but the
second constraint would. In other words the
second constraint would. In other words the
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_loaded</TT
>is_loaded</TT
> makes it possible to consider in
> makes it possible to consider in
isolation one of the factors that are considered when CDL expressions
isolation one of the factors that are considered when CDL expressions
are evaluated.</P
are evaluated.</P
><P
><P
>The configuration system's inference engine will not automatically
>The configuration system's inference engine will not automatically
load or unload packages to satisfy <TT
load or unload packages to satisfy <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_loaded</TT
>is_loaded</TT
>
>
constraints. </P
constraints. </P
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>is_substr(haystack,&nbsp;needle)</TT
>is_substr(haystack,&nbsp;needle)</TT
></DT
></DT
><DD
><DD
><P
><P
>This can be used to check whether or not a particular string is
>This can be used to check whether or not a particular string is
present in another string. It is used mainly for manipulating compiler
present in another string. It is used mainly for manipulating compiler
flags. The function takes two arguments, both of which can be
flags. The function takes two arguments, both of which can be
arbitrary expressions, and returns a boolean.</P
arbitrary expressions, and returns a boolean.</P
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_substr</TT
>is_substr</TT
> has some understanding of word
> has some understanding of word
boundaries. If the second argument starts with a space character then
boundaries. If the second argument starts with a space character then
that will match either a real space or the start of the string.
that will match either a real space or the start of the string.
Similarly if the second argument ends with a space character then that
Similarly if the second argument ends with a space character then that
will match a real space or the end of the string. For example, all of
will match a real space or the end of the string. For example, all of
the following conditions are satisfied:</P
the following conditions are satisfied:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    is_substr("abracadabra", "abra")
>    is_substr("abracadabra", "abra")
    is_substr("abracadabra", " abra")
    is_substr("abracadabra", " abra")
    is_substr("hocus pocus", " pocus")
    is_substr("hocus pocus", " pocus")
    is_substr("abracadabra", "abra ")</PRE
    is_substr("abracadabra", "abra ")</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The first is an exact match. The second is a match because the leading
>The first is an exact match. The second is a match because the leading
space matches the start of the string. The third is an exact match,
space matches the start of the string. The third is an exact match,
with the leading space matching an actual space. The fourth is a match
with the leading space matching an actual space. The fourth is a match
because the trailing space matches the end of the string. However, the
because the trailing space matches the end of the string. However, the
following condition is not satisfied.</P
following condition is not satisfied.</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    is_substr("abracadabra", " abra ")</PRE
>    is_substr("abracadabra", " abra ")</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This fails to match at the start of the string because the trailing
>This fails to match at the start of the string because the trailing
space is not matched by either a real space or the end of the string.
space is not matched by either a real space or the end of the string.
Similarly it fails to match at the end of the string.</P
Similarly it fails to match at the end of the string.</P
><P
><P
>If a constraint involving <TT
>If a constraint involving <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_substr</TT
>is_substr</TT
> is not
> is not
satisfied and the first argument is a reference to a configuration
satisfied and the first argument is a reference to a configuration
option, the inference engine will attempt to modify that option's
option, the inference engine will attempt to modify that option's
value. This can be achieved either by appending the second argument to
value. This can be achieved either by appending the second argument to
the current value, or by removing all occurrences of that argument
the current value, or by removing all occurrences of that argument
from the current value.</P
from the current value.</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { !is_substr(CYGBLD_GLOBAL_CFLAGS, " -fno-rtti ") }
>    requires { !is_substr(CYGBLD_GLOBAL_CFLAGS, " -fno-rtti ") }
    requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -frtti ") }</PRE
    requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -frtti ") }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>When data is removed the leading and trailing spaces will be left. For
>When data is removed the leading and trailing spaces will be left. For
example, given an initial value of
example, given an initial value of
&#60;<TT
&#60;<TT
CLASS="VARNAME"
CLASS="VARNAME"
>CYGBLD_GLOBAL_CFLAGS</TT
>CYGBLD_GLOBAL_CFLAGS</TT
> of
> of
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>-g&nbsp;-fno-rtti&nbsp;-O2</TT
>-g&nbsp;-fno-rtti&nbsp;-O2</TT
> the result will be
> the result will be
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>-g&nbsp;&nbsp;-O2</TT
>-g&nbsp;&nbsp;-O2</TT
> rather than <TT
> rather than <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-g-O2</TT
>-g-O2</TT
>.</P
>.</P
><P
><P
>If exact matches are needed, the function
>If exact matches are needed, the function
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_xsubstr</TT
>is_xsubstr</TT
> can be used instead.</P
> can be used instead.</P
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>is_xsubstr(haystack,&nbsp;needle)</TT
>is_xsubstr(haystack,&nbsp;needle)</TT
></DT
></DT
><DD
><DD
><P
><P
>This function checks whether or not the pattern string is an exact
>This function checks whether or not the pattern string is an exact
substring of the string being searched. It is similar to
substring of the string being searched. It is similar to
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_substr</TT
>is_substr</TT
> but uses exact matching only. In other
> but uses exact matching only. In other
words, leading or trailing spaces have to match exactly and will not
words, leading or trailing spaces have to match exactly and will not
match the beginning or end of the string being searched. The function
match the beginning or end of the string being searched. The function
takes two arguments, both of which can be arbitrary expressions, and
takes two arguments, both of which can be arbitrary expressions, and
returns a boolean. The difference between
returns a boolean. The difference between
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_substr</TT
>is_substr</TT
> and <TT
> and <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>is_xsubstr</TT
>is_xsubstr</TT
> is
> is
illustrated by the following examples:</P
illustrated by the following examples:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    cdl_option MAGIC {
>    cdl_option MAGIC {
        flavor data
        flavor data
        default_value { "abracadabra" }
        default_value { "abracadabra" }
    }
    }
    &#8230;
    &#8230;
    requires { is_substr(MAGIC,  " abra") }
    requires { is_substr(MAGIC,  " abra") }
    requires { is_xsubstr(MAGIC, " abra") }</PRE
    requires { is_xsubstr(MAGIC, " abra") }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The first goal will be satisfied because the leading space in the
>The first goal will be satisfied because the leading space in the
pattern matches the beginning of the string. The second goal will not
pattern matches the beginning of the string. The second goal will not
be satisfied initialy because there is no exact match, so the
be satisfied initialy because there is no exact match, so the
inference engine is likely to update the value of
inference engine is likely to update the value of
<TT
<TT
CLASS="VARNAME"
CLASS="VARNAME"
>MAGIC</TT
>MAGIC</TT
> to <TT
> to <TT
CLASS="LITERAL"
CLASS="LITERAL"
>abracadabra abra</TT
>abracadabra abra</TT
> which
> which
does give an exact match.</P
does give an exact match.</P
></DD
></DD
><DT
><DT
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>version_cmp(A,&nbsp;B)</TT
>version_cmp(A,&nbsp;B)</TT
></DT
></DT
><DD
><DD
><P
><P
>This function is used primarily to check that a sufficiently recent
>This function is used primarily to check that a sufficiently recent
<A
<A
HREF="package.versions.html"
HREF="package.versions.html"
>version</A
>version</A
> of some other package
> of some other package
is being used. It takes two arguments, both of which can be arbitrary
is being used. It takes two arguments, both of which can be arbitrary
expressions. In practice usually one of the arguments will be a
expressions. In practice usually one of the arguments will be a
reference to a package and the other will be a constant version
reference to a package and the other will be a constant version
string. The return value is -1 if the first argument is a more recent
string. The return value is -1 if the first argument is a more recent
version then the second, 0 if the two arguments correspond to
version then the second, 0 if the two arguments correspond to
identical versions, and 1 if the first argument is an older version.
identical versions, and 1 if the first argument is an older version.
For example the following constraint can be used to indicate that the
For example the following constraint can be used to indicate that the
current package depends on kernel functionality that only became
current package depends on kernel functionality that only became
available in version 1.3:</P
available in version 1.3:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { version_cmp(CYGPKG_KERNEL, "v1.3") &#60;= 0 }</PRE
>    requires { version_cmp(CYGPKG_KERNEL, "v1.3") &#60;= 0 }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
></DD
></DD
></DL
></DL
></DIV
></DIV
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>At this time it is not possible to define new functions inside a CDL
>At this time it is not possible to define new functions inside a CDL
script. Instead functions can only be added at the C++ level, usually
script. Instead functions can only be added at the C++ level, usually
by extending libcdl itself. This is partly because there is more to
by extending libcdl itself. This is partly because there is more to
CDL functions than simple evaluation: associated with most functions
CDL functions than simple evaluation: associated with most functions
is support for the inference engine, so that if a constraint involving
is support for the inference engine, so that if a constraint involving
a function is not currently satisfied the system may be able to find a
a function is not currently satisfied the system may be able to find a
solution automatically.</P
solution automatically.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="SECT2"
CLASS="SECT2"
><H2
><H2
CLASS="SECT2"
CLASS="SECT2"
><A
><A
NAME="LANGUAGE.GOAL-EXPRESSION">Goal Expressions</H2
NAME="LANGUAGE.GOAL-EXPRESSION">Goal Expressions</H2
><P
><P
>The arguments to certain properties, notably <SPAN
>The arguments to certain properties, notably <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
> and
> and
<SPAN
<SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>active_if</SPAN
>active_if</SPAN
>, constitute a goal expression. As with an ordinary
>, constitute a goal expression. As with an ordinary
expression, all of the arguments get combined and then the expression
expression, all of the arguments get combined and then the expression
parser takes over. The same care has to be taken with constant strings
parser takes over. The same care has to be taken with constant strings
and anything else that may get processed by the Tcl interpreter, so
and anything else that may get processed by the Tcl interpreter, so
often a goal expression is enclosed entirely in braces and the
often a goal expression is enclosed entirely in braces and the
expression parsing code sees just a single argument.</P
expression parsing code sees just a single argument.</P
><P
><P
>A goal expression is basically just a sequence of ordinary
>A goal expression is basically just a sequence of ordinary
expressions, for example:</P
expressions, for example:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
>    requires { CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
               !CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
               !CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
               !CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT }</PRE
               !CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This consists of three separate expressions, all of which should
>This consists of three separate expressions, all of which should
evaluate to a non-zero result. The same expression could be written
evaluate to a non-zero result. The same expression could be written
as: </P
as: </P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires { CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS  &#38;&#38;
>    requires { CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS  &#38;&#38;
               !CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT &#38;&#38;
               !CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT &#38;&#38;
               !CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT }</PRE
               !CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT }</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Alternatively the following would have much the same effect:</P
>Alternatively the following would have much the same effect:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
>    requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
    requires !CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
    requires !CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
    requires !CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT</PRE
    requires !CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Selecting between these alternatives is largely a stylistic choice.
>Selecting between these alternatives is largely a stylistic choice.
The first is slightly more concise than the others. The second is more
The first is slightly more concise than the others. The second is more
likely to appeal to mathematical purists. The third is more amenable
likely to appeal to mathematical purists. The third is more amenable
to cutting and pasting.</P
to cutting and pasting.</P
><P
><P
>The result of evaluating a goal expression is a boolean. If any part
>The result of evaluating a goal expression is a boolean. If any part
of the goal expression evaluates to the integer <TT
of the goal expression evaluates to the integer <TT
CLASS="LITERAL"
CLASS="LITERAL"
>0</TT
>0</TT
>
>
or an equivalent string then the result is false, otherwise it is
or an equivalent string then the result is false, otherwise it is
true. </P
true. </P
><P
><P
>The term &#8220;goal&nbsp;expression&#8221; relates to the component
>The term &#8220;goal&nbsp;expression&#8221; relates to the component
framework's inference engine: it is a description of a goal that
framework's inference engine: it is a description of a goal that
should be satisfied for a conflict-free configuration. If a <SPAN
should be satisfied for a conflict-free configuration. If a <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
>
>
constraint is not satisfied then the inference engine will examine the
constraint is not satisfied then the inference engine will examine the
goal expression: if there is some way of changing the configuration
goal expression: if there is some way of changing the configuration
that does not introduce new conflicts and that will cause the goal
that does not introduce new conflicts and that will cause the goal
expression to evaluate to true, the conflict can be resolved.</P
expression to evaluate to true, the conflict can be resolved.</P
><P
><P
>The inference engine works with one conflict and hence one goal
>The inference engine works with one conflict and hence one goal
expression at a time. This means that there can be slightly different
expression at a time. This means that there can be slightly different
behavior if a constraint is specified using a single <SPAN
behavior if a constraint is specified using a single <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>requires</SPAN
>requires</SPAN
>
>
property or several different ones. Given the above example, suppose
property or several different ones. Given the above example, suppose
that none of the three conditions are satisfied. If a single goal
that none of the three conditions are satisfied. If a single goal
expression is used then the inference engine might be able to satisfy
expression is used then the inference engine might be able to satisfy
only two of the three parts, but since the conflict as a whole cannot
only two of the three parts, but since the conflict as a whole cannot
be resolved no part of the solution will be applied. Instead the user
be resolved no part of the solution will be applied. Instead the user
will have to resolve the entire conflict. If three separate goal
will have to resolve the entire conflict. If three separate goal
expressions are used then the inference engine might well find
expressions are used then the inference engine might well find
solutions to two of them, leaving less work for the user. On the other
solutions to two of them, leaving less work for the user. On the other
hand, if a single goal expression is used then the inference engine
hand, if a single goal expression is used then the inference engine
has a bit more information to work with, and it might well find a
has a bit more information to work with, and it might well find a
solution to the entire conflict where it would be unable to find
solution to the entire conflict where it would be unable to find
separate solutions for the three parts. Things can get very
separate solutions for the three parts. Things can get very
complicated, and in general component writers should not worry about
complicated, and in general component writers should not worry about
the subtleties of the inference engine and how to manipulate its
the subtleties of the inference engine and how to manipulate its
behavior. </P
behavior. </P
><P
><P
>It is possible to write ambiguous goal expressions, for example:</P
>It is possible to write ambiguous goal expressions, for example:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires CYGNUM_LIBC_RAND_SEED -CYGNUM_LIBC_RAND_TRACE_LEVEL &gt; 5</PRE
>    requires CYGNUM_LIBC_RAND_SEED -CYGNUM_LIBC_RAND_TRACE_LEVEL &gt; 5</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This could be parsed in two ways:</P
>This could be parsed in two ways:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    requires ((CYGNUM_LIBC_RAND_SEED - CYGNUM_LIBC_RAND_TRACE_LEVEL) &gt; 5)
>    requires ((CYGNUM_LIBC_RAND_SEED - CYGNUM_LIBC_RAND_TRACE_LEVEL) &gt; 5)
    requires CYGNUM_LIBC_RAND_SEED &amp;&amp; ((-CYGNUM_LIBC_RAND_TRACE_LEVEL) &gt; 5)</PRE
    requires CYGNUM_LIBC_RAND_SEED &amp;&amp; ((-CYGNUM_LIBC_RAND_TRACE_LEVEL) &gt; 5)</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>The goal expression parsing code will always use the largest ordinary
>The goal expression parsing code will always use the largest ordinary
expression for each goal, so the first interpretation will be used.
expression for each goal, so the first interpretation will be used.
In such cases it is a good idea to use brackets and avoid possible
In such cases it is a good idea to use brackets and avoid possible
confusion. </P
confusion. </P
></DIV
></DIV
><DIV
><DIV
CLASS="SECT2"
CLASS="SECT2"
><H2
><H2
CLASS="SECT2"
CLASS="SECT2"
><A
><A
NAME="LANGUAGE.LIST-EXPRESSION">List Expressions</H2
NAME="LANGUAGE.LIST-EXPRESSION">List Expressions</H2
><P
><P
>The arguments to the <SPAN
>The arguments to the <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> property constitute a goal
> property constitute a goal
expression. As with an ordinary and goal expressions, all of the
expression. As with an ordinary and goal expressions, all of the
arguments get combined and then the expression parser takes over. The
arguments get combined and then the expression parser takes over. The
same care has to be taken with constant strings and anything else that
same care has to be taken with constant strings and anything else that
may get processed by the Tcl interpreter, so often a list expression
may get processed by the Tcl interpreter, so often a list expression
is enclosed entirely in braces and the expression parsing code sees
is enclosed entirely in braces and the expression parsing code sees
just a single argument.</P
just a single argument.</P
><P
><P
>Most list expressions take one of two forms:</P
>Most list expressions take one of two forms:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    legal_values &lt;expr1&gt; &lt;expr2&gt; &lt;expr3&gt; ...
>    legal_values &lt;expr1&gt; &lt;expr2&gt; &lt;expr3&gt; ...
    legal_values &lt;expr1&gt; to &lt;expr2&gt;</PRE
    legal_values &lt;expr1&gt; to &lt;expr2&gt;</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
><TT
><TT
CLASS="LITERAL"
CLASS="LITERAL"
>expr1</TT
>expr1</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>expr2</TT
>expr2</TT
> and so on are
> and so on are
ordinary expressions. Often these will be constants or references to
ordinary expressions. Often these will be constants or references to
calculated options in the architectural HAL package, but it is
calculated options in the architectural HAL package, but it is
possible to use arbitrary expressions when necessary. The first syntax
possible to use arbitrary expressions when necessary. The first syntax
indicates a list of possible values, which need not be numerical. The
indicates a list of possible values, which need not be numerical. The
second syntax indicates a numerical range: both sides of the
second syntax indicates a numerical range: both sides of the
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>to</TT
>to</TT
> must evaluate to a numerical value; if either
> must evaluate to a numerical value; if either
side involves a floating point number then any floating point number
side involves a floating point number then any floating point number
in that range is legal; otherwise only integer values are legal;
in that range is legal; otherwise only integer values are legal;
ranges are inclusive, so <TT
ranges are inclusive, so <TT
CLASS="LITERAL"
CLASS="LITERAL"
>4</TT
>4</TT
> is a valid value given a
> is a valid value given a
list expression <TT
list expression <TT
CLASS="LITERAL"
CLASS="LITERAL"
>1&nbsp;to&nbsp;</TT
>1&nbsp;to&nbsp;</TT
>; if one or both
>; if one or both
sides of the <TT
sides of the <TT
CLASS="LITERAL"
CLASS="LITERAL"
>to</TT
>to</TT
> does not evaluate to a numerical
> does not evaluate to a numerical
value then this will result in a run-time conflict. The following
value then this will result in a run-time conflict. The following
examples illustrate these possibilities:</P
examples illustrate these possibilities:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    legal_values { "red" "green" "blue" }
>    legal_values { "red" "green" "blue" }
    legal_values 1 2 4 8 16
    legal_values 1 2 4 8 16
    legal_values 1 to CYGARC_MAXINT
    legal_values 1 to CYGARC_MAXINT
    legal_values 1.0 to 2.0</PRE
    legal_values 1.0 to 2.0</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>It is possible to combine the two syntaxes, for example:</P
>It is possible to combine the two syntaxes, for example:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    legal_values 1 2 4 to CYGARC_MAXINT -1024 -20.0 to -10</PRE
>    legal_values 1 2 4 to CYGARC_MAXINT -1024 -20.0 to -10</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This indicates three legal values <TT
>This indicates three legal values <TT
CLASS="LITERAL"
CLASS="LITERAL"
>1</TT
>1</TT
>,
>,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>2</TT
>2</TT
> and <TT
> and <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-1024</TT
>-1024</TT
>, one
>, one
integer range <TT
integer range <TT
CLASS="LITERAL"
CLASS="LITERAL"
>4&nbsp;to&nbsp;CYGARC_MAXINT</TT
>4&nbsp;to&nbsp;CYGARC_MAXINT</TT
>, and one
>, and one
floating point range <TT
floating point range <TT
CLASS="LITERAL"
CLASS="LITERAL"
>-20.0&nbsp;to&nbsp;-10.0</TT
>-20.0&nbsp;to&nbsp;-10.0</TT
>. In
>. In
practice such list expressions are rarely useful.</P
practice such list expressions are rarely useful.</P
><P
><P
>The identifier <TT
>The identifier <TT
CLASS="VARNAME"
CLASS="VARNAME"
>to</TT
>to</TT
> is not reserved, so it is
> is not reserved, so it is
possible to have a configuration option with that name (although it
possible to have a configuration option with that name (although it
violates every naming convention). Using that option in a list
violates every naming convention). Using that option in a list
expression may however give unexpected results.</P
expression may however give unexpected results.</P
><P
><P
>The graphical configuration tool uses the <SPAN
>The graphical configuration tool uses the <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> list
> list
expression to determine how best to let users manipulate the option's
expression to determine how best to let users manipulate the option's
value. Different widgets will be appropriate for different lists, so
value. Different widgets will be appropriate for different lists, so
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>{&nbsp;"red"&nbsp;"green"&nbsp;"blue"&nbsp;}</TT
>{&nbsp;"red"&nbsp;"green"&nbsp;"blue"&nbsp;}</TT
> might
> might
involve a pull-down option menu, and
involve a pull-down option menu, and
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>1&nbsp;to&nbsp;16</TT
>1&nbsp;to&nbsp;16</TT
> could involve a spinner. The
> could involve a spinner. The
exact way in which <SPAN
exact way in which <SPAN
CLASS="PROPERTY"
CLASS="PROPERTY"
>legal_values</SPAN
>legal_values</SPAN
> lists get mapped on to GUI widgets
> lists get mapped on to GUI widgets
is not defined and is subject to change at any time.</P
is not defined and is subject to change at any time.</P
><P
><P
>As with goal expressions, list expressions can be ambiguous. Consider
>As with goal expressions, list expressions can be ambiguous. Consider
the following hypothetical example:</P
the following hypothetical example:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    legal_values CYGNUM_LIBC_RAND_SEED -CYGNUM_LIBC_RAND_TRACE_LEVEL</PRE
>    legal_values CYGNUM_LIBC_RAND_SEED -CYGNUM_LIBC_RAND_TRACE_LEVEL</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>This could be parsed in two ways:</P
>This could be parsed in two ways:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>    legal_values (CYGNUM_LIBC_RAND_SEED - CYGNUM_LIBC_RAND_TRACE_LEVEL)
>    legal_values (CYGNUM_LIBC_RAND_SEED - CYGNUM_LIBC_RAND_TRACE_LEVEL)
    legal_values (CYGNUM_LIBC_RAND_SEED) (-CYGNUM_LIBC_RAND_TRACE_LEVEL)</PRE
    legal_values (CYGNUM_LIBC_RAND_SEED) (-CYGNUM_LIBC_RAND_TRACE_LEVEL)</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>Both are legal. The list expression parsing code will always use the
>Both are legal. The list expression parsing code will always use the
largest ordinary expression for each element, so the first
largest ordinary expression for each element, so the first
interpretation will be used. In cases like this it is a good idea to
interpretation will be used. In cases like this it is a good idea to
use brackets and avoid possible confusion.</P
use brackets and avoid possible confusion.</P
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="NAVFOOTER"
CLASS="NAVFOOTER"
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
SUMMARY="Footer navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="language.tcl.html"
HREF="language.tcl.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="cdl-guide.html"
HREF="cdl-guide.html"
ACCESSKEY="H"
ACCESSKEY="H"
>Home</A
>Home</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="language.interface.html"
HREF="language.interface.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
>An Introduction to Tcl</TD
>An Introduction to Tcl</TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="language.html"
HREF="language.html"
ACCESSKEY="U"
ACCESSKEY="U"
>Up</A
>Up</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
>Interfaces</TD
>Interfaces</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.