+#endif
+
+ /* get Decomposition_Type & Decomposition_Mapping, field 5 */
+ d=NULL;
+ if(fields[5][0]==fields[5][1]) {
+ /* no decomposition, except UnicodeData.txt omits Hangul syllable decompositions */
+ if(c==0xac00 || c==0xd7a3) {
+ dt=U_DT_CANONICAL;
+ } else {
+ dt=U_DT_NONE;
+ }
+ } else {
+ d=fields[5][0];
+ *fields[5][1]=0;
+ dt=UCHAR_INVALID_CODE;
+ if(*d=='<') {
+ end=strchr(++d, '>');
+ if(end!=NULL) {
+ *end=0;
+ dt=u_getPropertyValueEnum(UCHAR_DECOMPOSITION_TYPE, d);
+ d=u_skipWhitespace(end+1);
+ }
+ } else {
+ dt=U_DT_CANONICAL;
+ }
+ }
+ if(dt>U_DT_NONE) {
+ if(c==0xac00) {
+ dm[0]=0x1100;
+ dm[1]=0x1161;
+ dm[2]=0;
+ dmLength=2;
+ } else if(c==0xd7a3) {
+ dm[0]=0xd788;
+ dm[1]=0x11c2;
+ dm[2]=0;
+ dmLength=2;
+ } else {
+ dmLength=u_parseString(d, dm, 32, NULL, pErrorCode);
+ }
+ } else {
+ dmLength=-1;
+ }
+ if(dt<0 || U_FAILURE(*pErrorCode)) {
+ log_err("error in UnicodeData.txt: syntax error in U+%04lX decomposition field\n", (long)c);
+ return;
+ }
+#if !UCONFIG_NO_NORMALIZATION
+ i=u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE);
+ if(i!=dt) {
+ log_err("error: u_getIntPropertyValue(U+%04lx, UCHAR_DECOMPOSITION_TYPE)==%d instead of %d\n", c, i, dt);
+ }
+ /* Expect Decomposition_Mapping=nfkc.getRawDecomposition(c). */
+ length=unorm2_getRawDecomposition(nfkc, c, s, 32, pErrorCode);
+ if(U_FAILURE(*pErrorCode) || length!=dmLength || (length>0 && 0!=u_strcmp(s, dm))) {
+ log_err("error: unorm2_getRawDecomposition(nfkc, U+%04lx)==%d instead of %d "
+ "or the Decomposition_Mapping is different (%s)\n",
+ c, length, dmLength, u_errorName(*pErrorCode));
+ return;
+ }
+ /* For canonical decompositions only, expect Decomposition_Mapping=nfc.getRawDecomposition(c). */
+ if(dt!=U_DT_CANONICAL) {
+ dmLength=-1;
+ }
+ nfc=((UnicodeDataContext *)context)->nfc;
+ length=unorm2_getRawDecomposition(nfc, c, s, 32, pErrorCode);
+ if(U_FAILURE(*pErrorCode) || length!=dmLength || (length>0 && 0!=u_strcmp(s, dm))) {
+ log_err("error: unorm2_getRawDecomposition(nfc, U+%04lx)==%d instead of %d "
+ "or the Decomposition_Mapping is different (%s)\n",
+ c, length, dmLength, u_errorName(*pErrorCode));
+ return;
+ }
+ /* recompose */
+ if(dt==U_DT_CANONICAL && !u_hasBinaryProperty(c, UCHAR_FULL_COMPOSITION_EXCLUSION)) {
+ UChar32 a, b, composite;
+ i=0;
+ U16_NEXT(dm, i, dmLength, a);
+ U16_NEXT(dm, i, dmLength, b);
+ /* i==dmLength */
+ composite=unorm2_composePair(nfc, a, b);
+ if(composite!=c) {
+ log_err("error: nfc U+%04lX decomposes to U+%04lX+U+%04lX but does not compose back (instead U+%04lX)\n",
+ (long)c, (long)a, (long)b, (long)composite);
+ }
+ /*
+ * Note: NFKC has fewer round-trip mappings than NFC,
+ * so we can't just test unorm2_composePair(nfkc, a, b) here without further data.
+ */
+ }
+#endif