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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  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. /** @brief Return the properties of the specified codepoint.
  359. *
  360. * @param c The Unicode codepoint to lookup.
  361. * @param category The General Category of the codepoint.
  362. * @return The properties associated with the codepoint.
  363. */
  364. ucd_property ucd_properties(codepoint_t c, ucd_category category);
  365. /** @brief Is the codepoint in the 'alnum' class?
  366. *
  367. * @param c The Unicode codepoint to check.
  368. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  369. */
  370. int ucd_isalnum(codepoint_t c);
  371. /** @brief Is the codepoint in the 'alpha' class?
  372. *
  373. * @param c The Unicode codepoint to check.
  374. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  375. */
  376. int ucd_isalpha(codepoint_t c);
  377. /** @brief Is the codepoint in the 'blank' class?
  378. *
  379. * @param c The Unicode codepoint to check.
  380. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  381. */
  382. int ucd_isblank(codepoint_t c);
  383. /** @brief Is the codepoint in the 'cntrl' class?
  384. *
  385. * @param c The Unicode codepoint to check.
  386. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  387. */
  388. int ucd_iscntrl(codepoint_t c);
  389. /** @brief Is the codepoint in the 'digit' class?
  390. *
  391. * @param c The Unicode codepoint to check.
  392. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  393. */
  394. int ucd_isdigit(codepoint_t c);
  395. /** @brief Is the codepoint in the 'graph' class?
  396. *
  397. * @param c The Unicode codepoint to check.
  398. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  399. */
  400. int ucd_isgraph(codepoint_t c);
  401. /** @brief Is the codepoint in the 'lower' class?
  402. *
  403. * @param c The Unicode codepoint to check.
  404. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  405. */
  406. int ucd_islower(codepoint_t c);
  407. /** @brief Is the codepoint in the 'print' class?
  408. *
  409. * @param c The Unicode codepoint to check.
  410. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  411. */
  412. int ucd_isprint(codepoint_t c);
  413. /** @brief Is the codepoint in the 'punct' class?
  414. *
  415. * @param c The Unicode codepoint to check.
  416. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  417. */
  418. int ucd_ispunct(codepoint_t c);
  419. /** @brief Is the codepoint in the 'space' class?
  420. *
  421. * @param c The Unicode codepoint to check.
  422. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  423. */
  424. int ucd_isspace(codepoint_t c);
  425. /** @brief Is the codepoint in the 'upper' class?
  426. *
  427. * @param c The Unicode codepoint to check.
  428. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  429. */
  430. int ucd_isupper(codepoint_t c);
  431. /** @brief Is the codepoint in the 'xdigit' class?
  432. *
  433. * @param c The Unicode codepoint to check.
  434. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  435. */
  436. int ucd_isxdigit(codepoint_t c);
  437. /** @brief Convert the Unicode codepoint to upper-case.
  438. *
  439. * This function only uses the simple case mapping present in the
  440. * UnicodeData file. The data in SpecialCasing requires Unicode
  441. * codepoints to be mapped to multiple codepoints.
  442. *
  443. * @param c The Unicode codepoint to convert.
  444. * @return The upper-case Unicode codepoint for this codepoint, or
  445. * this codepoint if there is no upper-case codepoint.
  446. */
  447. codepoint_t ucd_toupper(codepoint_t c);
  448. /** @brief Convert the Unicode codepoint to lower-case.
  449. *
  450. * This function only uses the simple case mapping present in the
  451. * UnicodeData file. The data in SpecialCasing requires Unicode
  452. * codepoints to be mapped to multiple codepoints.
  453. *
  454. * @param c The Unicode codepoint to convert.
  455. * @return The lower-case Unicode codepoint for this codepoint, or
  456. * this codepoint if there is no upper-case codepoint.
  457. */
  458. codepoint_t ucd_tolower(codepoint_t c);
  459. /** @brief Convert the Unicode codepoint to title-case.
  460. *
  461. * This function only uses the simple case mapping present in the
  462. * UnicodeData file. The data in SpecialCasing requires Unicode
  463. * codepoints to be mapped to multiple codepoints.
  464. *
  465. * @param c The Unicode codepoint to convert.
  466. * @return The title-case Unicode codepoint for this codepoint, or
  467. * this codepoint if there is no upper-case codepoint.
  468. */
  469. codepoint_t ucd_totitle(codepoint_t c);
  470. #ifdef __cplusplus
  471. }
  472. /** @brief Unicode Character Database
  473. */
  474. namespace ucd
  475. {
  476. /** @brief Represents a Unicode codepoint.
  477. */
  478. using ::codepoint_t;
  479. /** @brief Unicode General Category Groups
  480. * @see http://www.unicode.org/reports/tr44/
  481. */
  482. enum category_group
  483. {
  484. C = UCD_CATEGORY_GROUP_C, /**< @brief Other */
  485. I = UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
  486. L = UCD_CATEGORY_GROUP_L, /**< @brief Letter */
  487. M = UCD_CATEGORY_GROUP_M, /**< @brief Mark */
  488. N = UCD_CATEGORY_GROUP_N, /**< @brief Number */
  489. P = UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
  490. S = UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
  491. Z = UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
  492. };
  493. /** @brief Get a string representation of the category_group enumeration value.
  494. *
  495. * @param c The value to get the string representation for.
  496. *
  497. * @return The string representation, or "-" if the value is not recognized.
  498. */
  499. inline const char *get_category_group_string(category_group c)
  500. {
  501. return ucd_get_category_group_string((ucd_category_group)c);
  502. }
  503. /** @brief Unicode General Category Values
  504. * @see http://www.unicode.org/reports/tr44/
  505. */
  506. enum category
  507. {
  508. Cc = UCD_CATEGORY_Cc, /**< @brief Control Character */
  509. Cf = UCD_CATEGORY_Cf, /**< @brief Format Control Character */
  510. Cn = UCD_CATEGORY_Cn, /**< @brief Unassigned */
  511. Co = UCD_CATEGORY_Co, /**< @brief Private Use */
  512. Cs = UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
  513. Ii = UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
  514. Ll = UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
  515. Lm = UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
  516. Lo = UCD_CATEGORY_Lo, /**< @brief Other Letter */
  517. Lt = UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
  518. Lu = UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
  519. Mc = UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
  520. Me = UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
  521. Mn = UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
  522. Nd = UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
  523. Nl = UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
  524. No = UCD_CATEGORY_No, /**< @brief Other Number */
  525. Pc = UCD_CATEGORY_Pc, /**< @brief Connector */
  526. Pd = UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
  527. Pe = UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
  528. Pf = UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
  529. Pi = UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
  530. Po = UCD_CATEGORY_Po, /**< @brief Other */
  531. Ps = UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
  532. Sc = UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
  533. Sk = UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
  534. Sm = UCD_CATEGORY_Sm, /**< @brief Math Symbol */
  535. So = UCD_CATEGORY_So, /**< @brief Other Symbol */
  536. Zl = UCD_CATEGORY_Zl, /**< @brief Line Separator */
  537. Zp = UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
  538. Zs = UCD_CATEGORY_Zs, /**< @brief Space Separator */
  539. };
  540. /** @brief Get a string representation of the category enumeration value.
  541. *
  542. * @param c The value to get the string representation for.
  543. *
  544. * @return The string representation, or "--" if the value is not recognized.
  545. */
  546. inline const char *get_category_string(category c)
  547. {
  548. return ucd_get_category_string((ucd_category)c);
  549. }
  550. /** @brief Lookup the General Category Group for a General Category.
  551. *
  552. * @param c The General Category to lookup.
  553. * @return The General Category Group of the General Category.
  554. */
  555. inline category_group lookup_category_group(category c)
  556. {
  557. return (category_group)ucd_get_category_group_for_category((ucd_category)c);
  558. }
  559. /** @brief Lookup the General Category Group for a Unicode codepoint.
  560. *
  561. * @param c The Unicode codepoint to lookup.
  562. * @return The General Category Group of the Unicode codepoint.
  563. */
  564. inline category_group lookup_category_group(codepoint_t c)
  565. {
  566. return (category_group)ucd_lookup_category_group(c);
  567. }
  568. /** @brief Lookup the General Category for a Unicode codepoint.
  569. *
  570. * @param c The Unicode codepoint to lookup.
  571. * @return The General Category of the Unicode codepoint.
  572. */
  573. inline category lookup_category(codepoint_t c)
  574. {
  575. return (category)ucd_lookup_category(c);
  576. }
  577. /** @brief Unicode Script
  578. * @see http://www.iana.org/assignments/language-subtag-registry
  579. * @see http://www.unicode.org/iso15924/iso15924-codes.html
  580. */
  581. enum script
  582. {
  583. Adlm = UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
  584. Afak = UCD_SCRIPT_Afak, /**< @brief Afaka Script */
  585. Aghb = UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
  586. Ahom = UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
  587. Arab = UCD_SCRIPT_Arab, /**< @brief Arabic Script */
  588. Armi = UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
  589. Armn = UCD_SCRIPT_Armn, /**< @brief Armenian Script */
  590. Avst = UCD_SCRIPT_Avst, /**< @brief Avestan Script */
  591. Bali = UCD_SCRIPT_Bali, /**< @brief Balinese Script */
  592. Bamu = UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
  593. Bass = UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
  594. Batk = UCD_SCRIPT_Batk, /**< @brief Batak Script */
  595. Beng = UCD_SCRIPT_Beng, /**< @brief Bengali Script */
  596. Bhks = UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
  597. Blis = UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
  598. Bopo = UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
  599. Brah = UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
  600. Brai = UCD_SCRIPT_Brai, /**< @brief Braille Script */
  601. Bugi = UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
  602. Buhd = UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
  603. Cakm = UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
  604. Cans = UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
  605. Cari = UCD_SCRIPT_Cari, /**< @brief Carian Script */
  606. Cham = UCD_SCRIPT_Cham, /**< @brief Cham Script */
  607. Cher = UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
  608. Cirt = UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
  609. Copt = UCD_SCRIPT_Copt, /**< @brief Coptic Script */
  610. Cprt = UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
  611. Cyrl = UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
  612. Cyrs = UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
  613. Deva = UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
  614. Dogr = UCD_SCRIPT_Dogr, /**< @brief Dogra Script */
  615. Dsrt = UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
  616. Dupl = UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
  617. Egyd = UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
  618. Egyh = UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
  619. Egyp = UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
  620. Elba = UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
  621. Ethi = UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
  622. Geok = UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
  623. Geor = UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
  624. Glag = UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
  625. Gong = UCD_SCRIPT_Gong, /**< @brief Gunjala Gondi */
  626. Gonm = UCD_SCRIPT_Gonm, /**< @brief Masaram Gondi */
  627. Goth = UCD_SCRIPT_Goth, /**< @brief Gothic Script */
  628. Gran = UCD_SCRIPT_Gran, /**< @brief Grantha Script */
  629. Grek = UCD_SCRIPT_Grek, /**< @brief Greek Script */
  630. Gujr = UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
  631. Guru = UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
  632. Hang = UCD_SCRIPT_Hang, /**< @brief Hangul Script */
  633. Hani = UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
  634. Hano = UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
  635. Hans = UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
  636. Hant = UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
  637. Hatr = UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
  638. Hebr = UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
  639. Hira = UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
  640. Hluw = UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
  641. Hmng = UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
  642. Hrkt = UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
  643. Hung = UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
  644. Inds = UCD_SCRIPT_Inds, /**< @brief Indus Script */
  645. Ital = UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
  646. Java = UCD_SCRIPT_Java, /**< @brief Javanese Script */
  647. Jpan = UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
  648. Jurc = UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
  649. Kali = UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
  650. Kana = UCD_SCRIPT_Kana, /**< @brief Katakana Script */
  651. Khar = UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
  652. Khmr = UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
  653. Khoj = UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
  654. Knda = UCD_SCRIPT_Knda, /**< @brief Kannada Script */
  655. Kore = UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
  656. Kpel = UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
  657. Kthi = UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
  658. Lana = UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
  659. Laoo = UCD_SCRIPT_Laoo, /**< @brief Lao Script */
  660. Latf = UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
  661. Latg = UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
  662. Latn = UCD_SCRIPT_Latn, /**< @brief Latin Script */
  663. Lepc = UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
  664. Limb = UCD_SCRIPT_Limb, /**< @brief Limbu Script */
  665. Lina = UCD_SCRIPT_Lina, /**< @brief Linear A Script */
  666. Linb = UCD_SCRIPT_Linb, /**< @brief Linear B Script */
  667. Lisu = UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
  668. Loma = UCD_SCRIPT_Loma, /**< @brief Loma Script */
  669. Lyci = UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
  670. Lydi = UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
  671. Mahj = UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
  672. Maka = UCD_SCRIPT_Maka, /**< @brief Mahajani Script */
  673. Mand = UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
  674. Mani = UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
  675. Marc = UCD_SCRIPT_Marc, /**< @brief Marchen Script */
  676. Maya = UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
  677. Medf = UCD_SCRIPT_Medf, /**< @brief Medefaidrin (Oberi Okaime) Script */
  678. Mend = UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
  679. Merc = UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
  680. Mero = UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
  681. Mlym = UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
  682. Modi = UCD_SCRIPT_Modi, /**< @brief Modi Script */
  683. Mong = UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
  684. Moon = UCD_SCRIPT_Moon, /**< @brief Moon Script */
  685. Mroo = UCD_SCRIPT_Mroo, /**< @brief Mro Script */
  686. Mtei = UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
  687. Mult = UCD_SCRIPT_Mult, /**< @brief Multani Script */
  688. Mymr = UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
  689. Narb = UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
  690. Nbat = UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
  691. Newa = UCD_SCRIPT_Newa, /**< @brief Newa Script */
  692. Nkgb = UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
  693. Nkoo = UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
  694. Nshu = UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
  695. Ogam = UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
  696. Olck = UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
  697. Orkh = UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
  698. Orya = UCD_SCRIPT_Orya, /**< @brief Oriya Script */
  699. Osge = UCD_SCRIPT_Osge, /**< @brief Osage Script */
  700. Osma = UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
  701. Palm = UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
  702. Pauc = UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
  703. Perm = UCD_SCRIPT_Perm, /**< @brief Old Permic */
  704. Phag = UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
  705. Phli = UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
  706. Phlp = UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
  707. Phlv = UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
  708. Phnx = UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
  709. Plrd = UCD_SCRIPT_Plrd, /**< @brief Miao Script */
  710. Prti = UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
  711. Qaak = UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
  712. Rjng = UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
  713. Rohg = UCD_SCRIPT_Rohg, /**< @brief Hanifi Rohingya Script */
  714. Roro = UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
  715. Runr = UCD_SCRIPT_Runr, /**< @brief Runic Script */
  716. Samr = UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
  717. Sara = UCD_SCRIPT_Sara, /**< @brief Sarati Script */
  718. Sarb = UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
  719. Saur = UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
  720. Sgnw = UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
  721. Shaw = UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
  722. Shrd = UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
  723. Sidd = UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
  724. Sind = UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
  725. Sinh = UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
  726. Sogd = UCD_SCRIPT_Sogd, /**< @brief Sogdian Script */
  727. Sogo = UCD_SCRIPT_Sogo, /**< @brief Old Sogdian Script */
  728. Sora = UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
  729. Soyo = UCD_SCRIPT_Soyo, /**< @brief Soyombo */
  730. Sund = UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
  731. Sylo = UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
  732. Syrc = UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
  733. Syre = UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
  734. Syrj = UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
  735. Syrn = UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
  736. Tagb = UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
  737. Takr = UCD_SCRIPT_Takr, /**< @brief Takri Script */
  738. Tale = UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
  739. Talu = UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
  740. Taml = UCD_SCRIPT_Taml, /**< @brief Tamil Script */
  741. Tang = UCD_SCRIPT_Tang, /**< @brief Tangut Script */
  742. Tavt = UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
  743. Telu = UCD_SCRIPT_Telu, /**< @brief Telugu Script */
  744. Teng = UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
  745. Tfng = UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
  746. Tglg = UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
  747. Thaa = UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
  748. Thai = UCD_SCRIPT_Thai, /**< @brief Thai Script */
  749. Tibt = UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
  750. Tirh = UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
  751. Ugar = UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
  752. Vaii = UCD_SCRIPT_Vaii, /**< @brief Vai Script */
  753. Visp = UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
  754. Wara = UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
  755. Wole = UCD_SCRIPT_Wole, /**< @brief Woleai Script */
  756. Xpeo = UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
  757. Xsux = UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
  758. Yiii = UCD_SCRIPT_Yiii, /**< @brief Yi Script */
  759. Zanb = UCD_SCRIPT_Zanb, /**< @brief Zanabazar Square */
  760. Zinh = UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
  761. Zmth = UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
  762. Zsym = UCD_SCRIPT_Zsym, /**< @brief Symbols */
  763. Zxxx = UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
  764. Zyyy = UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
  765. Zzzz = UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
  766. };
  767. /** @brief Get a string representation of the script enumeration value.
  768. *
  769. * @param s The value to get the string representation for.
  770. *
  771. * @return The string representation, or "----" if the value is not recognized.
  772. */
  773. inline const char *get_script_string(script s)
  774. {
  775. return ucd_get_script_string((ucd_script)s);
  776. }
  777. /** @brief Lookup the Script for a Unicode codepoint.
  778. *
  779. * @param c The Unicode codepoint to lookup.
  780. * @return The Script of the Unicode codepoint.
  781. */
  782. inline script lookup_script(codepoint_t c)
  783. {
  784. return (script)ucd_lookup_script(c);
  785. }
  786. /** @brief Properties
  787. */
  788. typedef ucd_property property;
  789. enum
  790. {
  791. White_Space = UCD_PROPERTY_WHITE_SPACE, /**< @brief White_Space */
  792. Bidi_Control = UCD_PROPERTY_BIDI_CONTROL, /**< @brief Bidi_Control */
  793. Join_Control = UCD_PROPERTY_JOIN_CONTROL, /**< @brief Join_Control */
  794. Dash = UCD_PROPERTY_DASH, /**< @brief Dash */
  795. Hyphen = UCD_PROPERTY_HYPHEN, /**< @brief Hyphen */
  796. Quotation_Mark = UCD_PROPERTY_QUOTATION_MARK, /**< @brief Quotation_Mark */
  797. Terminal_Punctuation = UCD_PROPERTY_TERMINAL_PUNCTUATION, /**< @brief Terminal_Punctuation */
  798. Other_Math = UCD_PROPERTY_OTHER_MATH, /**< @brief Other_Math */
  799. Hex_Digit = UCD_PROPERTY_HEX_DIGIT, /**< @brief Hex_Digit */
  800. ASCII_Hex_Digit = UCD_PROPERTY_ASCII_HEX_DIGIT, /**< @brief ASCII_Hex_Digit */
  801. Other_Alphabetic = UCD_PROPERTY_OTHER_ALPHABETIC, /**< @brief Other_Alphabetic */
  802. Ideographic = UCD_PROPERTY_IDEOGRAPHIC, /**< @brief Ideographic */
  803. Diacritic = UCD_PROPERTY_DIACRITIC, /**< @brief Diacritic */
  804. Extender = UCD_PROPERTY_EXTENDER, /**< @brief Extender */
  805. Other_Lowercase = UCD_PROPERTY_OTHER_LOWERCASE, /**< @brief Other_Lowercase */
  806. Other_Uppercase = UCD_PROPERTY_OTHER_UPPERCASE, /**< @brief Other_Uppercase */
  807. Noncharacter_Code_Point = UCD_PROPERTY_NONCHARACTER_CODE_POINT, /**< @brief Noncharacter_Code_Point */
  808. Other_Grapheme_Extend = UCD_PROPERTY_OTHER_GRAPHEME_EXTEND, /**< @brief Other_Grapheme_Extend */
  809. IDS_Binary_Operator = UCD_PROPERTY_IDS_BINARY_OPERATOR, /**< @brief IDS_Binary_Operator */
  810. IDS_Trinary_Operator = UCD_PROPERTY_IDS_TRINARY_OPERATOR, /**< @brief IDS_Trinary_Operator */
  811. Radical = UCD_PROPERTY_RADICAL, /**< @brief Radical */
  812. Unified_Ideograph = UCD_PROPERTY_UNIFIED_IDEOGRAPH, /**< @brief Unified_Ideograph */
  813. Other_Default_Ignorable_Code_Point = UCD_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT, /**< @brief Other_Default_Ignorable_Code_Point */
  814. Deprecated = UCD_PROPERTY_DEPRECATED, /**< @brief Deprecated */
  815. Soft_Dotted = UCD_PROPERTY_SOFT_DOTTED, /**< @brief Soft_Dotted */
  816. Logical_Order_Exception = UCD_PROPERTY_LOGICAL_ORDER_EXCEPTION, /**< @brief Logical_Order_Exception */
  817. Other_ID_Start = UCD_PROPERTY_OTHER_ID_START, /**< @brief Other_ID_Start */
  818. Other_ID_Continue = UCD_PROPERTY_OTHER_ID_CONTINUE, /**< @brief Other_ID_Continue */
  819. Sentence_Terminal = UCD_PROPERTY_SENTENCE_TERMINAL, /**< @brief Sentence_Terminal */
  820. Variation_Selector = UCD_PROPERTY_VARIATION_SELECTOR, /**< @brief Variation_Selector */
  821. Pattern_White_Space = UCD_PROPERTY_PATTERN_WHITE_SPACE, /**< @brief Pattern_White_Space */
  822. Pattern_Syntax = UCD_PROPERTY_PATTERN_SYNTAX, /**< @brief Pattern_Syntax */
  823. Prepended_Concatenation_Mark = UCD_PROPERTY_PREPENDED_CONCATENATION_MARK, /**< @brief Prepended_Concatenation_Mark */
  824. Emoji = UCD_PROPERTY_EMOJI, /**< @brief Emoji */
  825. Emoji_Presentation = UCD_PROPERTY_EMOJI_PRESENTATION, /**< @brief Emoji_Presentation */
  826. Emoji_Modifier = UCD_PROPERTY_EMOJI_MODIFIER, /**< @brief Emoji_Modifier */
  827. Emoji_Modifier_Base = UCD_PROPERTY_EMOJI_MODIFIER_BASE, /**< @brief Emoji_Modifier_Base */
  828. Regional_Indicator = UCD_PROPERTY_REGIONAL_INDICATOR, /**< @brief Regional_Indicator */
  829. Emoji_Component = UCD_PROPERTY_EMOJI_COMPONENT, /**< @brief Emoji_Component */
  830. };
  831. /** @brief Return the properties of the specified codepoint.
  832. *
  833. * @param c The Unicode codepoint to lookup.
  834. * @param cat The General Category of the codepoint.
  835. * @return The properties associated with the codepoint.
  836. */
  837. inline property properties(codepoint_t c, category cat)
  838. {
  839. return (property)ucd_properties(c, (ucd_category)cat);
  840. }
  841. /** @brief Is the codepoint in the 'alnum' class?
  842. *
  843. * @param c The Unicode codepoint to check.
  844. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  845. */
  846. inline int isalnum(codepoint_t c)
  847. {
  848. return ucd_isalnum(c);
  849. }
  850. /** @brief Is the codepoint in the 'alpha' class?
  851. *
  852. * @param c The Unicode codepoint to check.
  853. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  854. */
  855. inline int isalpha(codepoint_t c)
  856. {
  857. return ucd_isalpha(c);
  858. }
  859. /** @brief Is the codepoint in the 'blank' class?
  860. *
  861. * @param c The Unicode codepoint to check.
  862. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  863. */
  864. inline int isblank(codepoint_t c)
  865. {
  866. return ucd_isblank(c);
  867. }
  868. /** @brief Is the codepoint in the 'cntrl' class?
  869. *
  870. * @param c The Unicode codepoint to check.
  871. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  872. */
  873. inline int iscntrl(codepoint_t c)
  874. {
  875. return ucd_iscntrl(c);
  876. }
  877. /** @brief Is the codepoint in the 'digit' class?
  878. *
  879. * @param c The Unicode codepoint to check.
  880. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  881. */
  882. inline int isdigit(codepoint_t c)
  883. {
  884. return ucd_isdigit(c);
  885. }
  886. /** @brief Is the codepoint in the 'graph' class?
  887. *
  888. * @param c The Unicode codepoint to check.
  889. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  890. */
  891. inline int isgraph(codepoint_t c)
  892. {
  893. return ucd_isgraph(c);
  894. }
  895. /** @brief Is the codepoint in the 'lower' class?
  896. *
  897. * @param c The Unicode codepoint to check.
  898. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  899. */
  900. inline int islower(codepoint_t c)
  901. {
  902. return ucd_islower(c);
  903. }
  904. /** @brief Is the codepoint in the 'print' class?
  905. *
  906. * @param c The Unicode codepoint to check.
  907. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  908. */
  909. inline int isprint(codepoint_t c)
  910. {
  911. return ucd_isprint(c);
  912. }
  913. /** @brief Is the codepoint in the 'punct' class?
  914. *
  915. * @param c The Unicode codepoint to check.
  916. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  917. */
  918. inline int ispunct(codepoint_t c)
  919. {
  920. return ucd_ispunct(c);
  921. }
  922. /** @brief Is the codepoint in the 'space' class?
  923. *
  924. * @param c The Unicode codepoint to check.
  925. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  926. */
  927. inline int isspace(codepoint_t c)
  928. {
  929. return ucd_isspace(c);
  930. }
  931. /** @brief Is the codepoint in the 'upper' class?
  932. *
  933. * @param c The Unicode codepoint to check.
  934. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  935. */
  936. inline int isupper(codepoint_t c)
  937. {
  938. return ucd_isupper(c);
  939. }
  940. /** @brief Is the codepoint in the 'xdigit' class?
  941. *
  942. * @param c The Unicode codepoint to check.
  943. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  944. */
  945. inline int isxdigit(codepoint_t c)
  946. {
  947. return ucd_isxdigit(c);
  948. }
  949. /** @brief Convert the Unicode codepoint to upper-case.
  950. *
  951. * This function only uses the simple case mapping present in the
  952. * UnicodeData file. The data in SpecialCasing requires Unicode
  953. * codepoints to be mapped to multiple codepoints.
  954. *
  955. * @param c The Unicode codepoint to convert.
  956. * @return The upper-case Unicode codepoint for this codepoint, or
  957. * this codepoint if there is no upper-case codepoint.
  958. */
  959. inline codepoint_t toupper(codepoint_t c)
  960. {
  961. return ucd_toupper(c);
  962. }
  963. /** @brief Convert the Unicode codepoint to lower-case.
  964. *
  965. * This function only uses the simple case mapping present in the
  966. * UnicodeData file. The data in SpecialCasing requires Unicode
  967. * codepoints to be mapped to multiple codepoints.
  968. *
  969. * @param c The Unicode codepoint to convert.
  970. * @return The lower-case Unicode codepoint for this codepoint, or
  971. * this codepoint if there is no upper-case codepoint.
  972. */
  973. inline codepoint_t tolower(codepoint_t c)
  974. {
  975. return ucd_tolower(c);
  976. }
  977. /** @brief Convert the Unicode codepoint to title-case.
  978. *
  979. * This function only uses the simple case mapping present in the
  980. * UnicodeData file. The data in SpecialCasing requires Unicode
  981. * codepoints to be mapped to multiple codepoints.
  982. *
  983. * @param c The Unicode codepoint to convert.
  984. * @return The title-case Unicode codepoint for this codepoint, or
  985. * this codepoint if there is no upper-case codepoint.
  986. */
  987. inline codepoint_t totitle(codepoint_t c)
  988. {
  989. return ucd_totitle(c);
  990. }
  991. }
  992. #endif
  993. #endif