1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="The eCos Component Writer's Guide"
20 HREF="cdl-guide.html"><LINK
22 TITLE="CDL Language Specification"
23 HREF="reference.html"><LINK
26 HREF="ref.compile.html"><LINK
29 HREF="ref.define.html"></HEAD
40 SUMMARY="Header navigation table"
52 > Component Writer's Guide</TH
60 HREF="ref.compile.html"
74 HREF="ref.define.html"
85 NAME="REF.DEFAULT-VALUE"><SPAN
99 > -- Provide a default value for this option using a CDL expression.</DIV
101 CLASS="REFSYNOPSISDIV"
113 >cdl_option <name> {
114 default_value <expression>
132 > property allows the initial value of a
133 configuration option to depend on other configuration options. The
134 arguments to the property should be a <SPAN
139 HREF="language.values.html#LANGUAGE.EXPRESSION"
140 >the Section called <I
141 >Ordinary Expressions</I
143 > for the syntactic details.
144 In many cases a simple constant value will suffice, for example:</P
152 CLASS="PROGRAMLISTING"
153 >cdl_component CYGPKG_KERNEL_EXCEPTIONS {
157 cdl_option CYGSEM_KERNEL_EXCEPTIONS_DECODE {
166 >However it is also possible for an option's default value to depend on
167 other options. For example the common HAL package provides some
168 support functions that are needed by the <SPAN
172 unlikely to be useful if the kernel is not being used. This
173 relationship can be expressed using:</P
181 CLASS="PROGRAMLISTING"
182 >cdl_option CYGFUN_HAL_COMMON_KERNEL_SUPPORT {
184 default_value CYGPKG_KERNEL
190 >If the kernel is loaded then this HAL option is automatically enabled,
191 although the user can still disable it explicitly should this prove
192 necessary. If the kernel is not loaded then the option is disabled,
193 although it can still be enabled by the user if desired.
197 > expressions can be more complicated than this if
198 appropriate, and provide a very powerful facility for component
199 writers who want their code to “just do the right thing”
200 in a wide variety of configurations.</P
205 > configuration system evaluates the <SPAN
209 expression when the current package is loaded and whenever there is a
210 change to any other option referenced in the expression. The result
211 depends on the option's flavor:</P
224 >Options with this flavor have no value, so the <SPAN
228 property is not applicable.</P
237 >If the expression evaluates to a non-zero result the option is
238 enabled by default, otherwise it is disabled.</P
247 >If the result of evaluating the expression is zero then the option is
248 disabled, otherwise the option is enabled and its value is the result.</P
257 >The default value of the option is the result of evaluating the
266 > or other entity can have at most one <SPAN
270 property, and it is illegal to have both a <SPAN
277 > property in one body. If an option does not have
284 > property and it does not
288 > then the configuration tools
289 will assume a default value expression of <TT
294 >On occasion it is useful to have a configuration option
298 > which has both a <SPAN
319 > will also be disabled by default and no
320 conflict arises. If <TT
327 > also becomes enabled and again no conflict
328 arises. If a user attempts to enable <TT
335 > then there will be a conflict. Users should be
336 able to deduce that the two options are closely interlinked and should
337 not be manipulated independently except in very unusual circumstances.</P
345 >If the first entry in a <SPAN
348 > expression is a negative
349 number, for example <TT
351 >default_value -1</TT
353 can be misinterpreted as an option instead of as part of the
354 expression. Currently the <SPAN
357 > property does not take any
358 options, but this may change in future. Option processing halts at the
362 >, so the desired value can be expressed
366 >default_value -- -1</TT
377 >In many cases it would be useful to calculate default values using
378 some global preferences, for example:</P
386 CLASS="PROGRAMLISTING"
387 >cdl_option CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST {
389 default_value CYGGLO_CODESIZE > CYGGLO_SPEED
395 >Such global preference options do not yet exist, but are likely to be
396 added in a future version.</P
406 >For options with the booldata flavor the current syntax does not allow
407 the default values of the enabled flag and the value to be controlled
408 separately. Functionality to permit this may be added in a future
427 CLASS="PROGRAMLISTING"
428 >cdl_option CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT {
429 display "Include GDB multi-threading debug support"
430 requires CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
431 default_value CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
433 This option enables some extra HAL code which is needed
434 to support multi-threaded source level debugging."
449 HREF="ref.calculated.html"
456 HREF="ref.flavor.html"
463 HREF="ref.legal-values.html"
475 SUMMARY="Footer navigation table"
486 HREF="ref.compile.html"
495 HREF="cdl-guide.html"
504 HREF="ref.define.html"
523 HREF="reference.html"