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 6.8 KiB

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