fixed the way to drive hcl in main.c

This commit is contained in:
hyung-hwan 2018-02-09 17:15:31 +00:00
parent eff4be881f
commit 45bb26d97f
2 changed files with 10 additions and 3 deletions

View File

@ -1601,10 +1601,10 @@ int main (int argc, char* argv[])
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot read object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl)); hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot read object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
} }
break; if (!xtn->reader_istty) goto oops;
continue;
} }
if (hcl_print(hcl, obj) <= -1) if (hcl_print(hcl, obj) <= -1)
{ {
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot print object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl)); hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot print object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
@ -1627,6 +1627,8 @@ int main (int argc, char* argv[])
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot compile object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl)); hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot compile object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
} }
/* carry on? */ /* carry on? */
if (!xtn->reader_istty) goto oops;
} }
else if (xtn->reader_istty) else if (xtn->reader_istty)
{ {
@ -1660,7 +1662,11 @@ int main (int argc, char* argv[])
/*hcl_dumpsymtab (hcl);*/ /*hcl_dumpsymtab (hcl);*/
} }
hcl_close (hcl);
hcl_close (hcl);
return 0; return 0;
oops:
hcl_close (hcl);
return -1;
} }

View File

@ -1276,6 +1276,7 @@ static HCL_INLINE hcl_oop_t leave_list (hcl_t* hcl, int* flagv, int* oldflagv)
/* the stack must not be empty - cannot leave a list without entering it */ /* the stack must not be empty - cannot leave a list without entering it */
HCL_ASSERT (hcl, !HCL_IS_NIL(hcl,hcl->c->r.s)); HCL_ASSERT (hcl, !HCL_IS_NIL(hcl,hcl->c->r.s));
/* TODO: fix bug here. unblanced ) cause assertion failure here */
/*head = HCL_CONS_CAR(HCL_CONS_CDR(hcl->c->r.s));*/ /*head = HCL_CONS_CAR(HCL_CONS_CDR(hcl->c->r.s));*/