summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2009-11-15 20:59:07 -0800
committerKaz Kylheku <kaz@kylheku.com>2009-11-15 20:59:07 -0800
commit0dd8652385533322d41b30fbd9375e6de9903548 (patch)
tree786b2554d78044d5613640220af6ab0fab9e2b01
parent24130a3641ae179816ca5672bde12cc04be17813 (diff)
downloadtxr-0dd8652385533322d41b30fbd9375e6de9903548.tar.gz
txr-0dd8652385533322d41b30fbd9375e6de9903548.tar.bz2
txr-0dd8652385533322d41b30fbd9375e6de9903548.zip
* lib.c (chr): Take wchar_t argument, not int. Dropped range check.
(c_chr): Return wchar_t not int. * lib.h (chr, c_chr): Declarations updated.
-rw-r--r--ChangeLog7
-rw-r--r--lib.c7
-rw-r--r--lib.h4
3 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d436115..4bfcad3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-11-15 Kaz Kylheku <kkylheku@gmail.com>
+ * lib.c (chr): Take wchar_t argument, not int. Dropped range check.
+ (c_chr): Return wchar_t not int.
+
+ * lib.h (chr, c_chr): Declarations updated.
+
+2009-11-15 Kaz Kylheku <kkylheku@gmail.com>
+
Version 021.
Text is represented using wide characters now. Queries and data
diff --git a/lib.c b/lib.c
index 05927cb9..b014015b 100644
--- a/lib.c
+++ b/lib.c
@@ -967,9 +967,8 @@ obj_t *string_lt(obj_t *astr, obj_t *bstr)
return cmp == -1 ? t : nil;
}
-obj_t *chr(int ch)
+obj_t *chr(wchar_t ch)
{
- numeric_assert (ch >= NUM_MIN && ch <= NUM_MAX);
return (obj_t *) ((ch << TAG_SHIFT) | TAG_CHR);
}
@@ -978,11 +977,11 @@ obj_t *chrp(obj_t *chr)
return (is_chr(num)) ? t : nil;
}
-int c_chr(obj_t *chr)
+wchar_t c_chr(obj_t *chr)
{
if (!is_chr(chr))
type_mismatch(L"~s is not a character", chr, nao);
- return ((int) chr) >> TAG_SHIFT;
+ return ((wchar_t) chr) >> TAG_SHIFT;
}
obj_t *chr_str(obj_t *str, obj_t *index)
diff --git a/lib.h b/lib.h
index 0eab0604..0d075b2f 100644
--- a/lib.h
+++ b/lib.h
@@ -258,9 +258,9 @@ obj_t *cat_str(obj_t *list, obj_t *sep);
obj_t *split_str(obj_t *str, obj_t *sep);
obj_t *trim_str(obj_t *str);
obj_t *string_lt(obj_t *astr, obj_t *bstr);
-obj_t *chr(int ch);
+obj_t *chr(wchar_t ch);
obj_t *chrp(obj_t *chr);
-int c_chr(obj_t *chr);
+wchar_t c_chr(obj_t *chr);
obj_t *chr_str(obj_t *str, obj_t *index);
obj_t *chr_str_set(obj_t *str, obj_t *index, obj_t *chr);
obj_t *sym_name(obj_t *sym);