exported hcl_readchar() and hcl_unreadchar()

This commit is contained in:
2018-03-04 14:43:23 +00:00
parent 71d024837d
commit d4d9491f3c
2 changed files with 35 additions and 0 deletions

View File

@ -2402,3 +2402,22 @@ void hcl_detachio (hcl_t* hcl)
}
}
}
hcl_iolxc_t* hcl_readchar (hcl_t* hcl)
{
int n = get_char(hcl);
if (n <= -1) return HCL_NULL;
return &hcl->c->lxc;
}
int hcl_unreadchar (hcl_t* hcl, const hcl_iolxc_t* c)
{
if (hcl->c->nungots >= HCL_COUNTOF(hcl->c->ungot))
{
hcl_seterrnum (hcl, HCL_EBUFFULL);
return -1;
}
unget_char (hcl, c);
return 0;
}