diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-23 13:01:06 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-23 13:01:06 -0300 |
commit | 59547c6cda8ac1371b473ec6f1088a35bcec7558 (patch) | |
tree | 787b7a681cf1524d854abc361caf85f91e1fe4a8 /lctype.h | |
parent | 3d3355b4f3394d7c223daf2b76c3cf8d854e24a6 (diff) | |
download | lua-59547c6cda8ac1371b473ec6f1088a35bcec7558.tar.gz lua-59547c6cda8ac1371b473ec6f1088a35bcec7558.tar.bz2 lua-59547c6cda8ac1371b473ec6f1088a35bcec7558.zip |
macro 'ltoupper' instead of 'lisupper' (more usefull for Lua)
Diffstat (limited to 'lctype.h')
-rw-r--r-- | lctype.h | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lctype.h,v 1.7 2009/05/27 16:51:15 roberto Exp roberto $ | 2 | ** $Id: lctype.h,v 1.8 2009/11/19 19:06:52 roberto Exp roberto $ |
3 | ** 'ctype' functions for Lua | 3 | ** 'ctype' functions for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -8,6 +8,13 @@ | |||
8 | #define lctype_h | 8 | #define lctype_h |
9 | 9 | ||
10 | 10 | ||
11 | /* | ||
12 | ** WARNING: the functions defined here do not necessarily correspond | ||
13 | ** to the similar functions in the standard C ctype.h. They are | ||
14 | ** optimized for the specific needs of Lua | ||
15 | */ | ||
16 | |||
17 | |||
11 | #include <limits.h> | 18 | #include <limits.h> |
12 | 19 | ||
13 | #include "lua.h" | 20 | #include "lua.h" |
@@ -20,7 +27,6 @@ | |||
20 | #define PRINTBIT 2 | 27 | #define PRINTBIT 2 |
21 | #define SPACEBIT 3 | 28 | #define SPACEBIT 3 |
22 | #define XDIGITBIT 4 | 29 | #define XDIGITBIT 4 |
23 | #define UPPERBIT 5 | ||
24 | 30 | ||
25 | 31 | ||
26 | #define MASK(B) (1 << (B)) | 32 | #define MASK(B) (1 << (B)) |
@@ -36,12 +42,16 @@ | |||
36 | */ | 42 | */ |
37 | #define lislalpha(c) testprop(c, MASK(ALPHABIT)) | 43 | #define lislalpha(c) testprop(c, MASK(ALPHABIT)) |
38 | #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) | 44 | #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) |
39 | #define lisupper(c) testprop(c, MASK(UPPERBIT)) | ||
40 | #define lisdigit(c) testprop(c, MASK(DIGITBIT)) | 45 | #define lisdigit(c) testprop(c, MASK(DIGITBIT)) |
41 | #define lisspace(c) testprop(c, MASK(SPACEBIT)) | 46 | #define lisspace(c) testprop(c, MASK(SPACEBIT)) |
42 | #define lisprint(c) testprop(c, MASK(PRINTBIT)) | 47 | #define lisprint(c) testprop(c, MASK(PRINTBIT)) |
43 | #define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) | 48 | #define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) |
44 | 49 | ||
50 | /* | ||
51 | ** this 'ltoupper' only works for alphabetic characters | ||
52 | */ | ||
53 | #define ltoupper(c) ((c) & ~32) | ||
54 | |||
45 | 55 | ||
46 | /* one more entry for 0 and one more for -1 (EOZ) */ | 56 | /* one more entry for 0 and one more for -1 (EOZ) */ |
47 | LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; | 57 | LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; |