implemented dictionary printing

This commit is contained in:
2018-02-07 10:55:20 +00:00
parent 979ba97769
commit f904914d6a
11 changed files with 247 additions and 173 deletions

View File

@ -1842,30 +1842,29 @@ static int execute (hcl_t* hcl)
break;
}
case HCL_CODE_MAKE_DICTIONARY:
case HCL_CODE_MAKE_DIC:
{
hcl_oop_t t;
FETCH_PARAM_CODE_TO (hcl, b1);
LOG_INST_1 (hcl, "make_dictionary %zu", b1);
LOG_INST_1 (hcl, "make_dic %zu", b1);
t = (hcl_oop_t)hcl_makedic (hcl, b1 + 10);
if (!t) return -1;
HCL_STACK_PUSH (hcl, t);
break;
}
case HCL_CODE_POP_INTO_DICTIONARY:
case HCL_CODE_POP_INTO_DIC:
{
hcl_oop_t t1, t2, t3;
LOG_INST_0 (hcl, "pop_into_dictionary");
LOG_INST_0 (hcl, "pop_into_dic");
t1 = HCL_STACK_GETTOP(hcl); /* value */
HCL_STACK_POP (hcl);
t2 = HCL_STACK_GETTOP(hcl); /* key */
HCL_STACK_POP (hcl);
t3 = HCL_STACK_GETTOP(hcl); /* dictionary */
/* TODO: generic dictioanry??? */
if (!hcl_putatdic (hcl, (hcl_oop_set_t)t3, t2, t1)) return -1;
if (!hcl_putatdic (hcl, (hcl_oop_dic_t)t3, t2, t1)) return -1;
break;
}