flex.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-flex" role="wrap">
  8. <?dbhtml filename="flex.html"?>
  9. <sect1info condition="script">
  10. <productname>flex</productname>
  11. <productnumber>&flex-version;</productnumber>
  12. <address>&flex-url;</address>
  13. </sect1info>
  14. <title>Flex-&flex-version;</title>
  15. <indexterm zone="ch-system-flex">
  16. <primary sortas="a-Flex">Flex</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Flex 软件包包含一个工具,用于生成在文本中识别模式的程序。</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&flex-ch6-sbu;</seg>
  26. <seg>&flex-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. </sect2>
  30. <sect2 role="installation">
  31. <title>安装 Flex</title>
  32. <para>首先修正一个 glibc-2.26 引入的问题:</para>
  33. <screen><userinput remap="pre">sed -i "/math.h/a #include &lt;malloc.h&gt;" src/flexdef.h</userinput></screen>
  34. <para>构建过程假设 <application>help2man</application>
  35. 程序存在,以根据可执行文件的 --help 选项创建一个 man 页面。
  36. 然而它并不存在,因此我们使用一个环境变量,跳过这一过程。
  37. 现在,准备编译 Flex:</para>
  38. <screen><userinput remap="configure">HELP2MAN=/tools/bin/true \
  39. ./configure --prefix=/usr --docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
  40. <para>编译该软件包:</para>
  41. <screen><userinput remap="make">make</userinput></screen>
  42. <para>如果要测试编译结果(需要约 0.5 SBU), 执行:</para>
  43. <screen><userinput remap="test">make check</userinput></screen>
  44. <para>安装该软件包:</para>
  45. <screen><userinput remap="install">make install</userinput></screen>
  46. <para>个别程序还不知道 <command>flex</command> ,
  47. 并试图去运行它的前身 <command>lex</command>。为了支持这些程序,
  48. 创建一个名为 <filename>lex</filename> 的符号链接,它以
  49. <command>lex</command> 仿真模式运行 <filename>flex</filename>:</para>
  50. <screen><userinput remap="install">ln -sv flex /usr/bin/lex</userinput></screen>
  51. </sect2>
  52. <sect2 id="contents-flex" role="content">
  53. <title>Flex 的内容</title>
  54. <segmentedlist>
  55. <segtitle>安装的程序</segtitle>
  56. <segtitle>安装的库</segtitle>
  57. <segtitle>安装的目录</segtitle>
  58. <seglistitem>
  59. <seg>flex, flex++ (到 flex 的链接), 以及 lex (到 flex 的链接)</seg>
  60. <seg>libfl.so</seg>
  61. <seg>/usr/share/doc/flex-&flex-version;</seg>
  62. </seglistitem>
  63. </segmentedlist>
  64. <variablelist>
  65. <bridgehead renderas="sect3">简要描述</bridgehead>
  66. <?dbfo list-presentation="list"?>
  67. <?dbhtml list-presentation="table"?>
  68. <varlistentry id="flex">
  69. <term><command>flex</command></term>
  70. <listitem>
  71. <!--para>A tool for generating programs that recognize patterns in text;
  72. it allows for the versatility to specify the rules for pattern-finding,
  73. eradicating the need to develop a specialized program</para-->
  74. <para>一个用于生成在文本文件中识别模式的程序的工具,
  75. 它允许灵活地指定查找模式的规则,消除了开发专用程序的需要。
  76. </para>
  77. <indexterm zone="ch-system-flex flex">
  78. <primary sortas="b-flex">flex</primary>
  79. </indexterm>
  80. </listitem>
  81. </varlistentry>
  82. <varlistentry id="flexpp">
  83. <term><command>flex++</command></term>
  84. <listitem>
  85. <para>flex 的扩展,用于生成 C++ 代码和类。它是一个指向
  86. <command>flex</command> 的符号链接</para>
  87. <indexterm zone="ch-system-flex flexpp">
  88. <primary sortas="b-flex++">flex++</primary>
  89. </indexterm>
  90. </listitem>
  91. </varlistentry>
  92. <varlistentry id="lex">
  93. <term><command>lex</command></term>
  94. <listitem>
  95. <para>一个以 <command>lex</command> 仿真模式运行
  96. <command>flex</command> 的符号链接</para>
  97. <indexterm zone="ch-system-flex lex">
  98. <primary sortas="b-lex">lex</primary>
  99. </indexterm>
  100. </listitem>
  101. </varlistentry>
  102. <varlistentry id="libfl">
  103. <term><filename class="libraryfile">libfl</filename></term>
  104. <listitem>
  105. <para><filename class="libraryfile">flex</filename> 库</para>
  106. <indexterm zone="ch-system-flex libfl">
  107. <primary sortas="c-libfl">libfl</primary>
  108. </indexterm>
  109. </listitem>
  110. </varlistentry>
  111. </variablelist>
  112. </sect2>
  113. </sect1>