void strm_eprint(strm_stream* strm) { strm_value v; node_error* exc = strm->exc; if (!exc) return; if (exc->fname) { fprintf(stderr, "%s:%d:", exc->fname, exc->lineno); } exec_cputs(strm, stderr, 1, &exc->arg, &v); /* TODO: garbage correct previous exception value */ strm_clear_exc(strm); }
int node_run(parser_state* p) { strm_value v; node_init(&p->ctx); strm_seq_init(&p->ctx); exec_expr(&p->ctx, (node*)p->lval, &v); if (p->ctx.exc != NULL) { strm_value v; exec_cputs(&p->ctx, stderr, 1, &p->ctx.exc->arg, &v); /* TODO: garbage correct previous exception value */ p->ctx.exc = NULL; } return 0; }
int node_run(parser_state* p) { strm_value v; strm_state *state = malloc(sizeof(strm_state)); memset(state, 0, sizeof(strm_state)); node_init(state); exec_expr(state, (node*)p->lval, &v); if (state->exc != NULL) { if (state->exc->type != NODE_ERROR_RETURN) { strm_value v; exec_cputs(state, stderr, 1, &state->exc->arg, &v); /* TODO: garbage correct previous exception value */ state->exc = NULL; } } return STRM_OK; }
static int exec_puts(strm_stream* strm, int argc, strm_value* args, strm_value* ret) { return exec_cputs(strm, stdout, argc, args, ret); }
static int exec_puts(node_ctx* ctx, int argc, strm_value* args, strm_value *ret) { return exec_cputs(ctx, stdout, argc, args, ret); }