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

📄 language.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>The CDL Language</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="PREVIOUS"TITLE="Making a Package Distribution"HREF="package.distrib.html"><LINKREL="NEXT"TITLE="CDL Commands"HREF="language.commands.html"></HEAD><BODYCLASS="CHAPTER"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="package.distrib.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="language.commands.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="LANGUAGE">Chapter 3. The CDL Language</H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><AHREF="language.html#LANGUAGE.OVERVIEW">Language Overview</A></DT><DT><AHREF="language.commands.html">CDL Commands</A></DT><DT><AHREF="language.properties.html">CDL Properties</A></DT><DT><AHREF="language.naming.html">Option Naming Convention</A></DT><DT><AHREF="language.tcl.html">An Introduction to Tcl</A></DT><DT><AHREF="language.values.html">Values and Expressions</A></DT><DT><AHREF="language.interface.html">Interfaces</A></DT><DT><AHREF="language.database.html">Updating the <SPANCLASS="DATABASE">ecos.db</SPAN> database</A></DT></DL></DIV><P>The <SPANCLASS="APPLICATION">CDL</SPAN> language is a key part of the <SPANCLASS="APPLICATION">eCos</SPAN> component framework.All packages must come with at least one <SPANCLASS="APPLICATION">CDL</SPAN> script, to describethat package to the framework. The information in that script includesdetails of all the configuration options and how to build the package.Implementing a new component or turning some existing code into an<SPANCLASS="APPLICATION">eCos</SPAN> component always involves writing corresponding <SPANCLASS="APPLICATION">CDL</SPAN>. Thischapter provides a description of the <SPANCLASS="APPLICATION">CDL</SPAN> language. Detailedinformation on specific parts of the language can be found in <AHREF="reference.html">Chapter 5</A>.</P><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="LANGUAGE.OVERVIEW">Language Overview</H1><P>A very simple <SPANCLASS="APPLICATION">CDL</SPAN> script would look like this:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_package CYGPKG_ERROR {    display       "Common error code support"    compile       strerror.cxx    include_dir   cyg/error    description   "        This package contains the common list of error and        status codes. It is held centrally to allow        packages to interchange error codes and status        codes in a common way, rather than each package        having its own conventions for error/status        reporting. The error codes are modelled on the        POSIX style naming e.g. EINVAL etc. This package        also provides the standard strerror() function to        convert error codes to textual representation."}</PRE></TD></TR></TABLE><P>This describes a single package, the error code package, which doesnot have any sub-components or configuration options. The package hasan internal name, <TTCLASS="VARNAME">CYGPKG_ERROR</TT>, which can bereferenced in other <SPANCLASS="APPLICATION">CDL</SPAN> scripts using e.g.<TTCLASS="LITERAL">requires&nbsp;CYGPKG_ERROR</TT>. There will also be a<TTCLASS="LITERAL">#define</TT> for this symbol in a configuration headerfile. In addition to the package name, this script provides a numberof properties for the package as a whole. The <SPANCLASS="PROPERTY">display</SPAN> propertyprovides a short description. The <SPANCLASS="PROPERTY">description</SPAN> property involves arather longer one, for when users need a bit more information. The<SPANCLASS="PROPERTY">compile</SPAN> and <SPANCLASS="PROPERTY">include_dir</SPAN> properties list the consequences of thispackage at build-time. The package appears to lack any on-linedocumentation. </P><P>Packages could be even simpler than this. If the package only providesan interface and there are no files to be compiled then there is noneed for a <SPANCLASS="PROPERTY">compile</SPAN> property. Alternatively if there are no exportedheader files, or if the exported header files should go to thetop-level of the <TTCLASS="FILENAME">install/include</TT> directory, then there isno need for an <SPANCLASS="PROPERTY">include_dir</SPAN> property. Strictly speaking the<SPANCLASS="PROPERTY">description</SPAN> and <SPANCLASS="PROPERTY">display</SPAN> properties are optional as well, althoughapplication developers would not appreciate the resulting lack ofinformation about what the package is supposed to do.</P><P>However many packages tend to be a bit more complicated than the errorpackage, containing various sub-components and configuration options.These are also defined in the <SPANCLASS="APPLICATION">CDL</SPAN> scripts and in much the same wayas the package. For example, the following excerpt comes from theinfrastructure package:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cdl_component CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER {    display       "Buffered tracing"    default_value 1    active_if     CYGDBG_USE_TRACING    description   "        An output module which buffers output from tracing and        assertion events. The stored messages are output when an        assert fires, or CYG_TRACE_PRINT() (defined in        &lt;cyg/infra/cyg_trac.h&gt;) is called. Of course, there will        only be stored messages if tracing per se (CYGDBG_USE_TRACING)        is enabled above."    cdl_option CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE {        display       "Trace buffer size"        flavor        data        default_value 32        legal_values  5 to 65535        description   "            The size of the trace buffer. This counts the number of            trace records stored. When the buffer fills it either            wraps, stops recording, or generates output."    }    &#8230;}</PRE></TD></TR></TABLE><P>Like a <TTCLASS="LITERAL">cdl_package</TT>, a <TTCLASS="LITERAL">cdl_component</TT> has a name and a body. Thebody contains various properties for that component, and may alsocontain sub-components or options. Similarly a <TTCLASS="LITERAL">cdl_option</TT> has aname and a body of properties. This example lists a number ofnew properties: <SPANCLASS="PROPERTY">default_value</SPAN>, <SPANCLASS="PROPERTY">active_if</SPAN>, <SPANCLASS="PROPERTY">flavor</SPAN> and<SPANCLASS="PROPERTY">legal_values</SPAN>. The meaning of most of these should be fairly obvious.The next sections describe the various <SPANCLASS="APPLICATION">CDL</SPAN> commands and properties. </P><P>There is one additional and very important point: <SPANCLASS="APPLICATION">CDL</SPAN> is not acompletely new language; instead it is implemented as an extension ofthe existing <SPANCLASS="APPLICATION">Tcl</SPAN> scripting language. The syntax of a <SPANCLASS="APPLICATION">CDL</SPAN> script is<SPANCLASS="APPLICATION">Tcl</SPAN> syntax, which is described below. In addition some of the moreadvanced facilities of <SPANCLASS="APPLICATION">CDL</SPAN> involve embedded fragments of <SPANCLASS="APPLICATION">Tcl</SPAN> code,for example there is a <SPANCLASS="PROPERTY">define_proc</SPAN> property which specifies somecode that needs to be executed when the component framework generatesthe configuration header files.</P></DIV></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="package.distrib.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="language.commands.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Making a Package Distribution</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top">&nbsp;</TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">CDL Commands</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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