added moo_oocu_t, moo_ucu_t, moo_bcu_t

This commit is contained in:
hyunghwan.chung 2019-11-19 13:50:31 +00:00
parent 207c12ea1e
commit 3a27f74492
2 changed files with 22 additions and 18 deletions

View File

@ -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 */ * these implemenent latin-1 only */
#if !defined(moo_is_bch_upper) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_lower) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_alpha) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_digit) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_xdigit) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_alnum) && defined(MOO_HAVE_INLINE) #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 #endif
#if !defined(moo_is_bch_space) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_print) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_graph) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_cntrl) && defined(MOO_HAVE_INLINE) #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) #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 #endif
#if !defined(moo_is_bch_punct) && defined(MOO_HAVE_INLINE) #if !defined(moo_is_bch_punct) && defined(MOO_HAVE_INLINE)

View File

@ -350,6 +350,7 @@
typedef char moo_bch_t; typedef char moo_bch_t;
typedef int moo_bci_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 */ 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_BCH_T MOO_SIZEOF_CHAR
#define MOO_SIZEOF_BCI_T MOO_SIZEOF_INT #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 #endif
typedef moo_int32_t moo_uci_t; typedef moo_int32_t moo_uci_t;
typedef moo_uint32_t moo_ucu_t;
#define MOO_SIZEOF_UCI_T 4 #define MOO_SIZEOF_UCI_T 4
typedef moo_uint8_t moo_oob_t; 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_uch_t moo_ooch_t;
typedef moo_uchu_t moo_oochu_t; typedef moo_uchu_t moo_oochu_t;
typedef moo_uci_t moo_ooci_t; typedef moo_uci_t moo_ooci_t;
typedef moo_ucu_t moo_oocu_t;
typedef moo_ucs_t moo_oocs_t; typedef moo_ucs_t moo_oocs_t;
# define MOO_OOCH_IS_UCH # define MOO_OOCH_IS_UCH
# define MOO_SIZEOF_OOCH_T MOO_SIZEOF_UCH_T # 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_bch_t moo_ooch_t;
typedef moo_bchu_t moo_oochu_t; typedef moo_bchu_t moo_oochu_t;
typedef moo_bci_t moo_ooci_t; typedef moo_bci_t moo_ooci_t;
typedef moo_bcu_t moo_oocu_t;
typedef moo_bcs_t moo_oocs_t; typedef moo_bcs_t moo_oocs_t;
# define MOO_OOCH_IS_BCH # define MOO_OOCH_IS_BCH
# define MOO_SIZEOF_OOCH_T MOO_SIZEOF_BCH_T # define MOO_SIZEOF_OOCH_T MOO_SIZEOF_BCH_T