int OpenedList::fromRoman( const QString& str ) { int n = 0; int j; int u; int v = 0; for ( int i = str.length() - 1; i >= 0; i-- ) { j = 0; u = 1000; while ( roman[j] != 'i' && roman[j] != str[i].toLower() ) { j += 2; u /= roman[j - 1]; } if ( u < v ) { n -= u; } else { n += u; } v = u; } if ( str.toLower() == toRoman(n) ) { return n; } else { return 0; } }
/****************** * Roman numerals * ****************** * Converts an integer in the range [1, 4000) to a lower case Roman numeral * #include <string> * REQUIRES: fill() **/ string toRoman( int n ) { if( n < 4 ) return fill( 'i', n ); if( n < 6 ) return fill( 'i', 5 - n ) + "v"; if( n < 9 ) return string( "v" ) + fill( 'i', n - 5 ); if( n < 11 ) return fill( 'i', 10 - n ) + "x"; if( n < 40 ) return fill( 'x', n / 10 ) + toRoman( n % 10 ); if( n < 60 ) return fill( 'x', 5 - n / 10 ) + 'l' + toRoman( n % 10 ); if( n < 90 ) return string( "l" ) + fill( 'x', n / 10 - 5 ) + toRoman( n % 10 ); if( n < 110 ) return fill( 'x', 10 - n / 10 ) + "c" + toRoman( n % 10 ); if( n < 400 ) return fill( 'c', n / 100 ) + toRoman( n % 100 ); if( n < 600 ) return fill( 'c', 5 - n / 100 ) + 'd' + toRoman( n % 100 ); if( n < 900 ) return string( "d" ) + fill( 'c', n / 100 - 5 ) + toRoman( n % 100 ); if( n < 1100 ) return fill( 'c', 10 - n / 100 ) + "m" + toRoman( n % 100 ); if( n < 4000 ) return fill( 'm', n / 1000 ) + toRoman( n % 1000 ); return "?"; }
int main() { int ans=0,sum=0; char s[100]; while (scanf("%s",s)==1) { int n=toNum(s); ans+=strlen(s)-toRoman(n); } printf("%d\n",ans); return(0); }
QString WBSDefinition::code(const CodeDef &def, uint index) const { if (def.code == "Number") { return QString("%1").arg(index); } if (def.code == "Roman, lower case") { return QString("%1").arg(toRoman(index)); } if (def.code == "Roman, upper case") { return QString("%1").arg(toRoman(index, true)); } if (def.code == "Letter, lower case") { if (index > 26) { index = 0; } return QString("%1").arg(Letters[index]); } if (def.code == "Letter, upper case") { if (index > 26) { index = 0; } return QString("%1").arg(Letters[index].toUpper()); } return QString(); }
int main() { int n, DP[101][5] = {}; char *str; for(n = 1; n <= 100; n++) { str = toRoman(n); for(int i = 0; i < 5; i++) DP[n][i] = DP[n-1][i]; for(int i = 0; str[i]; i++) { switch(str[i]) { case 'I':DP[n][0]++;break; case 'V':DP[n][1]++;break; case 'X':DP[n][2]++;break; case 'L':DP[n][3]++;break; case 'C':DP[n][4]++;break; } } delete[] str; } while(scanf("%d", &n) == 1 && n) { printf("%d: %d i, %d v, %d x, %d l, %d c\n", n, DP[n][0], DP[n][1], DP[n][2], DP[n][3], DP[n][4]); } return 0; }
bool QQuickStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format) { skipSpace(ch); int tagStart = ch - textIn.constData(); int tagLength = 0; while (!ch->isNull()) { if (*ch == greaterThan) { if (tagLength == 0) return false; QStringRef tag(&textIn, tagStart, tagLength); const QChar char0 = tag.at(0); if (char0 == QLatin1Char('b')) { if (tagLength == 1) { format.setFontWeight(QFont::Bold); return true; } else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) { textOut.append(QChar(QChar::LineSeparator)); hasSpace = true; prependSpace = false; return false; } } else if (char0 == QLatin1Char('i')) { if (tagLength == 1) { format.setFontItalic(true); return true; } } else if (char0 == QLatin1Char('p')) { if (tagLength == 1) { if (!hasNewLine) textOut.append(QChar::LineSeparator); hasSpace = true; prependSpace = false; } else if (tag == QLatin1String("pre")) { preFormat = true; if (!hasNewLine) textOut.append(QChar::LineSeparator); format.setFontFamily(QString::fromLatin1("Courier New,courier")); format.setFontFixedPitch(true); return true; } } else if (char0 == QLatin1Char('u')) { if (tagLength == 1) { format.setFontUnderline(true); return true; } else if (tag == QLatin1String("ul")) { List listItem; listItem.level = 0; listItem.type = Unordered; listItem.format = Bullet; listStack.push(listItem); } } else if (char0 == QLatin1Char('h') && tagLength == 2) { int level = tag.at(1).digitValue(); if (level >= 1 && level <= 6) { if (!hasNewLine) textOut.append(QChar::LineSeparator); hasSpace = true; prependSpace = false; setFontSize(7 - level, format); format.setFontWeight(QFont::Bold); return true; } } else if (tag == QLatin1String("strong")) { format.setFontWeight(QFont::Bold); return true; } else if (tag == QLatin1String("ol")) { List listItem; listItem.level = 0; listItem.type = Ordered; listItem.format = Decimal; listStack.push(listItem); } else if (tag == QLatin1String("li")) { if (!hasNewLine) textOut.append(QChar(QChar::LineSeparator)); if (!listStack.isEmpty()) { int count = ++listStack.top().level; for (int i = 0; i < listStack.size(); ++i) textOut += QString(tabsize, QChar::Nbsp); switch (listStack.top().format) { case Decimal: textOut += QString::number(count) % QLatin1Char('.'); break; case LowerAlpha: textOut += toAlpha(count, false) % QLatin1Char('.'); break; case UpperAlpha: textOut += toAlpha(count, true) % QLatin1Char('.'); break; case LowerRoman: textOut += toRoman(count, false) % QLatin1Char('.'); break; case UpperRoman: textOut += toRoman(count, true) % QLatin1Char('.'); break; case Bullet: textOut += bullet; break; case Disc: textOut += disc; break; case Square: textOut += square; break; } textOut += QString(2, QChar::Nbsp); } } return false; } else if (ch->isSpace()) { // may have params. QStringRef tag(&textIn, tagStart, tagLength); if (tag == QLatin1String("font")) return parseFontAttributes(ch, textIn, format); if (tag == QLatin1String("ol")) { parseOrderedListAttributes(ch, textIn); return false; // doesn't modify format } if (tag == QLatin1String("ul")) { parseUnorderedListAttributes(ch, textIn); return false; // doesn't modify format } if (tag == QLatin1String("a")) { return parseAnchorAttributes(ch, textIn, format); } if (tag == QLatin1String("img")) { parseImageAttributes(ch, textIn, textOut); return false; } if (*ch == greaterThan || ch->isNull()) continue; } else if (*ch != slash) { tagLength++; } ++ch; } return false; }
String listMarkerText(EListStyleType type, int value) { switch (type) { case LNONE: return ""; // We use the same characters for text security. // See RenderText::setInternalString. case CIRCLE: return String(&whiteBullet, 1); case DISC: return String(&bullet, 1); case SQUARE: // The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE // instead, but I think this looks better. return String(&blackSquare, 1); case LDECIMAL: return String::number(value); case DECIMAL_LEADING_ZERO: if (value < -9 || value > 9) return String::number(value); if (value < 0) return "-0" + String::number(-value); // -01 to -09 return "0" + String::number(value); // 00 to 09 case LOWER_ALPHA: case LOWER_LATIN: { static const UChar lowerLatinAlphabet[26] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; return toAlphabetic(value, lowerLatinAlphabet, 26); } case UPPER_ALPHA: case UPPER_LATIN: { static const UChar upperLatinAlphabet[26] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; return toAlphabetic(value, upperLatinAlphabet, 26); } case LOWER_GREEK: { static const UChar lowerGreekAlphabet[24] = { 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9 }; return toAlphabetic(value, lowerGreekAlphabet, 24); } case HIRAGANA: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar hiraganaAlphabet[48] = { 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F, 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D, 0x305F, 0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3072, 0x3075, 0x3078, 0x307B, 0x307E, 0x307F, 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308F, 0x3090, 0x3091, 0x3092, 0x3093 }; return toAlphabetic(value, hiraganaAlphabet, 48); } case HIRAGANA_IROHA: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar hiraganaIrohaAlphabet[47] = { 0x3044, 0x308D, 0x306F, 0x306B, 0x307B, 0x3078, 0x3068, 0x3061, 0x308A, 0x306C, 0x308B, 0x3092, 0x308F, 0x304B, 0x3088, 0x305F, 0x308C, 0x305D, 0x3064, 0x306D, 0x306A, 0x3089, 0x3080, 0x3046, 0x3090, 0x306E, 0x304A, 0x304F, 0x3084, 0x307E, 0x3051, 0x3075, 0x3053, 0x3048, 0x3066, 0x3042, 0x3055, 0x304D, 0x3086, 0x3081, 0x307F, 0x3057, 0x3091, 0x3072, 0x3082, 0x305B, 0x3059 }; return toAlphabetic(value, hiraganaIrohaAlphabet, 47); } case KATAKANA: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar katakanaAlphabet[48] = { 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F0, 0x30F1, 0x30F2, 0x30F3 }; return toAlphabetic(value, katakanaAlphabet, 48); } case KATAKANA_IROHA: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar katakanaIrohaAlphabet[47] = { 0x30A4, 0x30ED, 0x30CF, 0x30CB, 0x30DB, 0x30D8, 0x30C8, 0x30C1, 0x30EA, 0x30CC, 0x30EB, 0x30F2, 0x30EF, 0x30AB, 0x30E8, 0x30BF, 0x30EC, 0x30BD, 0x30C4, 0x30CD, 0x30CA, 0x30E9, 0x30E0, 0x30A6, 0x30F0, 0x30CE, 0x30AA, 0x30AF, 0x30E4, 0x30DE, 0x30B1, 0x30D5, 0x30B3, 0x30A8, 0x30C6, 0x30A2, 0x30B5, 0x30AD, 0x30E6, 0x30E1, 0x30DF, 0x30B7, 0x30F1, 0x30D2, 0x30E2, 0x30BB, 0x30B9 }; return toAlphabetic(value, katakanaIrohaAlphabet, 47); } case CJK_IDEOGRAPHIC: { static const UChar traditionalChineseInformalTable[16] = { 0x842C, 0x5104, 0x5146, 0x5341, 0x767E, 0x5343, 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }; return toCJKIdeographic(value, traditionalChineseInformalTable); } case LOWER_ROMAN: return toRoman(value, false); case UPPER_ROMAN: return toRoman(value, true); case ARMENIAN: // CSS3 says "armenian" means "lower-armenian". // But the CSS2.1 test suite contains uppercase test results for "armenian", // so we'll match the test suite. return toArmenian(value, true); case GEORGIAN: return toGeorgian(value); case HEBREW: return toHebrew(value); } ASSERT_NOT_REACHED(); return ""; }
String text(EListStyleType type, int count) { // If the list-style-type, say hebrew, cannot represent |count| because it's outside // its ordinal range then we fallback to some list style that can represent |count|. switch (effectiveListMarkerType(type, count)) { case NoneListStyle: return ""; // We use the same characters for text security. // See LayoutText::setInternalString. case Circle: return String(&whiteBulletCharacter, 1); case Disc: return String(&bulletCharacter, 1); case Square: // The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE // instead, but I think this looks better. return String(&blackSquareCharacter, 1); case DecimalListStyle: return String::number(count); case DecimalLeadingZero: if (count < -9 || count > 9) return String::number(count); if (count < 0) return "-0" + String::number(-count); // -01 to -09 return "0" + String::number(count); // 00 to 09 case ArabicIndic: { static const UChar arabicIndicNumerals[10] = { 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669 }; return toNumeric(count, arabicIndicNumerals); } case Bengali: { static const UChar bengaliNumerals[10] = { 0x09E6, 0x09E7, 0x09E8, 0x09E9, 0x09EA, 0x09EB, 0x09EC, 0x09ED, 0x09EE, 0x09EF }; return toNumeric(count, bengaliNumerals); } case Cambodian: case Khmer: { static const UChar khmerNumerals[10] = { 0x17E0, 0x17E1, 0x17E2, 0x17E3, 0x17E4, 0x17E5, 0x17E6, 0x17E7, 0x17E8, 0x17E9 }; return toNumeric(count, khmerNumerals); } case Devanagari: { static const UChar devanagariNumerals[10] = { 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F }; return toNumeric(count, devanagariNumerals); } case Gujarati: { static const UChar gujaratiNumerals[10] = { 0x0AE6, 0x0AE7, 0x0AE8, 0x0AE9, 0x0AEA, 0x0AEB, 0x0AEC, 0x0AED, 0x0AEE, 0x0AEF }; return toNumeric(count, gujaratiNumerals); } case Gurmukhi: { static const UChar gurmukhiNumerals[10] = { 0x0A66, 0x0A67, 0x0A68, 0x0A69, 0x0A6A, 0x0A6B, 0x0A6C, 0x0A6D, 0x0A6E, 0x0A6F }; return toNumeric(count, gurmukhiNumerals); } case Kannada: { static const UChar kannadaNumerals[10] = { 0x0CE6, 0x0CE7, 0x0CE8, 0x0CE9, 0x0CEA, 0x0CEB, 0x0CEC, 0x0CED, 0x0CEE, 0x0CEF }; return toNumeric(count, kannadaNumerals); } case Lao: { static const UChar laoNumerals[10] = { 0x0ED0, 0x0ED1, 0x0ED2, 0x0ED3, 0x0ED4, 0x0ED5, 0x0ED6, 0x0ED7, 0x0ED8, 0x0ED9 }; return toNumeric(count, laoNumerals); } case Malayalam: { static const UChar malayalamNumerals[10] = { 0x0D66, 0x0D67, 0x0D68, 0x0D69, 0x0D6A, 0x0D6B, 0x0D6C, 0x0D6D, 0x0D6E, 0x0D6F }; return toNumeric(count, malayalamNumerals); } case Mongolian: { static const UChar mongolianNumerals[10] = { 0x1810, 0x1811, 0x1812, 0x1813, 0x1814, 0x1815, 0x1816, 0x1817, 0x1818, 0x1819 }; return toNumeric(count, mongolianNumerals); } case Myanmar: { static const UChar myanmarNumerals[10] = { 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x1048, 0x1049 }; return toNumeric(count, myanmarNumerals); } case Oriya: { static const UChar oriyaNumerals[10] = { 0x0B66, 0x0B67, 0x0B68, 0x0B69, 0x0B6A, 0x0B6B, 0x0B6C, 0x0B6D, 0x0B6E, 0x0B6F }; return toNumeric(count, oriyaNumerals); } case Persian: case Urdu: { static const UChar urduNumerals[10] = { 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9 }; return toNumeric(count, urduNumerals); } case Telugu: { static const UChar teluguNumerals[10] = { 0x0C66, 0x0C67, 0x0C68, 0x0C69, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C6F }; return toNumeric(count, teluguNumerals); } case Tibetan: { static const UChar tibetanNumerals[10] = { 0x0F20, 0x0F21, 0x0F22, 0x0F23, 0x0F24, 0x0F25, 0x0F26, 0x0F27, 0x0F28, 0x0F29 }; return toNumeric(count, tibetanNumerals); } case Thai: { static const UChar thaiNumerals[10] = { 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59 }; return toNumeric(count, thaiNumerals); } case LowerAlpha: case LowerLatin: { static const LChar lowerLatinAlphabet[26] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; return toAlphabetic(count, lowerLatinAlphabet); } case UpperAlpha: case UpperLatin: { static const LChar upperLatinAlphabet[26] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; return toAlphabetic(count, upperLatinAlphabet); } case LowerGreek: { static const UChar lowerGreekAlphabet[24] = { 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9 }; return toAlphabetic(count, lowerGreekAlphabet); } case Hiragana: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar hiraganaAlphabet[48] = { 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F, 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D, 0x305F, 0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3072, 0x3075, 0x3078, 0x307B, 0x307E, 0x307F, 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308F, 0x3090, 0x3091, 0x3092, 0x3093 }; return toAlphabetic(count, hiraganaAlphabet); } case HiraganaIroha: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar hiraganaIrohaAlphabet[47] = { 0x3044, 0x308D, 0x306F, 0x306B, 0x307B, 0x3078, 0x3068, 0x3061, 0x308A, 0x306C, 0x308B, 0x3092, 0x308F, 0x304B, 0x3088, 0x305F, 0x308C, 0x305D, 0x3064, 0x306D, 0x306A, 0x3089, 0x3080, 0x3046, 0x3090, 0x306E, 0x304A, 0x304F, 0x3084, 0x307E, 0x3051, 0x3075, 0x3053, 0x3048, 0x3066, 0x3042, 0x3055, 0x304D, 0x3086, 0x3081, 0x307F, 0x3057, 0x3091, 0x3072, 0x3082, 0x305B, 0x3059 }; return toAlphabetic(count, hiraganaIrohaAlphabet); } case Katakana: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar katakanaAlphabet[48] = { 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F0, 0x30F1, 0x30F2, 0x30F3 }; return toAlphabetic(count, katakanaAlphabet); } case KatakanaIroha: { // FIXME: This table comes from the CSS3 draft, and is probably // incorrect, given the comments in that draft. static const UChar katakanaIrohaAlphabet[47] = { 0x30A4, 0x30ED, 0x30CF, 0x30CB, 0x30DB, 0x30D8, 0x30C8, 0x30C1, 0x30EA, 0x30CC, 0x30EB, 0x30F2, 0x30EF, 0x30AB, 0x30E8, 0x30BF, 0x30EC, 0x30BD, 0x30C4, 0x30CD, 0x30CA, 0x30E9, 0x30E0, 0x30A6, 0x30F0, 0x30CE, 0x30AA, 0x30AF, 0x30E4, 0x30DE, 0x30B1, 0x30D5, 0x30B3, 0x30A8, 0x30C6, 0x30A2, 0x30B5, 0x30AD, 0x30E6, 0x30E1, 0x30DF, 0x30B7, 0x30F1, 0x30D2, 0x30E2, 0x30BB, 0x30B9 }; return toAlphabetic(count, katakanaIrohaAlphabet); } case CjkEarthlyBranch: { static const UChar cjkEarthlyBranchAlphabet[12] = { 0x5B50, 0x4E11, 0x5BC5, 0x536F, 0x8FB0, 0x5DF3, 0x5348, 0x672A, 0x7533, 0x9149, 0x620C, 0x4EA5 }; return toAlphabetic(count, cjkEarthlyBranchAlphabet); } case CjkHeavenlyStem: { static const UChar cjkHeavenlyStemAlphabet[10] = { 0x7532, 0x4E59, 0x4E19, 0x4E01, 0x620A, 0x5DF1, 0x5E9A, 0x8F9B, 0x58EC, 0x7678 }; return toAlphabetic(count, cjkHeavenlyStemAlphabet); } case HangulConsonant: { static const UChar hangulConsonantAlphabet[14] = { 0x3131, 0x3134, 0x3137, 0x3139, 0x3141, 0x3142, 0x3145, 0x3147, 0x3148, 0x314A, 0x314B, 0x314C, 0x314D, 0x314E }; return toAlphabetic(count, hangulConsonantAlphabet); } case Hangul: { static const UChar hangulAlphabet[14] = { 0xAC00, 0xB098, 0xB2E4, 0xB77C, 0xB9C8, 0xBC14, 0xC0AC, 0xC544, 0xC790, 0xCC28, 0xCE74, 0xD0C0, 0xD30C, 0xD558 }; return toAlphabetic(count, hangulAlphabet); } case EthiopicHalehame: { static const UChar ethiopicHalehameGezAlphabet[26] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1240, 0x1260, 0x1270, 0x1280, 0x1290, 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12D8, 0x12E8, 0x12F0, 0x1308, 0x1320, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350 }; return toAlphabetic(count, ethiopicHalehameGezAlphabet); } case EthiopicHalehameAm: { static const UChar ethiopicHalehameAmAlphabet[33] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8, 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320, 0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350 }; return toAlphabetic(count, ethiopicHalehameAmAlphabet); } case EthiopicHalehameTiEr: { static const UChar ethiopicHalehameTiErAlphabet[31] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1250, 0x1260, 0x1270, 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8, 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320, 0x1328, 0x1330, 0x1338, 0x1348, 0x1350 }; return toAlphabetic(count, ethiopicHalehameTiErAlphabet); } case EthiopicHalehameTiEt: { static const UChar ethiopicHalehameTiEtAlphabet[34] = { 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240, 0x1250, 0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8, 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320, 0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350 }; return toAlphabetic(count, ethiopicHalehameTiEtAlphabet); } case KoreanHangulFormal: { static const UChar koreanHangulFormalTable[26] = { Korean, 0xB9CC, 0x0000, 0xC5B5, 0x0000, 0xC870, 0x0000, 0xC2ED, 0xBC31, 0xCC9C, 0xC601, 0xC77C, 0xC774, 0xC0BC, 0xC0AC, 0xC624, 0xC721, 0xCE60, 0xD314, 0xAD6C, 0xB9C8, 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000 }; return toCJKIdeographic(count, koreanHangulFormalTable, Formal); } case KoreanHanjaFormal: { static const UChar koreanHanjaFormalTable[26] = { Korean, 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000, 0x62FE, 0x767E, 0x4EDF, 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D, 0xB9C8, 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000 }; return toCJKIdeographic(count, koreanHanjaFormalTable, Formal); } case KoreanHanjaInformal: { static const UChar koreanHanjaInformalTable[26] = { Korean, 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000, 0x5341, 0x767E, 0x5343, 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D, 0xB9C8, 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000 }; return toCJKIdeographic(count, koreanHanjaInformalTable, Informal); } case CJKIdeographic: case TradChineseInformal: { static const UChar traditionalChineseInformalTable[22] = { Chinese, 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000, 0x5341, 0x767E, 0x5343, 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D, 0x8CA0, 0x0000 }; return toCJKIdeographic(count, traditionalChineseInformalTable, Informal); } case SimpChineseInformal: { static const UChar simpleChineseInformalTable[22] = { Chinese, 0x4E07, 0x0000, 0x4EBF, 0x0000, 0x4E07, 0x4EBF, 0x5341, 0x767E, 0x5343, 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D, 0x8D1F, 0x0000 }; return toCJKIdeographic(count, simpleChineseInformalTable, Informal); } case TradChineseFormal: { static const UChar traditionalChineseFormalTable[22] = { Chinese, 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000, 0x62FE, 0x4F70, 0x4EDF, 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x8086, 0x4F0D, 0x9678, 0x67D2, 0x634C, 0x7396, 0x8CA0, 0x0000 }; return toCJKIdeographic(count, traditionalChineseFormalTable, Formal); } case SimpChineseFormal: { static const UChar simpleChineseFormalTable[22] = { Chinese, 0x4E07, 0x0000, 0x4EBF, 0x0000, 0x4E07, 0x4EBF, 0x62FE, 0x4F70, 0x4EDF, 0x96F6, 0x58F9, 0x8D30, 0x53C1, 0x8086, 0x4F0D, 0x9646, 0x67D2, 0x634C, 0x7396, 0x8D1F, 0x0000 }; return toCJKIdeographic(count, simpleChineseFormalTable, Formal); } case LowerRoman: return toRoman(count, false); case UpperRoman: return toRoman(count, true); case Armenian: case UpperArmenian: // CSS3 says "armenian" means "lower-armenian". // But the CSS2.1 test suite contains uppercase test results for "armenian", // so we'll match the test suite. return toArmenian(count, true); case LowerArmenian: return toArmenian(count, false); case Georgian: return toGeorgian(count); case Hebrew: return toHebrew(count); } ASSERT_NOT_REACHED(); return ""; }