<!-- 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_proc</TITLE
|
>define_proc</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_header"
|
TITLE="define_header"
|
HREF="ref.define-header.html"><LINK
|
HREF="ref.define-header.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="description"
|
TITLE="description"
|
HREF="ref.description.html"></HEAD
|
HREF="ref.description.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-header.html"
|
HREF="ref.define-header.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.description.html"
|
HREF="ref.description.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-PROC"><SPAN
|
NAME="REF.DEFINE-PROC"><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
></H1
|
></H1
|
><DIV
|
><DIV
|
CLASS="REFNAMEDIV"
|
CLASS="REFNAMEDIV"
|
><A
|
><A
|
NAME="AEN4169"
|
NAME="AEN4169"
|
></A
|
></A
|
><H2
|
><H2
|
>Name</H2
|
>Name</H2
|
>Property <SPAN
|
>Property <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
> -- Use a fragment of Tcl code to output additional data to
|
> -- Use a fragment of Tcl code to output additional data to
|
configuration header files.</DIV
|
configuration header files.</DIV
|
><DIV
|
><DIV
|
CLASS="REFSYNOPSISDIV"
|
CLASS="REFSYNOPSISDIV"
|
><A
|
><A
|
NAME="AEN4173"><H2
|
NAME="AEN4173"><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_proc <Tcl script>
|
define_proc <Tcl script>
|
…
|
…
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN4175"
|
NAME="AEN4175"
|
></A
|
></A
|
><H2
|
><H2
|
>Description</H2
|
>Description</H2
|
><P
|
><P
|
>For most configuration options it is sufficient to have an entry in
|
>For most configuration options it is sufficient to have an entry in
|
the configuration header file of the form:</P
|
the configuration header file of the form:</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></PRE
|
>#define <name> <value></PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>In some cases it is desirable to perform some more complicated
|
>In some cases it is desirable to perform some more complicated
|
processing when generating a configuration header file. There are a
|
processing when generating a configuration header file. There are a
|
number of CDL properties for this, including <SPAN
|
number of CDL properties for this, including <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_format</SPAN
|
>define_format</SPAN
|
> and
|
> and
|
<SPAN
|
<SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>if_define</SPAN
|
>if_define</SPAN
|
>. The most flexible is <SPAN
|
>. The most flexible is <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
>: this allows the
|
>: this allows the
|
component writer to specify a Tcl script that gets invoked whenever
|
component writer to specify a Tcl script that gets invoked whenever
|
the configuration system generates the header file for the owning
|
the configuration system generates the header file for the owning
|
package. The script can output anything to the header file, for
|
package. The script can output anything to the header file, for
|
example it could generate a C data structure based on various
|
example it could generate a C data structure based on various
|
configuration values.</P
|
configuration values.</P
|
><P
|
><P
|
>At the point that the <SPAN
|
>At the point that the <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
> script is invoked there will be
|
> script is invoked there will be
|
two channels to open files, accessible via Tcl variables:
|
two channels to open files, accessible via Tcl variables:
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>cdl_header</TT
|
>cdl_header</TT
|
> is a channel to the current package's
|
> is a channel to the current package's
|
own header file for example
|
own header file for example
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>pkgconf/kernel.h</TT
|
>pkgconf/kernel.h</TT
|
>;
|
>;
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>cdl_system_header</TT
|
>cdl_system_header</TT
|
> is a channel to the global
|
> is a channel to the global
|
configuration file
|
configuration file
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>pkgconf/system.h</TT
|
>pkgconf/system.h</TT
|
>. A typical
|
>. A typical
|
<SPAN
|
<SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
> script will use the <TT
|
> script will use the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>puts</TT
|
>puts</TT
|
> command to
|
> command to
|
output data to one of these channels.</P
|
output data to one of these channels.</P
|
><P
|
><P
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
> properties only take effect if the current option is
|
> properties only take effect if the current option is
|
active and enabled. The default behavior of the configuration system
|
active and enabled. The default behavior of the configuration system
|
for an option with the <TT
|
for an option with the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>bool</TT
|
>bool</TT
|
> flavor corresponds to
|
> flavor corresponds to
|
the following <SPAN
|
the following <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
>:</P
|
>:</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 XXX {
|
> cdl_option XXX {
|
…
|
…
|
define_proc {
|
define_proc {
|
puts $cdl_header "#define XXX 1"
|
puts $cdl_header "#define XXX 1"
|
}
|
}
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><DIV
|
><DIV
|
CLASS="WARNING"
|
CLASS="WARNING"
|
><P
|
><P
|
></P
|
></P
|
><TABLE
|
><TABLE
|
CLASS="WARNING"
|
CLASS="WARNING"
|
BORDER="1"
|
BORDER="1"
|
WIDTH="100%"
|
WIDTH="100%"
|
><TR
|
><TR
|
><TD
|
><TD
|
ALIGN="CENTER"
|
ALIGN="CENTER"
|
><B
|
><B
|
>Warning</B
|
>Warning</B
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
><P
|
><P
|
>In the current implementation it is not possible for a <SPAN
|
>In the current implementation it is not possible for a <SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_proc</SPAN
|
>define_proc</SPAN
|
>
|
>
|
property to examine the current values of various configuration
|
property to examine the current values of various configuration
|
options and adapt accordingly. This is a major limitation, and will be
|
options and adapt accordingly. This is a major limitation, and will be
|
addressed in future versions of the configuration tools.</P
|
addressed in future versions of the configuration tools.</P
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN4199"
|
NAME="AEN4199"
|
></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_package CYGPKG_HAL_ARM_PID {
|
>cdl_package CYGPKG_HAL_ARM_PID {
|
display "ARM PID evaluation board"
|
display "ARM PID evaluation board"
|
parent CYGPKG_HAL_ARM
|
parent CYGPKG_HAL_ARM
|
define_header hal_arm_pid.h
|
define_header hal_arm_pid.h
|
include_dir cyg/hal
|
include_dir cyg/hal
|
hardware
|
hardware
|
|
|
define_proc {
|
define_proc {
|
puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_arm.h>"
|
puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_arm.h>"
|
puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_arm_pid.h>"
|
puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_arm_pid.h>"
|
puts $::cdl_header ""
|
puts $::cdl_header ""
|
puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM 7TDMI\""
|
puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM 7TDMI\""
|
puts $::cdl_header "#define HAL_PLATFORM_BOARD \"PID\""
|
puts $::cdl_header "#define HAL_PLATFORM_BOARD \"PID\""
|
puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\""
|
puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\""
|
puts $::cdl_header ""
|
puts $::cdl_header ""
|
}
|
}
|
…
|
…
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="REFSECT1"
|
CLASS="REFSECT1"
|
><A
|
><A
|
NAME="AEN4202"
|
NAME="AEN4202"
|
></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-format.html"
|
HREF="ref.define-format.html"
|
><SPAN
|
><SPAN
|
CLASS="PROPERTY"
|
CLASS="PROPERTY"
|
>define_format</SPAN
|
>define_format</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.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-header.html"
|
HREF="ref.define-header.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.description.html"
|
HREF="ref.description.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_header</SPAN
|
>define_header</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"
|
>description</SPAN
|
>description</SPAN
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|