diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-11-15 20:59:07 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-11-15 20:59:07 -0800 |
commit | 0dd8652385533322d41b30fbd9375e6de9903548 (patch) | |
tree | 786b2554d78044d5613640220af6ab0fab9e2b01 | |
parent | 24130a3641ae179816ca5672bde12cc04be17813 (diff) | |
download | txr-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-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib.c | 7 | ||||
-rw-r--r-- | lib.h | 4 |
3 files changed, 12 insertions, 6 deletions
@@ -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 @@ -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) @@ -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); |