]> Git Repo - J-linux.git/blobdiff - include/linux/unicode.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[J-linux.git] / include / linux / unicode.h
index 74484d44c7554bdfea1f86a5cebe89809d1bd8e1..4d39e6e11a950c76f78d775fd6f351296f3d7d53 100644 (file)
@@ -5,9 +5,52 @@
 #include <linux/init.h>
 #include <linux/dcache.h>
 
+struct utf8data;
+struct utf8data_table;
+
+#define UNICODE_MAJ_SHIFT              16
+#define UNICODE_MIN_SHIFT              8
+
+#define UNICODE_AGE(MAJ, MIN, REV)                     \
+       (((unsigned int)(MAJ) << UNICODE_MAJ_SHIFT) |   \
+        ((unsigned int)(MIN) << UNICODE_MIN_SHIFT) |   \
+        ((unsigned int)(REV)))
+
+static inline u8 unicode_major(unsigned int age)
+{
+       return (age >> UNICODE_MAJ_SHIFT) & 0xff;
+}
+
+static inline u8 unicode_minor(unsigned int age)
+{
+       return (age >> UNICODE_MIN_SHIFT) & 0xff;
+}
+
+static inline u8 unicode_rev(unsigned int age)
+{
+       return age & 0xff;
+}
+
+/*
+ * Two normalization forms are supported:
+ * 1) NFDI
+ *   - Apply unicode normalization form NFD.
+ *   - Remove any Default_Ignorable_Code_Point.
+ * 2) NFDICF
+ *   - Apply unicode normalization form NFD.
+ *   - Remove any Default_Ignorable_Code_Point.
+ *   - Apply a full casefold (C + F).
+ */
+enum utf8_normalization {
+       UTF8_NFDI = 0,
+       UTF8_NFDICF,
+       UTF8_NMAX,
+};
+
 struct unicode_map {
-       const char *charset;
-       int version;
+       unsigned int version;
+       const struct utf8data *ntab[UTF8_NMAX];
+       const struct utf8data_table *tables;
 };
 
 int utf8_validate(const struct unicode_map *um, const struct qstr *str);
@@ -30,7 +73,7 @@ int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
 int utf8_casefold_hash(const struct unicode_map *um, const void *salt,
                       struct qstr *str);
 
-struct unicode_map *utf8_load(const char *version);
+struct unicode_map *utf8_load(unsigned int version);
 void utf8_unload(struct unicode_map *um);
 
 #endif /* _LINUX_UNICODE_H */
This page took 0.029217 seconds and 4 git commands to generate.