12e5b6d6dSopenharmony_ci*******************************************************************************
22e5b6d6dSopenharmony_ci* © 2016 and later: Unicode, Inc. and others.
32e5b6d6dSopenharmony_ci* License & terms of use: http://www.unicode.org/copyright.html
42e5b6d6dSopenharmony_ci*******************************************************************************
52e5b6d6dSopenharmony_ci* Copyright (C) 2012-2013, International Business Machines Corporation and    *
62e5b6d6dSopenharmony_ci* others. All Rights Reserved.                                                *
72e5b6d6dSopenharmony_ci*******************************************************************************
82e5b6d6dSopenharmony_ci
92e5b6d6dSopenharmony_ci[Overview]
102e5b6d6dSopenharmony_ci
112e5b6d6dSopenharmony_ciThis directory contains a tool used for maintaining ICU's ISO 4217 currency
122e5b6d6dSopenharmony_cicode mapping data. ICU uses a resource generated by this tool for mapping
132e5b6d6dSopenharmony_ciISO 4217 currency alpha codes to numeric codes.
142e5b6d6dSopenharmony_ci
152e5b6d6dSopenharmony_ci
162e5b6d6dSopenharmony_ci[Files]
172e5b6d6dSopenharmony_ci
182e5b6d6dSopenharmony_cipackage com.ibm.icu.dev.tool.currency
192e5b6d6dSopenharmony_ci
202e5b6d6dSopenharmony_ciMain.java - The tool's entry point
212e5b6d6dSopenharmony_ciNumericCodeData.java - The mapping data used by ICU
222e5b6d6dSopenharmony_ciCurrencyDataParser.java - ISO 4217 XML data parser
232e5b6d6dSopenharmony_ciCurrencyDataEntry.java - ISO 4217 XML data entry
242e5b6d6dSopenharmony_ci
252e5b6d6dSopenharmony_ci
262e5b6d6dSopenharmony_ci[Details]
272e5b6d6dSopenharmony_ci
282e5b6d6dSopenharmony_cicom.ibm.icu.dev.tool.NumericCodeData has String[][] CODE_MAP_DATA.
292e5b6d6dSopenharmony_ciThis array represents mappings between ISO 4217 alpha codes and
302e5b6d6dSopenharmony_cinumeric codes. ICU's resource bundle currencyNumericCodes is generated
312e5b6d6dSopenharmony_cifrom the table.
322e5b6d6dSopenharmony_ci
332e5b6d6dSopenharmony_ciISO 4217 maintenance agency - SIX Interbank Clearing distributes
342e5b6d6dSopenharmony_ciISO 4217 code data in XML format. These files are found in
352e5b6d6dSopenharmony_cihttp://www.currency-iso.org/iso_index/iso_tables.htm. There are two
362e5b6d6dSopenharmony_cifiles that we're interested in.
372e5b6d6dSopenharmony_ci
382e5b6d6dSopenharmony_ci - https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
392e5b6d6dSopenharmony_ci - https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-three.xml
402e5b6d6dSopenharmony_ci
412e5b6d6dSopenharmony_ciTable A.1 contains current currencies and funds and Table A.3 contains
422e5b6d6dSopenharmony_cihistoric denominations.
432e5b6d6dSopenharmony_ci
442e5b6d6dSopenharmony_ciThe tool supports 2 commands - check / resource.
452e5b6d6dSopenharmony_ci
462e5b6d6dSopenharmony_ci1) check
472e5b6d6dSopenharmony_ci
482e5b6d6dSopenharmony_ciThis command compares the hardcoded mapping data in NumericCodeData.java
492e5b6d6dSopenharmony_ciwith the ISO 4217 XML data files side by side and check differences.
502e5b6d6dSopenharmony_ci
512e5b6d6dSopenharmony_ci2) resource
522e5b6d6dSopenharmony_ci
532e5b6d6dSopenharmony_ciThis command writes out the hardcoded mapping data in NumericCodeData.java
542e5b6d6dSopenharmony_ciin ICU resource bundle source format - currencyNumericCodes.txt.
552e5b6d6dSopenharmony_ci
562e5b6d6dSopenharmony_ci
572e5b6d6dSopenharmony_ci[Release Tasks]
582e5b6d6dSopenharmony_ci
592e5b6d6dSopenharmony_ciFor each ICU release, we should check if the mapping data is up to date.
602e5b6d6dSopenharmony_ci
612e5b6d6dSopenharmony_ciPrerequisites: Java 6+, ant
622e5b6d6dSopenharmony_ci
632e5b6d6dSopenharmony_ciFirst, run the ant target "check". This ant target download XML files from
642e5b6d6dSopenharmony_cithe SIX Interbank Clearing site and invoke the tool command "check".
652e5b6d6dSopenharmony_ci
662e5b6d6dSopenharmony_ciWhen the target successfully finished, you should see the log like below:
672e5b6d6dSopenharmony_ci----------------------------------------------------------------------------
682e5b6d6dSopenharmony_ciC:\devtools\trunk\currency>ant
692e5b6d6dSopenharmony_ciBuildfile: C:\devtools\trunk\currency\build.xml
702e5b6d6dSopenharmony_ci
712e5b6d6dSopenharmony_ciclasses:
722e5b6d6dSopenharmony_ci
732e5b6d6dSopenharmony_ci_checkLocalXml:
742e5b6d6dSopenharmony_ci
752e5b6d6dSopenharmony_ci_localXml:
762e5b6d6dSopenharmony_ci
772e5b6d6dSopenharmony_ci_downloadXml:
782e5b6d6dSopenharmony_ci     [echo] Downloading ISO 4217 XML data files
792e5b6d6dSopenharmony_ci      [get] Getting: http://www.currency-iso.org/dam/downloads/lists/list_one.xm
802e5b6d6dSopenharmony_cil
812e5b6d6dSopenharmony_ci      [get] To: C:\devtools\trunk\currency\out\xml\list_one.xml
822e5b6d6dSopenharmony_ci      [get] Getting: http://www.currency-iso.org/dam/downloads/lists/list_three.
832e5b6d6dSopenharmony_cixml
842e5b6d6dSopenharmony_ci      [get] To: C:\devtools\trunk\currency\out\xml\list_three.xml
852e5b6d6dSopenharmony_ci
862e5b6d6dSopenharmony_cixmlData:
872e5b6d6dSopenharmony_ci
882e5b6d6dSopenharmony_cicheck:
892e5b6d6dSopenharmony_ci     [java] [OK] ICU data is synchronized with the reference data
902e5b6d6dSopenharmony_ci
912e5b6d6dSopenharmony_ciresource:
922e5b6d6dSopenharmony_ci     [echo] ISO 4217 numeric code mapping data was successfully created in C:\de
932e5b6d6dSopenharmony_civtools\trunk\currency/out/res
942e5b6d6dSopenharmony_ci
952e5b6d6dSopenharmony_cibuild:
962e5b6d6dSopenharmony_ci
972e5b6d6dSopenharmony_ciBUILD SUCCESSFUL
982e5b6d6dSopenharmony_ciTotal time: 1 second
992e5b6d6dSopenharmony_ci----------------------------------------------------------------------------
1002e5b6d6dSopenharmony_ciIn this case, our data is synchronized with the latest XML data and you're done.
1012e5b6d6dSopenharmony_ci
1022e5b6d6dSopenharmony_ci
1032e5b6d6dSopenharmony_ciIf the data is out of sync, you should see message like below:
1042e5b6d6dSopenharmony_ci----------------------------------------------------------------------------
1052e5b6d6dSopenharmony_cicheck:
1062e5b6d6dSopenharmony_ci     [java] Missing alpha code in ICU map [ZWR]
1072e5b6d6dSopenharmony_ci     [java] Codes not found in the reference data: ZZZ
1082e5b6d6dSopenharmony_ci
1092e5b6d6dSopenharmony_ciBUILD FAILED
1102e5b6d6dSopenharmony_ciC:\devtools\trunk\currency\build.xml:54: Java returned: 1
1112e5b6d6dSopenharmony_ci----------------------------------------------------------------------------
1122e5b6d6dSopenharmony_ciIn this case, you have to update the hardcoded data in NumericCodeData.
1132e5b6d6dSopenharmony_ciYou can either edit the table in NumericCodeData manually, or run the tool
1142e5b6d6dSopenharmony_cicommand "print" and copy the output and paste it to the table.
1152e5b6d6dSopenharmony_ci
1162e5b6d6dSopenharmony_ciOnce you make sure "ant check" returns no errors, run "ant resource". This
1172e5b6d6dSopenharmony_citarget generate out/res/currencyNumericCodes.txt. The file should go to
1182e5b6d6dSopenharmony_ci<icu4c>/source/data/misc directory.
1192e5b6d6dSopenharmony_ci
1202e5b6d6dSopenharmony_ciNote: The default ant target does both operation. Although it creates the
1212e5b6d6dSopenharmony_ciICU resource file, you do not need to replace the one in ICU4C package with
1222e5b6d6dSopenharmony_cithe newly generated one if "check" successfully finished.
1232e5b6d6dSopenharmony_ci
124