added hak_makesymbolwithuchars()/hak_makesymbolwithbchars()/hak_makestringwithuchars()/hak_makestirngwithbchars()

fixed some fpc code related to character type configured
This commit is contained in:
2025-10-08 23:38:24 +09:00
parent 56dfb3630e
commit 7504ec1a4c
20 changed files with 406 additions and 132 deletions

View File

@ -375,22 +375,13 @@ int hak_unmarshalcode (hak_t* hak, hak_code_t* code, hak_xchg_reader_t rdr, void
}
nbytes = hak_leoowtoh(w);
if (b == HAK_XCHG_STRING_U)
if (nchars > usym_buf_capa)
{
ns = hak_makestring(hak, HAK_NULL, nchars);
if (HAK_UNLIKELY(!ns)) goto oops;
ucsptr = HAK_OBJ_GET_CHAR_PTR(ns, 0);
}
else
{
if (nchars > usym_buf_capa)
{
usym_buf_capa = nchars * HAK_SIZEOF(usym_buf[0]);
usym_buf = (hak_uch_t*)hak_allocmem(hak, usym_buf_capa);
if (HAK_UNLIKELY(!usym_buf)) goto oops;
}
ucsptr = usym_buf;
usym_buf_capa = nchars * HAK_SIZEOF(usym_buf[0]);
usym_buf = (hak_uch_t*)hak_allocmem(hak, usym_buf_capa);
if (HAK_UNLIKELY(!usym_buf)) goto oops;
}
ucsptr = usym_buf;
ucspos = 0;
bcsres = 0;
@ -420,14 +411,20 @@ int hak_unmarshalcode (hak_t* hak, hak_code_t* code, hak_xchg_reader_t rdr, void
HAK_ASSERT(hak, ucspos == nchars);
if (b != HAK_XCHG_STRING_U)
if (b == HAK_XCHG_STRING_U)
{
ns = hak_makesymbol(hak, usym_buf, nchars);
ns = hak_makestringwithuchars(hak, usym_buf, nchars);
if (HAK_UNLIKELY(!ns)) goto oops;
}
else
{
/* symlit or symbol */
ns = hak_makesymbolwithuchars(hak, usym_buf, nchars);
if (HAK_UNLIKELY(!ns)) goto oops;
if (b == HAK_XCHG_SYMBOL_U)
{
/* form a cons cell */
/* form a cons cell */
hak_oop_t nc;
hak_pushvolat(hak, &ns);
nc = hak_makecons(hak, ns, hak->_nil);