From: Leon B. <le...@us...> - 2015-02-12 22:38:39
|
Update of /cvsroot/lush/tl3/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10361/src Modified Files: io.c string.c Log Message: added unicode string escapes Index: io.c =================================================================== RCS file: /cvsroot/lush/tl3/src/io.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** io.c 8 Feb 2015 02:00:16 -0000 1.2 --- io.c 12 Feb 2015 22:38:31 -0000 1.3 *************** *** 647,651 **** static at * ! rl_utf8(long h) { char ub[8]; --- 647,651 ---- static at * ! rl_utf8(long h, int nofail) { char ub[8]; *************** *** 676,680 **** } *u++ = 0; ! return str_utf8_to_mb(ub); } --- 676,680 ---- } *u++ = 0; ! return str_utf8_to_mb_ext(ub,nofail); } *************** *** 711,721 **** *d++ = h; ! } else if (*s == '^' && s[1]) { /* control */ ! *d++ = (s[1]) & (0x1f); ! s += 2; ! ! } else if (*s == '+' && s[1]) { /* high bit */ ! #if HAVE_ICONV ! at *m = rl_utf8(s[1] | 0x80); if (! EXTERNP(m, &string_class)) goto err_string; --- 711,729 ---- *d++ = h; ! } else if (*s == 'u' || *s == 'U') { /* unicode */ ! unsigned long h = 0; ! int c = ((*s == 'u') ? 4 : 6); ! at *m; ! s++; ! for (; c > 0; c--) { ! ind = strchr(digit_string, tolower((unsigned char)*s)); ! if (*s && ind) { ! h *= 16; ! h += (ind - digit_string); ! s++; ! } else ! break; ! } ! m = rl_utf8(h, 1); if (! EXTERNP(m, &string_class)) goto err_string; *************** *** 723,729 **** d += strlen(d); UNLOCK(m); ! #else ! *d++ = (s[1]) | 0x80; ! #endif s += 2; --- 731,751 ---- d += strlen(d); UNLOCK(m); ! ! } else if (*s == '^' && s[1]) { /* control */ ! *d++ = (s[1]) & (0x1f); ! s += 2; ! ! } else if (*s == '+' && s[1]) { /* high bit */ ! at *m = rl_utf8(s[1] | 0x80, 0); ! if (EXTERNP(m, &string_class)) ! { ! strcpy(d, SADD(m->Object)); ! d += strlen(d); ! UNLOCK(m); ! } ! else ! { ! *d++ = (s[1]) | 0x80; ! } s += 2; Index: string.c =================================================================== RCS file: /cvsroot/lush/tl3/src/string.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** string.c 8 Feb 2015 02:00:16 -0000 1.4 --- string.c 12 Feb 2015 22:38:32 -0000 1.5 *************** *** 417,421 **** at* ! str_utf8_to_mb(const char *s) { /* best effort conversion from locale encoding from utf8 */ --- 417,421 ---- at* ! str_utf8_to_mb_ext(const char *s, int nofail) { /* best effort conversion from locale encoding from utf8 */ *************** *** 431,435 **** return ans; #endif ! return new_string(s); } --- 431,441 ---- return ans; #endif ! return (nofail) ? new_string(s) : NIL; ! } ! ! at* ! str_utf8_to_mb(const char *s) ! { ! return str_utf8_to_mb_ext(s, 1); } |