diff options
-rw-r--r-- | lib.c | 15 | ||||
-rw-r--r-- | txr.1 | 35 |
2 files changed, 35 insertions, 15 deletions
@@ -4025,7 +4025,7 @@ val chr_iscntrl(val ch) val chr_isdigit(val ch) { - return tnil(iswdigit(c_chr(ch))); + return if2(iswdigit(c_chr(ch)), minus(ch, chr('0'))); } val chr_isgraph(val ch) @@ -4070,7 +4070,18 @@ val chr_isupper(val ch) val chr_isxdigit(val ch) { - return tnil(iswxdigit(c_chr(ch))); + wchar_t cc = c_chr(ch); + + if ('0' <= cc && cc <= '9') + return num_fast(cc - '0'); + + if ('A' <= cc && cc <= 'F') + return num_fast(cc - 'A' + 10); + + if ('a' <= cc && cc <= 'a') + return num_fast(cc - 'a' + 10); + + return nil; } val chr_toupper(val ch) @@ -17646,11 +17646,11 @@ character. For other characters, it returns .mets (chr-isdigit << char ) .syne .desc -This function returns -.code t -if the character +If .meta char -is is an ASCII digit. +is is an ASCII digit character, +.code chr-isdigit +returns the integer value, 0 to 9, corresponding to that character. Otherwise, it returns .codn nil . @@ -17803,19 +17803,28 @@ is an ASCII upper case letter. Otherwise it returns .mets (chr-isxdigit << char ) .syne .desc -This function returns -.code t -if +If .meta char -is a hexadecimal digit. One of the ASCII -letters +is a hexadecimal digit character, +.code chr-isxdigit +returns its integer value 0 to 15. +Otherwise it returns +.codn nil . + +A hexadecimal digit is one of the ASCII +digit characters +.code 0 +through +.codn 9 , +or else one of the letters .code A through -.codn F , -or their lower-case equivalents, or an ASCII digit -.code 0 +.code F +or their lower-case equivalents +.code a through -.codn 9 . +.code f +denoting the values 10 to 15. .coNP Function @ chr-toupper .synb |