From 3a27f74492fb7464ff5d280c48c13fa8a1b3067f Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Tue, 19 Nov 2019 13:50:31 +0000 Subject: [PATCH] added moo_oocu_t, moo_ucu_t, moo_bcu_t --- moo/lib/moo-chr.h | 36 ++++++++++++++++++------------------ moo/lib/moo-cmn.h | 4 ++++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/moo/lib/moo-chr.h b/moo/lib/moo-chr.h index 8b71cfa..3934057 100644 --- a/moo/lib/moo-chr.h +++ b/moo/lib/moo-chr.h @@ -173,33 +173,33 @@ MOO_EXPORT int moo_is_bch_type (moo_bch_t c, moo_bch_prop_t type); * these implemenent latin-1 only */ #if !defined(moo_is_bch_upper) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_upper (moo_bch_t c) { return (moo_bchu_t)c - 'A' < 26; } +static MOO_INLINE int moo_is_bch_upper (moo_bch_t c) { return (moo_bcu_t)c - 'A' < 26; } #elif !defined(moo_is_bch_upper) -# define moo_is_bch_upper(c) ((moo_bchu_t)(c) - 'A' < 26) +# define moo_is_bch_upper(c) ((moo_bcu_t)(c) - 'A' < 26) #endif #if !defined(moo_is_bch_lower) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_lower (moo_bch_t c) { return (moo_bchu_t)c - 'a' < 26; } +static MOO_INLINE int moo_is_bch_lower (moo_bch_t c) { return (moo_bcu_t)c - 'a' < 26; } #elif !defined(moo_is_bch_lower) -# define moo_is_bch_lower(c) ((moo_bchu_t)(c) - 'a' < 26) +# define moo_is_bch_lower(c) ((moo_bcu_t)(c) - 'a' < 26) #endif #if !defined(moo_is_bch_alpha) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_alpha (moo_bch_t c) { return ((moo_bchu_t)c | 32) - 'a' < 26; } +static MOO_INLINE int moo_is_bch_alpha (moo_bch_t c) { return ((moo_bcu_t)c | 32) - 'a' < 26; } #elif !defined(moo_is_bch_alpha) -# define moo_is_bch_alpha(c) (((moo_bchu_t)(c) | 32) - 'a' < 26) +# define moo_is_bch_alpha(c) (((moo_bcu_t)(c) | 32) - 'a' < 26) #endif #if !defined(moo_is_bch_digit) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_digit (moo_bch_t c) { return (moo_bchu_t)c - '0' < 10; } +static MOO_INLINE int moo_is_bch_digit (moo_bch_t c) { return (moo_bcu_t)c - '0' < 10; } #elif !defined(moo_is_bch_digit) -# define moo_is_bch_digit(c) ((moo_bchu_t)(c) - '0' < 10) +# define moo_is_bch_digit(c) ((moo_bcu_t)(c) - '0' < 10) #endif #if !defined(moo_is_bch_xdigit) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_xdigit (moo_bch_t c) { return moo_is_bch_digit(c) || ((moo_bchu_t)c | 32) - 'a' < 6; } +static MOO_INLINE int moo_is_bch_xdigit (moo_bch_t c) { return moo_is_bch_digit(c) || ((moo_bcu_t)c | 32) - 'a' < 6; } #elif !defined(moo_is_bch_xdigit) -# define moo_is_bch_xdigit(c) (moo_is_bch_digit(c) || ((moo_bchu_t)(c) | 32) - 'a' < 6) +# define moo_is_bch_xdigit(c) (moo_is_bch_digit(c) || ((moo_bcu_t)(c) | 32) - 'a' < 6) #endif #if !defined(moo_is_bch_alnum) && defined(MOO_HAVE_INLINE) @@ -209,27 +209,27 @@ static MOO_INLINE int moo_is_bch_alnum (moo_bch_t c) { return moo_is_bch_alpha(c #endif #if !defined(moo_is_bch_space) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_space (moo_bch_t c) { return c == ' ' || (moo_bchu_t)c - '\t' < 5; } +static MOO_INLINE int moo_is_bch_space (moo_bch_t c) { return c == ' ' || (moo_bcu_t)c - '\t' < 5; } #elif !defined(moo_is_bch_space) -# define moo_is_bch_space(c) ((c) == ' ' || (moo_bchu_t)(c) - '\t' < 5) +# define moo_is_bch_space(c) ((c) == ' ' || (moo_bcu_t)(c) - '\t' < 5) #endif #if !defined(moo_is_bch_print) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_print (moo_bch_t c) { return (moo_bchu_t)c - ' ' < 95; } +static MOO_INLINE int moo_is_bch_print (moo_bch_t c) { return (moo_bcu_t)c - ' ' < 95; } #elif !defined(moo_is_bch_print) -# define moo_is_bch_print(c) ((moo_bchu_t)(c) - ' ' < 95) +# define moo_is_bch_print(c) ((moo_bcu_t)(c) - ' ' < 95) #endif #if !defined(moo_is_bch_graph) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_graph (moo_bch_t c) { return (moo_bchu_t)c - '!' < 94; } +static MOO_INLINE int moo_is_bch_graph (moo_bch_t c) { return (moo_bcu_t)c - '!' < 94; } #elif !defined(moo_is_bch_graph) -# define moo_is_bch_graph(c) ((moo_bchu_t)(c) - '!' < 94) +# define moo_is_bch_graph(c) ((moo_bcu_t)(c) - '!' < 94) #endif #if !defined(moo_is_bch_cntrl) && defined(MOO_HAVE_INLINE) -static MOO_INLINE int moo_is_bch_cntrl (moo_bch_t c) { return (moo_bchu_t)c < ' ' || (moo_bchu_t)c == 127; } +static MOO_INLINE int moo_is_bch_cntrl (moo_bch_t c) { return (moo_bcu_t)c < ' ' || (moo_bcu_t)c == 127; } #elif !defined(moo_is_bch_cntrl) -# define moo_is_bch_cntrl(c) ((moo_bchu_t)(c) < ' ' || (moo_bchu_t)(c) == 127) +# define moo_is_bch_cntrl(c) ((moo_bcu_t)(c) < ' ' || (moo_bcu_t)(c) == 127) #endif #if !defined(moo_is_bch_punct) && defined(MOO_HAVE_INLINE) diff --git a/moo/lib/moo-cmn.h b/moo/lib/moo-cmn.h index 05ba965..19fd62c 100644 --- a/moo/lib/moo-cmn.h +++ b/moo/lib/moo-cmn.h @@ -350,6 +350,7 @@ typedef char moo_bch_t; typedef int moo_bci_t; +typedef unsigned int moo_bcu_t; typedef unsigned char moo_bchu_t; /* unsigned version of moo_bch_t for inner working */ #define MOO_SIZEOF_BCH_T MOO_SIZEOF_CHAR #define MOO_SIZEOF_BCI_T MOO_SIZEOF_INT @@ -374,6 +375,7 @@ typedef unsigned char moo_bchu_t; /* unsigned version of moo_bch_t for #endif typedef moo_int32_t moo_uci_t; +typedef moo_uint32_t moo_ucu_t; #define MOO_SIZEOF_UCI_T 4 typedef moo_uint8_t moo_oob_t; @@ -411,6 +413,7 @@ typedef struct moo_bcs_t moo_bcs_t; typedef moo_uch_t moo_ooch_t; typedef moo_uchu_t moo_oochu_t; typedef moo_uci_t moo_ooci_t; + typedef moo_ucu_t moo_oocu_t; typedef moo_ucs_t moo_oocs_t; # define MOO_OOCH_IS_UCH # define MOO_SIZEOF_OOCH_T MOO_SIZEOF_UCH_T @@ -418,6 +421,7 @@ typedef struct moo_bcs_t moo_bcs_t; typedef moo_bch_t moo_ooch_t; typedef moo_bchu_t moo_oochu_t; typedef moo_bci_t moo_ooci_t; + typedef moo_bcu_t moo_oocu_t; typedef moo_bcs_t moo_oocs_t; # define MOO_OOCH_IS_BCH # define MOO_SIZEOF_OOCH_T MOO_SIZEOF_BCH_T