got rid of hcl_getlastretv() but let hcl_execute() and hcl_executefromip() to return the returnv value
This commit is contained in:
parent
a78dba499f
commit
9abb389aa2
@ -2203,7 +2203,7 @@ oops:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hcl_executefromip (hcl_t* hcl, hcl_ooi_t initial_ip)
|
hcl_oop_t hcl_executefromip (hcl_t* hcl, hcl_ooi_t initial_ip)
|
||||||
{
|
{
|
||||||
int n, log_default_type_mask;
|
int n, log_default_type_mask;
|
||||||
|
|
||||||
@ -2215,7 +2215,7 @@ int hcl_executefromip (hcl_t* hcl, hcl_ooi_t initial_ip)
|
|||||||
|
|
||||||
hcl->last_retv = hcl->_nil;
|
hcl->last_retv = hcl->_nil;
|
||||||
|
|
||||||
if (start_initial_process_and_context(hcl, initial_ip) <= -1) return -1;
|
if (start_initial_process_and_context(hcl, initial_ip) <= -1) return HCL_NULL;
|
||||||
hcl->initial_context = hcl->processor->active->initial_context;
|
hcl->initial_context = hcl->processor->active->initial_context;
|
||||||
|
|
||||||
n = execute (hcl);
|
n = execute (hcl);
|
||||||
@ -2227,11 +2227,10 @@ int hcl_executefromip (hcl_t* hcl, hcl_ooi_t initial_ip)
|
|||||||
hcl->active_context = HCL_NULL;
|
hcl->active_context = HCL_NULL;
|
||||||
|
|
||||||
hcl->log.default_type_mask = log_default_type_mask;
|
hcl->log.default_type_mask = log_default_type_mask;
|
||||||
return n;
|
return (n <= -1)? HCL_NULL: hcl->last_retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hcl_oop_t hcl_execute (hcl_t* hcl)
|
||||||
int hcl_execute (hcl_t* hcl)
|
|
||||||
{
|
{
|
||||||
return hcl_executefromip (hcl, 0);
|
return hcl_executefromip (hcl, 0);
|
||||||
}
|
}
|
||||||
|
10
lib/hcl.h
10
lib/hcl.h
@ -1450,21 +1450,15 @@ HCL_EXPORT int hcl_ignite (
|
|||||||
/**
|
/**
|
||||||
* The hcl_execute() function executes an activated context.
|
* The hcl_execute() function executes an activated context.
|
||||||
*/
|
*/
|
||||||
HCL_EXPORT int hcl_execute (
|
HCL_EXPORT hcl_oop_t hcl_execute (
|
||||||
hcl_t* hcl
|
hcl_t* hcl
|
||||||
);
|
);
|
||||||
|
|
||||||
HCL_EXPORT int hcl_executefromip (
|
HCL_EXPORT hcl_oop_t hcl_executefromip (
|
||||||
hcl_t* hcl,
|
hcl_t* hcl,
|
||||||
hcl_ooi_t initial_ip
|
hcl_ooi_t initial_ip
|
||||||
);
|
);
|
||||||
|
|
||||||
#if defined(HCL_HAVE_INLINE)
|
|
||||||
static HCL_INLINE hcl_oop_t hcl_getlastretv (hcl_t* hcl) { return hcl->last_retv; }
|
|
||||||
#else
|
|
||||||
# define hcl_getlastretv(hcl) ((hcl)->last_retv)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HCL_EXPORT int hcl_attachio (
|
HCL_EXPORT int hcl_attachio (
|
||||||
hcl_t* hcl,
|
hcl_t* hcl,
|
||||||
hcl_ioimpl_t reader,
|
hcl_ioimpl_t reader,
|
||||||
|
17
lib/main.c
17
lib/main.c
@ -1655,17 +1655,21 @@ int main (int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
else if (xtn->reader_istty)
|
else if (xtn->reader_istty)
|
||||||
{
|
{
|
||||||
|
hcl_oop_t retv;
|
||||||
|
|
||||||
hcl_decode (hcl, code_offset, hcl->code.bc.len);
|
hcl_decode (hcl, code_offset, hcl->code.bc.len);
|
||||||
HCL_LOG0 (hcl, HCL_LOG_MNEMONIC, "------------------------------------------\n");
|
HCL_LOG0 (hcl, HCL_LOG_MNEMONIC, "------------------------------------------\n");
|
||||||
g_hcl = hcl;
|
g_hcl = hcl;
|
||||||
//setup_tick ();
|
//setup_tick ();
|
||||||
if (hcl_executefromip(hcl, code_offset) <= -1)
|
|
||||||
|
retv = hcl_executefromip(hcl, code_offset);
|
||||||
|
if (!retv)
|
||||||
{
|
{
|
||||||
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot execute - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
|
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot execute - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hcl_logbfmt (hcl, HCL_LOG_STDERR, "OK: EXITED WITH %O\n", hcl_getlastretv(hcl));
|
hcl_logbfmt (hcl, HCL_LOG_STDERR, "OK: EXITED WITH %O\n", retv);
|
||||||
}
|
}
|
||||||
//cancel_tick();
|
//cancel_tick();
|
||||||
g_hcl = HCL_NULL;
|
g_hcl = HCL_NULL;
|
||||||
@ -1675,19 +1679,24 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
if (!xtn->reader_istty)
|
if (!xtn->reader_istty)
|
||||||
{
|
{
|
||||||
|
hcl_oop_t retv;
|
||||||
|
|
||||||
hcl_decode (hcl, 0, hcl->code.bc.len);
|
hcl_decode (hcl, 0, hcl->code.bc.len);
|
||||||
HCL_LOG2 (hcl, HCL_LOG_MNEMONIC, "BYTECODES hcl->code.bc.len = > %lu hcl->code.lit.len => %lu\n",
|
HCL_LOG2 (hcl, HCL_LOG_MNEMONIC, "BYTECODES hcl->code.bc.len = > %lu hcl->code.lit.len => %lu\n",
|
||||||
(unsigned long int)hcl->code.bc.len, (unsigned long int)hcl->code.lit.len);
|
(unsigned long int)hcl->code.bc.len, (unsigned long int)hcl->code.lit.len);
|
||||||
g_hcl = hcl;
|
g_hcl = hcl;
|
||||||
//setup_tick ();
|
//setup_tick ();
|
||||||
if (hcl_execute(hcl) <= -1)
|
|
||||||
|
retv = hcl_execute(hcl);
|
||||||
|
if (!retv)
|
||||||
{
|
{
|
||||||
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot execute - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
|
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot execute - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hcl_logbfmt (hcl, HCL_LOG_STDERR, "EXECUTION OK - EXITED WITH %O\n", hcl_getlastretv(hcl));
|
hcl_logbfmt (hcl, HCL_LOG_STDERR, "EXECUTION OK - EXITED WITH %O\n", retv);
|
||||||
}
|
}
|
||||||
|
|
||||||
//cancel_tick();
|
//cancel_tick();
|
||||||
g_hcl = HCL_NULL;
|
g_hcl = HCL_NULL;
|
||||||
/*hcl_dumpsymtab (hcl);*/
|
/*hcl_dumpsymtab (hcl);*/
|
||||||
|
Loading…
Reference in New Issue
Block a user