📄 ref.parent.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>parent</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="no_define"HREF="ref.no-define.html"><LINKREL="NEXT"TITLE="requires"HREF="ref.requires.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.no-define.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="ref.requires.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="REF.PARENT"><SPANCLASS="PROPERTY">parent</SPAN></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN4877"></A><H2>Name</H2>Property <SPANCLASS="PROPERTY">parent</SPAN> -- Control the location of an option in the configuration hierarchy.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN4881"><H2>Synopsis</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SYNOPSIS">cdl_option <name> { parent <component or package> …}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4883"></A><H2>Description</H2><P>Configuration options live in a hierarchy of packages and components.By default a given option's position in the hierarchy is a simpleconsequence of its position within the CDL scripts. Packages aregenerally placed at the top-level of the configuration. Any componentsor options that are defined at the same level as the <TTCLASS="LITERAL">cdl_package</TT>command in a package's top-level CDL script are placed immediatelybelow that package in the hierarchy. Any options or components thatare defined in the body of a <TTCLASS="LITERAL">cdl_package</TT> or <TTCLASS="LITERAL">cdl_component</TT> command,or that are read in as a result of processing a component's <SPANCLASS="PROPERTY">script</SPAN>property, will be placed immediately below that package or componentin the hierarchy.</P><P>In some circumstances it is useful to specify an alternative positionin the hierarchy for a given option. For example it is oftenconvenient to re-parent device driver packages below<TTCLASS="VARNAME">CYGPKG_IO</TT> in the configuration hierarchy, thusreducing the number of packages at the top level of the hierarchy andmaking navigation easier. The <SPANCLASS="PROPERTY">parent</SPAN> property can be used to achievethis. </P><P>The <SPANCLASS="PROPERTY">parent</SPAN> property takes a single argument, which should be thename of a package or component. The body of a <TTCLASS="LITERAL">cdl_option</TT> or otherCDL entity can contain at most one <SPANCLASS="PROPERTY">parent</SPAN> property.</P><P>Although the <SPANCLASS="PROPERTY">parent</SPAN> property affects an option's position in theoverall hierarchy and hence whether or not that option is active, are-parented option still belongs to the package that defines it. Bydefault any <TTCLASS="LITERAL">#define's</TT> will be exported to thatpackage's configuration header file. Any <SPANCLASS="PROPERTY">compile</SPAN> properties can onlyreference source files present in that package, and it is not directlypossible to cause some file in another package to be built byre-parenting. </P><P>As a special case, if an empty string is specified for the parent thenthe option is placed at the top of the hierarchy, ahead of anypackages which are not explicitly re-parented in this way. Thisfacility is useful for configuration options such as globalpreferences and default compiler flags.</P><DIVCLASS="TIP"><BLOCKQUOTECLASS="TIP"><P><B>Tip: </B>If an option is re-parented somewhere below another package and thatother package is not actually loaded, the option is an orphan and itsactive/inactive state is undefined. In such cases it is a good ideafor the owning package to require the presence of the other one.Unfortunately this technique does not work if a package as a whole isreparented below another one that has not been loaded: the package isorphaned so it may be automatically inactive, and hence any <SPANCLASS="PROPERTY">requires</SPAN>properties would have no effect.</P></BLOCKQUOTE></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4905"></A><H2>Example</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_HAL_I386 { display "i386 architecture" parent CYGPKG_HAL hardware include_dir cyg/hal define_header hal_i386.h …}cdl_component CYGBLD_GLOBAL_OPTIONS { display "Global build options" parent "" …}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4908"></A><H2>See Also</H2><P>Property <AHREF="ref.script.html"><SPANCLASS="PROPERTY">script</SPAN></A>,commands <AHREF="ref.cdl-component.html"><TTCLASS="LITERAL">cdl_component</TT></A> and<AHREF="ref.cdl-package.html"><TTCLASS="LITERAL">cdl_package</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.no-define.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.requires.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><SPANCLASS="PROPERTY">no_define</SPAN></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="reference.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><SPANCLASS="PROPERTY">requires</SPAN></TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -