aboutsummaryrefslogtreecommitdiff
path: root/lctype.h
diff options
context:
space:
mode:
Diffstat (limited to 'lctype.h')
-rw-r--r--lctype.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/lctype.h b/lctype.h
index cbff4d7e..864e1901 100644
--- a/lctype.h
+++ b/lctype.h
@@ -13,7 +13,7 @@
13/* 13/*
14** WARNING: the functions defined here do not necessarily correspond 14** WARNING: the functions defined here do not necessarily correspond
15** to the similar functions in the standard C ctype.h. They are 15** to the similar functions in the standard C ctype.h. They are
16** optimized for the specific needs of Lua 16** optimized for the specific needs of Lua.
17*/ 17*/
18 18
19#if !defined(LUA_USE_CTYPE) 19#if !defined(LUA_USE_CTYPE)
@@ -61,13 +61,19 @@
61#define lisprint(c) testprop(c, MASK(PRINTBIT)) 61#define lisprint(c) testprop(c, MASK(PRINTBIT))
62#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) 62#define lisxdigit(c) testprop(c, MASK(XDIGITBIT))
63 63
64
64/* 65/*
65** this 'ltolower' only works for alphabetic characters 66** In ASCII, this 'ltolower' is correct for alphabetic characters and
67** for '.'. That is enough for Lua needs. ('check_exp' ensures that
68** the character either is an upper-case letter or is unchanged by
69** the transformation, which holds for lower-case letters and '.'.)
66*/ 70*/
67#define ltolower(c) ((c) | ('A' ^ 'a')) 71#define ltolower(c) \
72 check_exp(('A' <= (c) && (c) <= 'Z') || (c) == ((c) | ('A' ^ 'a')), \
73 (c) | ('A' ^ 'a'))
68 74
69 75
70/* two more entries for 0 and -1 (EOZ) */ 76/* one entry for each character and for -1 (EOZ) */
71LUAI_DDEC(const lu_byte luai_ctype_[UCHAR_MAX + 2];) 77LUAI_DDEC(const lu_byte luai_ctype_[UCHAR_MAX + 2];)
72 78
73 79