use MAKEWORD16 for Str2Key and MSG_CHAR

This commit is contained in:
VincentWei
2018-02-02 11:40:01 +08:00
parent f4ccf7ee1c
commit c6c60b862b
12 changed files with 68 additions and 42 deletions

View File

@@ -83,6 +83,7 @@ dnl User selectable options
dnl System wide options
devel_mode="no"
detail_debug="no"
trace_message="no"
message_string="no"
@@ -285,6 +286,10 @@ AC_ARG_ENABLE(develmode,
[ --enable-develmode developer mode <default=no>],
devel_mode=$enableval)
AC_ARG_ENABLE(detaildebug,
[ --enable-detaildebug detailed debug info <default=no>],
detail_debug=$enableval)
AC_ARG_ENABLE(tracemsg,
[ --enable-tracemsg trace messages of MiniGUI <default=no>],
trace_message=$enableval)
@@ -1638,6 +1643,9 @@ fi
if test "x$devel_mode" = "xyes"; then
message_string="yes"
if test "x$detail_debug" = "xyes"; then
trace_message="yes"
fi
build_auto_ial_engine="yes"
build_random_ial_engine="yes"
@@ -2425,7 +2433,11 @@ dnl define _GNU_SOURCE for pthread_rwlock_t
CFLAGS="$CFLAGS -D_GNU_SOURCE"
if test "x$devel_mode" = "xyes"; then
CPPFLAGS="$CPPFLAGS -DDEBUG -D_DEBUG"
CPPFLAGS="$CPPFLAGS -D_DEBUG"
if test "x$detail_debug" = "xyes"; then
CPPFLAGS="$CPPFLAGS -DDEBUG"
fi
if test "$ac_cv_prog_gcc" = "yes"; then
CPPFLAGS="$CPPFLAGS -Wall -Werror"
fi

View File

@@ -719,9 +719,17 @@ typedef UINT_PTR LPARAM;
*/
#define HISWORD(l) ((SWORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD))
/**
* \def MAKELONG32(low, high)
* \brief Makes a 32-bit double word from \a low word and \a high word which are both in 16-bit.
* \sa MAKELONG
*/
#define MAKELONG32(low, high) ((DWORD32)(((WORD16)(low)) | (((DWORD32)((WORD16)(high))) << 16)))
/**
* \def MAKELONG(low, high)
* \brief Makes a double word from \a low word and \a high word.
* \brief Makes a double word with pointer precision from \a low word and \a high word.
* \sa MAKELONG32
*/
#define MAKELONG(low, high) ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << NR_BITS_WORD)))
@@ -1934,8 +1942,12 @@ int init_minigui_printf (int (*output_char) (int ch),
#if defined(__GNUC__)
# define _ERR_PRINTF(fmt...) fprintf (stderr, fmt)
# ifdef _DEBUG
# define _MG_PRINTF(fmt...) fprintf (stderr, fmt)
# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt)
# define _MG_PRINTF(fmt...) fprintf (stdout, fmt)
# ifdef DEBUG
# define _DBG_PRINTF(fmt...) fprintf (stdout, fmt)
# else
# define _DBG_PRINTF(fmt...)
# endif
# else
# define _MG_PRINTF(fmt...)
# define _DBG_PRINTF(fmt...)
@@ -1952,7 +1964,18 @@ static inline void _ERR_PRINTF(const char* fmt, ...)
}
static inline void _MG_PRINTF(const char* fmt, ...)
{
#ifdef _DEBUG
#ifdef DEBUG
va_list ap;
va_start (ap, fmt);
vfprintf (stdout, fmt, ap);
fprintf (stdout, "\n");
va_end (ap);
#endif
}
static inline void _DBG_PRINTF(const char* fmt, ...)
{
#if defined(DEBUG) && defined(_DEBUG)
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
@@ -1960,18 +1983,7 @@ static inline void _MG_PRINTF(const char* fmt, ...)
va_end(ap);
#endif
}
static inline void _DBG_PRINTF(const char* fmt, ...)
{
#ifdef _DEBUG
va_list ap;
va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
va_end(ap);
#endif
}
#endif /* __GNUC__ */
#endif /* !__GNUC__ */
#ifdef _MGRM_THREADS

