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

📄 language.sgml

📁 ecos实时嵌入式操作系统
💻 SGML
📖 第 1 页 / 共 5 页
字号:
suddenly becomes necessary to link with several libraries.</para><para>The &include-dir; and &include-files; properties relate to a package'sexported header files. By default a package's header files will beexported to the <filename class="directory">install/include</filename>directory. This is the desired behavior for some packages like the Clibrary, since headers like <filenameclass="headerfile">stdio.h</filename> should exist at that level.However if all header files were to end up in that directory thenthere would be a significant risk of a name clash. Instead it isbetter for packages to specify some sub-directory for their exportedheader files, for example:</para><programlisting width=72>cdl_package CYGPKG_INFRA {    display       "Infrastructure"    include_dir   cyg/infra    &hellip;}</programlisting><para>The various header files exported by the infrastructure, for example<filename class="headerfile">cyg_ass.h</filename> and <filenameclass="headerfile">cyg_trac.h</filename> will now end up in the<filename class="directory">install/include/cyg/infra</filename>sub-directory, where a name clash is very unlikely.</para><para>For packages which follow the <linklinkend="package.hierarchy">directory layout conventions</link> thecomponent framework will assume that the package's<filename class="directory">include</filename> sub-directory containsall exported header files. If this is not the case, for examplebecause the package is sufficiently simple that the layout conventionis inappropriate, then the exported header files can be listedexplicitly in an &include-files; property.</para></sect2><!-- }}} --><!-- {{{ Miscellaneous          --><sect2 id="language.properties.miscellaneous"><title>Miscellaneous Properties</title><para>The <link linkend="ref.hardware">&hardware;</link> property isonly relevant to packages. Some packages such as device drivers andHAL packages are hardware-specific, and generally it makes no sense toadd such packages to a configuration unless the corresponding hardwareis present on your target system. Typically hardware package selectionhappens automatically when you select your target. The &hardware;property should be used to identify a hardware-specific package, anddoes not take any arguments.</para><programlisting width=72>cdl_package CYGPKG_HAL_MIPS {    display "MIPS architecture"    parent        CYGPKG_HAL    hardware    include_dir   cyg/hal    define_header hal_mips.h    &hellip;}</programlisting><para>At present the &hardware; property is largely ignored by the componentframework. This may change in future releases.</para></sect2><!-- }}} --></sect1><!-- }}} --><!-- {{{ Naming conventions     --><sect1 id="language.naming"><title>Option Naming Convention</title><para>All the options in a given configuration live in the same namespace.Furthermore it is not possible for two separate options to have thesame name, because this would make any references to those options in&CDL; expressions ambiguous. A naming convention exists to avoidproblems. It is recommended that component writers observe some or allof this convention to reduce the probability of name clashes withother packages.</para><para>There is an important restriction on option names. Typically thecomponent framework will output a <literal>#define</literal> for everyactive and enabled option, using the name as the symbol being defined.This requires that all names are valid C preprocessor symbols, alimitation that is enforced even for options which have the&no-define; property. Preprocessor symbols can be any sequence oflower case letters <literal>a</literal>-<literal>z</literal>, uppercase letters, <literal>A</literal>-<literal>Z</literal>, theunderscore character <literal>_</literal>, and the digits<literal>0</literal>-<literal>9</literal>. The first character must bea non-digit. Using an underscore as the first character isdiscouraged, because that may clash with reserved languageidentifiers. In addition there is a convention that preprocessorsymbols only use upper case letters, and some component writers maywish to follow this convention.</para><para>A typical option name could be something like<varname>CYGSEM_KERNEL_SCHED_BITMAP</varname>. This name consists ofseveral different parts:</para><orderedlist><listitem><para>The first few characters, in this case the three letters<literal>CYG</literal>, are used to identify the organization thatproduced the package. For historical reasons packages produced by RedHat tend to use the prefix <literal>CYG</literal> rather than<literal>RHAT</literal>. Component writers should use their ownprefix: even when cutting and pasting from an existing &CDL; scriptthe prefix should be changed to something appropriate to theirorganization. </para><para>It can be argued that a short prefix, often limited to upper caseletters, is not sufficiently long to eliminate the possibility ofname clashes. A longer prefix could be used, for example one based oninternet domain names. However the C preprocessor has no concept ofnamespaces or <literal>import</literal> directives, so it would alwaysbe necessary to use the full option name in component source codewhich gets tedious - option names tend to be long enough as it is.There is a small increased risk of name clashes, but this risk is feltto be acceptable.</para></listitem><listitem><para>The next three characters indicate the nature of the option, forexample whether it affects the interface or just the implementation. Alist of common tags is given below.</para></listitem><listitem><para>The <literal>KERNEL_SCHED</literal> part indicates the location of theoption within the overall hierarchy. In this case the option is part ofthe scheduling component of the kernel package. Having the hierarchydetails as part of the option name can help in understandingconfigurable code and further reduces the probability of a name clash.</para></listitem><listitem><para>The final part, <literal>BITMAP</literal>, identifies the optionitself. </para></listitem></orderedlist><para>The three-character tag is intended to provide some additionalinformation about the nature of the option. There are a number ofpre-defined tags. However for many options there is a choice:options related to the platform should normally use<literal>HWR</literal>, but numerical options should normally use<literal>NUM</literal>; a platform-related numerical option such asthe size of an interrupt stack could therefore use either tag.There are no absolute rules, and it is left to component writers tointerpret the following guidelines:</para><variablelist><varlistentry><term><literal>xxxARC_</literal></term><listitem><para>The <literal>ARC</literal> tag is intended for options relatedto the processor architecture. Typically such options will only occurin architectural or variant HAL packages.</para></listitem></varlistentry><varlistentry><term><literal>xxxHWR_</literal></term><listitem><para>The <literal>HWR</literal> tag is intended for options related tothe specific target board. Typically such options will only occur inplatform HAL packages.</para></listitem></varlistentry><varlistentry><term><literal>xxxPKG_</literal></term><listitem><para>This tag is intended for packages or components, in other wordsoptions which extend the configuration hierarchy. Arguably a<literal>COM</literal> tag would be more appropriate forcomponents, but this could be confusing because of the considerablenumber of computing terms that begin with com.</para></listitem></varlistentry><varlistentry><term><literal>xxxGLO_</literal></term><listitem><para>This is intended for global configuration options, especiallypreferences.</para></listitem></varlistentry><varlistentry><term><literal>xxxDBG_</literal></term><listitem><para>The <literal>DBG</literal> tag indicates that the option is insome way related to debugging, for example it may enable assertions insome part of the system.</para></listitem></varlistentry><varlistentry><term><literal>xxxTST_</literal></term><listitem><para>This tag is for testing-related options. Typically these do notaffect actual application code, instead they control the interactionbetween target-side test cases and a host-side testing infrastructure.</para></listitem></varlistentry><varlistentry><term><literal>xxxFUN_</literal></term><listitem><para>This is for configuration options which affect the interface of apackage. There are a number of related tag which are alsointerface-related. <literal>xxxFUN_</literal> is intended primarilyfor options that control whether or not one or more functions areprovided by the package, but can also be used if none of the otherinterface-related tags is applicable.</para></listitem></varlistentry><varlistentry><term><literal>xxxVAR_</literal></term><listitem><para>This is analogous to <literal>FUN</literal> but controls the presenceor absence of one or more variables or objects.</para></listitem></varlistentry><varlistentry><term><literal>xxxCLS_</literal></term><listitem><para>The <literal>CLS</literal> tag is intended only for packages thatprovide an object-oriented interface, and controls the presence orabsence of an entire class.</para></listitem></varlistentry><varlistentry><term><literal>xxxMFN_</literal></term><listitem><para>This is also for object-orientated interfaces, and indicates thepresence or absence of a member function rather than an entire class.</para></listitem></varlistentry><varlistentry><term><literal>xxxSEM_</literal></term><listitem><para>A <literal>SEM</literal> option does not affect the interface (or ifdoes affect the interface, this is incidental). Instead it is used foroptions which have a fundamental effect on the semantic behavior of apackage. For example the choice of kernel schedulers is semantic innature: it does not affect the interface, in particular the function<function>cyg_thread_create</function> exists irrespective of whichscheduler has been selected. However it does have a major impact onthe system's behavior.</para></listitem></varlistentry><varlistentry><term><literal>xxxIMP_</literal></term><listitem><para><literal>IMP</literal> is for implementation options. These do notaffect either the interface or the semantic behavior (with thepossible exception of timing-related changes). A typicalimplementation option controls whether or not a particular function orset of functions should get inlined.</para></listitem></varlistentry><varlistentry><term><literal>xxxNUM_</literal></term><listitem><para>This tag is for numerical options, for example the number ofscheduling priority levels.</para></listitem></varlistentry><varlistentry><term><literal>xxxDAT_</literal></term><listitem><para>This is for data items that are not numerical in nature, for example adevice name.</para></listitem></varlistentry><varlistentry><term><literal>xxxBLD_</literal></term><listitem><para>The <literal>BLD</literal> tag indicates an option that affectsthe build process, for example compiler flag settings.</para></listitem></varlistentry><varlistentry><term><literal>xxxINT_</literal></term><listitem><para>This should normally be used for &CDL; interfaces, which is a languageconstruct that is largely independent from the interface exported by apackage via its header files. For more details of &CDL; interfacessee <xref linkend="language.interface">.</para></listitem></varlistentry><varlistentry><term><literal>xxxPRI_</literal></term><listitem><para>This tag is not normally used for configuration options. Insteadit is used by &CDL; scripts to pass additional private information tothe source code via the configuration header files, typically inside a&define-proc; property.</para></listitem></varlistentry><varlistentry><term><literal>xxxSRC_</literal></term><listitem><para>This tag is not normally used for configuration options. Insteadit can be used by package source code to interact with such options,especially in the context of the &if-define; property.</para></listitem></varlistentry></variablelist><para>There is one special case of a potential name clash that is worth

⌨️ 快捷键说明

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