You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

native2ascii.html 7.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head><link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  17. <title>Native2Ascii Task</title></head>
  18. <body>
  19. <h2>Native2Ascii</h2>
  20. <h3>Description:</h3>
  21. <p>
  22. Converts files from native encodings to ASCII with escaped Unicode.
  23. A common usage is to convert source files maintained in a native
  24. operating system encoding, to ASCII prior to compilation.
  25. </p>
  26. <p>
  27. Files in the directory <em>src</em>
  28. are converted from a native encoding to ASCII.
  29. By default, all files in the directory are converted.
  30. However, conversion may be limited to selected files using
  31. <em>includes</em> and <em>excludes</em> attributes.
  32. For more information on file matching patterns,
  33. see the section on
  34. <a href="../dirtasks.html#directorybasedtasks">directory based tasks</a>.
  35. If no <em>encoding</em> is specified,
  36. the default encoding for the JVM is used.
  37. If <em>ext</em> is specified, then output files are renamed
  38. to use it as a new extension.
  39. More sophisticated file name translations can be achieved using a nested
  40. <em><code>&lt;mapper&gt;</code></em> element. By default an
  41. <a href="../CoreTypes/mapper.html#identity-mapper">identity mapper</a> will be used.
  42. If <em>dest</em> and <em>src</em> point to the same directory,
  43. the <em>ext</em> attribute or a nested <em><code>&lt;mapper&gt;</code></em>
  44. is required.
  45. </p>
  46. <p>
  47. This task forms an implicit <a href="../CoreTypes/fileset.html">File Set</a>,
  48. and supports all attributes of <code>&lt;fileset&gt;</code>
  49. (<code>dir</code> becomes <code>src</code>) as well as
  50. nested <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code>,
  51. and <code>&lt;patternset&gt;</code> elements.
  52. </p>
  53. <p>It is possible to use different converters. This can be selected
  54. with the <code>implementation</code> attribute.
  55. <a name="implementationvalues">Here are the choices</a>:</p>
  56. <ul>
  57. <li>default - the default converter (kaffe or sun) for the platform.</li>
  58. <li>sun (the standard converter of the JDK)</li>
  59. <li>kaffe (the standard converter of <a href="http://www.kaffe.org" target="_top">Kaffe</a>)</li>
  60. </ul>
  61. <table border="1" cellpadding="2" cellspacing="0">
  62. <tr>
  63. <td><b>Attribute</b></td>
  64. <td><b>Description</b></td>
  65. <td><b>Required</b></td>
  66. </tr>
  67. <tr>
  68. <td>reverse</td>
  69. <td>Reverse the sense of the conversion,
  70. i.e. convert from ASCII to native <b>only supported by the
  71. sun converter</b></td>
  72. <td align="center">No</td>
  73. </tr>
  74. <tr>
  75. <td>encoding</td>
  76. <td>The native encoding the files are in
  77. (default is the default encoding for the JVM)</td>
  78. <td align="center">No</td>
  79. </tr>
  80. <tr>
  81. <td>src</td>
  82. <td>The directory to find files in (default is <em>basedir</em>)</td>
  83. <td align="center">No</td>
  84. </tr>
  85. <tr>
  86. <td>dest</td>
  87. <td>The directory to output file to</td>
  88. <td align="center">Yes</td>
  89. </tr>
  90. <tr>
  91. <td>ext</td>
  92. <td>File extension to use in renaming output files</td>
  93. <td align="center">No</td>
  94. </tr>
  95. <tr>
  96. <td>defaultexcludes</td>
  97. <td>indicates whether default excludes should be used or not
  98. (&quot;yes&quot;/&quot;no&quot;).
  99. Default excludes are used when omitted.
  100. </td>
  101. <td align="center">No</td>
  102. </tr>
  103. <tr>
  104. <td>includes</td>
  105. <td>comma- or space-separated list of patterns of files that must be
  106. included. All files are included when omitted.</td>
  107. <td align="center">No</td>
  108. </tr>
  109. <tr>
  110. <td>includesfile</td>
  111. <td>the name of a file. Each line of this file is
  112. taken to be an include pattern</td>
  113. <td align="center">No</td>
  114. </tr>
  115. <tr>
  116. <td>excludes</td>
  117. <td>comma- or space-separated list of patterns of files that must be excluded.
  118. No files (except default excludes) are excluded when omitted.</td>
  119. <td align="center">No</td>
  120. </tr>
  121. <tr>
  122. <td>excludesfile</td>
  123. <td>the name of a file. Each line of this file is
  124. taken to be an exclude pattern</td>
  125. <td align="center">No</td>
  126. </tr>
  127. <tr>
  128. <td valign="top">implementation</td>
  129. <td valign="top">The converter implementation to use.
  130. If this attribute is not set, the default converter for the
  131. current VM will be used. (See the above <a
  132. href="#implementationvalues">list</a> of valid converters.)</td>
  133. <td align="center" valign="top">No</td>
  134. </tr>
  135. </table>
  136. <h3>Parameters specified as nested elements</h3>
  137. <h4>arg</h4>
  138. <p>You can specify additional command line arguments for the converter
  139. with nested <code>&lt;arg&gt;</code> elements. These elements are
  140. specified like <a href="../using.html#arg">Command-line Arguments</a>
  141. but have an additional attribute that can be used to enable arguments
  142. only if a given converter implementation will be used.</p>
  143. <table border="1" cellpadding="2" cellspacing="0">
  144. <tr>
  145. <td width="12%" valign="top"><b>Attribute</b></td>
  146. <td width="78%" valign="top"><b>Description</b></td>
  147. <td width="10%" valign="top"><b>Required</b></td>
  148. </tr>
  149. <tr>
  150. <td valign="top">value</td>
  151. <td align="center" rowspan="4">See
  152. <a href="../using.html#arg">Command-line Arguments</a>.</td>
  153. <td align="center" rowspan="4">Exactly one of these.</td>
  154. </tr>
  155. <tr>
  156. <td valign="top">line</td>
  157. </tr>
  158. <tr>
  159. <td valign="top">file</td>
  160. </tr>
  161. <tr>
  162. <td valign="top">path</td>
  163. </tr>
  164. <tr>
  165. <td valign="top">implementation</td>
  166. <td>Only pass the specified argument if the chosen converter
  167. implementation matches the value of this attribute. Legal values
  168. are the same as those in the above <a
  169. href="#implementationvalues">list</a> of valid compilers.)</td>
  170. <td align="center">No</td>
  171. </tr>
  172. </table>
  173. <h3>Examples</h3>
  174. <pre>
  175. &lt;native2ascii encoding=&quot;EUCJIS&quot; src=&quot;srcdir&quot; dest=&quot;srcdir&quot;
  176. includes=&quot;**/*.eucjis&quot; ext=&quot;.java&quot;/&gt;
  177. </pre>
  178. <p>
  179. Converts all files in the directory <em>srcdir</em>
  180. ending in <code>.eucjis</code> from the EUCJIS encoding to ASCII
  181. and renames them to end in <code>.java</code>.
  182. </p>
  183. <pre>
  184. &lt;native2ascii encoding=&quot;EUCJIS&quot; src=&quot;native/japanese&quot; dest=&quot;src&quot;
  185. includes=&quot;**/*.java&quot;/&gt;
  186. </pre>
  187. <p>
  188. Converts all the files ending in <code>.java</code>
  189. in the directory <em>native/japanese</em> to ASCII,
  190. placing the results in the directory <em>src</em>.
  191. The names of the files remain the same.
  192. </p>
  193. </body>
  194. </html>