aboutsummaryrefslogtreecommitdiff
path: root/lib/unicode/prop
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-21 15:20:27 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-21 15:20:27 +0200
commit5b14562e05457d96a6524b5aa2e533e69cf30fb2 (patch)
treedffebad583a6d5089b258cd337d64cc7788ba049 /lib/unicode/prop
parent274191d21c2b198860249016e1ed5af10f1a3865 (diff)
Add uprop_get_scx()
Diffstat (limited to 'lib/unicode/prop')
-rw-r--r--lib/unicode/prop/uprop_get_scx.c180
1 files changed, 180 insertions, 0 deletions
diff --git a/lib/unicode/prop/uprop_get_scx.c b/lib/unicode/prop/uprop_get_scx.c
new file mode 100644
index 0000000..f9aff23
--- /dev/null
+++ b/lib/unicode/prop/uprop_get_scx.c
@@ -0,0 +1,180 @@
+/* This file is autogenerated by gen/prop/scx; DO NOT EDIT. */
+
+#include "_bsearch.h"
+#include "macros.h"
+#include "rune.h"
+#include "unicode/prop.h"
+
+#define CAST(...) (const enum uprop_sc []){__VA_ARGS__}
+#define _(...) {CAST(__VA_ARGS__), lengthof(CAST(__VA_ARGS__))}
+
+struct uprop_sc_view {
+ const enum uprop_sc *p;
+ size_t n;
+};
+
+static constexpr enum uprop_sc fallback[] = {
+ SC_ZZZZ, SC_ADLM, SC_AGHB, SC_AHOM, SC_ARAB, SC_ARMI, SC_ARMN, SC_AVST,
+ SC_BALI, SC_BAMU, SC_BASS, SC_BATK, SC_BENG, SC_BHKS, SC_BOPO, SC_BRAH,
+ SC_BRAI, SC_BUGI, SC_BUHD, SC_CAKM, SC_CANS, SC_CARI, SC_CHAM, SC_CHER,
+ SC_CHRS, SC_COPT, SC_CPMN, SC_CPRT, SC_CYRL, SC_DEVA, SC_DIAK, SC_DOGR,
+ SC_DSRT, SC_DUPL, SC_EGYP, SC_ELBA, SC_ELYM, SC_ETHI, SC_GEOR, SC_GLAG,
+ SC_GONG, SC_GONM, SC_GOTH, SC_GRAN, SC_GREK, SC_GUJR, SC_GURU, SC_HANG,
+ SC_HANI, SC_HANO, SC_HATR, SC_HEBR, SC_HIRA, SC_HLUW, SC_HMNG, SC_HMNP,
+ SC_HRKT, SC_HUNG, SC_ITAL, SC_JAVA, SC_KALI, SC_KANA, SC_KAWI, SC_KHAR,
+ SC_KHMR, SC_KHOJ, SC_KITS, SC_KNDA, SC_KTHI, SC_LANA, SC_LAOO, SC_LATN,
+ SC_LEPC, SC_LIMB, SC_LINA, SC_LINB, SC_LISU, SC_LYCI, SC_LYDI, SC_MAHJ,
+ SC_MAKA, SC_MAND, SC_MANI, SC_MARC, SC_MEDF, SC_MEND, SC_MERC, SC_MERO,
+ SC_MLYM, SC_MODI, SC_MONG, SC_MROO, SC_MTEI, SC_MULT, SC_MYMR, SC_NAGM,
+ SC_NAND, SC_NARB, SC_NBAT, SC_NEWA, SC_NKOO, SC_NSHU, SC_OGAM, SC_OLCK,
+ SC_ORKH, SC_ORYA, SC_OSGE, SC_OSMA, SC_OUGR, SC_PALM, SC_PAUC, SC_PERM,
+ SC_PHAG, SC_PHLI, SC_PHLP, SC_PHNX, SC_PLRD, SC_PRTI, SC_RJNG, SC_ROHG,
+ SC_RUNR, SC_SAMR, SC_SARB, SC_SAUR, SC_SGNW, SC_SHAW, SC_SHRD, SC_SIDD,
+ SC_SIND, SC_SINH, SC_SOGD, SC_SOGO, SC_SORA, SC_SOYO, SC_SUND, SC_SYLO,
+ SC_SYRC, SC_TAGB, SC_TAKR, SC_TALE, SC_TALU, SC_TAML, SC_TANG, SC_TAVT,
+ SC_TELU, SC_TFNG, SC_TGLG, SC_THAA, SC_THAI, SC_TIBT, SC_TIRH, SC_TNSA,
+ SC_TOTO, SC_UGAR, SC_VAII, SC_VITH, SC_WARA, SC_WCHO, SC_XPEO, SC_XSUX,
+ SC_YEZI, SC_YIII, SC_ZANB, SC_ZINH, SC_ZYYY,
+};
+
+static const struct {
+ rune lo, hi;
+ struct uprop_sc_view val;
+} lookup[] = {
+ {RUNE_C(0x000342), RUNE_C(0x000342), _(SC_GREK)},
+ {RUNE_C(0x000345), RUNE_C(0x000345), _(SC_GREK)},
+ {RUNE_C(0x000363), RUNE_C(0x00036F), _(SC_LATN)},
+ {RUNE_C(0x000483), RUNE_C(0x000483), _(SC_CYRL, SC_PERM)},
+ {RUNE_C(0x000484), RUNE_C(0x000484), _(SC_CYRL, SC_GLAG)},
+ {RUNE_C(0x000485), RUNE_C(0x000486), _(SC_CYRL, SC_LATN)},
+ {RUNE_C(0x000487), RUNE_C(0x000487), _(SC_CYRL, SC_GLAG)},
+ {RUNE_C(0x00060C), RUNE_C(0x00060C), _(SC_ARAB, SC_NKOO, SC_ROHG, SC_SYRC, SC_THAA, SC_YEZI)},
+ {RUNE_C(0x00061B), RUNE_C(0x00061B), _(SC_ARAB, SC_NKOO, SC_ROHG, SC_SYRC, SC_THAA, SC_YEZI)},
+ {RUNE_C(0x00061C), RUNE_C(0x00061C), _(SC_ARAB, SC_SYRC, SC_THAA)},
+ {RUNE_C(0x00061F), RUNE_C(0x00061F), _(SC_ADLM, SC_ARAB, SC_NKOO, SC_ROHG, SC_SYRC, SC_THAA, SC_YEZI)},
+ {RUNE_C(0x000640), RUNE_C(0x000640), _(SC_ADLM, SC_ARAB, SC_MAND, SC_MANI, SC_OUGR, SC_PHLP, SC_ROHG, SC_SOGD, SC_SYRC)},
+ {RUNE_C(0x00064B), RUNE_C(0x000655), _(SC_ARAB, SC_SYRC)},
+ {RUNE_C(0x000660), RUNE_C(0x000669), _(SC_ARAB, SC_THAA, SC_YEZI)},
+ {RUNE_C(0x000670), RUNE_C(0x000670), _(SC_ARAB, SC_SYRC)},
+ {RUNE_C(0x0006D4), RUNE_C(0x0006D4), _(SC_ARAB, SC_ROHG)},
+ {RUNE_C(0x000951), RUNE_C(0x000951), _(SC_BENG, SC_DEVA, SC_GRAN, SC_GUJR, SC_GURU, SC_KNDA, SC_LATN, SC_MLYM, SC_ORYA, SC_SHRD, SC_TAML, SC_TELU, SC_TIRH)},
+ {RUNE_C(0x000952), RUNE_C(0x000952), _(SC_BENG, SC_DEVA, SC_GRAN, SC_GUJR, SC_GURU, SC_KNDA, SC_LATN, SC_MLYM, SC_ORYA, SC_TAML, SC_TELU, SC_TIRH)},
+ {RUNE_C(0x000964), RUNE_C(0x000964), _(SC_BENG, SC_DEVA, SC_DOGR, SC_GONG, SC_GONM, SC_GRAN, SC_GUJR, SC_GURU, SC_KNDA, SC_MAHJ, SC_MLYM, SC_NAND, SC_ORYA, SC_SIND, SC_SINH, SC_SYLO, SC_TAKR, SC_TAML, SC_TELU, SC_TIRH)},
+ {RUNE_C(0x000965), RUNE_C(0x000965), _(SC_BENG, SC_DEVA, SC_DOGR, SC_GONG, SC_GONM, SC_GRAN, SC_GUJR, SC_GURU, SC_KNDA, SC_LIMB, SC_MAHJ, SC_MLYM, SC_NAND, SC_ORYA, SC_SIND, SC_SINH, SC_SYLO, SC_TAKR, SC_TAML, SC_TELU, SC_TIRH)},
+ {RUNE_C(0x000966), RUNE_C(0x00096F), _(SC_DEVA, SC_DOGR, SC_KTHI, SC_MAHJ)},
+ {RUNE_C(0x0009E6), RUNE_C(0x0009EF), _(SC_BENG, SC_CAKM, SC_SYLO)},
+ {RUNE_C(0x000A66), RUNE_C(0x000A6F), _(SC_GURU, SC_MULT)},
+ {RUNE_C(0x000AE6), RUNE_C(0x000AEF), _(SC_GUJR, SC_KHOJ)},
+ {RUNE_C(0x000BE6), RUNE_C(0x000BF3), _(SC_GRAN, SC_TAML)},
+ {RUNE_C(0x000CE6), RUNE_C(0x000CEF), _(SC_KNDA, SC_NAND)},
+ {RUNE_C(0x001040), RUNE_C(0x001049), _(SC_CAKM, SC_MYMR, SC_TALE)},
+ {RUNE_C(0x0010FB), RUNE_C(0x0010FB), _(SC_GEOR, SC_LATN)},
+ {RUNE_C(0x001735), RUNE_C(0x001736), _(SC_BUHD, SC_HANO, SC_TAGB, SC_TGLG)},
+ {RUNE_C(0x001802), RUNE_C(0x001803), _(SC_MONG, SC_PHAG)},
+ {RUNE_C(0x001805), RUNE_C(0x001805), _(SC_MONG, SC_PHAG)},
+ {RUNE_C(0x001CD0), RUNE_C(0x001CD0), _(SC_BENG, SC_DEVA, SC_GRAN, SC_KNDA)},
+ {RUNE_C(0x001CD1), RUNE_C(0x001CD1), _(SC_DEVA)},
+ {RUNE_C(0x001CD2), RUNE_C(0x001CD2), _(SC_BENG, SC_DEVA, SC_GRAN, SC_KNDA)},
+ {RUNE_C(0x001CD3), RUNE_C(0x001CD3), _(SC_DEVA, SC_GRAN)},
+ {RUNE_C(0x001CD4), RUNE_C(0x001CD4), _(SC_DEVA)},
+ {RUNE_C(0x001CD5), RUNE_C(0x001CD6), _(SC_BENG, SC_DEVA)},
+ {RUNE_C(0x001CD7), RUNE_C(0x001CD7), _(SC_DEVA, SC_SHRD)},
+ {RUNE_C(0x001CD8), RUNE_C(0x001CD8), _(SC_BENG, SC_DEVA)},
+ {RUNE_C(0x001CD9), RUNE_C(0x001CD9), _(SC_DEVA, SC_SHRD)},
+ {RUNE_C(0x001CDA), RUNE_C(0x001CDA), _(SC_DEVA, SC_KNDA, SC_MLYM, SC_ORYA, SC_TAML, SC_TELU)},
+ {RUNE_C(0x001CDB), RUNE_C(0x001CDB), _(SC_DEVA)},
+ {RUNE_C(0x001CDC), RUNE_C(0x001CDD), _(SC_DEVA, SC_SHRD)},
+ {RUNE_C(0x001CDE), RUNE_C(0x001CDF), _(SC_DEVA)},
+ {RUNE_C(0x001CE0), RUNE_C(0x001CE0), _(SC_DEVA, SC_SHRD)},
+ {RUNE_C(0x001CE1), RUNE_C(0x001CE1), _(SC_BENG, SC_DEVA)},
+ {RUNE_C(0x001CE2), RUNE_C(0x001CE8), _(SC_DEVA)},
+ {RUNE_C(0x001CE9), RUNE_C(0x001CE9), _(SC_DEVA, SC_NAND)},
+ {RUNE_C(0x001CEA), RUNE_C(0x001CEA), _(SC_BENG, SC_DEVA)},
+ {RUNE_C(0x001CEB), RUNE_C(0x001CEC), _(SC_DEVA)},
+ {RUNE_C(0x001CED), RUNE_C(0x001CED), _(SC_BENG, SC_DEVA)},
+ {RUNE_C(0x001CEE), RUNE_C(0x001CF1), _(SC_DEVA)},
+ {RUNE_C(0x001CF2), RUNE_C(0x001CF2), _(SC_BENG, SC_DEVA, SC_GRAN, SC_KNDA, SC_MLYM, SC_NAND, SC_ORYA, SC_SINH, SC_TELU, SC_TIRH)},
+ {RUNE_C(0x001CF3), RUNE_C(0x001CF3), _(SC_DEVA, SC_GRAN)},
+ {RUNE_C(0x001CF4), RUNE_C(0x001CF4), _(SC_DEVA, SC_GRAN, SC_KNDA)},
+ {RUNE_C(0x001CF5), RUNE_C(0x001CF6), _(SC_BENG, SC_DEVA)},
+ {RUNE_C(0x001CF7), RUNE_C(0x001CF7), _(SC_BENG)},
+ {RUNE_C(0x001CF8), RUNE_C(0x001CF9), _(SC_DEVA, SC_GRAN)},
+ {RUNE_C(0x001CFA), RUNE_C(0x001CFA), _(SC_NAND)},
+ {RUNE_C(0x001DC0), RUNE_C(0x001DC1), _(SC_GREK)},
+ {RUNE_C(0x001DF8), RUNE_C(0x001DF8), _(SC_CYRL, SC_SYRC)},
+ {RUNE_C(0x001DFA), RUNE_C(0x001DFA), _(SC_SYRC)},
+ {RUNE_C(0x00202F), RUNE_C(0x00202F), _(SC_LATN, SC_MONG)},
+ {RUNE_C(0x0020F0), RUNE_C(0x0020F0), _(SC_DEVA, SC_GRAN, SC_LATN)},
+ {RUNE_C(0x002E43), RUNE_C(0x002E43), _(SC_CYRL, SC_GLAG)},
+ {RUNE_C(0x003001), RUNE_C(0x003002), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA, SC_YIII)},
+ {RUNE_C(0x003003), RUNE_C(0x003003), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA)},
+ {RUNE_C(0x003006), RUNE_C(0x003006), _(SC_HANI)},
+ {RUNE_C(0x003008), RUNE_C(0x003011), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA, SC_YIII)},
+ {RUNE_C(0x003013), RUNE_C(0x003013), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA)},
+ {RUNE_C(0x003014), RUNE_C(0x00301B), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA, SC_YIII)},
+ {RUNE_C(0x00301C), RUNE_C(0x00301F), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA)},
+ {RUNE_C(0x00302A), RUNE_C(0x00302D), _(SC_BOPO, SC_HANI)},
+ {RUNE_C(0x003030), RUNE_C(0x003030), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA)},
+ {RUNE_C(0x003031), RUNE_C(0x003035), _(SC_HIRA, SC_KANA)},
+ {RUNE_C(0x003037), RUNE_C(0x003037), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA)},
+ {RUNE_C(0x00303C), RUNE_C(0x00303D), _(SC_HANI, SC_HIRA, SC_KANA)},
+ {RUNE_C(0x00303E), RUNE_C(0x00303F), _(SC_HANI)},
+ {RUNE_C(0x003099), RUNE_C(0x00309C), _(SC_HIRA, SC_KANA)},
+ {RUNE_C(0x0030A0), RUNE_C(0x0030A0), _(SC_HIRA, SC_KANA)},
+ {RUNE_C(0x0030FB), RUNE_C(0x0030FB), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA, SC_YIII)},
+ {RUNE_C(0x0030FC), RUNE_C(0x0030FC), _(SC_HIRA, SC_KANA)},
+ {RUNE_C(0x003190), RUNE_C(0x00319F), _(SC_HANI)},
+ {RUNE_C(0x0031C0), RUNE_C(0x0031E3), _(SC_HANI)},
+ {RUNE_C(0x003220), RUNE_C(0x003247), _(SC_HANI)},
+ {RUNE_C(0x003280), RUNE_C(0x0032B0), _(SC_HANI)},
+ {RUNE_C(0x0032C0), RUNE_C(0x0032CB), _(SC_HANI)},
+ {RUNE_C(0x0032FF), RUNE_C(0x0032FF), _(SC_HANI)},
+ {RUNE_C(0x003358), RUNE_C(0x003370), _(SC_HANI)},
+ {RUNE_C(0x00337B), RUNE_C(0x00337F), _(SC_HANI)},
+ {RUNE_C(0x0033E0), RUNE_C(0x0033FE), _(SC_HANI)},
+ {RUNE_C(0x00A66F), RUNE_C(0x00A66F), _(SC_CYRL, SC_GLAG)},
+ {RUNE_C(0x00A700), RUNE_C(0x00A707), _(SC_HANI, SC_LATN)},
+ {RUNE_C(0x00A830), RUNE_C(0x00A832), _(SC_DEVA, SC_DOGR, SC_GUJR, SC_GURU, SC_KHOJ, SC_KNDA, SC_KTHI, SC_MAHJ, SC_MLYM, SC_MODI, SC_NAND, SC_SHRD, SC_SIND, SC_TAKR, SC_TIRH)},
+ {RUNE_C(0x00A833), RUNE_C(0x00A835), _(SC_DEVA, SC_DOGR, SC_GUJR, SC_GURU, SC_KHOJ, SC_KNDA, SC_KTHI, SC_MAHJ, SC_MODI, SC_NAND, SC_SHRD, SC_SIND, SC_TAKR, SC_TIRH)},
+ {RUNE_C(0x00A836), RUNE_C(0x00A837), _(SC_DEVA, SC_DOGR, SC_GUJR, SC_GURU, SC_KHOJ, SC_KTHI, SC_MAHJ, SC_MODI, SC_SIND, SC_TAKR, SC_TIRH)},
+ {RUNE_C(0x00A838), RUNE_C(0x00A838), _(SC_DEVA, SC_DOGR, SC_GUJR, SC_GURU, SC_KHOJ, SC_KTHI, SC_MAHJ, SC_MODI, SC_SHRD, SC_SIND, SC_TAKR, SC_TIRH)},
+ {RUNE_C(0x00A839), RUNE_C(0x00A839), _(SC_DEVA, SC_DOGR, SC_GUJR, SC_GURU, SC_KHOJ, SC_KTHI, SC_MAHJ, SC_MODI, SC_SIND, SC_TAKR, SC_TIRH)},
+ {RUNE_C(0x00A8F1), RUNE_C(0x00A8F1), _(SC_BENG, SC_DEVA)},
+ {RUNE_C(0x00A8F3), RUNE_C(0x00A8F3), _(SC_DEVA, SC_TAML)},
+ {RUNE_C(0x00A92E), RUNE_C(0x00A92E), _(SC_KALI, SC_LATN, SC_MYMR)},
+ {RUNE_C(0x00A9CF), RUNE_C(0x00A9CF), _(SC_BUGI, SC_JAVA)},
+ {RUNE_C(0x00FD3E), RUNE_C(0x00FD3F), _(SC_ARAB, SC_NKOO)},
+ {RUNE_C(0x00FDF2), RUNE_C(0x00FDF2), _(SC_ARAB, SC_THAA)},
+ {RUNE_C(0x00FDFD), RUNE_C(0x00FDFD), _(SC_ARAB, SC_THAA)},
+ {RUNE_C(0x00FE45), RUNE_C(0x00FE46), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA)},
+ {RUNE_C(0x00FF61), RUNE_C(0x00FF65), _(SC_BOPO, SC_HANG, SC_HANI, SC_HIRA, SC_KANA, SC_YIII)},
+ {RUNE_C(0x00FF70), RUNE_C(0x00FF70), _(SC_HIRA, SC_KANA)},
+ {RUNE_C(0x00FF9E), RUNE_C(0x00FF9F), _(SC_HIRA, SC_KANA)},
+ {RUNE_C(0x010100), RUNE_C(0x010101), _(SC_CPMN, SC_CPRT, SC_LINB)},
+ {RUNE_C(0x010102), RUNE_C(0x010102), _(SC_CPRT, SC_LINB)},
+ {RUNE_C(0x010107), RUNE_C(0x010133), _(SC_CPRT, SC_LINA, SC_LINB)},
+ {RUNE_C(0x010137), RUNE_C(0x01013F), _(SC_CPRT, SC_LINB)},
+ {RUNE_C(0x0102E0), RUNE_C(0x0102FB), _(SC_ARAB, SC_COPT)},
+ {RUNE_C(0x010AF2), RUNE_C(0x010AF2), _(SC_MANI, SC_OUGR)},
+ {RUNE_C(0x011301), RUNE_C(0x011301), _(SC_GRAN, SC_TAML)},
+ {RUNE_C(0x011303), RUNE_C(0x011303), _(SC_GRAN, SC_TAML)},
+ {RUNE_C(0x01133B), RUNE_C(0x01133C), _(SC_GRAN, SC_TAML)},
+ {RUNE_C(0x011FD0), RUNE_C(0x011FD1), _(SC_GRAN, SC_TAML)},
+ {RUNE_C(0x011FD3), RUNE_C(0x011FD3), _(SC_GRAN, SC_TAML)},
+ {RUNE_C(0x01BCA0), RUNE_C(0x01BCA3), _(SC_DUPL)},
+ {RUNE_C(0x01D360), RUNE_C(0x01D371), _(SC_HANI)},
+ {RUNE_C(0x01F250), RUNE_C(0x01F251), _(SC_HANI)},
+};
+
+_MLIB_DEFINE_BSEARCH(struct uprop_sc_view, lookup, ((struct uprop_sc_view){
+ .p = fallback + uprop_get_sc(ch),
+ .n = 1,
+}))
+
+const enum uprop_sc *
+uprop_get_scx(rune ch, size_t *n)
+{
+ struct uprop_sc_view v = mlib_lookup(ch);
+ *n = v.n;
+ return v.p;
+}