diverted w/W to k/K in format_stack_args() in the non-unicode mode

This commit is contained in:
hyunghwan.chung 2019-06-02 15:58:31 +00:00
parent 1222c2bf78
commit d7246b729e

View File

@ -2345,6 +2345,10 @@ static MOO_INLINE int format_stack_args (moo_fmtout_t* fmtout, moo_ooi_t nargs,
break;
}
#if !defined(MOO_OOCH_IS_UCH)
case 'w': /* the string object is not in the unicode encoding */
case 'W': /* treat w/W like k/K */
#endif
case 'k':
case 'K':
{
@ -2397,7 +2401,13 @@ static MOO_INLINE int format_stack_args (moo_fmtout_t* fmtout, moo_ooi_t nargs,
else
{
moo_bch_t xbuf[3];
moo_byte_to_bcstr (*bsp, xbuf, MOO_COUNTOF(xbuf), (16 | (ch == 'k'? MOO_BYTE_TO_BCSTR_LOWERCASE: 0)), '0');
int flagged_radix = 16;
#if defined(HCL_OOCH_IS_UCH)
if (ch == 'k') flagged_radix |= MOO_BYTE_TO_BCSTR_LOWERCASE;
#else
if (ch == 'k' || ch == 'w') flagged_radix |= MOO_BYTE_TO_BCSTR_LOWERCASE;
#endif
moo_byte_to_bcstr (*bsp, xbuf, MOO_COUNTOF(xbuf), flagged_radix, '0');
if (lm_flag & (LF_H | LF_L)) PUT_BCS (fmtout, "\\x", 2);
PUT_BCS (fmtout, xbuf, 2);
}
@ -2413,6 +2423,7 @@ static MOO_INLINE int format_stack_args (moo_fmtout_t* fmtout, moo_ooi_t nargs,
break;
}
#if defined(MOO_OOCH_IS_UCH)
case 'w':
case 'W':
{
@ -2479,6 +2490,7 @@ static MOO_INLINE int format_stack_args (moo_fmtout_t* fmtout, moo_ooi_t nargs,
if ((flagc & FLAGC_LEFTADJ) && width > 0) PUT_OOCH (fmtout, padc, width);
break;
}
#endif
case 'O': /* object - ignore precision, width, adjustment */
GET_NEXT_ARG_TO (moo, nargs, &arg_state, arg);