added hcl_getip(), hcl_getbclen(), hcl_getlflen()

renamed vm_checkpoint to vm_checkbc while adding a new parameter
This commit is contained in:
2018-03-11 11:16:28 +00:00
parent b9224dfa97
commit 27e1e55a7c
6 changed files with 65 additions and 30 deletions

View File

@ -55,7 +55,7 @@
#endif
/* TODO: check if ip shoots beyond the maximum length in fetching code and parameters */
int hcl_decode (hcl_t* hcl, hcl_ooi_t start, hcl_ooi_t end)
int hcl_decode (hcl_t* hcl, hcl_oow_t start, hcl_oow_t end)
{
hcl_oob_t bcode, * cdptr;
hcl_ooi_t ip = start, fetched_instruction_pointer;
@ -67,6 +67,12 @@ int hcl_decode (hcl_t* hcl, hcl_ooi_t start, hcl_ooi_t end)
HCL_ASSERT (hcl, start >= 0 && end >= 0);
HCL_ASSERT (hcl, hcl->code.bc.len < HCL_SMOOI_MAX); /* asserted by the compiler */
HCL_ASSERT (hcl, end <= hcl->code.bc.len); /* not harmful though this fails */
if (start >= hcl->code.bc.len)
{
hcl_seterrnum (hcl, HCL_EINVAL);
return -1;
}
if (end > hcl->code.bc.len) end = hcl->code.bc.len;
ip = start;
cdptr = ((hcl_oop_byte_t)hcl->code.bc.arr)->slot;