enhanced types and macros to handle the wchar_t type defined to 1 byte in size
This commit is contained in:
parent
e3be2e5273
commit
e57c9673d1
@ -251,7 +251,11 @@
|
|||||||
* The #QSE_WT macro maps a multi-byte literal string to a wide character
|
* The #QSE_WT macro maps a multi-byte literal string to a wide character
|
||||||
* string by prefixing it with @b L.
|
* string by prefixing it with @b L.
|
||||||
*/
|
*/
|
||||||
#define QSE_WT(txt) (L ## txt)
|
#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
|
/** @def QSE_T
|
||||||
* The #QSE_T macro maps to #QSE_MT if #QSE_CHAR_IS_MCHAR is defined, and to
|
* The #QSE_T macro maps to #QSE_MT if #QSE_CHAR_IS_MCHAR is defined, and to
|
||||||
|
@ -528,6 +528,12 @@ typedef int qse_mcint_t;
|
|||||||
#elif defined(__GNUC__) && defined(__WCHAR_TYPE__) && defined(__WINT_TYPE__)
|
#elif defined(__GNUC__) && defined(__WCHAR_TYPE__) && defined(__WINT_TYPE__)
|
||||||
typedef __WCHAR_TYPE__ qse_wchar_t;
|
typedef __WCHAR_TYPE__ qse_wchar_t;
|
||||||
typedef __WINT_TYPE__ qse_wcint_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)
|
#elif (QSE_SIZEOF_WCHAR_T == 2) || (QSE_SIZEOF_WCHAR_T == 0)
|
||||||
typedef unsigned short qse_wchar_t;
|
typedef unsigned short qse_wchar_t;
|
||||||
typedef unsigned short qse_wcint_t;
|
typedef unsigned short qse_wcint_t;
|
||||||
|
@ -156,7 +156,7 @@ int qse_ismctype (qse_mcint_t c, qse_mctype_t type)
|
|||||||
|
|
||||||
static int (*f[]) (qse_mcint_t) =
|
static int (*f[]) (qse_mcint_t) =
|
||||||
{
|
{
|
||||||
#if 0
|
#if 1
|
||||||
is_malnum,
|
is_malnum,
|
||||||
is_malpha,
|
is_malpha,
|
||||||
is_mblank,
|
is_mblank,
|
||||||
@ -169,8 +169,7 @@ int qse_ismctype (qse_mcint_t c, qse_mctype_t type)
|
|||||||
is_mspace,
|
is_mspace,
|
||||||
is_mupper,
|
is_mupper,
|
||||||
is_mxdigit
|
is_mxdigit
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
isalnum,
|
isalnum,
|
||||||
isalpha,
|
isalpha,
|
||||||
is_mblank,
|
is_mblank,
|
||||||
@ -183,6 +182,7 @@ int qse_ismctype (qse_mcint_t c, qse_mctype_t type)
|
|||||||
isspace,
|
isspace,
|
||||||
isupper,
|
isupper,
|
||||||
isxdigit
|
isxdigit
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
QSE_ASSERTX (type >= QSE_WCTYPE_ALNUM && type <= QSE_WCTYPE_XDIGIT,
|
QSE_ASSERTX (type >= QSE_WCTYPE_ALNUM && type <= QSE_WCTYPE_XDIGIT,
|
||||||
|
@ -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))
|
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);
|
w = walker (dll, QSE_GDL_CONTAINER (n, qse_dll_node_t, link), ctx);
|
||||||
|
|
||||||
if (w == QSE_DLL_WALK_FORWARD) n = QSE_GDL_NEXT (&tmp);
|
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))
|
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);
|
w = walker (dll, QSE_GDL_CONTAINER (n, qse_dll_node_t, link), ctx);
|
||||||
|
|
||||||
if (w == QSE_DLL_WALK_FORWARD) n = QSE_GDL_NEXT (&tmp);
|
if (w == QSE_DLL_WALK_FORWARD) n = QSE_GDL_NEXT (&tmp);
|
||||||
|
Loading…
Reference in New Issue
Block a user