📄 ref.cdl-component.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- This material may be distributed only subject to the terms --><!-- and conditions set forth in the Open Publication License, v1.0 --><!-- or later (the latest version is presently available at --><!-- http://www.opencontent.org/openpub/). --><!-- Distribution of the work or derivative of the work in any --><!-- standard (paper) book form is prohibited unless prior --><!-- permission is obtained from the copyright holder. --><HTML><HEAD><TITLE>cdl_component</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="The eCos Component Writer's Guide"HREF="cdl-guide.html"><LINKREL="UP"TITLE="CDL Language Specification"HREF="reference.html"><LINKREL="PREVIOUS"TITLE="cdl_option"HREF="ref.cdl-option.html"><LINKREL="NEXT"TITLE="cdl_package"HREF="ref.cdl-package.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">The <SPANCLASS="APPLICATION">eCos</SPAN> Component Writer's Guide</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="ref.cdl-option.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="ref.cdl-package.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="REF.CDL-COMPONENT"><TTCLASS="LITERAL">cdl_component</TT></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN3091"></A><H2>Name</H2>Command <TTCLASS="LITERAL">cdl_component</TT> -- Define a component, a collection of configuration options</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN3095"><H2>Synopsis</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SYNOPSIS">cdl_component <name> { …}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN3097"></A><H2>Description</H2><P>A component is a configuration option that can contain additionaloptions and sub-components. The body of a <TTCLASS="LITERAL">cdl_component</TT> can containthe same properties as that of a <TTCLASS="LITERAL">cdl_option</TT>. There is an additionalproperty, <SPANCLASS="PROPERTY">script</SPAN> which allows configuration data to be split intomultiple files. It is also possible for a component body to include<TTCLASS="LITERAL">cdl_component</TT>, <TTCLASS="LITERAL">cdl_option</TT> and <TTCLASS="LITERAL">cdl_interface</TT> entities that shouldgo below this component in the configuration hierarchy.</P><P><TTCLASS="LITERAL">cdl_component</TT> is implemented as a Tcl command that takes twoarguments, a name and a body. The name must be a valid C preprocessoridentifier: a sequence of upper or lower case letters, digits orunderscores, starting with a non-digit character; identifiersbeginning with an underscore should normally be avoided because theymay clash with system packages or with identifiers reserved for use bythe compiler. Within a single configuration, names must be unique. Ifa configuration contained two packages which defined the same entity<TTCLASS="LITERAL">CYGIMP_SOME_OPTION</TT>, any references to that entityin a <SPANCLASS="PROPERTY">requires</SPAN> property or any other expression would be ambiguous.It is possible for a given name to be used by two different packagesif those packages should never be loaded into a single configuration.For example, architectural HAL packages are allowed to re-use certainnames because a single configuration cannot target two differentarchitectures. For a recommended naming convention see <AHREF="package.contents.html">the Section called <I>Package Contents and Layout</I> in Chapter 2</A>.</P><P>The second argument to <TTCLASS="LITERAL">cdl_component</TT> is a body of properties andother commands, typically surrounded by braces so that the Tclinterpreter treats it as a single argument. This body will beprocessed by a recursive invocation of the Tcl interpreter, extendedwith additional commands for the various properties that are allowedinside a <TTCLASS="LITERAL">cdl_component</TT>. The valid commands are:</P><P></P><DIVCLASS="VARIABLELIST"><DL><DT><AHREF="ref.active-if.html"><SPANCLASS="PROPERTY">active_if</SPAN></A></DT><DD><P>Allow additional control over the active state of this component.</P></DD><DT><AHREF="ref.calculated.html"><SPANCLASS="PROPERTY">calculated</SPAN></A></DT><DD><P>The component's value is not directly user-modifiable, it is calculatedusing a suitable CDL expression.</P></DD><DT><AHREF="ref.cdl-component.html"><TTCLASS="LITERAL">cdl_component</TT></A></DT><DD><P>Define a sub-component.</P></DD><DT><AHREF="ref.cdl-interface.html"><TTCLASS="LITERAL">cdl_interface</TT></A></DT><DD><P>Define an interface which should appear immediately below thiscomponent in the configuration hierarchy.</P></DD><DT><AHREF="ref.cdl-option.html"><TTCLASS="LITERAL">cdl_option</TT></A></DT><DD><P>Define a configuration option which should appear immediately belowthis component in the configuration hierarchy.</P></DD><DT><AHREF="ref.compile.html"><SPANCLASS="PROPERTY">compile</SPAN></A></DT><DD><P>List the source files that should be built if this component is activeand enabled.</P></DD><DT><AHREF="ref.default-value.html"><SPANCLASS="PROPERTY">default_value</SPAN></A></DT><DD><P>Provide a default value for this component using a CDL expression.</P></DD><DT><AHREF="ref.define.html"><SPANCLASS="PROPERTY">define</SPAN></A></DT><DD><P>Specify additional <TTCLASS="LITERAL">#define</TT> symbols that should gointo the owning package's configuration header file.</P></DD><DT><AHREF="ref.define-format.html"><SPANCLASS="PROPERTY">define_format</SPAN></A></DT><DD><P>Control how the component's value will appear in the configuration headerfile.</P></DD><DT><AHREF="ref.define-proc.html"><SPANCLASS="PROPERTY">define_proc</SPAN></A></DT><DD><P>Use a fragment of Tcl code to output additional data toconfiguration header files.</P></DD><DT><AHREF="ref.description.html"><SPANCLASS="PROPERTY">description</SPAN></A></DT><DD><P>Provide a textual description for this component.</P></DD><DT><AHREF="ref.display.html"><SPANCLASS="PROPERTY">display</SPAN></A></DT><DD><P>Provide a short string describing this component.</P></DD><DT><AHREF="ref.doc.html"><SPANCLASS="PROPERTY">doc</SPAN></A></DT><DD><P>The location of on-line documentation for this component.</P></DD><DT><AHREF="ref.flavor.html"><SPANCLASS="PROPERTY">flavor</SPAN></A></DT><DD><P>Specify the nature of this component.</P></DD><DT><AHREF="ref.if-define.html"><SPANCLASS="PROPERTY">if_define</SPAN></A></DT><DD><P>Output a common preprocessor construct to a configuration header file. </P></DD><DT><AHREF="ref.implements.html"><SPANCLASS="PROPERTY">implements</SPAN></A></DT><DD><P>Enabling this component provides one instance of a more generalinterface. </P></DD><DT><AHREF="ref.legal-values.html"><SPANCLASS="PROPERTY">legal_values</SPAN></A></DT><DD><P>Impose constraints on the possible values for this component.</P></DD><DT><AHREF="ref.make.html"><SPANCLASS="PROPERTY">make</SPAN></A></DT><DD><P>An additional custom build step associated with this component, resultingin a target that should not go directly into a library.</P></DD><DT><AHREF="ref.make-object.html"><SPANCLASS="PROPERTY">make_object</SPAN></A></DT><DD><P>An additional custom build step associated with this component, resultingin an object file that should go into a library.</P></DD><DT><AHREF="ref.no-define.html"><SPANCLASS="PROPERTY">no_define</SPAN></A></DT><DD><P>Suppress the normal generation of a preprocessor<TTCLASS="LITERAL">#define</TT> symbol in a configuration header file.</P></DD><DT><AHREF="ref.parent.html"><SPANCLASS="PROPERTY">parent</SPAN></A></DT><DD><P>Control the location of this component in the configuration hierarchy. </P></DD><DT><AHREF="ref.requires.html"><SPANCLASS="PROPERTY">requires</SPAN></A></DT><DD><P>List constraints that the configuration should satisfy if this component isactive and enabled.</P></DD><DT><AHREF="ref.script.html"><SPANCLASS="PROPERTY">script</SPAN></A></DT><DD><P>Include additional configuration information from anotherCDL script</P></DD></DL></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN3255"></A><H2>Example</H2><P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_component CYGDBG_USE_ASSERTS { display "Use asserts" default_value 1 description " If this component is enabled, assertions in the code are tested at run-time. Assert functions (CYG_ASSERT()) are defined in 'include/cyg/infra/cyg_ass.h' within the 'install' tree. If the component is disabled, these result in no additional object code and no checking of the asserted conditions." script assert.cdl}</PRE></TD></TR></TABLE></P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN3259"></A><H2>See Also</H2><P>Command <AHREF="ref.cdl-option.html"><TTCLASS="LITERAL">cdl_option</TT></A>,command <AHREF="ref.cdl-package.html"><TTCLASS="LITERAL">cdl_package</TT></A>,command <AHREF="ref.cdl-interface.html"><TTCLASS="LITERAL">cdl_interface</TT></A>.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="ref.cdl-option.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="cdl-guide.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="ref.cdl-package.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><TTCLASS="LITERAL">cdl_option</TT></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="reference.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><TTCLASS="LITERAL">cdl_package</TT></TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -