diff options
| -rw-r--r-- | libcharconv.h | 6 | ||||
| -rw-r--r-- | libcharconv_go_black.c | 4 | ||||
| -rw-r--r-- | libcharconv_go_white.c | 4 | ||||
| -rw-r--r-- | libcharconv_latin.c | 6 |
4 files changed, 16 insertions, 4 deletions
diff --git a/libcharconv.h b/libcharconv.h index 0a34555..b1d6599 100644 --- a/libcharconv.h +++ b/libcharconv.h @@ -84,7 +84,8 @@ enum libcharconv_result libcharconv_dice(const char *s, size_t slen, size_t *n, /** * Convert - * '0' to WHITE CIRCLE, + * '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 * @@ -119,7 +120,8 @@ enum libcharconv_result libcharconv_go_white(const char *s, size_t slen, size_t /** * Convert - * '0' to BLACK CIRCLE, + * '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 * diff --git a/libcharconv_go_black.c b/libcharconv_go_black.c index 6ca0886..5845f5d 100644 --- a/libcharconv_go_black.c +++ b/libcharconv_go_black.c @@ -9,6 +9,10 @@ libcharconv_go_black(const char *s, size_t slen, size_t *n, uint_least32_t *cp, *n = 0; for (; slen--; s++) { switch (*s) { + case 'w': + case 'W': c = UINT32_C(0x25CB); goto conv; + case 'b': + case 'B': case '0': c = UINT32_C(0x25CF); goto conv; case '1': c = UINT32_C(0x2688); goto conv; case '2': c = UINT32_C(0x2689); goto conv; diff --git a/libcharconv_go_white.c b/libcharconv_go_white.c index 163a938..43509b2 100644 --- a/libcharconv_go_white.c +++ b/libcharconv_go_white.c @@ -9,6 +9,10 @@ libcharconv_go_white(const char *s, size_t slen, size_t *n, uint_least32_t *cp, *n = 0; for (; slen--; s++) { switch (*s) { + case 'b': + case 'B': c = UINT32_C(0x25CF); goto conv; + case 'w': + case 'W': case '0': c = UINT32_C(0x25CB); goto conv; case '1': c = UINT32_C(0x2686); goto conv; case '2': c = UINT32_C(0x2687); goto conv; diff --git a/libcharconv_latin.c b/libcharconv_latin.c index 7c70318..5179388 100644 --- a/libcharconv_latin.c +++ b/libcharconv_latin.c @@ -358,13 +358,15 @@ libcharconv_latin(const char *s, size_t slen, size_t *n, uint_least32_t *cp, siz case UINT32_C(0x26C9): c = (uint_least32_t)'W'; goto conv; case UINT32_C(0x26CA): c = (uint_least32_t)'B'; goto conv; + /* go (common) */ + case UINT32_C(0x25CF): c = (uint_least32_t)'b'; goto conv; + case UINT32_C(0x25CB): c = (uint_least32_t)'w'; goto conv; + /* go (white) */ - case UINT32_C(0x25CB): c = (uint_least32_t)'0'; goto conv; case UINT32_C(0x2686): c = (uint_least32_t)'1'; goto conv; case UINT32_C(0x2687): c = (uint_least32_t)'2'; goto conv; /* go (black) */ - case UINT32_C(0x25CF): c = (uint_least32_t)'0'; goto conv; case UINT32_C(0x2688): c = (uint_least32_t)'1'; goto conv; case UINT32_C(0x2689): c = (uint_least32_t)'2'; goto conv; |
