changed to prefer char16_t with c11 compiler. yet to add --prefer-char16 option to configure.ac

This commit is contained in:
2018-01-29 15:38:32 +00:00
parent 11d1344b70
commit 2fbfe3a71b
7 changed files with 40 additions and 14 deletions

View File

@ -273,8 +273,13 @@
*/
#define QSE_MT(txt) (txt)
#define QSE_WQ_I(val) (L ## #val)
#define QSE_WQ(val) QSE_WQ_I(val)
#if defined(QSE_WCHAR_IS_CHAR16_T)
# define QSE_WQ_I(val) (u ## #val)
# define QSE_WQ(val) QSE_WQ_I(val)
#else
# define QSE_WQ_I(val) (L ## #val)
# define QSE_WQ(val) QSE_WQ_I(val)
#endif
/**
* The #QSE_WT macro maps a multi-byte literal string to a wide character
@ -282,6 +287,8 @@
*/
#if (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_MCHAR_T)
# define QSE_WT(txt) (txt)
#elif defined(QSE_WCHAR_IS_CHAR16_T)
# define QSE_WT(txt) (u ## txt)
#else
# define QSE_WT(txt) (L ## txt)
#endif

View File

@ -42,8 +42,8 @@ typedef void (*qse_intr_handler_t) (void *arg);
extern "C" {
#endif
QSE_EXPORT void qse_setintrhandler (qse_intr_handler_t handler, void* arg);
QSE_EXPORT void qse_clearintrhandler (void);
QSE_EXPORT void qse_set_intr_handler (qse_intr_handler_t handler, void* arg);
QSE_EXPORT void qse_clear_intr_handler (void);
#ifdef __cplusplus
}

View File

@ -523,7 +523,7 @@ typedef unsigned char qse_mchau_t;
* #QSE_MCHAR_EOF.
*/
typedef int qse_mcint_t;
#define QSE_SIZEOF_MCINT_T QSE_SIZEOF_INT
/*#define QSE_SIZEOF_MCINT_T QSE_SIZEOF_INT*/
/** \typedef qse_wchar_t
@ -536,7 +536,26 @@ typedef int qse_mcint_t;
* The qse_wcint_t type defines a type that can hold a qse_wchar_t value and
* #QSE_WCHAR_EOF.
*/
#if defined(__cplusplus) && (defined(__WATCOMC__) && (__WATCOMC__ < 1200))
#if /*defined(QSE_PREFER_CHAR16_T) &&*/ defined(__GNUC__) && defined(__CHAR16_TYPE__) && \
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
/* C11 */
typedef __CHAR16_TYPE__ qse_wchar_t;
typedef qse_uint16_t qse_wchau_t;
#if (QSE_SIZEOF_INT > 2)
typedef int qse_wcint_t;
#else
typedef qse_uint16_t qse_wcint_t;
#endif
#define QSE_WCHAR_IS_CHAR16_T
#undef QSE_SIZEOF_WCHAR_T
#define QSE_SIZEOF_WCHAR_T 2
#elif defined(__cplusplus) && (defined(__WATCOMC__) && (__WATCOMC__ < 1200))
/* WATCOM C++ before OpenWatcom */
typedef long char qse_wchar_t;