1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
/* See LICENSE file for copyright and license details. */
#ifndef LIBCHARCONV_H
#define LIBCHARCONV_H
#include <stddef.h>
#include <stdint.h>
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);
/**
* Convert
* '1' to METRICAL BREVE,
* '2' to METRICAL TWO SHORTS JOINED,
* '-1' to METRICAL LONG OVER SHORT,
* '-2' to METRICAL LONG OVER TWO SHORTS,
* '_1' to METRICAL SHORT OVER LONG,
* '_2' to METRICAL TWO SHORTS OVER LONG,
* '3' to METRICAL TRISEME,
* '4' to METRICAL TETRASEME, and
* '5' to METRICAL PENTASEME
*/
LIBCHARCONV_FUNC_(libcharconv_metrical);
/**
* Convert to DENTISTRY SYMBOLs
*/
LIBCHARCONV_FUNC_(libcharconv_dentistry);
/**
* Convert to PLAYING CARDs and SUITs
*/
LIBCHARCONV_FUNC_(libcharconv_cards);
/**
* Stack characters vertically
*/
LIBCHARCONV_FUNC_(libcharconv_stacked);
#undef LIBCHARCONV_FUNC_
#endif
|