commit b6fac0032914a8870a81e9eaead3ea424a294c5d
parent a57b81b6112987e11bf243c174dfdab8430520c0
Author: Andres Navarro <canavarro82@gmail.com>
Date: Wed, 23 Mar 2011 17:00:40 -0300
Added symbol->string to the ground environment.
Diffstat:
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/kground.c b/src/kground.c
@@ -650,7 +650,7 @@ void kinit_ground_env(klisp_State *K)
/* 13.3.1? symbol->string */
/* TEMP: for now all strings are mutable, this returns a new object
each time */
- /* TODO */
+ add_applicative(K, ground_env, "symbol->string", symbol_to_string, 0);
/* 13.3.2? string->symbol */
/* TEMP: for now this can create symbols with no external representation
diff --git a/src/kgstrings.c b/src/kgstrings.c
@@ -453,7 +453,15 @@ void string_fillS(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
/* 13.3.1? symbol->string */
/* TEMP: for now all strings are mutable, this returns a new object
each time */
-/* TODO */
+void symbol_to_string(klisp_State *K, TValue *xparams, TValue ptree,
+ TValue denv)
+{
+ UNUSED(xparams);
+ UNUSED(denv);
+ bind_1tp(K, "symbol->string", ptree, "symbol", ttissymbol, sym);
+ TValue new_str = kstring_new(K, ksymbol_buf(sym), ksymbol_size(sym));
+ kapply_cc(K, new_str);
+}
/* 13.3.2? string->symbol */
/* TEMP: for now this can create symbols with no external representation
diff --git a/src/kgstrings.h b/src/kgstrings.h
@@ -84,7 +84,8 @@ void string_fillS(klisp_State *K, TValue *xparams, TValue ptree, TValue denv);
/* 13.3.1? symbol->string */
/* TEMP: for now all strings are mutable, this returns a new object
each time */
-/* TODO */
+void symbol_to_string(klisp_State *K, TValue *xparams, TValue ptree,
+ TValue denv);
/* 13.3.2? string->symbol */
/* TEMP: for now this can create symbols with no external representation