/* See LICENSE file for copyright and license details. */ #ifndef LIBCHARCONV_H #define LIBCHARCONV_H #include #include enum libcharconv_result { LIBCHARCONV_NO_CONVERT, LIBCHARCONV_CONVERTED, LIBCHARCONV_INDETERMINATE, LIBCHARCONV_CONVERT_IF_END }; #define LIBCHARCONV_FUNC_(NAME)\ /** * @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 NAME(const char *s, size_t slen, size_t *n,\ uint_least32_t *cp, size_t *ncp) /** * Convert * 'w' to WHITE SHOGI PIECE, * 'b' to BLACK SHOGI PIECE, * 'W' to TURNED WHITE SHOGI PIECE, and * 'B' to TURNED BLACK SHOGI PIECE */ LIBCHARCONV_FUNC_(libcharconv_shogi); /** * Convert '1' through '6' to DIE FACE-1 through DIE FACE-6 */ LIBCHARCONV_FUNC_(libcharconv_dice); /** * Convert * '0', 'w', and 'W' to WHITE CIRCLE, * 'b' and 'B' to BLACK CIRCLE, * '1' to WHITE CIRCLE WITH DOT RIGHT, and * '2' to WHITE CIRCLE WITH TWO DOTS */ LIBCHARCONV_FUNC_(libcharconv_go_white); /** * Convert * '0', 'b', and 'B' to BLACK CIRCLE, * 'w', and 'W' to WHITE CIRCLE, * '1' to BLACK CIRCLE WITH WHITE DOT RIGHT, and * '2' to BLACK CIRCLE WITH TWO WHITE DOTS */ LIBCHARCONV_FUNC_(libcharconv_go_black); /** * Convert * 'm' and '1' to WHITE DRAUGHTS MAN, * 'k' and '2' to WHITE DRAUGHTS KING, * 'M' to BLACK DRAUGHTS MAN, and * 'K' to BLACK DRAUGHTS KING */ LIBCHARCONV_FUNC_(libcharconv_draughts); /** * Convert 'a' through 'z' and 'A' through 'Z' * to REGION INDICATOR SYMBOL LETTER A through * REGION INDICATOR SYMBOL LETTER Z */ LIBCHARCONV_FUNC_(libcharconv_region_indicators); /** * Convert ' ' through '~' to * TAG SPACE through TAG TILDE */ LIBCHARCONV_FUNC_(libcharconv_tags); /** * Convert * 'f', 'F', 'w', and 'W' to FEMALE SIGN, * 'm' and 'M' to MALE SIGN, and * 'i' and 'I' to MERCURY (intersex sign) */ LIBCHARCONV_FUNC_(libcharconv_gender_symbols); /** * Preforms convertion in opposite direction * of the other functions */ LIBCHARCONV_FUNC_(libcharconv_latin); /** * Convert from Latin to Cypriot */ LIBCHARCONV_FUNC_(libcharconv_cypriot); /** * Convert from Latin to MATHEMATICAL BOLD */ LIBCHARCONV_FUNC_(libcharconv_bold); /** * Convert from Latin to MATHEMATICAL ITALIC */ LIBCHARCONV_FUNC_(libcharconv_italic); /** * Convert from Latin to MATHEMATICAL BOLD ITALIC */ LIBCHARCONV_FUNC_(libcharconv_bold_italic); /** * Convert from Latin to MATHEMATICAL MONOSPACE */ LIBCHARCONV_FUNC_(libcharconv_monospace); /** * Convert from DIGITs to SEGMENTED DIGITs */ LIBCHARCONV_FUNC_(libcharconv_segmented); /** * Convert from Latin and enclosed numbers to * MATHEMATICAL SANS-SERIF */ LIBCHARCONV_FUNC_(libcharconv_sans_serif); /** * Convert from Latin to MATHEMATICAL SANS-SERIF BOLD */ LIBCHARCONV_FUNC_(libcharconv_sans_serif_bold); /** * Convert from Latin to MATHEMATICAL SANS-SERIF ITALIC */ LIBCHARCONV_FUNC_(libcharconv_sans_serif_italic); /** * Convert from Latin to MATHEMATICAL SANS-SERIF BOLD ITALIC */ LIBCHARCONV_FUNC_(libcharconv_sans_serif_bold_italic); /** * Convert from Latin to MATHEMATICAL DOUBLE-STRUCK */ LIBCHARCONV_FUNC_(libcharconv_double_struck); /** * Convert from Latin to DOUBLE-STRUCK ITALIC */ LIBCHARCONV_FUNC_(libcharconv_double_struck_italic); /** * Convert from Latin to MATHEMATICAL FRAKTUR */ LIBCHARCONV_FUNC_(libcharconv_fraktur); /** * Convert from Latin to MATHEMATICAL BOLD FRAKTUR */ LIBCHARCONV_FUNC_(libcharconv_bold_fraktur); /** * Convert from Latin to MATHEMATICAL SCRIPT */ LIBCHARCONV_FUNC_(libcharconv_script); /** * Convert from Latin to MATHEMATICAL BOLD SCRIPT */ LIBCHARCONV_FUNC_(libcharconv_bold_script); /** * Convert from Latin to Buhid */ LIBCHARCONV_FUNC_(libcharconv_buhid); /** * Convert * "obj" to OBJECT REPLACEMENT CHARACTER, and * "?" to REPLACEMENT CHARACTER */ LIBCHARCONV_FUNC_(libcharconv_replacement); /** * Convert alphanumerics to bracketed form */ LIBCHARCONV_FUNC_(libcharconv_bracketed); /** * Convert numbers to VARIATION SELECTORs */ LIBCHARCONV_FUNC_(libcharconv_variation_selectors); /** * Convert to superscript */ LIBCHARCONV_FUNC_(libcharconv_superscript); /** * Convert to subscript */ LIBCHARCONV_FUNC_(libcharconv_subscript); /** * Convert from Latin to Lydian */ LIBCHARCONV_FUNC_(libcharconv_lydian); /** * Convert from Latin to Lycian */ LIBCHARCONV_FUNC_(libcharconv_lycian); /** * 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 */ LIBCHARCONV_FUNC_(libcharconv_domino_tiles_horizontal); /** * 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 */ LIBCHARCONV_FUNC_(libcharconv_domino_tiles_vertical); /** * Convert "0:00", "1:00", ..., '24:00', * "00:00", "01:00", ..., '24:00', * "0:30", "1:30", ..., '23:30', and * "00:30", "01:30", ..., '23:30' to CLOCK FACEs */ LIBCHARCONV_FUNC_(libcharconv_clock_faces); /** * Convert * 'S' and 's' to OCR HOOK, * 'd' and 'h' to OCR CHAIR, * 'Y' to OCR FORK, * 'A' to OCR INVERTED FORK, * 'I' to OCR BELT BUCKLE, * 'X' and 'x' to OCR BOW TIE, * '\' to OCR DOUBLE BACKSLASH, * 'C' and 'c' to OCR BRANCH BANK IDENTIFICATION, * '/' to OCR AMOUNT OF CHECK, * 'P' and 'p' to OCR DASH, * '_' to OCR CUSTOMER ACCOUNT NUMBER, and * 'E' to HELLSCHREIBER PAUSE SYMBOL */ LIBCHARCONV_FUNC_(libcharconv_ocr); /** * Convert "-|", "|-", "_|", and "|_" to CROP marks */ LIBCHARCONV_FUNC_(libcharconv_crop_marks); /** * Convert sequences of unique [1, 8]-digits to BRAILLE PATTERNs, * a sequence can be empty (for the blank pattern), each * sequence can be (and the empty sequence must be) termianted * by a DIGIT ZERO */ LIBCHARCONV_FUNC_(libcharconv_braille); /** * Convert from Latin to Lisu */ LIBCHARCONV_FUNC_(libcharconv_lisu); /** * Convert from [1, 3]-digits to Yijing monograms */ LIBCHARCONV_FUNC_(libcharconv_yijing_monograms); /** * Convert from [1, 3]-digit sequences to Yijing digrams */ LIBCHARCONV_FUNC_(libcharconv_yijing_digrams); /** * Convert from [1, 2]-digit sequences to Yijing trigrams */ LIBCHARCONV_FUNC_(libcharconv_yijing_trigrams); /** * Convert from [1, 3]-digit sequences to Yijing tetragrams */ LIBCHARCONV_FUNC_(libcharconv_yijing_tetragrams); /** * Convert from [1, 2]-digit sequences to Yijing hexagrams */ LIBCHARCONV_FUNC_(libcharconv_yijing_hexagrams); /** * Convert from ASCII to VULGAR FRACTIONs and FRACTION NUMERATORs, * or from SOLIDUS to FRACTION SLASH */ LIBCHARCONV_FUNC_(libcharconv_vulgar_fractions); /** * Flip characters vertically */ LIBCHARCONV_FUNC_(libcharconv_flipped); /** * Overlay characters * * Filled and outlined characters can be combined * to create a mixed, when there is a mixed version */ LIBCHARCONV_FUNC_(libcharconv_overlaid); /** * Join characters horizontally */ LIBCHARCONV_FUNC_(libcharconv_joined); /** * Mirror characters horizontally */ LIBCHARCONV_FUNC_(libcharconv_mirrored); /** * Rotate characters 180 degrees */ LIBCHARCONV_FUNC_(libcharconv_turned); /** * Transpose characters */ LIBCHARCONV_FUNC_(libcharconv_transposed); /** * Convert from Latin to Sora Sompeng */ LIBCHARCONV_FUNC_(libcharconv_sora_sompeng); /** * Convert '1' and '5' to TALLY MARKs */ LIBCHARCONV_FUNC_(libcharconv_tally_marks); /** * Convert '1' through '5' to IDEOGRAPHIC TALLY MARKs */ LIBCHARCONV_FUNC_(libcharconv_ideographic_tally_marks); /** * Convert to opposite colour (between filled and outlined) */ LIBCHARCONV_FUNC_(libcharconv_negative); /** * Convert characters and character sequences to symbols */ LIBCHARCONV_FUNC_(libcharconv_symbols); /** * Convert characters and character sequences to * control characters, spaces, and SOFT HYPHENs * (textual representation symbols can be converted) */ LIBCHARCONV_FUNC_(libcharconv_control_characters); /** * Convert characters xiangqi pieces, with red * as the default colour */ LIBCHARCONV_FUNC_(libcharconv_xiangqi_red); /** * Convert characters xiangqi pieces, with black * as the default colour */ LIBCHARCONV_FUNC_(libcharconv_xiangqi_black); /** * Convert ASCII control characters, and SPACE, * and their abbrevations to textual representation * symbols */ LIBCHARCONV_FUNC_(libcharconv_control_character_representations); /** * Convert characters xiangqi pieces, with white * as the default colour */ LIBCHARCONV_FUNC_(libcharconv_chess_white); /** * Convert characters chess pieces, with black * as the default colour */ LIBCHARCONV_FUNC_(libcharconv_chess_black); /** * Convert characters chess pieces, with * neutral colour */ LIBCHARCONV_FUNC_(libcharconv_chess_neutral); /** * Rotate characters 45 degrees clockwise */ LIBCHARCONV_FUNC_(libcharconv_rotated_45deg_cw); /** * Rotate characters 45 degrees counter-clockwise */ LIBCHARCONV_FUNC_(libcharconv_rotated_45deg_ccw); /** * Rotate characters 90 degrees clockwise */ LIBCHARCONV_FUNC_(libcharconv_rotated_90deg_cw); /** * Rotate characters 90 degrees counter-clockwise */ LIBCHARCONV_FUNC_(libcharconv_rotated_90deg_ccw); /** * Convert * '(' to FUNCTION APPLICATION, * '*' to INVISIBLE TIMES, * '|' to INVISIBLE SEPARATOR, and * '+' to INVISIBLE PLUS */ LIBCHARCONV_FUNC_(libcharconv_invisible); /** * Convert alphanumerics, including regular and * MATHEMATICAL SANS-SERIF, to outlined enclosed form */ LIBCHARCONV_FUNC_(libcharconv_enclosed_positive); /** * Convert alphanumerics, including regular and * MATHEMATICAL SANS-SERIF, to filled enclosed form */ LIBCHARCONV_FUNC_(libcharconv_enclosed_negative); #undef LIBCHARCONV_FUNC_ #endif