enhanced types and macros to handle the wchar_t type defined to 1 byte in size

This commit is contained in:
hyung-hwan 2014-11-17 15:25:55 +00:00
parent e3be2e5273
commit e57c9673d1
4 changed files with 18 additions and 6 deletions

View File

@ -251,7 +251,11 @@
* The #QSE_WT macro maps a multi-byte literal string to a wide character
* string by prefixing it with @b L.
*/
#if (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_MCHAR_T)
# define QSE_WT(txt) (txt)
#else
# define QSE_WT(txt) (L ## txt)
#endif
/** @def QSE_T
* The #QSE_T macro maps to #QSE_MT if #QSE_CHAR_IS_MCHAR is defined, and to

View File

@ -528,6 +528,12 @@ typedef int qse_mcint_t;
#elif defined(__GNUC__) && defined(__WCHAR_TYPE__) && defined(__WINT_TYPE__)
typedef __WCHAR_TYPE__ qse_wchar_t;
typedef __WINT_TYPE__ qse_wcint_t;
#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_MCHAR_T)
/* most likely, there is no support for wchar_t */
typedef qse_mchar_t qse_wchar_t;
typedef qse_mcint_t qse_wcint_t;
#elif (QSE_SIZEOF_WCHAR_T == 2) || (QSE_SIZEOF_WCHAR_T == 0)
typedef unsigned short qse_wchar_t;
typedef unsigned short qse_wcint_t;

View File

@ -156,7 +156,7 @@ int qse_ismctype (qse_mcint_t c, qse_mctype_t type)
static int (*f[]) (qse_mcint_t) =
{
#if 0
#if 1
is_malnum,
is_malpha,
is_mblank,
@ -169,8 +169,7 @@ int qse_ismctype (qse_mcint_t c, qse_mctype_t type)
is_mspace,
is_mupper,
is_mxdigit
#endif
#else
isalnum,
isalpha,
is_mblank,
@ -183,6 +182,7 @@ int qse_ismctype (qse_mcint_t c, qse_mctype_t type)
isspace,
isupper,
isxdigit
#endif
};
QSE_ASSERTX (type >= QSE_WCTYPE_ALNUM && type <= QSE_WCTYPE_XDIGIT,

View File

@ -299,8 +299,9 @@ void qse_dll_walk (qse_dll_t* dll, qse_dll_walker_t walker, void* ctx)
while (QSE_GDL_ISLINK(&dll->gdl,n))
{
qse_gdl_link_t tmp = *n;
qse_gdl_link_t tmp;
tmp = *n;
w = walker (dll, QSE_GDL_CONTAINER (n, qse_dll_node_t, link), ctx);
if (w == QSE_DLL_WALK_FORWARD) n = QSE_GDL_NEXT (&tmp);
@ -316,8 +317,9 @@ void qse_dll_rwalk (qse_dll_t* dll, qse_dll_walker_t walker, void* ctx)
while (QSE_GDL_ISLINK(&dll->gdl,n))
{
qse_gdl_link_t tmp = *n;
qse_gdl_link_t tmp;
tmp = *n;
w = walker (dll, QSE_GDL_CONTAINER (n, qse_dll_node_t, link), ctx);
if (w == QSE_DLL_WALK_FORWARD) n = QSE_GDL_NEXT (&tmp);