enhanced --enable-unicode to accept ucs4 and ucs2 in addition to yes/no.

redefined the moo_uch_t type to follow the enable-unicode value
This commit is contained in:
hyung-hwan 2018-02-21 10:12:47 +00:00
parent 67a334bc26
commit c12b85e0a0
4 changed files with 36 additions and 81 deletions

54
configure vendored
View File

@ -803,7 +803,6 @@ with_gnu_ld
with_sysroot
enable_libtool_lock
enable_debug
enable_override_uch
enable_unicode
enable_cxx
enable_dynamic_module
@ -1453,10 +1452,9 @@ Optional Features:
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-debug build the library in the debug mode (default. no)
--enable-override-uch Use the specified unicode character type (default.
no)
--enable-unicode Use the unicode character type as the default
character type (default. yes)
character type. one of yes, no, ucs2, ucs4 (default.
yes)
--enable-cxx build the library for C++ if a C++ compiler is
available (default. yes)
--enable-dynamic-module enable dynamic module capability(default. yes)
@ -19417,44 +19415,6 @@ $as_echo "#define HCL_BUILD_RELEASE 1" >>confdefs.h
fi
# Check whether --enable-override-uch was given.
if test "${enable_override_uch+set}" = set; then :
enableval=$enable_override_uch; enable_override_uch=$enableval
else
enable_override_uch=no
fi
if test "${enable_override_uch}" = "wchar_t"
then
test "${ac_cv_sizeof_wchar_t}" = "0" && enable_override_uch=no
test "${ac_cv_sizeof_wchar_t}" = "1" && enable_override_uch=no
elif test "${enable_override_uch}" = "char16_t"
then
test "${ac_cv_sizeof_char16_t}" = "0" && enable_override_uch=no
elif test "${enable_override_uch}" = "char32_t"
then
test "${ac_cv_sizeof_char32_t}" = "0" && enable_override_uch=no
fi
if test "${enable_override_uch}" = "wchar_t"
then
$as_echo "#define HCL_OVERRIDE_UCH_TYPE wchar_t" >>confdefs.h
elif test "${enable_override_uch}" = "char16_t"
then
$as_echo "#define HCL_OVERRIDE_UCH_TYPE char16_t" >>confdefs.h
elif test "${enable_override_uch}" = "char32_t"
then
$as_echo "#define HCL_OVERRIDE_UCH_TYPE char32_t" >>confdefs.h
fi
# Check whether --enable-unicode was given.
if test "${enable_unicode+set}" = set; then :
enableval=$enable_unicode; enable_unicode=$enableval
@ -19468,6 +19428,16 @@ then
$as_echo "#define HCL_ENABLE_UNICODE 1" >>confdefs.h
elif test "${enable_unicode}" = "ucs2"
then
$as_echo "#define HCL_ENABLE_UNICODE 2" >>confdefs.h
elif test "${enable_unicode}" = "ucs4"
then
$as_echo "#define HCL_ENABLE_UNICODE 4" >>confdefs.h
fi
# Check whether --enable-cxx was given.

View File

@ -408,43 +408,20 @@ else
AC_SUBST(BUILD_MODE, "release")
fi
AC_ARG_ENABLE([override-uch],
[AS_HELP_STRING([--enable-override-uch],[Use the specified unicode character type (default. no)])],
enable_override_uch=$enableval,
enable_override_uch=no
)
if test "${enable_override_uch}" = "wchar_t"
then
test "${ac_cv_sizeof_wchar_t}" = "0" && enable_override_uch=no
test "${ac_cv_sizeof_wchar_t}" = "1" && enable_override_uch=no
elif test "${enable_override_uch}" = "char16_t"
then
test "${ac_cv_sizeof_char16_t}" = "0" && enable_override_uch=no
elif test "${enable_override_uch}" = "char32_t"
then
test "${ac_cv_sizeof_char32_t}" = "0" && enable_override_uch=no
fi
if test "${enable_override_uch}" = "wchar_t"
then
AC_DEFINE([HCL_OVERRIDE_UCH_TYPE],[wchar_t],[unicode character type])
elif test "${enable_override_uch}" = "char16_t"
then
AC_DEFINE([HCL_OVERRIDE_UCH_TYPE],[char16_t],[unicode character type])
elif test "${enable_override_uch}" = "char32_t"
then
AC_DEFINE([HCL_OVERRIDE_UCH_TYPE],[char32_t],[unicode character type])
fi
AC_ARG_ENABLE([unicode],
[AS_HELP_STRING([--enable-unicode],[Use the unicode character type as the default character type (default. yes)])],
[AS_HELP_STRING([--enable-unicode],[Use the unicode character type as the default character type. one of yes, no, ucs2, ucs4 (default. yes)])],
enable_unicode=$enableval,
enable_unicode=yes
)
if test "${enable_unicode}" = "yes"
then
AC_DEFINE([HCL_ENABLE_UNICODE],[1],[Use the unicode character type as the default character type])
elif test "${enable_unicode}" = "ucs2"
then
AC_DEFINE([HCL_ENABLE_UNICODE],[2],[Use the unicode character type as the default character type])
elif test "${enable_unicode}" = "ucs4"
then
AC_DEFINE([HCL_ENABLE_UNICODE],[4],[Use the unicode character type as the default character type])
fi
AC_ARG_ENABLE([cxx],

View File

@ -243,9 +243,6 @@
/* MB_LEN_MAX */
#undef HCL_MBLEN_MAX
/* unicode character type */
#undef HCL_OVERRIDE_UCH_TYPE
/* Author */
#undef HCL_PACKAGE_AUTHOR

View File

@ -280,15 +280,26 @@ typedef unsigned char hcl_bchu_t; /* unsigned version of hcl_bch_t for
#define HCL_SIZEOF_BCH_T HCL_SIZEOF_CHAR
#define HCL_SIZEOF_BCI_T HCL_SIZEOF_INT
#if defined(__GNUC__) && defined(__CHAR16_TYPE__)
/* TODO ... wchar_t???, char16_t? char32_t? */
typedef __CHAR16_TYPE__ hcl_uch_t;
#if defined(HCL_ENABLE_UNICODE) && (HCL_ENABLE_UNICODE == 4)
# if defined(__GNUC__) && defined(__CHAR32_TYPE__)
typedef __CHAR32_TYPE__ hcl_uch_t;
# else
typedef hcl_uint16_t hcl_uch_t;
typedef hcl_uint32_t hcl_uch_t;
# endif
typedef hcl_int32_t hcl_uci_t;
typedef hcl_uint32_t hcl_uchu_t; /* same as hcl_uch_t as it is already unsigned */
# define HCL_SIZEOF_UCH_T 4
#elif defined(__GNUC__) && defined(__CHAR16_TYPE__)
typedef __CHAR16_TYPE__ hcl_uch_t;
typedef hcl_uint16_t hcl_uchu_t; /* same as hcl_uch_t as it is already unsigned */
# define HCL_SIZEOF_UCH_T 2
#else
typedef hcl_uint16_t hcl_uch_t;
typedef hcl_uint16_t hcl_uchu_t; /* same as hcl_uch_t as it is already unsigned */
# define HCL_SIZEOF_UCH_T 2
#endif
typedef hcl_int32_t hcl_uci_t;
#define HCL_SIZEOF_UCI_T 4
typedef hcl_uint8_t hcl_oob_t;