aboutsummaryrefslogtreecommitdiffstats
path: root/libcharconv.h
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-01-25 12:04:20 +0100
committerMattias Andrée <m@maandree.se>2026-01-25 12:04:20 +0100
commita7c404e03a4b814160ec4c97797a56ee4581a0f7 (patch)
treeac3c598e792f041826438e8fe81e31ce5ca92d6b /libcharconv.h
parentAdd lisu (diff)
downloadcharconv-a7c404e03a4b814160ec4c97797a56ee4581a0f7.tar.gz
charconv-a7c404e03a4b814160ec4c97797a56ee4581a0f7.tar.bz2
charconv-a7c404e03a4b814160ec4c97797a56ee4581a0f7.tar.xz
Add yijing n-grams
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libcharconv.h')
-rw-r--r--libcharconv.h200
1 files changed, 180 insertions, 20 deletions
diff --git a/libcharconv.h b/libcharconv.h
index 9c77b1f..1be4782 100644
--- a/libcharconv.h
+++ b/libcharconv.h
@@ -326,7 +326,7 @@ enum libcharconv_result libcharconv_latin(const char *s, size_t slen, size_t *n,
/**
- * Preforms convertion from Latin to Cypriot
+ * Convert from Latin to Cypriot
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -358,7 +358,7 @@ enum libcharconv_result libcharconv_cypriot(const char *s, size_t slen, size_t *
/**
- * Preforms convertion from Latin to MATHEMATICAL BOLD
+ * Convert from Latin to MATHEMATICAL BOLD
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -390,7 +390,7 @@ enum libcharconv_result libcharconv_bold(const char *s, size_t slen, size_t *n,
/**
- * Preforms convertion from Latin to MATHEMATICAL ITALIC
+ * Convert from Latin to MATHEMATICAL ITALIC
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -422,7 +422,7 @@ enum libcharconv_result libcharconv_italic(const char *s, size_t slen, size_t *n
/**
- * Preforms convertion from Latin to MATHEMATICAL BOLD ITALIC
+ * Convert from Latin to MATHEMATICAL BOLD ITALIC
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -454,7 +454,7 @@ enum libcharconv_result libcharconv_bold_italic(const char *s, size_t slen, size
/**
- * Preforms convertion from Latin to MATHEMATICAL MONOSPACE
+ * Convert from Latin to MATHEMATICAL MONOSPACE
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -486,7 +486,7 @@ enum libcharconv_result libcharconv_monospace(const char *s, size_t slen, size_t
/**
- * Preforms convertion from DIGITs to SEGMENTED DIGITs
+ * Convert from DIGITs to SEGMENTED DIGITs
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -518,7 +518,7 @@ enum libcharconv_result libcharconv_segmented(const char *s, size_t slen, size_t
/**
- * Preforms convertion from Latin to MATHEMATICAL SANS-SERIF
+ * Convert from Latin to MATHEMATICAL SANS-SERIF
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -550,7 +550,7 @@ enum libcharconv_result libcharconv_sans_serif(const char *s, size_t slen, size_
/**
- * Preforms convertion from Latin to MATHEMATICAL SANS-SERIF BOLD
+ * Convert from Latin to MATHEMATICAL SANS-SERIF BOLD
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -582,7 +582,7 @@ enum libcharconv_result libcharconv_sans_serif_bold(const char *s, size_t slen,
/**
- * Preforms convertion from Latin to MATHEMATICAL SANS-SERIF ITALIC
+ * Convert from Latin to MATHEMATICAL SANS-SERIF ITALIC
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -614,7 +614,7 @@ enum libcharconv_result libcharconv_sans_serif_italic(const char *s, size_t slen
/**
- * Preforms convertion from Latin to MATHEMATICAL SANS-SERIF BOLD ITALIC
+ * Convert from Latin to MATHEMATICAL SANS-SERIF BOLD ITALIC
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -646,7 +646,7 @@ enum libcharconv_result libcharconv_sans_serif_bold_italic(const char *s, size_t
/**
- * Preforms convertion from Latin to MATHEMATICAL DOUBLE-STRUCK
+ * Convert from Latin to MATHEMATICAL DOUBLE-STRUCK
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -678,7 +678,7 @@ enum libcharconv_result libcharconv_double_struck(const char *s, size_t slen, si
/**
- * Preforms convertion from Latin to DOUBLE-STRUCK ITALIC
+ * Convert from Latin to DOUBLE-STRUCK ITALIC
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -710,7 +710,7 @@ enum libcharconv_result libcharconv_double_struck_italic(const char *s, size_t s
/**
- * Preforms convertion from Latin to MATHEMATICAL FRAKTUR
+ * Convert from Latin to MATHEMATICAL FRAKTUR
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -742,7 +742,7 @@ enum libcharconv_result libcharconv_fraktur(const char *s, size_t slen, size_t *
/**
- * Preforms convertion from Latin to MATHEMATICAL BOLD FRAKTUR
+ * Convert from Latin to MATHEMATICAL BOLD FRAKTUR
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -774,7 +774,7 @@ enum libcharconv_result libcharconv_bold_fraktur(const char *s, size_t slen, siz
/**
- * Preforms convertion from Latin to MATHEMATICAL SCRIPT
+ * Convert from Latin to MATHEMATICAL SCRIPT
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -806,7 +806,7 @@ enum libcharconv_result libcharconv_script(const char *s, size_t slen, size_t *n
/**
- * Preforms convertion from Latin to MATHEMATICAL BOLD SCRIPT
+ * Convert from Latin to MATHEMATICAL BOLD SCRIPT
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -838,7 +838,7 @@ enum libcharconv_result libcharconv_bold_script(const char *s, size_t slen, size
/**
- * Preforms convertion from Latin to Buhid
+ * Convert from Latin to Buhid
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -1032,7 +1032,7 @@ enum libcharconv_result libcharconv_subscript(const char *s, size_t slen, size_t
/**
- * Preforms convertion from Latin to Lydian
+ * Convert from Latin to Lydian
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -1064,7 +1064,7 @@ enum libcharconv_result libcharconv_lydian(const char *s, size_t slen, size_t *n
/**
- * Preforms convertion from Latin to Lycian
+ * Convert from Latin to Lycian
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -1314,7 +1314,7 @@ enum libcharconv_result libcharconv_braille(const char *s, size_t slen, size_t *
/**
- * Preforms convertion from Latin to Lisu
+ * Convert from Latin to Lisu
*
* @param s Text to convert
* @param slen The number of bytes available in `s`
@@ -1345,4 +1345,164 @@ enum libcharconv_result libcharconv_braille(const char *s, size_t slen, size_t *
enum libcharconv_result libcharconv_lisu(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp);
+/**
+ * Convert from [1, 3]-digits to Yijing monograms
+ *
+ * @param s Text to convert
+ * @param slen The number of bytes available in `s`
+ * @param n Output parameter for the number of consumed bytes
+ * @param cp Output buffer for the codepoints
+ * @param ncp Input parameter for the number of codepoints that
+ * fit in `cp`, and output parameter for the number
+ * of output codepoints (if it exceeds the original
+ * value of `ncp`, a larger buffer is needed)
+ * @return LIBCHARCONV_NO_CONVERT:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that cannot be converted
+ * LIBCHARCONV_CONVERTED:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that was converted to a codepoint which
+ * is stored in `*cp`
+ * LIBCHARCONV_INDETERMINATE:
+ * If all text has been input, no more can be
+ * converted, otherwise more of the text most
+ * be made available before the function can
+ * determine whether the beginning of `s` can be
+ * converted or what it should be converted to
+ * LIBCHARCONV_CONVERT_IF_END:
+ * As LIBCHARCONV_CONVERTED the entire text has
+ * been input, as LIBCHARCONV_INDETERMINATE
+ * otherwise
+ */
+enum libcharconv_result libcharconv_yijing_monograms(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp);
+
+
+/**
+ * Convert from [1, 3]-digit sequences to Yijing digrams
+ *
+ * @param s Text to convert
+ * @param slen The number of bytes available in `s`
+ * @param n Output parameter for the number of consumed bytes
+ * @param cp Output buffer for the codepoints
+ * @param ncp Input parameter for the number of codepoints that
+ * fit in `cp`, and output parameter for the number
+ * of output codepoints (if it exceeds the original
+ * value of `ncp`, a larger buffer is needed)
+ * @return LIBCHARCONV_NO_CONVERT:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that cannot be converted
+ * LIBCHARCONV_CONVERTED:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that was converted to a codepoint which
+ * is stored in `*cp`
+ * LIBCHARCONV_INDETERMINATE:
+ * If all text has been input, no more can be
+ * converted, otherwise more of the text most
+ * be made available before the function can
+ * determine whether the beginning of `s` can be
+ * converted or what it should be converted to
+ * LIBCHARCONV_CONVERT_IF_END:
+ * As LIBCHARCONV_CONVERTED the entire text has
+ * been input, as LIBCHARCONV_INDETERMINATE
+ * otherwise
+ */
+enum libcharconv_result libcharconv_yijing_digrams(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp);
+
+
+/**
+ * Convert from [1, 2]-digit sequences to Yijing trigrams
+ *
+ * @param s Text to convert
+ * @param slen The number of bytes available in `s`
+ * @param n Output parameter for the number of consumed bytes
+ * @param cp Output buffer for the codepoints
+ * @param ncp Input parameter for the number of codepoints that
+ * fit in `cp`, and output parameter for the number
+ * of output codepoints (if it exceeds the original
+ * value of `ncp`, a larger buffer is needed)
+ * @return LIBCHARCONV_NO_CONVERT:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that cannot be converted
+ * LIBCHARCONV_CONVERTED:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that was converted to a codepoint which
+ * is stored in `*cp`
+ * LIBCHARCONV_INDETERMINATE:
+ * If all text has been input, no more can be
+ * converted, otherwise more of the text most
+ * be made available before the function can
+ * determine whether the beginning of `s` can be
+ * converted or what it should be converted to
+ * LIBCHARCONV_CONVERT_IF_END:
+ * As LIBCHARCONV_CONVERTED the entire text has
+ * been input, as LIBCHARCONV_INDETERMINATE
+ * otherwise
+ */
+enum libcharconv_result libcharconv_yijing_trigrams(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp);
+
+
+/**
+ * Convert from [1, 3]-digit sequences to Yijing tetragrams
+ *
+ * @param s Text to convert
+ * @param slen The number of bytes available in `s`
+ * @param n Output parameter for the number of consumed bytes
+ * @param cp Output buffer for the codepoints
+ * @param ncp Input parameter for the number of codepoints that
+ * fit in `cp`, and output parameter for the number
+ * of output codepoints (if it exceeds the original
+ * value of `ncp`, a larger buffer is needed)
+ * @return LIBCHARCONV_NO_CONVERT:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that cannot be converted
+ * LIBCHARCONV_CONVERTED:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that was converted to a codepoint which
+ * is stored in `*cp`
+ * LIBCHARCONV_INDETERMINATE:
+ * If all text has been input, no more can be
+ * converted, otherwise more of the text most
+ * be made available before the function can
+ * determine whether the beginning of `s` can be
+ * converted or what it should be converted to
+ * LIBCHARCONV_CONVERT_IF_END:
+ * As LIBCHARCONV_CONVERTED the entire text has
+ * been input, as LIBCHARCONV_INDETERMINATE
+ * otherwise
+ */
+enum libcharconv_result libcharconv_yijing_tetragrams(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp);
+
+
+/**
+ * Convert from [1, 2]-digit sequences to Yijing hexagrams
+ *
+ * @param s Text to convert
+ * @param slen The number of bytes available in `s`
+ * @param n Output parameter for the number of consumed bytes
+ * @param cp Output buffer for the codepoints
+ * @param ncp Input parameter for the number of codepoints that
+ * fit in `cp`, and output parameter for the number
+ * of output codepoints (if it exceeds the original
+ * value of `ncp`, a larger buffer is needed)
+ * @return LIBCHARCONV_NO_CONVERT:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that cannot be converted
+ * LIBCHARCONV_CONVERTED:
+ * `*n` is the number of bytes from the beginning
+ * of `s` that was converted to a codepoint which
+ * is stored in `*cp`
+ * LIBCHARCONV_INDETERMINATE:
+ * If all text has been input, no more can be
+ * converted, otherwise more of the text most
+ * be made available before the function can
+ * determine whether the beginning of `s` can be
+ * converted or what it should be converted to
+ * LIBCHARCONV_CONVERT_IF_END:
+ * As LIBCHARCONV_CONVERTED the entire text has
+ * been input, as LIBCHARCONV_INDETERMINATE
+ * otherwise
+ */
+enum libcharconv_result libcharconv_yijing_hexagrams(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp);
+
+
#endif