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

📄 ref.define-proc.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_proc</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_header"HREF="ref.define-header.html"><LINKREL="NEXT"TITLE="description"HREF="ref.description.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-header.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="ref.description.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="REF.DEFINE-PROC"><SPANCLASS="PROPERTY">define_proc</SPAN></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN4169"></A><H2>Name</H2>Property <SPANCLASS="PROPERTY">define_proc</SPAN>&nbsp;--&nbsp;Use a fragment of Tcl code to output additional data toconfiguration header files.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN4173"><H2>Synopsis</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SYNOPSIS">cdl_option &lt;name&gt; {    define_proc &lt;Tcl script&gt;    &#8230;}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4175"></A><H2>Description</H2><P>For most configuration options it is sufficient to have an entry inthe configuration header file of the form:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">#define &lt;name&gt; &lt;value&gt;</PRE></TD></TR></TABLE><P>In some cases it is desirable to perform some more complicatedprocessing when generating a configuration header file. There are anumber of CDL properties for this, including <SPANCLASS="PROPERTY">define_format</SPAN> and<SPANCLASS="PROPERTY">if_define</SPAN>. The most flexible is <SPANCLASS="PROPERTY">define_proc</SPAN>: this allows thecomponent writer to specify a Tcl script that gets invoked wheneverthe configuration system generates the header file for the owningpackage. The script can output anything to the header file, forexample it could generate a C data structure based on variousconfiguration values.</P><P>At the point that the <SPANCLASS="PROPERTY">define_proc</SPAN> script is invoked there will betwo channels to open files, accessible via Tcl variables:<TTCLASS="LITERAL">cdl_header</TT> is a channel to the current package'sown header file for example<TTCLASS="FILENAME">pkgconf/kernel.h</TT>;<TTCLASS="LITERAL">cdl_system_header</TT> is a channel to the globalconfiguration file<TTCLASS="FILENAME">pkgconf/system.h</TT>. A typical<SPANCLASS="PROPERTY">define_proc</SPAN> script will use the <TTCLASS="LITERAL">puts</TT> command tooutput data to one of these channels.</P><P><SPANCLASS="PROPERTY">define_proc</SPAN> properties only take effect if the current option isactive and enabled. The default behavior of the configuration systemfor an option with the <TTCLASS="LITERAL">bool</TT> flavor corresponds tothe following <SPANCLASS="PROPERTY">define_proc</SPAN>:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">    cdl_option XXX {        &#8230;        define_proc {            puts $cdl_header "#define XXX 1"        }}</PRE></TD></TR></TABLE><DIVCLASS="WARNING"><P></P><TABLECLASS="WARNING"BORDER="1"WIDTH="100%"><TR><TDALIGN="CENTER"><B>Warning</B></TD></TR><TR><TDALIGN="LEFT"><P>In the current implementation it is not possible for a <SPANCLASS="PROPERTY">define_proc</SPAN>property to examine the current values of various configurationoptions and adapt accordingly. This is a major limitation, and will beaddressed in future versions of the configuration tools.</P></TD></TR></TABLE></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4199"></A><H2>Example</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_HAL_ARM_PID {    display       "ARM PID evaluation board"    parent        CYGPKG_HAL_ARM    define_header hal_arm_pid.h    include_dir   cyg/hal    hardware    define_proc {        puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H   &lt;pkgconf/hal_arm.h&gt;"        puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H &lt;pkgconf/hal_arm_pid.h&gt;"        puts $::cdl_header ""        puts $::cdl_header "#define HAL_PLATFORM_CPU    \"ARM 7TDMI\""        puts $::cdl_header "#define HAL_PLATFORM_BOARD  \"PID\""        puts $::cdl_header "#define HAL_PLATFORM_EXTRA  \"\""        puts $::cdl_header ""    }    &#8230;}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN4202"></A><H2>See Also</H2><P>Properties <AHREF="ref.define.html"><SPANCLASS="PROPERTY">define</SPAN></A>,<AHREF="ref.define-format.html"><SPANCLASS="PROPERTY">define_format</SPAN></A>,<AHREF="ref.define-header.html"><SPANCLASS="PROPERTY">define_header</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-header.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.description.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><SPANCLASS="PROPERTY">define_header</SPAN></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="reference.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><SPANCLASS="PROPERTY">description</SPAN></TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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