eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ucd.h 46KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. /* Unicode Character Database API
  2. *
  3. * Copyright (C) 2012-2018 Reece H. Dunn
  4. *
  5. * This file is part of ucd-tools.
  6. *
  7. * ucd-tools is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * ucd-tools is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef UNICODE_CHARACTER_DATA_H
  21. #define UNICODE_CHARACTER_DATA_H
  22. #include <stdint.h>
  23. #ifdef __cplusplus
  24. extern "C"
  25. {
  26. #endif
  27. /** @brief Represents a Unicode codepoint.
  28. */
  29. typedef uint32_t codepoint_t;
  30. /** @brief Unicode General Category Groups
  31. * @see http://www.unicode.org/reports/tr44/
  32. */
  33. typedef enum ucd_category_group_
  34. {
  35. UCD_CATEGORY_GROUP_C, /**< @brief Other */
  36. UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
  37. UCD_CATEGORY_GROUP_L, /**< @brief Letter */
  38. UCD_CATEGORY_GROUP_M, /**< @brief Mark */
  39. UCD_CATEGORY_GROUP_N, /**< @brief Number */
  40. UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
  41. UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
  42. UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
  43. } ucd_category_group;
  44. /** @brief Get a string representation of the category_group enumeration value.
  45. *
  46. * @param c The value to get the string representation for.
  47. *
  48. * @return The string representation, or "-" if the value is not recognized.
  49. */
  50. const char *ucd_get_category_group_string(ucd_category_group c);
  51. /** @brief Unicode General Category Values
  52. * @see http://www.unicode.org/reports/tr44/
  53. */
  54. typedef enum ucd_category_
  55. {
  56. UCD_CATEGORY_Cc, /**< @brief Control Character */
  57. UCD_CATEGORY_Cf, /**< @brief Format Control Character */
  58. UCD_CATEGORY_Cn, /**< @brief Unassigned */
  59. UCD_CATEGORY_Co, /**< @brief Private Use */
  60. UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
  61. UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
  62. UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
  63. UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
  64. UCD_CATEGORY_Lo, /**< @brief Other Letter */
  65. UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
  66. UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
  67. UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
  68. UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
  69. UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
  70. UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
  71. UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
  72. UCD_CATEGORY_No, /**< @brief Other Number */
  73. UCD_CATEGORY_Pc, /**< @brief Connector */
  74. UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
  75. UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
  76. UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
  77. UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
  78. UCD_CATEGORY_Po, /**< @brief Other */
  79. UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
  80. UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
  81. UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
  82. UCD_CATEGORY_Sm, /**< @brief Math Symbol */
  83. UCD_CATEGORY_So, /**< @brief Other Symbol */
  84. UCD_CATEGORY_Zl, /**< @brief Line Separator */
  85. UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
  86. UCD_CATEGORY_Zs, /**< @brief Space Separator */
  87. } ucd_category;
  88. /** @brief Get a string representation of the category enumeration value.
  89. *
  90. * @param c The value to get the string representation for.
  91. *
  92. * @return The string representation, or "--" if the value is not recognized.
  93. */
  94. const char *ucd_get_category_string(ucd_category c);
  95. /** @brief Lookup the General Category Group for a General Category.
  96. *
  97. * @param c The General Category to lookup.
  98. * @return The General Category Group of the General Category.
  99. */
  100. ucd_category_group ucd_get_category_group_for_category(ucd_category c);
  101. /** @brief Lookup the General Category Group for a Unicode codepoint.
  102. *
  103. * @param c The Unicode codepoint to lookup.
  104. * @return The General Category Group of the Unicode codepoint.
  105. */
  106. ucd_category_group ucd_lookup_category_group(codepoint_t c);
  107. /** @brief Lookup the General Category for a Unicode codepoint.
  108. *
  109. * @param c The Unicode codepoint to lookup.
  110. * @return The General Category of the Unicode codepoint.
  111. */
  112. ucd_category ucd_lookup_category(codepoint_t c);
  113. /** @brief Unicode Script
  114. * @see http://www.iana.org/assignments/language-subtag-registry
  115. * @see http://www.unicode.org/iso15924/iso15924-codes.html
  116. */
  117. typedef enum ucd_script_
  118. {
  119. UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
  120. UCD_SCRIPT_Afak, /**< @brief Afaka Script */
  121. UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
  122. UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
  123. UCD_SCRIPT_Arab, /**< @brief Arabic Script */
  124. UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
  125. UCD_SCRIPT_Armn, /**< @brief Armenian Script */
  126. UCD_SCRIPT_Avst, /**< @brief Avestan Script */
  127. UCD_SCRIPT_Bali, /**< @brief Balinese Script */
  128. UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
  129. UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
  130. UCD_SCRIPT_Batk, /**< @brief Batak Script */
  131. UCD_SCRIPT_Beng, /**< @brief Bengali Script */
  132. UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
  133. UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
  134. UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
  135. UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
  136. UCD_SCRIPT_Brai, /**< @brief Braille Script */
  137. UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
  138. UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
  139. UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
  140. UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
  141. UCD_SCRIPT_Cari, /**< @brief Carian Script */
  142. UCD_SCRIPT_Cham, /**< @brief Cham Script */
  143. UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
  144. UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
  145. UCD_SCRIPT_Copt, /**< @brief Coptic Script */
  146. UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
  147. UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
  148. UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
  149. UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
  150. UCD_SCRIPT_Dogr, /**< @brief Dogra Script */
  151. UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
  152. UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
  153. UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
  154. UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
  155. UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
  156. UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
  157. UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
  158. UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
  159. UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
  160. UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
  161. UCD_SCRIPT_Gong, /**< @brief Gunjala Gondi */
  162. UCD_SCRIPT_Gonm, /**< @brief Masaram Gondi */
  163. UCD_SCRIPT_Goth, /**< @brief Gothic Script */
  164. UCD_SCRIPT_Gran, /**< @brief Grantha Script */
  165. UCD_SCRIPT_Grek, /**< @brief Greek Script */
  166. UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
  167. UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
  168. UCD_SCRIPT_Hang, /**< @brief Hangul Script */
  169. UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
  170. UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
  171. UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
  172. UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
  173. UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
  174. UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
  175. UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
  176. UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
  177. UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
  178. UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
  179. UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
  180. UCD_SCRIPT_Inds, /**< @brief Indus Script */
  181. UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
  182. UCD_SCRIPT_Java, /**< @brief Javanese Script */
  183. UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
  184. UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
  185. UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
  186. UCD_SCRIPT_Kana, /**< @brief Katakana Script */
  187. UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
  188. UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
  189. UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
  190. UCD_SCRIPT_Knda, /**< @brief Kannada Script */
  191. UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
  192. UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
  193. UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
  194. UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
  195. UCD_SCRIPT_Laoo, /**< @brief Lao Script */
  196. UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
  197. UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
  198. UCD_SCRIPT_Latn, /**< @brief Latin Script */
  199. UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
  200. UCD_SCRIPT_Limb, /**< @brief Limbu Script */
  201. UCD_SCRIPT_Lina, /**< @brief Linear A Script */
  202. UCD_SCRIPT_Linb, /**< @brief Linear B Script */
  203. UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
  204. UCD_SCRIPT_Loma, /**< @brief Loma Script */
  205. UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
  206. UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
  207. UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
  208. UCD_SCRIPT_Maka, /**< @brief Makasar Script */
  209. UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
  210. UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
  211. UCD_SCRIPT_Marc, /**< @brief Marchen Script */
  212. UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
  213. UCD_SCRIPT_Medf, /**< @brief Medefaidrin (Oberi Okaime) Script */
  214. UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
  215. UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
  216. UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
  217. UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
  218. UCD_SCRIPT_Modi, /**< @brief Modi Script */
  219. UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
  220. UCD_SCRIPT_Moon, /**< @brief Moon Script */
  221. UCD_SCRIPT_Mroo, /**< @brief Mro Script */
  222. UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
  223. UCD_SCRIPT_Mult, /**< @brief Multani Script */
  224. UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
  225. UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
  226. UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
  227. UCD_SCRIPT_Newa, /**< @brief Newa Script */
  228. UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
  229. UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
  230. UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
  231. UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
  232. UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
  233. UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
  234. UCD_SCRIPT_Orya, /**< @brief Oriya Script */
  235. UCD_SCRIPT_Osge, /**< @brief Osage Script */
  236. UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
  237. UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
  238. UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
  239. UCD_SCRIPT_Perm, /**< @brief Old Permic */
  240. UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
  241. UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
  242. UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
  243. UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
  244. UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
  245. UCD_SCRIPT_Plrd, /**< @brief Miao Script */
  246. UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
  247. UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
  248. UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
  249. UCD_SCRIPT_Rohg, /**< @brief Hanifi Rohingya Script */
  250. UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
  251. UCD_SCRIPT_Runr, /**< @brief Runic Script */
  252. UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
  253. UCD_SCRIPT_Sara, /**< @brief Sarati Script */
  254. UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
  255. UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
  256. UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
  257. UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
  258. UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
  259. UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
  260. UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
  261. UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
  262. UCD_SCRIPT_Sogd, /**< @brief Sogdian Script */
  263. UCD_SCRIPT_Sogo, /**< @brief Old Sogdian Script */
  264. UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
  265. UCD_SCRIPT_Soyo, /**< @brief Soyombo */
  266. UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
  267. UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
  268. UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
  269. UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
  270. UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
  271. UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
  272. UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
  273. UCD_SCRIPT_Takr, /**< @brief Takri Script */
  274. UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
  275. UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
  276. UCD_SCRIPT_Taml, /**< @brief Tamil Script */
  277. UCD_SCRIPT_Tang, /**< @brief Tangut Script */
  278. UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
  279. UCD_SCRIPT_Telu, /**< @brief Telugu Script */
  280. UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
  281. UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
  282. UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
  283. UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
  284. UCD_SCRIPT_Thai, /**< @brief Thai Script */
  285. UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
  286. UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
  287. UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
  288. UCD_SCRIPT_Vaii, /**< @brief Vai Script */
  289. UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
  290. UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
  291. UCD_SCRIPT_Wole, /**< @brief Woleai Script */
  292. UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
  293. UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
  294. UCD_SCRIPT_Yiii, /**< @brief Yi Script */
  295. UCD_SCRIPT_Zanb, /**< @brief Zanabazar Square */
  296. UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
  297. UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
  298. UCD_SCRIPT_Zsym, /**< @brief Symbols */
  299. UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
  300. UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
  301. UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
  302. } ucd_script;
  303. /** @brief Get a string representation of the script enumeration value.
  304. *
  305. * @param s The value to get the string representation for.
  306. *
  307. * @return The string representation, or "----" if the value is not recognized.
  308. */
  309. const char *ucd_get_script_string(ucd_script s);
  310. /** @brief Lookup the Script for a Unicode codepoint.
  311. *
  312. * @param c The Unicode codepoint to lookup.
  313. * @return The Script of the Unicode codepoint.
  314. */
  315. ucd_script ucd_lookup_script(codepoint_t c);
  316. /** @brief Properties
  317. */
  318. typedef uint64_t ucd_property;
  319. #define UCD_PROPERTY_WHITE_SPACE 0x0000000000000001ull /**< @brief White_Space */
  320. #define UCD_PROPERTY_BIDI_CONTROL 0x0000000000000002ull /**< @brief Bidi_Control */
  321. #define UCD_PROPERTY_JOIN_CONTROL 0x0000000000000004ull /**< @brief Join_Control */
  322. #define UCD_PROPERTY_DASH 0x0000000000000008ull /**< @brief Dash */
  323. #define UCD_PROPERTY_HYPHEN 0x0000000000000010ull /**< @brief Hyphen */
  324. #define UCD_PROPERTY_QUOTATION_MARK 0x0000000000000020ull /**< @brief Quotation_Mark */
  325. #define UCD_PROPERTY_TERMINAL_PUNCTUATION 0x0000000000000040ull /**< @brief Terminal_Punctuation */
  326. #define UCD_PROPERTY_OTHER_MATH 0x0000000000000080ull /**< @brief Other_Math */
  327. #define UCD_PROPERTY_HEX_DIGIT 0x0000000000000100ull /**< @brief Hex_Digit */
  328. #define UCD_PROPERTY_ASCII_HEX_DIGIT 0x0000000000000200ull /**< @brief ASCII_Hex_Digit */
  329. #define UCD_PROPERTY_OTHER_ALPHABETIC 0x0000000000000400ull /**< @brief Other_Alphabetic */
  330. #define UCD_PROPERTY_IDEOGRAPHIC 0x0000000000000800ull /**< @brief Ideographic */
  331. #define UCD_PROPERTY_DIACRITIC 0x0000000000001000ull /**< @brief Diacritic */
  332. #define UCD_PROPERTY_EXTENDER 0x0000000000002000ull /**< @brief Extender */
  333. #define UCD_PROPERTY_OTHER_LOWERCASE 0x0000000000004000ull /**< @brief Other_Lowercase */
  334. #define UCD_PROPERTY_OTHER_UPPERCASE 0x0000000000008000ull /**< @brief Other_Uppercase */
  335. #define UCD_PROPERTY_NONCHARACTER_CODE_POINT 0x0000000000010000ull /**< @brief Noncharacter_Code_Point */
  336. #define UCD_PROPERTY_OTHER_GRAPHEME_EXTEND 0x0000000000020000ull /**< @brief Other_Grapheme_Extend */
  337. #define UCD_PROPERTY_IDS_BINARY_OPERATOR 0x0000000000040000ull /**< @brief IDS_Binary_Operator */
  338. #define UCD_PROPERTY_IDS_TRINARY_OPERATOR 0x0000000000080000ull /**< @brief IDS_Trinary_Operator */
  339. #define UCD_PROPERTY_RADICAL 0x0000000000100000ull /**< @brief Radical */
  340. #define UCD_PROPERTY_UNIFIED_IDEOGRAPH 0x0000000000200000ull /**< @brief Unified_Ideograph */
  341. #define UCD_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT 0x0000000000400000ull /**< @brief Other_Default_Ignorable_Code_Point */
  342. #define UCD_PROPERTY_DEPRECATED 0x0000000000800000ull /**< @brief Deprecated */
  343. #define UCD_PROPERTY_SOFT_DOTTED 0x0000000001000000ull /**< @brief Soft_Dotted */
  344. #define UCD_PROPERTY_LOGICAL_ORDER_EXCEPTION 0x0000000002000000ull /**< @brief Logical_Order_Exception */
  345. #define UCD_PROPERTY_OTHER_ID_START 0x0000000004000000ull /**< @brief Other_ID_Start */
  346. #define UCD_PROPERTY_OTHER_ID_CONTINUE 0x0000000008000000ull /**< @brief Other_ID_Continue */
  347. #define UCD_PROPERTY_SENTENCE_TERMINAL 0x0000000010000000ull /**< @brief Sentence_Terminal */
  348. #define UCD_PROPERTY_VARIATION_SELECTOR 0x0000000020000000ull /**< @brief Variation_Selector */
  349. #define UCD_PROPERTY_PATTERN_WHITE_SPACE 0x0000000040000000ull /**< @brief Pattern_White_Space */
  350. #define UCD_PROPERTY_PATTERN_SYNTAX 0x0000000080000000ull /**< @brief Pattern_Syntax */
  351. #define UCD_PROPERTY_PREPENDED_CONCATENATION_MARK 0x0000000100000000ull /**< @brief Prepended_Concatenation_Mark */
  352. #define UCD_PROPERTY_EMOJI 0x0000000200000000ull /**< @brief Emoji */
  353. #define UCD_PROPERTY_EMOJI_PRESENTATION 0x0000000400000000ull /**< @brief Emoji_Presentation */
  354. #define UCD_PROPERTY_EMOJI_MODIFIER 0x0000000800000000ull /**< @brief Emoji_Modifier */
  355. #define UCD_PROPERTY_EMOJI_MODIFIER_BASE 0x0000001000000000ull /**< @brief Emoji_Modifier_Base */
  356. #define UCD_PROPERTY_REGIONAL_INDICATOR 0x0000002000000000ull /**< @brief Regional_Indicator */
  357. #define UCD_PROPERTY_EMOJI_COMPONENT 0x0000004000000000ull /**< @brief Emoji_Component */
  358. #define UCD_PROPERTY_EXTENDED_PICTOGRAPHIC 0x0000008000000000ull /**< @brief Extended_Pictographic */
  359. /** @brief Return the properties of the specified codepoint.
  360. *
  361. * @param c The Unicode codepoint to lookup.
  362. * @param category The General Category of the codepoint.
  363. * @return The properties associated with the codepoint.
  364. */
  365. ucd_property ucd_properties(codepoint_t c, ucd_category category);
  366. /** @brief Is the codepoint in the 'alnum' class?
  367. *
  368. * @param c The Unicode codepoint to check.
  369. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  370. */
  371. int ucd_isalnum(codepoint_t c);
  372. /** @brief Is the codepoint in the 'alpha' class?
  373. *
  374. * @param c The Unicode codepoint to check.
  375. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  376. */
  377. int ucd_isalpha(codepoint_t c);
  378. /** @brief Is the codepoint in the 'blank' class?
  379. *
  380. * @param c The Unicode codepoint to check.
  381. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  382. */
  383. int ucd_isblank(codepoint_t c);
  384. /** @brief Is the codepoint in the 'cntrl' class?
  385. *
  386. * @param c The Unicode codepoint to check.
  387. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  388. */
  389. int ucd_iscntrl(codepoint_t c);
  390. /** @brief Is the codepoint in the 'digit' class?
  391. *
  392. * @param c The Unicode codepoint to check.
  393. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  394. */
  395. int ucd_isdigit(codepoint_t c);
  396. /** @brief Is the codepoint in the 'graph' class?
  397. *
  398. * @param c The Unicode codepoint to check.
  399. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  400. */
  401. int ucd_isgraph(codepoint_t c);
  402. /** @brief Is the codepoint in the 'lower' class?
  403. *
  404. * @param c The Unicode codepoint to check.
  405. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  406. */
  407. int ucd_islower(codepoint_t c);
  408. /** @brief Is the codepoint in the 'print' class?
  409. *
  410. * @param c The Unicode codepoint to check.
  411. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  412. */
  413. int ucd_isprint(codepoint_t c);
  414. /** @brief Is the codepoint in the 'punct' class?
  415. *
  416. * @param c The Unicode codepoint to check.
  417. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  418. */
  419. int ucd_ispunct(codepoint_t c);
  420. /** @brief Is the codepoint in the 'space' class?
  421. *
  422. * @param c The Unicode codepoint to check.
  423. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  424. */
  425. int ucd_isspace(codepoint_t c);
  426. /** @brief Is the codepoint in the 'upper' class?
  427. *
  428. * @param c The Unicode codepoint to check.
  429. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  430. */
  431. int ucd_isupper(codepoint_t c);
  432. /** @brief Is the codepoint in the 'xdigit' class?
  433. *
  434. * @param c The Unicode codepoint to check.
  435. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  436. */
  437. int ucd_isxdigit(codepoint_t c);
  438. /** @brief Convert the Unicode codepoint to upper-case.
  439. *
  440. * This function only uses the simple case mapping present in the
  441. * UnicodeData file. The data in SpecialCasing requires Unicode
  442. * codepoints to be mapped to multiple codepoints.
  443. *
  444. * @param c The Unicode codepoint to convert.
  445. * @return The upper-case Unicode codepoint for this codepoint, or
  446. * this codepoint if there is no upper-case codepoint.
  447. */
  448. codepoint_t ucd_toupper(codepoint_t c);
  449. /** @brief Convert the Unicode codepoint to lower-case.
  450. *
  451. * This function only uses the simple case mapping present in the
  452. * UnicodeData file. The data in SpecialCasing requires Unicode
  453. * codepoints to be mapped to multiple codepoints.
  454. *
  455. * @param c The Unicode codepoint to convert.
  456. * @return The lower-case Unicode codepoint for this codepoint, or
  457. * this codepoint if there is no upper-case codepoint.
  458. */
  459. codepoint_t ucd_tolower(codepoint_t c);
  460. /** @brief Convert the Unicode codepoint to title-case.
  461. *
  462. * This function only uses the simple case mapping present in the
  463. * UnicodeData file. The data in SpecialCasing requires Unicode
  464. * codepoints to be mapped to multiple codepoints.
  465. *
  466. * @param c The Unicode codepoint to convert.
  467. * @return The title-case Unicode codepoint for this codepoint, or
  468. * this codepoint if there is no upper-case codepoint.
  469. */
  470. codepoint_t ucd_totitle(codepoint_t c);
  471. #ifdef __cplusplus
  472. }
  473. /** @brief Unicode Character Database
  474. */
  475. namespace ucd
  476. {
  477. /** @brief Represents a Unicode codepoint.
  478. */
  479. using ::codepoint_t;
  480. /** @brief Unicode General Category Groups
  481. * @see http://www.unicode.org/reports/tr44/
  482. */
  483. enum category_group
  484. {
  485. C = UCD_CATEGORY_GROUP_C, /**< @brief Other */
  486. I = UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
  487. L = UCD_CATEGORY_GROUP_L, /**< @brief Letter */
  488. M = UCD_CATEGORY_GROUP_M, /**< @brief Mark */
  489. N = UCD_CATEGORY_GROUP_N, /**< @brief Number */
  490. P = UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
  491. S = UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
  492. Z = UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
  493. };
  494. /** @brief Get a string representation of the category_group enumeration value.
  495. *
  496. * @param c The value to get the string representation for.
  497. *
  498. * @return The string representation, or "-" if the value is not recognized.
  499. */
  500. inline const char *get_category_group_string(category_group c)
  501. {
  502. return ucd_get_category_group_string((ucd_category_group)c);
  503. }
  504. /** @brief Unicode General Category Values
  505. * @see http://www.unicode.org/reports/tr44/
  506. */
  507. enum category
  508. {
  509. Cc = UCD_CATEGORY_Cc, /**< @brief Control Character */
  510. Cf = UCD_CATEGORY_Cf, /**< @brief Format Control Character */
  511. Cn = UCD_CATEGORY_Cn, /**< @brief Unassigned */
  512. Co = UCD_CATEGORY_Co, /**< @brief Private Use */
  513. Cs = UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
  514. Ii = UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
  515. Ll = UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
  516. Lm = UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
  517. Lo = UCD_CATEGORY_Lo, /**< @brief Other Letter */
  518. Lt = UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
  519. Lu = UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
  520. Mc = UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
  521. Me = UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
  522. Mn = UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
  523. Nd = UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
  524. Nl = UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
  525. No = UCD_CATEGORY_No, /**< @brief Other Number */
  526. Pc = UCD_CATEGORY_Pc, /**< @brief Connector */
  527. Pd = UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
  528. Pe = UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
  529. Pf = UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
  530. Pi = UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
  531. Po = UCD_CATEGORY_Po, /**< @brief Other */
  532. Ps = UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
  533. Sc = UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
  534. Sk = UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
  535. Sm = UCD_CATEGORY_Sm, /**< @brief Math Symbol */
  536. So = UCD_CATEGORY_So, /**< @brief Other Symbol */
  537. Zl = UCD_CATEGORY_Zl, /**< @brief Line Separator */
  538. Zp = UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
  539. Zs = UCD_CATEGORY_Zs, /**< @brief Space Separator */
  540. };
  541. /** @brief Get a string representation of the category enumeration value.
  542. *
  543. * @param c The value to get the string representation for.
  544. *
  545. * @return The string representation, or "--" if the value is not recognized.
  546. */
  547. inline const char *get_category_string(category c)
  548. {
  549. return ucd_get_category_string((ucd_category)c);
  550. }
  551. /** @brief Lookup the General Category Group for a General Category.
  552. *
  553. * @param c The General Category to lookup.
  554. * @return The General Category Group of the General Category.
  555. */
  556. inline category_group lookup_category_group(category c)
  557. {
  558. return (category_group)ucd_get_category_group_for_category((ucd_category)c);
  559. }
  560. /** @brief Lookup the General Category Group for a Unicode codepoint.
  561. *
  562. * @param c The Unicode codepoint to lookup.
  563. * @return The General Category Group of the Unicode codepoint.
  564. */
  565. inline category_group lookup_category_group(codepoint_t c)
  566. {
  567. return (category_group)ucd_lookup_category_group(c);
  568. }
  569. /** @brief Lookup the General Category for a Unicode codepoint.
  570. *
  571. * @param c The Unicode codepoint to lookup.
  572. * @return The General Category of the Unicode codepoint.
  573. */
  574. inline category lookup_category(codepoint_t c)
  575. {
  576. return (category)ucd_lookup_category(c);
  577. }
  578. /** @brief Unicode Script
  579. * @see http://www.iana.org/assignments/language-subtag-registry
  580. * @see http://www.unicode.org/iso15924/iso15924-codes.html
  581. */
  582. enum script
  583. {
  584. Adlm = UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
  585. Afak = UCD_SCRIPT_Afak, /**< @brief Afaka Script */
  586. Aghb = UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
  587. Ahom = UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
  588. Arab = UCD_SCRIPT_Arab, /**< @brief Arabic Script */
  589. Armi = UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
  590. Armn = UCD_SCRIPT_Armn, /**< @brief Armenian Script */
  591. Avst = UCD_SCRIPT_Avst, /**< @brief Avestan Script */
  592. Bali = UCD_SCRIPT_Bali, /**< @brief Balinese Script */
  593. Bamu = UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
  594. Bass = UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
  595. Batk = UCD_SCRIPT_Batk, /**< @brief Batak Script */
  596. Beng = UCD_SCRIPT_Beng, /**< @brief Bengali Script */
  597. Bhks = UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
  598. Blis = UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
  599. Bopo = UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
  600. Brah = UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
  601. Brai = UCD_SCRIPT_Brai, /**< @brief Braille Script */
  602. Bugi = UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
  603. Buhd = UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
  604. Cakm = UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
  605. Cans = UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
  606. Cari = UCD_SCRIPT_Cari, /**< @brief Carian Script */
  607. Cham = UCD_SCRIPT_Cham, /**< @brief Cham Script */
  608. Cher = UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
  609. Cirt = UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
  610. Copt = UCD_SCRIPT_Copt, /**< @brief Coptic Script */
  611. Cprt = UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
  612. Cyrl = UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
  613. Cyrs = UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
  614. Deva = UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
  615. Dogr = UCD_SCRIPT_Dogr, /**< @brief Dogra Script */
  616. Dsrt = UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
  617. Dupl = UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
  618. Egyd = UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
  619. Egyh = UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
  620. Egyp = UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
  621. Elba = UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
  622. Ethi = UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
  623. Geok = UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
  624. Geor = UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
  625. Glag = UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
  626. Gong = UCD_SCRIPT_Gong, /**< @brief Gunjala Gondi */
  627. Gonm = UCD_SCRIPT_Gonm, /**< @brief Masaram Gondi */
  628. Goth = UCD_SCRIPT_Goth, /**< @brief Gothic Script */
  629. Gran = UCD_SCRIPT_Gran, /**< @brief Grantha Script */
  630. Grek = UCD_SCRIPT_Grek, /**< @brief Greek Script */
  631. Gujr = UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
  632. Guru = UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
  633. Hang = UCD_SCRIPT_Hang, /**< @brief Hangul Script */
  634. Hani = UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
  635. Hano = UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
  636. Hans = UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
  637. Hant = UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
  638. Hatr = UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
  639. Hebr = UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
  640. Hira = UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
  641. Hluw = UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
  642. Hmng = UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
  643. Hrkt = UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
  644. Hung = UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
  645. Inds = UCD_SCRIPT_Inds, /**< @brief Indus Script */
  646. Ital = UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
  647. Java = UCD_SCRIPT_Java, /**< @brief Javanese Script */
  648. Jpan = UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
  649. Jurc = UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
  650. Kali = UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
  651. Kana = UCD_SCRIPT_Kana, /**< @brief Katakana Script */
  652. Khar = UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
  653. Khmr = UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
  654. Khoj = UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
  655. Knda = UCD_SCRIPT_Knda, /**< @brief Kannada Script */
  656. Kore = UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
  657. Kpel = UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
  658. Kthi = UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
  659. Lana = UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
  660. Laoo = UCD_SCRIPT_Laoo, /**< @brief Lao Script */
  661. Latf = UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
  662. Latg = UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
  663. Latn = UCD_SCRIPT_Latn, /**< @brief Latin Script */
  664. Lepc = UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
  665. Limb = UCD_SCRIPT_Limb, /**< @brief Limbu Script */
  666. Lina = UCD_SCRIPT_Lina, /**< @brief Linear A Script */
  667. Linb = UCD_SCRIPT_Linb, /**< @brief Linear B Script */
  668. Lisu = UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
  669. Loma = UCD_SCRIPT_Loma, /**< @brief Loma Script */
  670. Lyci = UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
  671. Lydi = UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
  672. Mahj = UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
  673. Maka = UCD_SCRIPT_Maka, /**< @brief Mahajani Script */
  674. Mand = UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
  675. Mani = UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
  676. Marc = UCD_SCRIPT_Marc, /**< @brief Marchen Script */
  677. Maya = UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
  678. Medf = UCD_SCRIPT_Medf, /**< @brief Medefaidrin (Oberi Okaime) Script */
  679. Mend = UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
  680. Merc = UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
  681. Mero = UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
  682. Mlym = UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
  683. Modi = UCD_SCRIPT_Modi, /**< @brief Modi Script */
  684. Mong = UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
  685. Moon = UCD_SCRIPT_Moon, /**< @brief Moon Script */
  686. Mroo = UCD_SCRIPT_Mroo, /**< @brief Mro Script */
  687. Mtei = UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
  688. Mult = UCD_SCRIPT_Mult, /**< @brief Multani Script */
  689. Mymr = UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
  690. Narb = UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
  691. Nbat = UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
  692. Newa = UCD_SCRIPT_Newa, /**< @brief Newa Script */
  693. Nkgb = UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
  694. Nkoo = UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
  695. Nshu = UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
  696. Ogam = UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
  697. Olck = UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
  698. Orkh = UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
  699. Orya = UCD_SCRIPT_Orya, /**< @brief Oriya Script */
  700. Osge = UCD_SCRIPT_Osge, /**< @brief Osage Script */
  701. Osma = UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
  702. Palm = UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
  703. Pauc = UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
  704. Perm = UCD_SCRIPT_Perm, /**< @brief Old Permic */
  705. Phag = UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
  706. Phli = UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
  707. Phlp = UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
  708. Phlv = UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
  709. Phnx = UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
  710. Plrd = UCD_SCRIPT_Plrd, /**< @brief Miao Script */
  711. Prti = UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
  712. Qaak = UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
  713. Rjng = UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
  714. Rohg = UCD_SCRIPT_Rohg, /**< @brief Hanifi Rohingya Script */
  715. Roro = UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
  716. Runr = UCD_SCRIPT_Runr, /**< @brief Runic Script */
  717. Samr = UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
  718. Sara = UCD_SCRIPT_Sara, /**< @brief Sarati Script */
  719. Sarb = UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
  720. Saur = UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
  721. Sgnw = UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
  722. Shaw = UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
  723. Shrd = UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
  724. Sidd = UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
  725. Sind = UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
  726. Sinh = UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
  727. Sogd = UCD_SCRIPT_Sogd, /**< @brief Sogdian Script */
  728. Sogo = UCD_SCRIPT_Sogo, /**< @brief Old Sogdian Script */
  729. Sora = UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
  730. Soyo = UCD_SCRIPT_Soyo, /**< @brief Soyombo */
  731. Sund = UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
  732. Sylo = UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
  733. Syrc = UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
  734. Syre = UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
  735. Syrj = UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
  736. Syrn = UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
  737. Tagb = UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
  738. Takr = UCD_SCRIPT_Takr, /**< @brief Takri Script */
  739. Tale = UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
  740. Talu = UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
  741. Taml = UCD_SCRIPT_Taml, /**< @brief Tamil Script */
  742. Tang = UCD_SCRIPT_Tang, /**< @brief Tangut Script */
  743. Tavt = UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
  744. Telu = UCD_SCRIPT_Telu, /**< @brief Telugu Script */
  745. Teng = UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
  746. Tfng = UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
  747. Tglg = UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
  748. Thaa = UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
  749. Thai = UCD_SCRIPT_Thai, /**< @brief Thai Script */
  750. Tibt = UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
  751. Tirh = UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
  752. Ugar = UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
  753. Vaii = UCD_SCRIPT_Vaii, /**< @brief Vai Script */
  754. Visp = UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
  755. Wara = UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
  756. Wole = UCD_SCRIPT_Wole, /**< @brief Woleai Script */
  757. Xpeo = UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
  758. Xsux = UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
  759. Yiii = UCD_SCRIPT_Yiii, /**< @brief Yi Script */
  760. Zanb = UCD_SCRIPT_Zanb, /**< @brief Zanabazar Square */
  761. Zinh = UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
  762. Zmth = UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
  763. Zsym = UCD_SCRIPT_Zsym, /**< @brief Symbols */
  764. Zxxx = UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
  765. Zyyy = UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
  766. Zzzz = UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
  767. };
  768. /** @brief Get a string representation of the script enumeration value.
  769. *
  770. * @param s The value to get the string representation for.
  771. *
  772. * @return The string representation, or "----" if the value is not recognized.
  773. */
  774. inline const char *get_script_string(script s)
  775. {
  776. return ucd_get_script_string((ucd_script)s);
  777. }
  778. /** @brief Lookup the Script for a Unicode codepoint.
  779. *
  780. * @param c The Unicode codepoint to lookup.
  781. * @return The Script of the Unicode codepoint.
  782. */
  783. inline script lookup_script(codepoint_t c)
  784. {
  785. return (script)ucd_lookup_script(c);
  786. }
  787. /** @brief Properties
  788. */
  789. typedef ucd_property property;
  790. enum
  791. {
  792. White_Space = UCD_PROPERTY_WHITE_SPACE, /**< @brief White_Space */
  793. Bidi_Control = UCD_PROPERTY_BIDI_CONTROL, /**< @brief Bidi_Control */
  794. Join_Control = UCD_PROPERTY_JOIN_CONTROL, /**< @brief Join_Control */
  795. Dash = UCD_PROPERTY_DASH, /**< @brief Dash */
  796. Hyphen = UCD_PROPERTY_HYPHEN, /**< @brief Hyphen */
  797. Quotation_Mark = UCD_PROPERTY_QUOTATION_MARK, /**< @brief Quotation_Mark */
  798. Terminal_Punctuation = UCD_PROPERTY_TERMINAL_PUNCTUATION, /**< @brief Terminal_Punctuation */
  799. Other_Math = UCD_PROPERTY_OTHER_MATH, /**< @brief Other_Math */
  800. Hex_Digit = UCD_PROPERTY_HEX_DIGIT, /**< @brief Hex_Digit */
  801. ASCII_Hex_Digit = UCD_PROPERTY_ASCII_HEX_DIGIT, /**< @brief ASCII_Hex_Digit */
  802. Other_Alphabetic = UCD_PROPERTY_OTHER_ALPHABETIC, /**< @brief Other_Alphabetic */
  803. Ideographic = UCD_PROPERTY_IDEOGRAPHIC, /**< @brief Ideographic */
  804. Diacritic = UCD_PROPERTY_DIACRITIC, /**< @brief Diacritic */
  805. Extender = UCD_PROPERTY_EXTENDER, /**< @brief Extender */
  806. Other_Lowercase = UCD_PROPERTY_OTHER_LOWERCASE, /**< @brief Other_Lowercase */
  807. Other_Uppercase = UCD_PROPERTY_OTHER_UPPERCASE, /**< @brief Other_Uppercase */
  808. Noncharacter_Code_Point = UCD_PROPERTY_NONCHARACTER_CODE_POINT, /**< @brief Noncharacter_Code_Point */
  809. Other_Grapheme_Extend = UCD_PROPERTY_OTHER_GRAPHEME_EXTEND, /**< @brief Other_Grapheme_Extend */
  810. IDS_Binary_Operator = UCD_PROPERTY_IDS_BINARY_OPERATOR, /**< @brief IDS_Binary_Operator */
  811. IDS_Trinary_Operator = UCD_PROPERTY_IDS_TRINARY_OPERATOR, /**< @brief IDS_Trinary_Operator */
  812. Radical = UCD_PROPERTY_RADICAL, /**< @brief Radical */
  813. Unified_Ideograph = UCD_PROPERTY_UNIFIED_IDEOGRAPH, /**< @brief Unified_Ideograph */
  814. Other_Default_Ignorable_Code_Point = UCD_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT, /**< @brief Other_Default_Ignorable_Code_Point */
  815. Deprecated = UCD_PROPERTY_DEPRECATED, /**< @brief Deprecated */
  816. Soft_Dotted = UCD_PROPERTY_SOFT_DOTTED, /**< @brief Soft_Dotted */
  817. Logical_Order_Exception = UCD_PROPERTY_LOGICAL_ORDER_EXCEPTION, /**< @brief Logical_Order_Exception */
  818. Other_ID_Start = UCD_PROPERTY_OTHER_ID_START, /**< @brief Other_ID_Start */
  819. Other_ID_Continue = UCD_PROPERTY_OTHER_ID_CONTINUE, /**< @brief Other_ID_Continue */
  820. Sentence_Terminal = UCD_PROPERTY_SENTENCE_TERMINAL, /**< @brief Sentence_Terminal */
  821. Variation_Selector = UCD_PROPERTY_VARIATION_SELECTOR, /**< @brief Variation_Selector */
  822. Pattern_White_Space = UCD_PROPERTY_PATTERN_WHITE_SPACE, /**< @brief Pattern_White_Space */
  823. Pattern_Syntax = UCD_PROPERTY_PATTERN_SYNTAX, /**< @brief Pattern_Syntax */
  824. Prepended_Concatenation_Mark = UCD_PROPERTY_PREPENDED_CONCATENATION_MARK, /**< @brief Prepended_Concatenation_Mark */
  825. Emoji = UCD_PROPERTY_EMOJI, /**< @brief Emoji */
  826. Emoji_Presentation = UCD_PROPERTY_EMOJI_PRESENTATION, /**< @brief Emoji_Presentation */
  827. Emoji_Modifier = UCD_PROPERTY_EMOJI_MODIFIER, /**< @brief Emoji_Modifier */
  828. Emoji_Modifier_Base = UCD_PROPERTY_EMOJI_MODIFIER_BASE, /**< @brief Emoji_Modifier_Base */
  829. Regional_Indicator = UCD_PROPERTY_REGIONAL_INDICATOR, /**< @brief Regional_Indicator */
  830. Emoji_Component = UCD_PROPERTY_EMOJI_COMPONENT, /**< @brief Emoji_Component */
  831. Extended_Pictographic = UCD_PROPERTY_EXTENDED_PICTOGRAPHIC, /**< @brief Extended_Pictographic */
  832. };
  833. /** @brief Return the properties of the specified codepoint.
  834. *
  835. * @param c The Unicode codepoint to lookup.
  836. * @param cat The General Category of the codepoint.
  837. * @return The properties associated with the codepoint.
  838. */
  839. inline property properties(codepoint_t c, category cat)
  840. {
  841. return (property)ucd_properties(c, (ucd_category)cat);
  842. }
  843. /** @brief Is the codepoint in the 'alnum' class?
  844. *
  845. * @param c The Unicode codepoint to check.
  846. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  847. */
  848. inline int isalnum(codepoint_t c)
  849. {
  850. return ucd_isalnum(c);
  851. }
  852. /** @brief Is the codepoint in the 'alpha' class?
  853. *
  854. * @param c The Unicode codepoint to check.
  855. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  856. */
  857. inline int isalpha(codepoint_t c)
  858. {
  859. return ucd_isalpha(c);
  860. }
  861. /** @brief Is the codepoint in the 'blank' class?
  862. *
  863. * @param c The Unicode codepoint to check.
  864. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  865. */
  866. inline int isblank(codepoint_t c)
  867. {
  868. return ucd_isblank(c);
  869. }
  870. /** @brief Is the codepoint in the 'cntrl' class?
  871. *
  872. * @param c The Unicode codepoint to check.
  873. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  874. */
  875. inline int iscntrl(codepoint_t c)
  876. {
  877. return ucd_iscntrl(c);
  878. }
  879. /** @brief Is the codepoint in the 'digit' class?
  880. *
  881. * @param c The Unicode codepoint to check.
  882. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  883. */
  884. inline int isdigit(codepoint_t c)
  885. {
  886. return ucd_isdigit(c);
  887. }
  888. /** @brief Is the codepoint in the 'graph' class?
  889. *
  890. * @param c The Unicode codepoint to check.
  891. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  892. */
  893. inline int isgraph(codepoint_t c)
  894. {
  895. return ucd_isgraph(c);
  896. }
  897. /** @brief Is the codepoint in the 'lower' class?
  898. *
  899. * @param c The Unicode codepoint to check.
  900. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  901. */
  902. inline int islower(codepoint_t c)
  903. {
  904. return ucd_islower(c);
  905. }
  906. /** @brief Is the codepoint in the 'print' class?
  907. *
  908. * @param c The Unicode codepoint to check.
  909. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  910. */
  911. inline int isprint(codepoint_t c)
  912. {
  913. return ucd_isprint(c);
  914. }
  915. /** @brief Is the codepoint in the 'punct' class?
  916. *
  917. * @param c The Unicode codepoint to check.
  918. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  919. */
  920. inline int ispunct(codepoint_t c)
  921. {
  922. return ucd_ispunct(c);
  923. }
  924. /** @brief Is the codepoint in the 'space' class?
  925. *
  926. * @param c The Unicode codepoint to check.
  927. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  928. */
  929. inline int isspace(codepoint_t c)
  930. {
  931. return ucd_isspace(c);
  932. }
  933. /** @brief Is the codepoint in the 'upper' class?
  934. *
  935. * @param c The Unicode codepoint to check.
  936. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  937. */
  938. inline int isupper(codepoint_t c)
  939. {
  940. return ucd_isupper(c);
  941. }
  942. /** @brief Is the codepoint in the 'xdigit' class?
  943. *
  944. * @param c The Unicode codepoint to check.
  945. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  946. */
  947. inline int isxdigit(codepoint_t c)
  948. {
  949. return ucd_isxdigit(c);
  950. }
  951. /** @brief Convert the Unicode codepoint to upper-case.
  952. *
  953. * This function only uses the simple case mapping present in the
  954. * UnicodeData file. The data in SpecialCasing requires Unicode
  955. * codepoints to be mapped to multiple codepoints.
  956. *
  957. * @param c The Unicode codepoint to convert.
  958. * @return The upper-case Unicode codepoint for this codepoint, or
  959. * this codepoint if there is no upper-case codepoint.
  960. */
  961. inline codepoint_t toupper(codepoint_t c)
  962. {
  963. return ucd_toupper(c);
  964. }
  965. /** @brief Convert the Unicode codepoint to lower-case.
  966. *
  967. * This function only uses the simple case mapping present in the
  968. * UnicodeData file. The data in SpecialCasing requires Unicode
  969. * codepoints to be mapped to multiple codepoints.
  970. *
  971. * @param c The Unicode codepoint to convert.
  972. * @return The lower-case Unicode codepoint for this codepoint, or
  973. * this codepoint if there is no upper-case codepoint.
  974. */
  975. inline codepoint_t tolower(codepoint_t c)
  976. {
  977. return ucd_tolower(c);
  978. }
  979. /** @brief Convert the Unicode codepoint to title-case.
  980. *
  981. * This function only uses the simple case mapping present in the
  982. * UnicodeData file. The data in SpecialCasing requires Unicode
  983. * codepoints to be mapped to multiple codepoints.
  984. *
  985. * @param c The Unicode codepoint to convert.
  986. * @return The title-case Unicode codepoint for this codepoint, or
  987. * this codepoint if there is no upper-case codepoint.
  988. */
  989. inline codepoint_t totitle(codepoint_t c)
  990. {
  991. return ucd_totitle(c);
  992. }
  993. }
  994. #endif
  995. #endif