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

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

View File

@ -161,7 +161,7 @@ static void stop_run (void* arg)
static void set_intr_run (void)
{
qse_setintrhandler (stop_run, QSE_NULL);
qse_set_intr_handler (stop_run, QSE_NULL);
#if !defined(_WIN32) && !defined(__OS2__) && !defined(__DOS__) && defined(SIGPIPE)
setsignal (SIGPIPE, SIG_IGN, 0);
#endif
@ -169,7 +169,7 @@ static void set_intr_run (void)
static void unset_intr_run (void)
{
qse_clearintrhandler ();
qse_clear_intr_handler ();
#if !defined(_WIN32) && !defined(__OS2__) && !defined(__DOS__) && defined(SIGPIPE)
setsignal (SIGPIPE, SIG_DFL, 0);
#endif

View File

@ -502,7 +502,7 @@ static void stop_run (void* arg)
static void set_intr_run (void)
{
qse_setintrhandler (stop_run, QSE_NULL);
qse_set_intr_handler (stop_run, QSE_NULL);
#if !defined(_WIN32) && !defined(__OS2__) && !defined(__DOS__) && defined(SIGPIPE)
setsignal (SIGPIPE, SIG_IGN, 0);
#endif
@ -510,7 +510,7 @@ static void set_intr_run (void)
static void unset_intr_run (void)
{
qse_clearintrhandler ();
qse_clear_intr_handler ();
#if !defined(_WIN32) && !defined(__OS2__) && !defined(__DOS__) && defined(SIGPIPE)
setsignal (SIGPIPE, SIG_DFL, 0);
#endif

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;

View File

@ -127,7 +127,7 @@ static int setsignal (int sig, void(*handler)(int), int restart)
}
#endif
void qse_setintrhandler (qse_intr_handler_t handler, void* arg)
void qse_set_intr_handler (qse_intr_handler_t handler, void* arg)
{
intr_handler = handler;
intr_handler_arg = arg;
@ -145,7 +145,7 @@ void qse_setintrhandler (qse_intr_handler_t handler, void* arg)
#endif
}
void qse_clearintrhandler (void)
void qse_clear_intr_handler (void)
{
intr_handler = QSE_NULL;
intr_handler_arg = QSE_NULL;

View File

@ -125,9 +125,9 @@ int main ()
qse_open_stdsios ();
qse_setintrhandler (stop_run, QSE_NULL);
qse_set_intr_handler (stop_run, QSE_NULL);
test_001 ();
qse_clearintrhandler ();
qse_clear_intr_handler ();
qse_close_stdsios ();