some fixes for bch mode

This commit is contained in:
hyung-hwan 2020-01-24 06:54:49 +00:00
parent 58515d6c39
commit c3d7da33f5
2 changed files with 14 additions and 5 deletions

View File

@ -998,8 +998,8 @@ int Hawk::Value::setIndexedStr (const Index& idx, const hawk_uch_t* str, bool nu
int Hawk::Value::setIndexedStr (Run* r, const Index& idx, const hawk_uch_t* str, bool numeric)
{
hawk_val_t* tmp;
tmp = numeric? hawk_rtx_makenstrvalwithoocstr(r->rtx, str):
hawk_rtx_makestrvalwithoocstr(r->rtx, str);
tmp = numeric? hawk_rtx_makenstrvalwithucstr(r->rtx, str):
hawk_rtx_makestrvalwithucstr(r->rtx, str);
if (tmp == HAWK_NULL)
{
r->hawk->retrieveError (r);
@ -1378,8 +1378,8 @@ const hawk_uch_t* Hawk::getErrorLocationFileU () const
if (!this->errinf.loc.file) return HAWK_NULL;
hawk_oow_t wcslen, mbslen;
wcslen = HAWK_COUNTOF(this->xerrlocfile);
hawk_conv_bcstr_to_ucstr_with_cmgr (this->errinf.loc.file, &mbslen, hawk->xerrlocfile, &wcslen, this->getCmgr(), 1);
return hawk->xerrlocfile;
hawk_conv_bcstr_to_ucstr_with_cmgr (this->errinf.loc.file, &mbslen, this->xerrlocfile, &wcslen, this->getCmgr(), 1);
return this->xerrlocfile;
#endif
}

View File

@ -417,7 +417,7 @@ static global_t gtab[] =
{ \
hawk_bch_t __xbuf[HAWK_MBLEN_MAX + 1]; \
hawk_oow_t __len, __i; \
__len = hawk_uctoutf8(c, __xbuf, HAWK_COUNTOF(__xbuf)); /* use utf8 all the time */ \
__len = uc_to_utf8(c, __xbuf, HAWK_COUNTOF(__xbuf)); /* use utf8 all the time */ \
for (__i = 0; __i < __len; __i++) ADD_TOKEN_CHAR(awk, tok, __xbuf[__i]); \
} \
} while (0)
@ -439,6 +439,15 @@ static global_t gtab[] =
#define ADJERR_LOC(hawk,l) do { (hawk)->_gem.errloc = *(l); } while (0)
#if defined(HAWK_OOCH_IS_BCH)
static HAWK_INLINE hawk_oow_t uc_to_utf8 (hawk_uch_t uc, hawk_bch_t* buf, hawk_oow_t bsz)
{
static hawk_cmgr_t* utf8_cmgr = HAWK_NULL;
if (!utf8_cmgr) utf8_cmgr = hawk_get_cmgr_by_id(HAWK_CMGR_UTF8);
return utf8_cmgr->uctobc(uc, buf, bsz);
}
#endif
static HAWK_INLINE int is_plain_var (hawk_nde_t* nde)
{
return nde->type == HAWK_NDE_GBL ||