implemented reading and printing of fixed-point decimal number. primitives yet to be written

This commit is contained in:
2018-03-28 08:57:49 +00:00
parent 25253fc0e1
commit 3a30ffda7b
5 changed files with 145 additions and 22 deletions

View File

@ -284,6 +284,22 @@ next:
break;
}
case HCL_BRAND_FPDEC:
{
hcl_oop_t tmp;
hcl_oop_fpdec_t f = (hcl_oop_fpdec_t)obj;
hcl_ooi_t scale;
scale = HCL_OOP_TO_SMOOI(f->scale);
tmp = hcl_inttostr(hcl, f->value, 10, -1);
if (!tmp) return -1;
HCL_ASSERT (hcl, (hcl_oop_t)tmp == hcl->_nil);
if (outbfmt(hcl, mask, "%.*js.%.*js", hcl->inttostr.xbuf.len - scale, hcl->inttostr.xbuf.ptr, scale, &hcl->inttostr.xbuf.ptr[hcl->inttostr.xbuf.len - scale]) <= -1) return -1;
break;
}
#if 0
case HCL_BRAND_REAL:
{