View File

@@ -427,6 +427,9 @@ extern "C" {
* \param ch The ASCII code of the pressed key.
* \param key_flags The shift key status when this message occurred.
*
* \note Please use \a LOBYTE_WORD16 and \a HIBYTE_WORD16 to get the bytes
* if the character is a two-byte character.
*
* \sa MSG_SYSCHAR, TranslateMessage, key_defs
*/
#define MSG_CHAR 0x0011

View File

@@ -2004,8 +2004,8 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
return;
}
ch [0] = LOBYTE (wParam);
ch [1] = HIBYTE (wParam);
ch [0] = LOBYTE_WORD16 (wParam);
ch [1] = HIBYTE_WORD16 (wParam);
ch [2] = (0x0ff0000 & wParam) >> 16;
if (ch[2]) {

View File

@@ -3525,7 +3525,7 @@ static int utf16le_len_first_char (const unsigned char* mstr, int len)
if (len < 2)
return 0;
w1 = MAKEWORD (mstr[0], mstr[1]);
w1 = MAKEWORD16 (mstr[0], mstr[1]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return 2;
@@ -3533,7 +3533,7 @@ static int utf16le_len_first_char (const unsigned char* mstr, int len)
if (w1 >= 0xD800 && w1 <= 0xDBFF) {
if (len < 4)
return 0;
w2 = MAKEWORD (mstr[2], mstr[3]);
w2 = MAKEWORD16 (mstr[2], mstr[3]);
if (w2 < 0xDC00 || w2 > 0xDFFF)
return 0;
}
@@ -3547,12 +3547,12 @@ static Glyph32 utf16le_char_glyph_value (const unsigned char* pre_mchar,
UChar16 w1, w2;
UChar32 wc;
w1 = MAKEWORD (cur_mchar[0], cur_mchar[1]);
w1 = MAKEWORD16 (cur_mchar[0], cur_mchar[1]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return w1;
w2 = MAKEWORD (cur_mchar[2], cur_mchar[3]);
w2 = MAKEWORD16 (cur_mchar[2], cur_mchar[3]);
wc = w1;
wc <<= 10;
@@ -3765,7 +3765,7 @@ static int utf16be_len_first_char (const unsigned char* mstr, int len)
if (len < 2)
return 0;
w1 = MAKEWORD (mstr[1], mstr[0]);
w1 = MAKEWORD16 (mstr[1], mstr[0]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return 2;
@@ -3773,7 +3773,7 @@ static int utf16be_len_first_char (const unsigned char* mstr, int len)
if (w1 >= 0xD800 && w1 <= 0xDBFF) {
if (len < 4)
return 0;
w2 = MAKEWORD (mstr[3], mstr[2]);
w2 = MAKEWORD16 (mstr[3], mstr[2]);
if (w2 < 0xDC00 || w2 > 0xDFFF)
return 0;
}
@@ -3787,12 +3787,12 @@ static Glyph32 utf16be_char_glyph_value (const unsigned char* pre_mchar,
UChar16 w1, w2;
UChar32 wc;
w1 = MAKEWORD (cur_mchar[1], cur_mchar[0]);
w1 = MAKEWORD16 (cur_mchar[1], cur_mchar[0]);
if (w1 < 0xD800 || w1 > 0xDFFF)
return w1;
w2 = MAKEWORD (cur_mchar[3], cur_mchar[2]);
w2 = MAKEWORD16 (cur_mchar[3], cur_mchar[2]);
wc = w1;
wc <<= 10;

View File

@@ -113,7 +113,7 @@ static int set_gbhz_pinyin (unsigned char ch1, unsigned char ch2, unsigned short
p = gbhz_py_tab + index;
p->encoding = MAKEWORD (ch2, ch1);
p->encoding = MAKEWORD16 (ch2, ch1);
for (i = 0; i < MAX_NR_PINYIN; i++) {
if (p->pinyin [i] == 0) {
p->pinyin [i] = no_py;

View File

@@ -561,7 +561,7 @@ BOOL GUIAPI TranslateMessage (PMSG pMsg)
else if (__mg_kinfo.pos == 2 && arabic_compose_flag) {
/*
SendNotifyMessage (pMsg->hwnd, MSG_CHAR,
MAKEWORD (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
MAKEWORD16 (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
pMsg->lParam);
*/
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, __mg_kinfo.buff[0], pMsg->lParam);
@@ -571,7 +571,7 @@ BOOL GUIAPI TranslateMessage (PMSG pMsg)
else {
for (i = 0; i < __mg_kinfo.pos; i++)
SendNotifyMessage (pMsg->hwnd, MSG_KEYSYM,
MAKEWORD (__mg_kinfo.buff[i], i), pMsg->lParam);
MAKEWORD16 (__mg_kinfo.buff[i], i), pMsg->lParam);
}
return FALSE;
@@ -612,7 +612,7 @@ BOOL GUIAPI TranslateMessage (PMSG pMsg)
else if (kinfo.pos == 2 && arabic_compose_flag) {
/*
SendNotifyMessage (pMsg->hwnd, MSG_CHAR,
MAKEWORD (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
MAKEWORD16 (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
pMsg->lParam);
*/
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, kinfo.buff[0], pMsg->lParam);

View File

@@ -1348,7 +1348,7 @@ void __mg_ime_writemsg (BYTE *buffer, int len, LPARAM lParam, BOOL bDByte)
if (bDByte) {
for (i=0; i<len; i+=2) {
wDByte = MAKEWORD (buffer[i], buffer[i+1]);
wDByte = MAKEWORD16 (buffer[i], buffer[i+1]);
if (sg_hTargetWnd)
PostMessage (sg_hTargetWnd, MSG_CHAR, wDByte, 0);
#if defined(_LITE_VERSION) && !defined(_STAND_ALONE)

View File

@@ -70,14 +70,14 @@ void* win_PCXVFbInit (char* execl_file, char* etc_param, const char *skin)
char caption[64] = "wvfb";
char cmdline[512];
STARTUPINFO si;
WORD wVersionRequested;
WORD16 wVersionRequested;
WSADATA wsaData;
struct sockaddr_in ser_addr;
struct sockaddr_in c_addr;
int client_len;
// Initial for the socket ......
wVersionRequested = MAKEWORD(2, 2);
wVersionRequested = MAKEWORD16 (2, 2);
if (0 != WSAStartup(wVersionRequested, &wsaData))
{
return NULL;

View File

@@ -677,8 +677,8 @@ static void _dc_draw_pixel_span_and_1 (COMP_CTXT* comp_ctxt, int w)
#ifdef ASM_memandset4
if (comp_ctxt->step == 1 && !((Uint32)row & 3)
&& !(w & 3) && (w > 3)) {
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG (_w, _w);
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG32 (_w, _w);
ASM_memandset4 (row, _u, w >> 2);
return;
}
@@ -751,8 +751,8 @@ static void _dc_draw_pixel_span_or_1 (COMP_CTXT* comp_ctxt, int w)
#ifdef ASM_memorset4
if (comp_ctxt->step == 1 && !((Uint32)row & 3)
&& !(w & 3) && (w > 3)) {
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG (_w, _w);
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG32 (_w, _w);
ASM_memorset4 (row, _u, w >> 2);
return;
}
@@ -826,8 +826,8 @@ static void _dc_draw_pixel_span_xor_1 (COMP_CTXT* comp_ctxt, int w)
#ifdef ASM_memxorset4
if (comp_ctxt->step == 1 && !((Uint32)comp_ctxt->cur_dst & 3)
&& !(w & 3) && (w > 3)) {
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG (_w, _w);
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
Uint32 _u = MAKELONG32 (_w, _w);
ASM_memxorset4 (comp_ctxt->cur_dst, _u, w >> 2);
return;
}

View File

@@ -830,7 +830,7 @@ RES_KEY Str2Key (const char* str)
l = (strlen(str)+1) / 2;
for (i=0; i<l; i++) {
unsigned short w = MAKEWORD(str[i<<1], str[(i<<1)+1]);
Uint16 w = MAKEWORD16(str[i<<1], str[(i<<1)+1]);
ret ^= (w<<(i&0x0f));
}

View File

@@ -1,4 +1,3 @@
/*
** $Id: resource.c 12916 2010-05-14 03:51:46Z wanzheng $
**