From 19ec71ba06fb953d9838a930ee5e1522092a8493 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 10 May 2014 17:54:32 -0700 Subject: String type related bugfixes: neglecting to handle all three kinds in some places. In particular, the test case echo : | ./txr -c '@a:@a' - breaks because of neglected LIT in do_match_line. * arith.c (tofloat, toint): Handle LIT type in switch. * lib.c (ref, refset, replace, update): Handle LSTR type. * match.c (do_match_line, do_output_line): Handle LSTR and LIT objects in switch. --- lib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 5bf37ed4..fed06664 100644 --- a/lib.c +++ b/lib.c @@ -5017,6 +5017,7 @@ val ref(val seq, val ind) return listref(seq, ind); case LIT: case STR: + case LSTR: return chr_str(seq, ind); case VEC: return vecref(seq, ind); @@ -5034,6 +5035,7 @@ val refset(val seq, val ind, val newval) return set(listref_l(seq, ind), newval); case LIT: case STR: + case LSTR: return chr_str_set(seq, ind, newval); case VEC: return set(vecref_l(seq, ind), newval); @@ -5052,6 +5054,7 @@ val replace(val seq, val items, val from, val to) return replace_list(seq, items, from, to); case LIT: case STR: + case LSTR: return replace_str(seq, items, from, to); case VEC: return replace_vec(seq, items, from, to); @@ -5078,6 +5081,7 @@ val update(val seq, val fun) break; case LIT: case STR: + case LSTR: case VEC: { val len = length(seq); -- cgit v1.2.3