123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- /* Enumeration types to string.
- *
- * Copyright (C) 2012-2016 Reece H. Dunn
- *
- * This file is part of ucd-tools.
- *
- * ucd-tools is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * ucd-tools is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
- */
-
- #include "ucd/ucd.h"
-
- const char *ucd_get_category_group_string(ucd_category_group c)
- {
- switch (c)
- {
- case UCD_CATEGORY_GROUP_C: return "C";
- case UCD_CATEGORY_GROUP_I: return "I";
- case UCD_CATEGORY_GROUP_L: return "L";
- case UCD_CATEGORY_GROUP_M: return "M";
- case UCD_CATEGORY_GROUP_N: return "N";
- case UCD_CATEGORY_GROUP_P: return "P";
- case UCD_CATEGORY_GROUP_S: return "S";
- case UCD_CATEGORY_GROUP_Z: return "Z";
- default: return "-";
- }
- }
-
- const char *ucd_get_category_string(ucd_category c)
- {
- switch (c)
- {
- case UCD_CATEGORY_Cc: return "Cc";
- case UCD_CATEGORY_Cf: return "Cf";
- case UCD_CATEGORY_Cn: return "Cn";
- case UCD_CATEGORY_Co: return "Co";
- case UCD_CATEGORY_Cs: return "Cs";
- case UCD_CATEGORY_Ii: return "Ii";
- case UCD_CATEGORY_Ll: return "Ll";
- case UCD_CATEGORY_Lm: return "Lm";
- case UCD_CATEGORY_Lo: return "Lo";
- case UCD_CATEGORY_Lt: return "Lt";
- case UCD_CATEGORY_Lu: return "Lu";
- case UCD_CATEGORY_Mc: return "Mc";
- case UCD_CATEGORY_Me: return "Me";
- case UCD_CATEGORY_Mn: return "Mn";
- case UCD_CATEGORY_Nd: return "Nd";
- case UCD_CATEGORY_Nl: return "Nl";
- case UCD_CATEGORY_No: return "No";
- case UCD_CATEGORY_Pc: return "Pc";
- case UCD_CATEGORY_Pd: return "Pd";
- case UCD_CATEGORY_Pe: return "Pe";
- case UCD_CATEGORY_Pf: return "Pf";
- case UCD_CATEGORY_Pi: return "Pi";
- case UCD_CATEGORY_Po: return "Po";
- case UCD_CATEGORY_Ps: return "Ps";
- case UCD_CATEGORY_Sc: return "Sc";
- case UCD_CATEGORY_Sk: return "Sk";
- case UCD_CATEGORY_Sm: return "Sm";
- case UCD_CATEGORY_So: return "So";
- case UCD_CATEGORY_Zl: return "Zl";
- case UCD_CATEGORY_Zp: return "Zp";
- case UCD_CATEGORY_Zs: return "Zs";
- default: return "--";
- }
- }
-
- const char *ucd_get_script_string(ucd_script s)
- {
- static const char *scripts[] =
- {
- "Afak",
- "Aghb",
- "Ahom",
- "Arab",
- "Armi",
- "Armn",
- "Avst",
- "Bali",
- "Bamu",
- "Bass",
- "Batk",
- "Beng",
- "Blis",
- "Bopo",
- "Brah",
- "Brai",
- "Bugi",
- "Buhd",
- "Cakm",
- "Cans",
- "Cari",
- "Cham",
- "Cher",
- "Cirt",
- "Copt",
- "Cprt",
- "Cyrl",
- "Cyrs",
- "Deva",
- "Dsrt",
- "Dupl",
- "Egyd",
- "Egyh",
- "Egyp",
- "Elba",
- "Ethi",
- "Geok",
- "Geor",
- "Glag",
- "Goth",
- "Gran",
- "Grek",
- "Gujr",
- "Guru",
- "Hang",
- "Hani",
- "Hano",
- "Hans",
- "Hant",
- "Hatr",
- "Hebr",
- "Hira",
- "Hluw",
- "Hmng",
- "Hrkt",
- "Hung",
- "Inds",
- "Ital",
- "Java",
- "Jpan",
- "Jurc",
- "Kali",
- "Kana",
- "Khar",
- "Khmr",
- "Khoj",
- "Knda",
- "Kore",
- "Kpel",
- "Kthi",
- "Lana",
- "Laoo",
- "Latf",
- "Latg",
- "Latn",
- "Lepc",
- "Limb",
- "Lina",
- "Linb",
- "Lisu",
- "Loma",
- "Lyci",
- "Lydi",
- "Mahj",
- "Mand",
- "Mani",
- "Maya",
- "Mend",
- "Merc",
- "Mero",
- "Mlym",
- "Modi",
- "Mong",
- "Moon",
- "Mroo",
- "Mtei",
- "Mult",
- "Mymr",
- "Narb",
- "Nbat",
- "Nkgb",
- "Nkoo",
- "Nshu",
- "Ogam",
- "Olck",
- "Orkh",
- "Orya",
- "Osma",
- "Palm",
- "Pauc",
- "Perm",
- "Phag",
- "Phli",
- "Phlp",
- "Phlv",
- "Phnx",
- "Plrd",
- "Prti",
- "Qaak",
- "Rjng",
- "Roro",
- "Runr",
- "Samr",
- "Sara",
- "Sarb",
- "Saur",
- "Sgnw",
- "Shaw",
- "Shrd",
- "Sidd",
- "Sind",
- "Sinh",
- "Sora",
- "Sund",
- "Sylo",
- "Syrc",
- "Syre",
- "Syrj",
- "Syrn",
- "Tagb",
- "Takr",
- "Tale",
- "Talu",
- "Taml",
- "Tang",
- "Tavt",
- "Telu",
- "Teng",
- "Tfng",
- "Tglg",
- "Thaa",
- "Thai",
- "Tibt",
- "Tirh",
- "Ugar",
- "Vaii",
- "Visp",
- "Wara",
- "Wole",
- "Xpeo",
- "Xsux",
- "Yiii",
- "Zinh",
- "Zmth",
- "Zsym",
- "Zxxx",
- "Zyyy",
- "Zzzz",
- };
-
- if ((unsigned int)s >= (sizeof(scripts)/sizeof(scripts[0])))
- return "----";
- return scripts[(unsigned int)s];
- }
|