added more character conversion functions

This commit is contained in:
hyunghwan.chung
2017-01-12 10:06:43 +00:00
parent d130ec02ec
commit ec3285da57
10 changed files with 96 additions and 51 deletions

View File

@ -181,11 +181,7 @@ static moo_pfrc_t pf_write (moo_t* moo, moo_ooi_t nargs)
bcslen = MOO_COUNTOF(bcs);
if ((n = moo_convootobchars (moo, &oomsg->slot[ucspos], &ucslen, bcs, &bcslen)) <= -1)
{
if (n != -2 || ucslen <= 0)
{
moo_seterrnum (moo, MOO_EECERR);
return MOO_PF_HARD_FAILURE;
}
if (n != -2 || ucslen <= 0) return MOO_PF_HARD_FAILURE;
}
write (con->fd, bcs, bcslen); /* TODO: error handling */

View File

@ -122,6 +122,7 @@ reterr:
MOO_STACK_SETRETTOERROR (moo, nargs);
return MOO_PF_SUCCESS;
}
/*
struct bcstr_node_t
{
@ -141,6 +142,7 @@ static void free_bcstr_node (moo_t* moo, bcstr_node_t* bcstr)
moo_freemem (moo, bcstr);
}
*/
static moo_pfrc_t pf_call (moo_t* moo, moo_ooi_t nargs)
{
#if defined(USE_DYNCALL)

View File

@ -159,11 +159,7 @@ static moo_pfrc_t __pf_puts (moo_t* moo, moo_ooi_t nargs, moo_oow_t limit)
/* TODO: implement character conversion into stdio and use it instead of vm's conversion facility. */
if ((n = moo_convootobchars (moo, &x->slot[ucspos], &ucslen, bcs, &bcslen)) <= -1)
{
if (n != -2 || ucslen <= 0)
{
moo_seterrnum (moo, MOO_EECERR);
goto reterr;
}
if (n != -2 || ucslen <= 0) goto reterr;
}
if (fwrite (bcs, 1, bcslen, rcv->fp) < bcslen)