<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>define_format</TITLE
|
>define_format</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="The eCos Component Writer's Guide"
|
TITLE="The eCos Component Writer's Guide"
|
HREF="cdl-guide.html"><LINK
|
HREF="cdl-guide.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="CDL Language Specification"
|
TITLE="CDL Language Specification"
|
HREF="reference.html"><LINK
|
HREF="reference.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="define"
|
TITLE="define"
|
HREF="ref.define.html"><LINK
|
HREF="ref.define.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="define_header"
|
TITLE="define_header"
|
HREF="ref.define-header.html"></HEAD
|
HREF="ref.define-header.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="REFENTRY"
|
CLASS="REFENTRY"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>The <SPAN
|
>The <SPAN
|
CLASS="APPLICATION"
|
CLASS="APPLICATION"
|
>eCos</SPAN
|
>eCos</SPAN
|
> Component Writer's Guide</TH
|
> Component Writer's Guide</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="ref.define.html"
|
HREF="ref.define.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="ref.define-header.html"
|
HREF="ref.define-header.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><H1
|
><H1
|
><A
|
><A
|
NAME="REF.DEFINE-FORMAT"><SPAN
|
NAME="REF.DEFINE-FORMAT"><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_format</SPAN
|
>define_format</SPAN
|
></H1
|
></H1
|
><DIV
|
><DIV
|
CLASS="REFNAMEDIV"
|
CLASS="REFNAMEDIV"
|
><A
|
><A
|
NAME="AEN4073"
|
NAME="AEN4073"
|
></A
|
></A
|
><H2
|
><H2
|
>Name</H2
|
>Name</H2
|
>Property <SPAN
|
>Property <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_format</SPAN
|
>define_format</SPAN
|
> -- Control how an option's value will appear in the
|
> -- Control how an option's value will appear in the
|
configuration header file.</DIV
|
configuration header file.</DIV
|
><DIV
|
><DIV
|
CLASS="REFSYNOPSISDIV"
|
CLASS="REFSYNOPSISDIV"
|
><A
|
><A
|
NAME="AEN4077"><H2
|
NAME="AEN4077"><H2
|
>Synopsis</H2
|
>Synopsis</H2
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SYNOPSIS"
|
CLASS="SYNOPSIS"
|
>cdl_option <name> {
|
>cdl_option <name> {
|
define_format <format string>
|
define_format <format string>
|
…
|
…
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN4079"
|
NAME="AEN4079"
|
></A
|
></A
|
><H2
|
><H2
|
>Description</H2
|
>Description</H2
|
><P
|
><P
|
>For active options with the <TT
|
>For active options with the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>data</TT
|
>data</TT
|
> flavor, and for
|
> flavor, and for
|
active and enabled options with the <TT
|
active and enabled options with the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>booldata</TT
|
>booldata</TT
|
>
|
>
|
flavor, the configuration tools will normally generate two
|
flavor, the configuration tools will normally generate two
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>#define's</TT
|
>#define's</TT
|
> in the package's configuration header
|
> in the package's configuration header
|
file. These take the following forms:</P
|
file. These take the following forms:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>#define <name> <value>
|
>#define <name> <value>
|
#define <name>_<value></PRE
|
#define <name>_<value></PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>The <SPAN
|
>The <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_format</SPAN
|
>define_format</SPAN
|
> property can be used to control exactly what
|
> property can be used to control exactly what
|
appears as the value for the first of these
|
appears as the value for the first of these
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>#define's</TT
|
>#define's</TT
|
>. For example, the following can be used
|
>. For example, the following can be used
|
to output some configuration data as a C string:</P
|
to output some configuration data as a C string:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_option <name> {
|
>cdl_option <name> {
|
…
|
…
|
define -format="\\\"%s\\\"" <symbol>
|
define -format="\\\"%s\\\"" <symbol>
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>The implementation of <SPAN
|
>The implementation of <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_format</SPAN
|
>define_format</SPAN
|
> involves concatenating the Tcl
|
> involves concatenating the Tcl
|
command <TT
|
command <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>format</TT
|
>format</TT
|
>, the format string, and the string
|
>, the format string, and the string
|
representation of the option's value, and evaluating this in a Tcl
|
representation of the option's value, and evaluating this in a Tcl
|
interpreter. Therefore the format string will be processed twice by a
|
interpreter. Therefore the format string will be processed twice by a
|
Tcl parser, and appropriate care has to be taken with quoting.</P
|
Tcl parser, and appropriate care has to be taken with quoting.</P
|
><P
|
><P
|
>The second <TT
|
>The second <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>#define</TT
|
>#define</TT
|
> will be generated only if is a
|
> will be generated only if is a
|
valid C preprocessor macro symbol, and is not affected by the
|
valid C preprocessor macro symbol, and is not affected by the
|
<SPAN
|
<SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_format</SPAN
|
>define_format</SPAN
|
> property. Also, the property is only relevant for
|
> property. Also, the property is only relevant for
|
options with the <TT
|
options with the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>data</TT
|
>data</TT
|
> or
|
> or
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>booldata</TT
|
>booldata</TT
|
> flavor, and cannot be used in
|
> flavor, and cannot be used in
|
conjunction with the <SPAN
|
conjunction with the <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>no_define</SPAN
|
>no_define</SPAN
|
> property since it makes no sense to
|
> property since it makes no sense to
|
specify the format if no <TT
|
specify the format if no <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>#define</TT
|
>#define</TT
|
> is generated.</P
|
> is generated.</P
|
><DIV
|
><DIV
|
CLASS="CAUTION"
|
CLASS="CAUTION"
|
><P
|
><P
|
></P
|
></P
|
><TABLE
|
><TABLE
|
CLASS="CAUTION"
|
CLASS="CAUTION"
|
BORDER="1"
|
BORDER="1"
|
WIDTH="100%"
|
WIDTH="100%"
|
><TR
|
><TR
|
><TD
|
><TD
|
ALIGN="CENTER"
|
ALIGN="CENTER"
|
><B
|
><B
|
>Caution</B
|
>Caution</B
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
><P
|
><P
|
>Because the Tcl interpreter's <TT
|
>Because the Tcl interpreter's <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>format</TT
|
>format</TT
|
> command is
|
> command is
|
used, this property is subject to any problems with the implementation
|
used, this property is subject to any problems with the implementation
|
of this in the Tcl library. Generally there should be no problems with
|
of this in the Tcl library. Generally there should be no problems with
|
string data or with integers up to 32 bits, but there may well be
|
string data or with integers up to 32 bits, but there may well be
|
problems if 64-bit data is involved. This issue may be addressed in a
|
problems if 64-bit data is involved. This issue may be addressed in a
|
future release.</P
|
future release.</P
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN4103"
|
NAME="AEN4103"
|
></A
|
></A
|
><H2
|
><H2
|
>Example</H2
|
>Example</H2
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>cdl_option CYGNUM_UITRON_VER_ID {
|
>cdl_option CYGNUM_UITRON_VER_ID {
|
display "OS identification"
|
display "OS identification"
|
flavor data
|
flavor data
|
legal_values 0 to 0xFFFF
|
legal_values 0 to 0xFFFF
|
default_value 0
|
default_value 0
|
define_format "0x%04x"
|
define_format "0x%04x"
|
description "
|
description "
|
This value is returned in the 'id'
|
This value is returned in the 'id'
|
field of the T_VER structure in
|
field of the T_VER structure in
|
response to a get_ver() system call."
|
response to a get_ver() system call."
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN4106"
|
NAME="AEN4106"
|
></A
|
></A
|
><H2
|
><H2
|
>See Also</H2
|
>See Also</H2
|
><P
|
><P
|
>Properties <A
|
>Properties <A
|
HREF="ref.define.html"
|
HREF="ref.define.html"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define</SPAN
|
>define</SPAN
|
></A
|
></A
|
>,
|
>,
|
<A
|
<A
|
HREF="ref.define-header.html"
|
HREF="ref.define-header.html"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_header</SPAN
|
>define_header</SPAN
|
></A
|
></A
|
>,
|
>,
|
<A
|
<A
|
HREF="ref.define-proc.html"
|
HREF="ref.define-proc.html"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
></A
|
></A
|
>,
|
>,
|
<A
|
<A
|
HREF="ref.if-define.html"
|
HREF="ref.if-define.html"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>if_define</SPAN
|
>if_define</SPAN
|
></A
|
></A
|
> and
|
> and
|
<A
|
<A
|
HREF="ref.no-define.html"
|
HREF="ref.no-define.html"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>no_define</SPAN
|
>no_define</SPAN
|
></A
|
></A
|
>.</P
|
>.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ref.define.html"
|
HREF="ref.define.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="cdl-guide.html"
|
HREF="cdl-guide.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ref.define-header.html"
|
HREF="ref.define-header.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define</SPAN
|
>define</SPAN
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="reference.html"
|
HREF="reference.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_header</SPAN
|
>define_header</SPAN
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|