From 1521adde660652f214be2b8f2811db0c2a0339d2 Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <kaz@kylheku.com>
Date: Wed, 26 Feb 2014 07:33:19 -0800
Subject: * lib.c (lit_s): New symbol. (code2type): Return lit_s for LIT type.
 (typeof): Return lit_s for TAG_LIT. (replace_str): Error message wording.
 (obj_init): lit_s interned.

---
 lib.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'lib.c')

diff --git a/lib.c b/lib.c
index 15096f27..4b1366e1 100644
--- a/lib.c
+++ b/lib.c
@@ -69,7 +69,7 @@ val packages;
 val system_package, keyword_package, user_package;
 
 val null_s, t, cons_s, str_s, chr_s, fixnum_s, sym_s, pkg_s, fun_s, vec_s;
-val stream_s, hash_s, hash_iter_s, lcons_s, lstr_s, cobj_s, cptr_s;
+val lit_s, stream_s, hash_s, hash_iter_s, lcons_s, lstr_s, cobj_s, cptr_s;
 val env_s, bignum_s, float_s;
 val var_s, expr_s, regex_s, chset_s, set_s, cset_s, wild_s, oneplus_s;
 val nongreedy_s, compiled_regex_s;
@@ -113,7 +113,7 @@ static val code2type(int code)
   case NIL: return null_s;
   case CONS: return cons_s;
   case STR: return str_s;
-  case LIT: return str_s;
+  case LIT: return lit_s;
   case CHR: return chr_s;
   case NUM: return fixnum_s;
   case SYM: return sym_s;
@@ -138,7 +138,7 @@ val typeof(val obj)
   case TAG_CHR:
     return chr_s;
   case TAG_LIT:
-    return str_s;
+    return lit_s;
   case TAG_PTR:
     {
       int typecode = type(obj);
@@ -2127,9 +2127,11 @@ val replace_str(val str_in, val items, val from, val to)
   val len_it = length(itseq);
   val len_rep;
 
-  if (type(str_in) != STR)
-    uw_throwf(error_s, lit("replace-str: string ~s of type ~s not supported"),
+  if (type(str_in) != STR) {
+    uw_throwf(error_s, lit("replace-str: ~s of type ~s is not "
+                           "a modifiable string"),
               str_in, typeof(str_in), nao);
+  }
 
   if (null_or_missing_p(from))
     from = zero;
@@ -5072,6 +5074,7 @@ static void obj_init(void)
   null_s = intern(lit("null"), user_package);
   cons_s = intern(lit("cons"), user_package);
   str_s = intern(lit("str"), user_package);
+  lit_s = intern(lit("lit"), user_package);
   chr_s = intern(lit("chr"), user_package);
   fixnum_s = intern(lit("fixnum"), user_package);
   sym_s = intern(lit("sym"), user_package);
-- 
cgit v1.2.3