commit 54311c2bc8f054bae929369c511991f9c17acad6
parent 2f4dba85227938e51620d6818a2c718ea82c80c8
Author: Andres Navarro <canavarro82@gmail.com>
Date: Fri, 29 Apr 2011 13:10:48 -0300
Added a combiner object to continuation to signal who created the continuation and returning more useful error msgs (for example in $and? and filter).
Diffstat:
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/kcontinuation.c b/src/kcontinuation.c
@@ -28,6 +28,12 @@ TValue kmake_continuation(klisp_State *K, TValue parent, klisp_Cfunc fn,
/* continuation specific fields */
new_cont->mark = KFALSE;
new_cont->parent = parent;
+
+ TValue comb = K->next_obj;
+ if (ttiscontinuation(comb))
+ comb = tv2cont(comb)->comb;
+ new_cont->comb = comb;
+
new_cont->fn = fn;
new_cont->extra_size = xcount;
diff --git a/src/kobject.h b/src/kobject.h
@@ -372,6 +372,7 @@ typedef struct __attribute__ ((__packed__)) {
CommonHeader;
TValue mark; /* for guarding continuation */
TValue parent; /* may be () for root continuation */
+ TValue comb; /* combiner that created the cont (or #inert) */
void *fn; /* the function that does the work */
int32_t extra_size;
TValue extra[];
diff --git a/src/krepl.c b/src/krepl.c
@@ -139,6 +139,10 @@ void error_fn(klisp_State *K, TValue *xparams, TValue obj)
Error *err_obj = tv2error(obj);
TValue who = err_obj->who;
char *who_str;
+ /* TEMP? */
+ if (ttiscontinuation(who))
+ who = tv2cont(who)->comb;
+
if (ttisstring(who)) {
who_str = kstring_buf(who);
#if KTRACK_NAMES