📄 language.properties.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 Properties</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="The CDL Language"HREF="language.html"><LINKREL="PREVIOUS"TITLE="CDL Commands"HREF="language.commands.html"><LINKREL="NEXT"TITLE="Option Naming Convention"HREF="language.naming.html"></HEAD><BODYCLASS="SECT1"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="language.commands.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 3. The CDL Language</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="language.naming.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="LANGUAGE.PROPERTIES">CDL Properties</H1><P>Each package, component, option, and interface has a body ofproperties, which provide the component framework with informationabout how to handle each option. For example there is a property for adescriptive text message which can be displayed to a user who istrying to figure out just what effect manipulating the option wouldhave on the target application. There is another property for thedefault value, for example whether a particular option should beenabled or disabled by default.</P><P>All of the properties are optional, it is legal to define aconfiguration option which has an empty body. However some propertiesare more optional than others: users will not appreciate having tomanipulate an option if they are not given any sort of description ordocumentation. Other properties are intended only for very specificpurposes, for example <SPANCLASS="PROPERTY">make_object</SPAN> and <SPANCLASS="PROPERTY">include_files</SPAN>, and are usedonly rarely.</P><P>Because different properties serve very different purposes, theirsyntax is not as uniform as the top-level commands. Some propertiestake no arguments at all. Other properties take a single argument suchas a description string, or a list of arguments such as a <SPANCLASS="PROPERTY">compile</SPAN>property which specifies the file or files that should be compiled ifa given option is active and enabled. The <SPANCLASS="PROPERTY">define_proc</SPAN> property takesas argument a snippet of <SPANCLASS="APPLICATION">Tcl</SPAN> code. The <SPANCLASS="PROPERTY">active_if</SPAN>, <SPANCLASS="PROPERTY">calculated</SPAN>,<SPANCLASS="PROPERTY">default_value</SPAN>, <SPANCLASS="PROPERTY">legal_values</SPAN> and <SPANCLASS="PROPERTY">requires</SPAN> properties take variousexpressions. Additional properties may be defined in future which takenew kinds of arguments.</P><P>All property parsing code supports options for every property,although at present the majority of properties do not yet take anyoptions. Any initial arguments that begin with a hyphen character<TTCLASS="LITERAL">-</TT> will be interpreted as an option, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_HAL_ARM { … make -priority 1 { … }}</PRE></TD></TR></TABLE><P>If the option involves additional data, as for the<TTCLASS="LITERAL">-priority</TT> example above, then this can be writtenas either <TTCLASS="LITERAL">-priority=1</TT> or as<TTCLASS="LITERAL">-priority 1</TT>. On occasion the option parsingcode can get in the way, for example:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_option CYGNUM_LIBC_TIME_DST_DEFAULT_STATE { … legal_values -1 to 1 default_value -1}</PRE></TD></TR></TABLE><P>Neither the <SPANCLASS="PROPERTY">legal_values</SPAN> nor the <SPANCLASS="PROPERTY">default_value</SPAN> property willaccept <TTCLASS="LITERAL">-1</TT> as a valid option, so this will result insyntax errors when the <SPANCLASS="APPLICATION">CDL</SPAN> script is read in by the componentframework. To avoid problems, the option parsing code will recognizethe string <TTCLASS="LITERAL">--</TT> and will not attempt to interpret anysubsequent arguments. Hence this option should be written as:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_option CYGNUM_LIBC_TIME_DST_DEFAULT_STATE { … legal_values -- -1 to 1 default_value -- -1}</PRE></TD></TR></TABLE><P>The property parsing code involves a recursive invocation of the Tclinterpreter that is used to parse the top-level commands. This meansthat some characters in the body of an option will be treatedspecially. The <TTCLASS="LITERAL">#</TT> character can be used forcomments. The backslash character <TTCLASS="LITERAL">\</TT>, thedollar character <TTCLASS="LITERAL">$</TT>, square brackets<TTCLASS="LITERAL">[</TT> and <TTCLASS="LITERAL">]</TT>, braces<TTCLASS="LITERAL">{</TT> and <TTCLASS="LITERAL">}</TT>, and the quote character<TTCLASS="LITERAL">"</TT> may all receive special treatment. Most of thetime this is not a problem because these characters are not useful formost properties. On occasion having a <SPANCLASS="APPLICATION">Tcl</SPAN> interpreter aroundperforming the parser can be very powerful. For more details ofhow the presence of a <SPANCLASS="APPLICATION">Tcl</SPAN> interpreter can affect <SPANCLASS="APPLICATION">CDL</SPAN> scripts,see <AHREF="language.tcl.html">the Section called <I>An Introduction to Tcl</I></A>.</P><P>Many of the properties can be used in any of <TTCLASS="LITERAL">cdl_package</TT>,<TTCLASS="LITERAL">cdl_component</TT>, <TTCLASS="LITERAL">cdl_option</TT> or <TTCLASS="LITERAL">cdl_interface</TT>. Other properties aremore specific. The <SPANCLASS="PROPERTY">script</SPAN> property is only relevant to components.The <SPANCLASS="PROPERTY">define_header</SPAN>, <SPANCLASS="PROPERTY">hardware</SPAN>, <SPANCLASS="PROPERTY">include_dir</SPAN>, <SPANCLASS="PROPERTY">include_files</SPAN>, and<SPANCLASS="PROPERTY">library</SPAN> properties apply to a package as a whole, so can only occurin the body of a <TTCLASS="LITERAL">cdl_package</TT> command. The <SPANCLASS="PROPERTY">calculated</SPAN>,<SPANCLASS="PROPERTY">default_value</SPAN>, <SPANCLASS="PROPERTY">legal_values</SPAN> and <SPANCLASS="PROPERTY">flavor</SPAN> properties are notrelevant to packages, as will be explained later. The <SPANCLASS="PROPERTY">calculated</SPAN> and<SPANCLASS="PROPERTY">default_value</SPAN> properties are also not relevant to interfaces.</P><P>This section lists the various properties, grouped by purpose. Eachproperty also has a full reference page in <AHREF="reference.html">Chapter 5</A>.Properties related to values and expressions are described in moredetail in <AHREF="language.values.html">the Section called <I>Values and Expressions</I></A>. Properties related toheader file generation and to the build process are described in<AHREF="build.html">Chapter 4</A>.</P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="LANGUAGE.PROPERTIES.USER">Information-providing Properties</H2><P>Users can only be expected to manipulate configuration optionssensibly if they are given sufficient information about these options.There are three properties which serve to explain an option in plaintext: the <AHREF="ref.display.html"><SPANCLASS="PROPERTY">display</SPAN></A> property givesa textual alias for an option, which is usually more comprehensiblethan something like <TTCLASS="LITERAL">CYGPKG_LIBC_TIME_ZONES`</TT>; the<AHREF="ref.description.html"><SPANCLASS="PROPERTY">description</SPAN></A> property gives alonger description, typically a paragraph or so; the <AHREF="ref.doc.html"><SPANCLASS="PROPERTY">doc</SPAN></A> property specifies the location ofadditional on-line documentation related to a configuration option. Inthe context of a graphical tool the <SPANCLASS="PROPERTY">display</SPAN> string will be theprimary way for users to identify configuration options; the<SPANCLASS="PROPERTY">description</SPAN> paragraph will be visible whenever the option isselected; the on-line documentation will only be accessed when theuser explicitly requests it.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_UITRON { display "uITRON compatibility layer" doc ref/ecos-ref.a.html description " eCos supports a uITRON Compatibility Layer, providing full Level S (Standard) compliance with Version 3.02 of the uITRON Standard, plus many Level E (Extended) features. uITRON is the premier Japanese embedded RTOS standard." …}</PRE></TD></TR></TABLE><P>All three properties take a single argument. For <SPANCLASS="PROPERTY">display</SPAN> and<SPANCLASS="PROPERTY">description</SPAN> this argument is just a string. For <SPANCLASS="PROPERTY">doc</SPAN> it should be apointer to a suitable HTML file, optionally including an anchor withinthat page. If the <AHREF="package.html#PACKAGE.HIERARCHY">directory layoutconventions</A> are observed then the component framework will lookfor the HTML file in the package's <TTCLASS="FILENAME">doc</TT> sub-directory, otherwise the <SPANCLASS="PROPERTY">doc</SPAN>filename will be treated as relative to the package's top-level directory.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="LANGUAGE.PROPERTIES.HIERARCHY">The Configuration Hierarchy</H2><P>There are two properties related to the hierarchical organization ofcomponents and options: <AHREF="ref.parent.html"><SPANCLASS="PROPERTY">parent</SPAN></A> and<AHREF="ref.script.html"><SPANCLASS="PROPERTY">script</SPAN></A>.</P><P>The <SPANCLASS="PROPERTY">parent</SPAN> property can be used to move a <SPANCLASS="APPLICATION">CDL</SPAN> entity somewhereelse in the hierarchy. The most common use is for packages, to avoidhaving all the packages appear at the top-level of the configurationhierarchy. For example an architectural HAL package such as<TTCLASS="VARNAME">CYGPKG_HAL_SH</TT> is placed below the common HALpackage <TTCLASS="VARNAME">CYGPKG_HAL</TT> using a <SPANCLASS="PROPERTY">parent</SPAN> property.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_HAL_SH { display "SH architecture" parent CYGPKG_HAL …}</PRE></TD></TR></TABLE><P>The <SPANCLASS="PROPERTY">parent</SPAN> property can also be used in the body of a<TTCLASS="LITERAL">cdl_component</TT>, <TTCLASS="LITERAL">cdl_option</TT> or <TTCLASS="LITERAL">cdl_interface</TT>, but this is lesscommon. However care has to be taken since excessive re-parenting canbe confusing. Care also has to be taken when reparenting below someother package that may not actually be loaded in a givenconfiguration, since the resulting behavior is undefined.</P><P
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -