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.9 KiB

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