commit bccaf30021071d01e62147ed79a62db7de1d95cc
parent 55837a9de0a51f63f51c7ce57977371af0c1a068
Author: Andres Navarro <canavarro82@gmail.com>
Date: Mon, 14 Mar 2011 23:28:18 -0300
Added apply-continuation to the ground environment.
Diffstat:
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/kgcontinuations.c b/src/kgcontinuations.c
@@ -102,17 +102,29 @@ void cont_app(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
}
/* 7.2.6 root-continuation */
-/* TODO */
+/* done in kground.c/krepl.c */
/* 7.2.7 error-continuation */
-/* TODO */
+/* done in kground.c/krepl.c */
/*
** 7.3 Library features
*/
/* 7.3.1 apply-continuation */
-/* TODO */
+void apply_continuation(klisp_State *K, TValue *xparams, TValue ptree,
+ TValue denv)
+{
+ (void) xparams;
+ (void) denv;
+
+ bind_2tp(K, "apply-continuation", ptree, "continuation", ttiscontinuation,
+ cont, "any", anytype, obj);
+
+ /* TODO: look out for guards and dynamic variables */
+ /* should be probably handled in kcall_cont() */
+ kcall_cont(K, cont, obj);
+}
/* 7.3.2 $let/cc */
/* TODO */
diff --git a/src/kgcontinuations.h b/src/kgcontinuations.h
@@ -36,13 +36,14 @@ void continuation_applicative(klisp_State *K, TValue *xparams, TValue ptree,
TValue denv);
/* 7.2.6 root-continuation */
-/* TODO */
+/* done in kground.c/krepl.c */
/* 7.2.7 error-continuation */
-/* TODO */
+/* done in kground.c/krepl.c */
/* 7.3.1 apply-continuation */
-/* TODO */
+void apply_continuation(klisp_State *K, TValue *xparams, TValue ptree,
+ TValue denv);
/* 7.3.2 $let/cc */
/* TODO */
diff --git a/src/kground.c b/src/kground.c
@@ -380,7 +380,8 @@ void kinit_ground_env(klisp_State *K)
*/
/* 7.3.1 apply-continuation */
- /* TODO */
+ add_applicative(K, ground_env, "apply-continuation", apply_continuation,
+ 0);
/* 7.3.2 $let/cc */
/* TODO */