diff options
| author | Mattias Andrée <m@maandree.se> | 2026-01-24 21:31:58 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-01-24 21:31:58 +0100 |
| commit | 6b568aa1bca7f7f502af7b57303ec2673b331c8f (patch) | |
| tree | 584870f81a8f5ecb093af3ff05aab8114de96b7d /libcharconv.h | |
| parent | Add superscript and subscript (so far only with digits) and lycian and lydian (diff) | |
| download | charconv-6b568aa1bca7f7f502af7b57303ec2673b331c8f.tar.gz charconv-6b568aa1bca7f7f502af7b57303ec2673b331c8f.tar.bz2 charconv-6b568aa1bca7f7f502af7b57303ec2673b331c8f.tar.xz | |
Add domino tiles
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | libcharconv.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libcharconv.h b/libcharconv.h index 9eab393..9eac800 100644 --- a/libcharconv.h +++ b/libcharconv.h @@ -1093,4 +1093,76 @@ enum libcharconv_result libcharconv_lydian(const char *s, size_t slen, size_t *n enum libcharconv_result libcharconv_lycian(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp); +/** + * Convert a pair of [0, 6]-digits to domino tiles, + * or "##" to the back of a domino tiles. The tile + * will be horizontal by default, but '|' or '-' can + * be added between the two symbols to select + * horizontal ('|') or vertical ('-') orientation + * + * @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_domino_tiles_horizontal(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp); + + +/** + * Convert a pair of [0, 6]-digits to domino tiles, + * or "##" to the back of a domino tiles. The tile + * will be vertical by default, but '|' or '-' can + * be added between the two symbols to select + * horizontal ('|') or vertical ('-') orientation + * + * @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_domino_tiles_vertical(const char *s, size_t slen, size_t *n, uint_least32_t *cp, size_t *ncp); + + #endif |
