⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ref.define-format.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 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>define_format</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="define"HREF="ref.define.html"><LINKREL="NEXT"TITLE="define_header"HREF="ref.define-header.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.define.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="ref.define-header.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="REF.DEFINE-FORMAT"><SPANCLASS="PROPERTY">define_format</SPAN></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN4073"></A><H2>Name</H2>Property <SPANCLASS="PROPERTY">define_format</SPAN>&nbsp;--&nbsp;Control how an option's value will appear in theconfiguration header file.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN4077"><H2>Synopsis</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SYNOPSIS">cdl_option &lt;name&gt; {    define_format &lt;format string&gt;    &#8230;}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4079"></A><H2>Description</H2><P>For active options with the <TTCLASS="LITERAL">data</TT> flavor, and foractive and enabled options with the <TTCLASS="LITERAL">booldata</TT>flavor, the configuration tools will normally generate two<TTCLASS="LITERAL">#define's</TT> in the package's configuration headerfile. These take the following forms:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">#define &lt;name&gt; &lt;value&gt;#define &lt;name&gt;_&lt;value&gt;</PRE></TD></TR></TABLE><P>The <SPANCLASS="PROPERTY">define_format</SPAN> property can be used to control exactly whatappears as the value for the first of these<TTCLASS="LITERAL">#define's</TT>. For example, the following can be usedto output some configuration data as a C string:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_option &lt;name&gt; {    &#8230;    define -format="\\\"%s\\\"" &lt;symbol&gt;}</PRE></TD></TR></TABLE><P>The implementation of <SPANCLASS="PROPERTY">define_format</SPAN> involves concatenating the Tclcommand <TTCLASS="LITERAL">format</TT>, the format string, and the stringrepresentation of the option's value, and evaluating this in a Tclinterpreter. Therefore the format string will be processed twice by aTcl parser, and appropriate care has to be taken with quoting.</P><P>The second <TTCLASS="LITERAL">#define</TT> will be generated only if is avalid C preprocessor macro symbol, and is not affected by the<SPANCLASS="PROPERTY">define_format</SPAN> property. Also, the property is only relevant foroptions with the <TTCLASS="LITERAL">data</TT> or<TTCLASS="LITERAL">booldata</TT> flavor, and cannot be used inconjunction with the <SPANCLASS="PROPERTY">no_define</SPAN> property since it makes no sense tospecify the format if no <TTCLASS="LITERAL">#define</TT> is generated.</P><DIVCLASS="CAUTION"><P></P><TABLECLASS="CAUTION"BORDER="1"WIDTH="100%"><TR><TDALIGN="CENTER"><B>Caution</B></TD></TR><TR><TDALIGN="LEFT"><P>Because the Tcl interpreter's <TTCLASS="LITERAL">format</TT> command isused, this property is subject to any problems with the implementationof this in the Tcl library. Generally there should be no problems withstring data or with integers up to 32 bits, but there may well beproblems if 64-bit data is involved. This issue may be addressed in afuture release.</P></TD></TR></TABLE></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4103"></A><H2>Example</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_option CYGNUM_UITRON_VER_ID     {    display       "OS identification"    flavor        data    legal_values  0 to 0xFFFF    default_value 0    define_format "0x%04x"    description   "        This value is returned in the 'id'        field of the T_VER structure in        response to a get_ver() system call."}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4106"></A><H2>See Also</H2><P>Properties <AHREF="ref.define.html"><SPANCLASS="PROPERTY">define</SPAN></A>,<AHREF="ref.define-header.html"><SPANCLASS="PROPERTY">define_header</SPAN></A>,<AHREF="ref.define-proc.html"><SPANCLASS="PROPERTY">define_proc</SPAN></A>,<AHREF="ref.if-define.html"><SPANCLASS="PROPERTY">if_define</SPAN></A> and<AHREF="ref.no-define.html"><SPANCLASS="PROPERTY">no_define</SPAN></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.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.define-header.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><SPANCLASS="PROPERTY">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">define_header</SPAN></TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -